×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to use variable with OPEN() or NEXT() ... etc ?

How to use variable with OPEN() or NEXT() ... etc ?

How to use variable with OPEN() or NEXT() ... etc ?

(OP)
I am interrested by the previous thread :
"How to use variable with OPEN() or NEXT() ... etc ?"
Thread192-478960

But It does NOT work.

Here what I am trying to do :


VariableFile    PROCEDURE                    

MyFILE       &FILE
MySTRING     STRING(20)

  CODE
   MySTRING = 'Calendar'  
! An existing file in the dictonary
   MyFILE   &= (MySTRING)
!Without paenthesis : compilation error !
   
   OPEN(MyFILE)              !Program crash here
   SET(MyFILE)
   LOOP
      NEXT(MyFILE)
      IF ERRORCODE() THEN BREAK.
!Dynamically access the differents fields of MyFILE => this part work
   END
   
   
 
 Could you help please ?

RE: How to use variable with OPEN() or NEXT() ... etc ?

The File variable must reference a File Label and not a String variable.

USAGE : VariableFile( FileLabel )

EXAMPLES : VariableFile (CUSTOMER), etc

VariableFile    PROCEDURE( FILE iFile )

MyFILE       &FILE

   CODE

   IF iFile &= NULL THEN RETURN.

   MyFILE &= iFile
   
   OPEN(MyFILE)              !Program crash here
   SET(MyFILE)
   LOOP
      NEXT(MyFILE)
      IF ERRORCODE() THEN BREAK.
!Dynamically access the differents fields of MyFILE => this part work
   END

   MyFile &= NULL

   RETURN

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close