Joined: 02 Dec 2002 Posts: 700 Topics: 63 Location: USA
Posted: Thu Dec 18, 2003 12:43 am Post subject: Get common records using Syncsort
Hi,
I have two sorted files, FILE1 and FILE2 and I want to get records that are common to both. It seems there are many solutions using DFSORT but I couldn't search any using syncsort.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Fri Dec 19, 2003 6:23 am Post subject:
Dibakar,
The following JCL will give you desired results.
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
A
DIBA
LOVES
MVS
A
COMMUNITY
FOR
MVS
PROGRAMMER
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC FIELDS=(1,10,C'1') $ TOTLA LRECL + CONSTANT 1
SORT FIELDS=(1,10,CH,A) $ SORT ON KEY
SUM FIELDS=(11,1,ZD) $ SUM ON CONSTANT
OUTFIL INCLUDE=(11,1,ZD,GT,1) $ INCLUDE WHEN SUM GT > 1
OUTREC=(1,10) $ STRIP THE CONSTANT
/*
Hope this helps...
cheers
kolusu
PS: You can use Select statement with Syncsort's synctool, but it might not work with older versions of syncsort. _________________ Kolusu
www.linkedin.com/in/kolusu
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum