Have a Question?
Print

00016: How to READ backwards after hitting the end of a mkeyed file

Title:

How to READ backwards after hitting the end of a mkeyed file

Description:

Once you’ve READ the last record in the file, the read “pointer” has been forced forward (past the last record), which is when you receive the ERROR 2– “End of File”. A READ(channel_num,dir=-1)IOL=100 can’t change direction, since the pointer is not currently looking at a record. 

The only solution is to grab the key to the last record with the KEYL() function and set “dir=0” to hold the pointer on that last record. The you can use “dir=-1” to walk backward through the file. 

>1000 END_OF_FILE: 
>2000 READ(channel_num,KEY=KEYL(channel_num),DIR=0)IOL=100 
>3000 READ(channel_num,DIR=-1)IOL=100 



Last Modified: 12/17/1997 Product: PRO/5 Operating System: All platforms

BASIS structures five components of their technology into the BBx Generations.

Table of Contents
Scroll to Top