Loading

FILE-STATUS and EOF (End of File) in Easytrieve

In Easytrieve, whenever you perform an operation to a File, the STATUS of the operation can be checked using the FILE-STATUS variable.

For Normal Files,
FILE-STATUS = 0 means, Successful GET or PUT or READ or WRITE operation.

 GET INFILE
 IF INFILE:FILE-STATUS NE 0
     DISPLAY 'ERROR IN READING FILE'
 END-IF

End of a File can be identified using EOF keyword.
i.e,

 IF EOF INFILE
     DISPLAY 'END OF FILE'
 END-IF

In case of a VSAM file, FILE-STATUS can mean any of the following

FILE-STATUS Meaning
0 Successful operation
4 End of File
8 Duplicate key during a Write/PUT (or)

Additional records with the same key exist in the

alternate index during a GET operation

12 Keys not in Sequence during PUT/WRITE
16 Record not found during READ

Related Posts




blog comments powered by Disqus

There's 3 Comments So Far

Share your thoughts, leave a comment!