Archive

Archive for December, 2009

Peoplesoft SQR File Read Problem Resolved

December 15th, 2009 No comments

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
END-WHILE

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:


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

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.

Categories: Peoplesoft Tags: