Page 1 of 1

Comparation between 2 datasets

PostPosted: Tue Aug 30, 2011 7:51 pm
by vegafacundodaniel
I want to match keys of a field in a dataset with keys of a field in another dataset.

Re: Comparation between 2 datasets

PostPosted: Tue Aug 30, 2011 11:31 pm
by Frank Yaeger
vegafacundodaniel,

For examples with DFSORT, see the "Create files with matching and non-matching records" Smart DFSORT Trick at:

http://www.ibm.com/support/docview.wss? ... g3T7000094

If you need more specific help, please show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.

Re: Comparation between 2 datasets

PostPosted: Wed May 22, 2013 1:29 am
by Mainframe_bhing
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 !

Re: Comparation between 2 datasets

PostPosted: Wed May 22, 2013 1:31 am
by Akatsukami
Mr. Yaeger retired a year ago, kusomushi.

Re: Comparation between 2 datasets

PostPosted: Wed May 22, 2013 2:02 am
by Mainframe_bhing
I know I can achieve this by Easytrieve and have also tested it with sample file.

But I need to implement the solution for 300 files thus exploring if there is any other way by which it would be faster execution and easily customized for 300 different files with different keys.

If I had time to learn try and research using manual then I would have never come to the forum for solution. I will sure read manual and do trial and errors once my project is implemented and I can devote some time to this learning then.

If you can help to address the raised issue it will be appreciated.

Sarcasm is good to boost one's ego but not good for any solution.

Thanks !

Re: Comparation between 2 datasets

PostPosted: Wed May 22, 2013 2:37 am
by Akatsukami
That wasn't sarcasm, kusomushi; Mr. Yaeger did retire a year ago. Moreover, he was (and Mr Kolusu is) a DFSORT developer; you apparently use Syncsort, a competitive product.

I wrote the job you're whining about on our sister board in 50 minutes...without a manual (I don't have one written in this century), but by searching and reading fora on the two boards. Judging by your join date on the other board, you have about one-fifth the experience that I do; you are therefore permitted to take five times as long to come up with a solution. Get. To. Work.