How to re-read the same file in one job activity?
search cancel

How to re-read the same file in one job activity?

book

Article ID: 50926

calendar_today

Updated On:

Products

Easytrieve Report Generator

Issue/Introduction

 How can an Easytrieve program be coded to process the same file multiple times within one job activity?

Resolution

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