Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.

Geoffroy77

Programmer
Aug 6, 2003
1
BE
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 ?
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top