Compare two files using Easytrieve -
//STEP020 EXEC PGM=EZTPA00
//EZTVFM DD SPACE=(CYL,(3,3)),UNIT=SYSDA
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//INFILE1 DD *
21400 SANDIP 11111
21500 MANDIP 22222
21600 RANDIP 33333
21700 BALDIP 44444
//INFILE2 DD *
21500 PUNE
21600 MUMBAI
21800 CHENAI
21900 HYDERABAD
//OUTFILE DD DSN=XX7384A.TEST.OUT1,DISP=OLD
//SYSIN DD *
*
FILE INFILE1
EID1 01 05 A
ENAME1 07 06 A
ESAL1 14 05 N
*
FILE INFILE2
EID2 01 05 A
ECITY2 07 10 A
*
FILE OUTFILE
EIDO 01 05 A
ENAMEO 07 06 A
ESALO 15 05 N
ECITYO 22 10 A
*
WS-COUNT W 04 N
*
JOB INPUT (INFILE1 KEY(EID1) +
INFILE2 KEY(EID2)) +
NAME PLAMATCH FINISH DISP-RTN
IF MATCHED
EIDO = EID1
ENAMEO = ENAME1
ESALO = ESAL1
ECITYO = ECITY2
PUT OUTFILE
WS-COUNT = WS-COUNT + 1
END-IF
DISP-RTN. PROC.
DISPLAY ' RECORDS MATCHED ' WS-COUNT
END-PROC.
Output :
21500 MANDIP 22222 PUNE
21600 RANDIP 33333 MUMBAI
How to read next records if not match?
ReplyDelete