Page 1 of 1

Syncsort Comparing different fields from 1 file to 2nd file

PostPosted: Fri Apr 29, 2011 12:52 am
by teacher01
Hello All,

I have to compare the values from File 1 to File 2. The values of File 1 are

AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
GGGGGGG HHHHHH JJJJJJJJ KKKKKKKKK

The value in File 1 is in 4 different fields, starting from col 1 to 8 and then again from col 10 to 17.

My File 2 has the values that is present in column 1 to 8

AAAAAAAA
BBBBBBBBB
CCCCCCCC
DDDDDDDD
EEEEEEEEE
FFFFFFFFF

So I used the JOINKEY and performed a match on both files. But the match is performed only on col 1 to 8.
Here is the JCL
//PS070 EXEC PGM=SORT
//SORTJNF1 DD DSN=TEST.EVENT.SORT,DISP=SHR
//SORTJNF2 DD DSN=TEST.OCC.SORT,DISP=SHR
//FBOUT DD DSN=TEST.FINAL.OUT,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(5,20),RLSE),
// DCB=SYS3.DSCB
//SYSOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(1,8,A)
JOINKEYS FILE=F2,FIELDS=(1,8,A)
REFORMAT FIELDS=(F1:1,8,F2:1,8)
SORT FIELDS=(1,8,CH,A)
SUM FIELDS=NONE
OUTREC FIELDS=(1,8)
OUTFIL FNAMES=FBOUT
/*


How do i make sure that all the columns from FILE 1 get compared with COLUMN in FILE 2.

I tried specifying

JOINKEYS FILE=F1,FIELDS=(1,8,A,10,8,A,19,8,A)
JOINKEYS FILE=F2,FIELDS=(1,8,A)

But I got an error mentioning the no. of keys need to be equal,

so I changed it to

JOINKEYS FILE=F1,FIELDS=(1,8,A,10,8,A,19,8,A)
JOINKEYS FILE=F2,FIELDS=(1,8,A,1,8,A,1,8,A)

but I did not get any results...

Any suggestions ....?

Re: Syncsort Comparing different fields from 1 file to 2nd

PostPosted: Fri Apr 29, 2011 8:01 pm
by Alissa Margulies
Teacher01,

What are you expecting in your output? Please show the desired output based on your sample input data.

Re: Syncsort Comparing different fields from 1 file to 2nd

PostPosted: Sun May 01, 2011 2:43 am
by teacher01
The output file should be in one column that has values matched for all the columns in File 1.

AAAAAAAA
BBBBBBBB
CCCCCCCC
DDDDDDDD

Re: Syncsort Comparing different fields from 1 file to 2nd

PostPosted: Sat May 07, 2011 1:53 am
by Alissa Margulies
If the records in File 1 are:

AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
EEEEEEEEE XXXXXXXX YYYYYYYYY ZZZZZZZZZ
GGGGGGG HHHHHH JJJJJJJJ KKKKKKKKK

Should the output include EEEEEEE? Or do all 4 fields need to have a match in File 2?