Page 1 of 2

Need help to compare 2 files and write the matched records

PostPosted: Wed Mar 30, 2011 5:30 pm
by pgoe9
Hi,

I have 2 files. First file (Input1) having only 1 record is of 8 bytes containing the date in YYYYMMDD format. The second input file (Input2) having many records is of 107 bytes. This 2nd input file (Input2) contains the date from the column 100 to 107.

I need to compare both these files on the dates value and if the date matches then I need to copy all the contents from file 2 (input2) from column 1 to 99 in my output file.

For example: INPUT1
20110110

INPUT2
emp no1, name1, address,.........20110101
emp no2, name2, address,.........20110211
emp no3, name3, address,.........20110110

OUTPUT
emp no3, name3, address,.........

The JCL that I have coded is as follows:
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DSN=Input 1,DISP=SHR  --> file of 8 bytes
//SORTJNF2 DD DSN=Input 2,DISP=SHR  --> file of 107 bytes
//SORTOUT DD DSN=Output,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(230,4),RLSE),
// DCB=(RECFM=FB,LRECL=99,BLKSIZE=990)
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(100,8,A)
JOINKEYS FILES=F2,FIELDS=(1,8,A)
REFORMAT FIELDS=(F1:1,99)
OPTION COPY
/*


However, I'm getting this error constantly:
1 SYNCSORT  3.7BR  TPF1  US PATENTS: 4210961,5117495, OTHER PAT. PEND. (C) 199861,5117495, OTHER PAT. PEND. (C) 1998 SYNCSORT INC. DATE=2011/089 TIME=07.25.38
                                              z/OS   1.0.0   CPU MODEL 2097
 SYSIN :
   JOINKEYS FILE=F1,FIELDS=(100,8,A)
   *
   JOINKEYS FILE=F2,FIELDS=(1,8,A)
   *
   REFORMAT FIELDS=(F1:1,99)
   *
   SORT FIELDS=COPY
 WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT
 WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT
 WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT
 WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000

I also tried giving PGM=SYNCTOOL, but it failed with RC 0020.
Please help me wit this problem. I need this urgently

Re: Need help to compare 2 files and write the matched recor

PostPosted: Wed Mar 30, 2011 8:34 pm
by NicC
If you need it urgently then I suggest you ask around in your office or hire someone. We do not do 'urgent', 'asap', 'now' etc. We do as and when we feel like/can. Have you searched for the other topics like this? - in fact I think it is exactly the same.

Re: Need help to compare 2 files and write the matched recor

PostPosted: Thu Mar 31, 2011 10:34 am
by pgoe9
Yes Nic. I searched this forum for the similar problem. However what I have understood is that my syntax and everything related to Syncsort is exactly the same as guided by your panel; however the solution is till not working. What I would like to know is with the version that I'm using, does syncsort/joinkeys have different format or way to be used?

I have posted the exact error too. Although I need your help desperately, however whenever you or anyone from your panel feel like, then please let me know your inputs.

Thanks.

Re: Need help to compare 2 files and write the matched recor

PostPosted: Thu Mar 31, 2011 11:53 am
by BillyBoyo
Put at least one blank in front of your sort control cards.

Re: Need help to compare 2 files and write the matched recor

PostPosted: Thu Mar 31, 2011 11:54 pm
by NicC
We don't have a 'panel' - we are all computer professionals with various statuses - employed, unemployed, retired, whatever. I, for example, am not working in IT at the moment and only have an hour or 2 each day in which to look at these requests - others have all day unless they have another life!

Re: Need help to compare 2 files and write the matched recor

PostPosted: Fri Apr 01, 2011 12:06 am
by Robert Sample
However what I have understood is that my syntax and everything related to Syncsort is exactly the same as guided by your panel; however the solution is till not working.
Not true -- if you paid any attention at all to the many SORT posts on this forum, you would have noticed that they have at least one space before the SORT commands -- yours start in column 1. They are not "exactly the same" -- not at all.

Re: Need help to compare 2 files and write the matched recor

PostPosted: Fri Apr 01, 2011 11:56 am
by pgoe9
Thanks Billy Boyo and Robert. I did try all the possible starting positions of the SORT commands by not leaving any space, by leaving 1 space, by leaving 2 spaces, 3 spaces... but its still showing the same error as pasted above in my previous email :(

Re: Need help to compare 2 files and write the matched recor

PostPosted: Fri Apr 01, 2011 12:08 pm
by BillyBoyo
The output you are showing us does not match your input. You have "FILES" in input, "FILE" in output. OPTION COPY vs SORT FIELDS=COPY. Plus the spaces now in front of the control cards.

So, I don't think you can be showing us the current output. If this doesn't help you, post the input and output again, but making sure we are looking at the same thing.

Re: Need help to compare 2 files and write the matched recor

PostPosted: Fri Apr 01, 2011 12:30 pm
by enrico-sorichetti
any frigging reason to have the same issue posted multiple times all over the net? :evil:

anyway seems that the syncsort version release whatever is pretty old
SYNCSORT 3.7BR TPF1 US PATENTS: 4210961,5117495, OTHER PAT. PEND. (C) 199861,5117495, OTHER PAT. PEND. (C) 1998 SYNCSORT INC
z/OS 1.0.0

vs a more current one
SYNCSORT FOR Z/OS 1.3.2.1R U.S. PATENTS: 4210961, 5117495 (C) 2007 SYNCSORT INC.

I guess that joinkeys would not be available at that time

Re: Need help to compare 2 files and write the matched recor

PostPosted: Fri Apr 01, 2011 12:41 pm
by pgoe9
Thank You Enrico for pointing that out. So now since the version that I'm using is pretty old and joinkeys functionality is out of question, is there a way to still achieve the result by some other utility that might work?