I have just a smattering of experience with Easytrieve, and all of it gleaned from my co-workers. I do have the "Easytrieve Plus student guide" though! My coworkers are willing to help when I hit a bump, but I can't seem to get a satisfactory answer from them on this one. I've been reading through the forums here and elsewhere trying to find an answer for my problem, but haven't come across a working solution.
Basically, We have a CICS screen where a user keys in a number of transaction codes for the night. That screen can only accommodate 54 codes though, so when we have more than that, I have to hold a batch job and manually add the missing codes to a file. These codes are listed three times within the file though, each time with different info after the code number.
Input File1 example, just transaction codes:
ABC1003
ABC1004
ABC1004
Input File2 example
ABC1001 PULL EVEN WHEN NO MATCH
ABC1002 PULL EVEN WHEN NO MATCH
000.000 PULL % OPEN % CLOSE
ABC1001 DROP-ACTION
ABC1002 DROP-ACTION
100.100 DROP % OPEN % CLOSE
ABC1001 DROP-BUCK
ABC1002 DROP-BUCK
AAA0000 ZZZZZZZZ
ABC1002 PULL EVEN WHEN NO MATCH
000.000 PULL % OPEN % CLOSE
ABC1001 DROP-ACTION
ABC1002 DROP-ACTION
100.100 DROP % OPEN % CLOSE
ABC1001 DROP-BUCK
ABC1002 DROP-BUCK
AAA0000 ZZZZZZZZ
Expected Output
ABC1001 PULL EVEN WHEN NO MATCH
ABC1002 PULL EVEN WHEN NO MATCH
ABC1003 PULL EVEN WHEN NO MATCH
ABC1004 PULL EVEN WHEN NO MATCH
000.000 PULL % OPEN % CLOSE
ABC1001 DROP-ACTION
ABC1002 DROP-ACTION
ABC1003 DROP-ACTION
ABC1004 DROP-ACTION
100.100 DROP % OPEN % CLOSE
ABC1001 DROP-BUCK
ABC1002 DROP-BUCK
ABC1003 DROP-BUCK
ABC1004 DROP-BUCK
AAA0000 ZZZZZZZZ
ABC1002 PULL EVEN WHEN NO MATCH
ABC1003 PULL EVEN WHEN NO MATCH
ABC1004 PULL EVEN WHEN NO MATCH
000.000 PULL % OPEN % CLOSE
ABC1001 DROP-ACTION
ABC1002 DROP-ACTION
ABC1003 DROP-ACTION
ABC1004 DROP-ACTION
100.100 DROP % OPEN % CLOSE
ABC1001 DROP-BUCK
ABC1002 DROP-BUCK
ABC1003 DROP-BUCK
ABC1004 DROP-BUCK
AAA0000 ZZZZZZZZ
The program reads FILE2 and writes it out with no changes until it finds the end-of-section markers (The two line with % and the line with ZZZZZZZZ), It then reads FILE1 with a get until EOF loop. It then formats the transaction codes into the style for the section it is adding it to (Pull, Drop) before adding it to the output.
This works great for the first marker, the output contains all the old & new transactions, but it fails on a A010 INVALID FILE REFERENCE since FILE1 is now at EOF. Is there a way to close the file, or start the read from the top of FILE1 again?
IF DESCRIPT NE W-MARKER-1 W-MARKER-2 W-MARKER-3
** IF NO MATCH TO MARKER FLAGS, THEN SEND IT TO O/P FILE
BUFF-OUTDD = BUFF-FILE2
PUT OUTDD
W-RETAIN-DESC = DESCRIPT
ELSE
* IF ONE OF THE MARKERS IS FOUND...
* SAVE THE DESCRIPTION AREA
W-LINE1-DESCRIPT = W-RETAIN-DESC
PERFORM READ-FILE1
* DONE ADDING DATA, PUT MARKER ON OUTPUT FILE
BUFF-OUTDD = BUFF-FILE2
PUT OUTDD
END-IF
READ-FILE1. PROC
* READ FILE1 TO ADD THE DATA
GET FILE1
DO WHILE NOT EOF FILE1
W-LINE1-TRN-CODE = BUFF-TRN
BUFF-OUTDD = W-LINE1
PUT OUTDD
GET FILE1
END-DO
END-PROC
** IF NO MATCH TO MARKER FLAGS, THEN SEND IT TO O/P FILE
BUFF-OUTDD = BUFF-FILE2
PUT OUTDD
W-RETAIN-DESC = DESCRIPT
ELSE
* IF ONE OF THE MARKERS IS FOUND...
* SAVE THE DESCRIPTION AREA
W-LINE1-DESCRIPT = W-RETAIN-DESC
PERFORM READ-FILE1
* DONE ADDING DATA, PUT MARKER ON OUTPUT FILE
BUFF-OUTDD = BUFF-FILE2
PUT OUTDD
END-IF
READ-FILE1. PROC
* READ FILE1 TO ADD THE DATA
GET FILE1
DO WHILE NOT EOF FILE1
W-LINE1-TRN-CODE = BUFF-TRN
BUFF-OUTDD = W-LINE1
PUT OUTDD
GET FILE1
END-DO
END-PROC
I've tried multiple JOB statements, but that resets the output too. I eventually got it to work using three separate DD's for FILE1, all pointing to the same DSN, and each having a separate PROC, but that looks sloppy.