by Mainframe_bhing » Wed May 22, 2013 1:29 am
Thanks Frank ! I also have same open thread on ibmmainframes.com.
I have 2 files like (Sample data)
FILE-1 : VB 133. KEY : 1st 4 position.
0001 ABCD 2013-05-01
0005 SDSA 2013-05-01
0004 SDAD 2013-05-01
0002 DASD 2013-05-01
FILE-2 : VB 133. KEY : 1st 4 position.
0006 ADAS 2013-05-02
0001 ABCD 2013-05-02
0008 DSDA 2013-05-02
0007 SDAW 2013-05-02
0002 DASD 2013-05-01
Need to compare the Keys in the FILE-1 and FILE-2 and created the 3rd file which will have all non matching records and if we have matching key records then copy the record from FILE-B to the output file.
FILE-OUT may look like this:
0001 ABCD 2013-05-02
0002 DASD 2013-05-01
0004 SDAD 2013-05-01
0005 SDSA 2013-05-01
0006 ADAS 2013-05-02
0007 SDAW 2013-05-02
0008 DSDA 2013-05-02
By looking at the manual I tried many things yesterday but was only able to create the matching key files, but when I replace the key lengths in REFORMAT with entire record length the jobs fails "Error:REFORMAT FIELD OUTSIDE RANGE".
By reading manual I came up with following card :
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(5,15,A)
JOINKEYS FILE=F2,FIELDS=(5,15,A)
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:5,129,F2:5,129),FILL=C'$'
SORT FIELDS=COPY
OUTFIL INCLUDE=(130,1,CH,NE,C'$',AND,1,1,CH,NE,C'$'),
BUILD=(130,129)
/*
COuld you please help to know if this can be achieved using JOINKEYS with the VB file lengths which I have ? Or do I need to try some different approach ?
THanks !