How can an Easytrieve program be coded to process the same file multiple times within one job activity?
Note you have to code your own file processing loop and not rely on Easytrieve since you want to read the same file more than once.
The following solution is coded for EZT 11.x and makes use of the new CLOSE statement. It will not work for prior releases or compatibility mode.
FILE PERSNL F(150)
%PERSNL
JOB INPUT NULL
* First time through
DO UNTIL EOF PERSNL
GET PERSNL
IF REGION EQ 1
PRINT REPORT1
END-IF
END-DO
CLOSE PERSNL
* Second time through
DO UNTIL EOF PERSNL
GET PERSNL
IF REGION EQ 2
PRINT REPORT2
END-IF
END-DO
STOP
REPORT REPORT1
LINE NAME-LAST EMP#
REPORT REPORT2
LINE NAME-LAST ADDR-ZIP