Hello,
Declare the two fields as a key and
try this
JOB INPUT ( FILEA KEY(A-KEY) +
FILEB KEY(B-KEY) ) FINISH
*
IF MATCHED
C-REC = A-REC
PUT FILEC
ELSE
IF FILEA
D-REC = A-REC
PUT FILED
ELSE
IF FILEB
E-REC = B-REC
PUT FILEE
END-IF
END-IF
END-IF
*
i hope this helps.
Note: Both the files has to be sorted before running this easytrieve.
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
Hello,
Good to hear you have a process working
In the future, you might want to consider a simpler style of code. . .
I leave the file definitions to you, but the following bit of code should do what you want:
Code:
JOB INPUT INFILE.
IF as-acc-key = ap-acc-key
[ i am moving all the inp records to the output files here]
put output
else
<i am moving all the non matched records to the other output file>
put other-output
endif
You should not need to check eof over and over and you should not need a proc to read the input. Easytrieve will do lots for you