Help needed in SYNCTOOL
Posted:
Mon Jul 21, 2008 8:00 pm
by SANDHYA BUDHI
I have 2 input files . The LRECL of file A is 10 charaters and file B is 503. I have to take a ID from the file A and check if it is in File B. If exists then move the id in the File A to the output file.
But the ID in file A is in the position 1 and in the File B it is in the position 40. will I be able to do a compare and get the dupliacte ID in the output file.
can I do this using SYNCTOOL or any other way is possible.. In SYNCTOOL which I referred the ID's are in the same position in both the files.
Please help how to proceed with this
Re: Help needed in SYNCTOOL
Posted:
Mon Jul 21, 2008 9:02 pm
by Alissa Margulies
This can be accomplished using SyncSort's JOIN feature, which is available in SyncSort for z/OS 1.2 and 1.3.
Assuming the ID is 10 bytes, try this:
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD DSN=OUTPUT.FILE
//SORTJNF1 DD DSN=FILEA (LRECL=10)
//SORTJNF2 DD DSN=FILEB (LRECL=503)
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(1,10,A)
JOINKEYS FILE=F2,FIELDS=(40,10,A)
REFORMAT FIELDS=(F1:1,10)
SORT FIELDS=COPY
/*
Re: Help needed in SYNCTOOL
Posted:
Wed Jul 23, 2008 2:53 pm
by SANDHYA BUDHI
Hi,
Thanks for your timely help.
I tried using the SYNCTOOL with the files having the same LRECL. Please find my JCL
//SYNC01 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FILEIN DD DSN=FILE1,
// DISP=SHR
// DD DSN=FILE2,
// DISP=SHR
//NODUPS DD DSN=OUTFILE,
// DISP=(,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=500,BLKSIZE=0),
// UNIT=SMS,SPACE=(CYL,(90,90),RLSE)
//TOOLIN DD *
SELECT FROM(FILEIN) TO(NODUPS) ON(01,07,CH) ALLDUPS
/*
Suppose my file1 contains
AA
BB
CC
File 2
BB
CC
The output file should have only
BB
CC
But using the above SORT I am getting the output file as
BB
BB
CC
CC
I can use one more sort for getting rid of these duplicates. Will I be able to do it using SUNCTOOL itself.
Re: Help needed in SYNCTOOL
Posted:
Fri Jul 25, 2008 12:56 am
by Alissa Margulies
Sandhya -- Based on your example, this can be accomplished in a single step. Try this:
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD DSN=OUTPUT.FILE
//SORTJNF1 DD *
AA
BB
CC
//SORTJNF2 DD *
BB
CC
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(1,2,A)
JOINKEYS FILE=F2,FIELDS=(1,2,A)
REFORMAT FIELDS=(F1:1,2)
SORT FIELDS=COPY
/*
Re: Help needed in SYNCTOOL
Posted:
Tue Jul 29, 2008 9:31 pm
by ranga_subham
Alissa,
Where the non-matching records will be written? I want to capture those too.........
Pls suggest.
Thanks.
Re: Help needed in SYNCTOOL
Posted:
Thu Jul 31, 2008 2:05 am
by Alissa Margulies
That is a different requirement than the original post. This JCL will provide you with the desired results.
//SORT1 EXEC PGM=SORT
//SORTJNF1 DD *
AA
BB
CC
//SORTJNF2 DD *
BB
CC
//SORTOF01 DD DSN=MATCHED.RECORDS
//SORTOF02 DD DSN=UNMATCH.RECORDS
//SYSOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(1,2,A)
JOINKEYS FILE=F2,FIELDS=(1,2,A)
REFORMAT FIELDS=(F1:1,2,F2:1,2)
JOIN UNPAIRED
SORT FIELDS=COPY
OUTFIL FILES=01,
INCLUDE=(3,2,CH,NE,C' '),
OUTREC=(1,2)
OUTFIL FILES=02,
INCLUDE=(3,2,CH,EQ,C' '),
OUTREC=(1,2)
/*
Re: Help needed in SYNCTOOL
Posted:
Thu Jul 31, 2008 7:31 pm
by ranga_subham
Alissa,
I tried the sort given by you and it gives me following output:
SORTOF01:
AA
BB
SORTOF02:
AA
BB
SORTOUT:
AAAA
BBBB
CC
And, I expected the output like the below:
SORTOF01: Matched records from the two files
AA
BB
SORTOF02: Non-Matched records from the 1st file
AA
BB
SORTOUT: Non-Matching records from the 2nd file
CC
Please suggest.
Thanks.
Re: Help needed in SYNCTOOL
Posted:
Thu Jul 31, 2008 8:10 pm
by Alissa Margulies
Show me your exact control cards. Something about your OUTFIL coding is not what I specified. Furthermore, if you want unmatched records from File2 written to SORTOUT, then you need to add the following:
OUTFIL FILES=OUT,
INCLUDE=(1,2,CH,EQ,C' '),
OUTREC=(3,2)
Or you can change the SORTOUT DD to SORTOF03, and change the above
OUTFIL FILES=OUT
to
OUTFIL FILES=03