View previous topic :: View next topic |
Author |
Message |
dohellwithmf Beginner
Joined: 12 Jul 2007 Posts: 55 Topics: 23
|
Posted: Thu Apr 30, 2009 6:53 pm Post subject: Eztrieve to compare 1 file against multiple files |
|
|
Hi All,
I need ur urgent help. I have to compare 1 file against 4 files in an Ezt. Based on which 2 files have matchign keys i have to populate different indicators in the output file. example:
--if key in file 1 matches with file2 then 12
--if key in file 1 matches with file3 then 13
--if key in file 1 matches with file 2 and file 3 then 123 and so on....
Pls reply asap....thanks in anticipation !!!! |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Thu Apr 30, 2009 8:07 pm Post subject: |
|
|
dohellwithmf,
untested sample code. I assumed that your key is 4 bytes in pos 1 in all files and File1 does NOT have any duplicates.
Code: |
//SYSIN DD *
FILE FILE1
F1-KEY 01 04 A
FILE FILE2
F2-KEY 01 04 A
FILE FILE3
F3-KEY 01 04 A
FILE FILE4
F4-KEY 01 04 A
FILE OUTPUT FB(0 0)
OUT-KEY 01 04 A
OUT-FLAGS 06 04 A
******************************************
* MAINLINE *
******************************************
JOB INPUT (FILE1 KEY (F1-KEY) +
FILE2 KEY (F2-KEY) +
FILE3 KEY (F3-KEY) +
FILE4 KEY (F4-KEY))
IF MATCHED
OUT-KEY = F1-KEY
OUT-FLAGS = '1234'
PUT OUTPUT
ELSE-IF FILE1 AND FILE2 AND NOT FILE3 AND NOT FILE4
OUT-KEY = F1-KEY
OUT-FLAGS = '12 '
PUT OUTPUT
ELSE-IF FILE1 AND FILE3 AND NOT FILE2 AND NOT FILE4
OUT-KEY = F1-KEY
OUT-FLAGS = '13 '
PUT OUTPUT
ELSE-IF FILE1 AND FILE4 AND NOT FILE2 AND NOT FILE3
OUT-KEY = F1-KEY
OUT-FLAGS = '14 '
PUT OUTPUT
END-IF
|
|
|
Back to top |
|
|
|
|