Carl Henderson

My contribution

Peoplesoft SQR File Read Problem Resolved

If you plan to open the same file multiple times you cannot rely on #end-file to be correct.

I ran into this problem where it would only read through my data file once but not a second time. After opening the file, I used the following code to read it:

WHILE NOT #end-file
  READ 1 into $line:100

However once the second read came around, the cursor was already at the eof keeping #end-file true.

The way around this is by altering the While logic:

  READ 1 into $line:100
  IF #end-file

In the latter example, it’s important to note that #end-file is used after another READ command. This resets the eof and allows the SQR to function as intended.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>