MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
Selvakumar Beginner Joined: 26 May 2004 Posts: 16 Topics: 6
Posted: Fri Dec 03, 2004 5:06 am Post subject: To retrieve records which is common in both files
Hi,
I have two files. The structure of the file is
1st file:
AAA 00 12.00
AAA 01 13.00
BBB 00 11.00
CCC 04 01.00
AAA 02 23.00
BBB 02 12.00
2nd file:
AAA
CCC
DDD
and the output file should have the records of first file, whose key should match with second file.
output file:
AAA 00 12.00
AAA 01 13.00
AAA 02 23.00
CCC 04 01.00
I tried in syncsort, but could not acheive the desired result.
Help needed. _________________ Thanks,
Zelwaa
-what matters most is how u c urself!!!
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Back to top
Selvakumar Beginner Joined: 26 May 2004 Posts: 16 Topics: 6
Posted: Fri Dec 03, 2004 6:46 am Post subject:
Kolusu,
The above link does not help for this condition.
See the input file. The key is not unique in the first file. So it will not give the desired output as shown.
We can do that using cobol/sas.
But i want to know whether there is any option to do using syncsort/fileaid. _________________ Thanks,
Zelwaa
-what matters most is how u c urself!!!
Back to top
Phantom Data Mgmt Moderator Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Fri Dec 03, 2004 8:43 am Post subject:
Selva,
The following link contains solutions for different types of input data. The one which contains no dups & the one which has dups.
http://www.mvsforums.com/helpboards/viewtopic.php?t=3121&highlight=match
Again, as kolusu said I just searched on the keyword "Match". Pls try to search. There are tons of questions especially on Matching records.
Hope this helps,
Thanks,
Phantom
Back to top
Phantom Data Mgmt Moderator Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Fri Dec 03, 2004 8:44 am Post subject:
I just forgot to update something. The solutions posted in the link will work only for DFSORT or latest version of Syncsort. What version of syncsort do you have ?
Thanks,
Phantom
Back to top
Selvakumar Beginner Joined: 26 May 2004 Posts: 16 Topics: 6
Posted: Fri Dec 03, 2004 9:14 am Post subject:
I dont have splice operator in the DFSORT utility. It is the old version.
How to find the version of the syncsort? _________________ Thanks,
Zelwaa
-what matters most is how u c urself!!!
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Fri Dec 03, 2004 9:16 am Post subject:
Selvakumar ,
Run this job and look at the sysout of this job
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
TEST
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
/*
The first line sysout tells you the version for syncsort
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
Selvakumar Beginner Joined: 26 May 2004 Posts: 16 Topics: 6
Posted: Fri Dec 03, 2004 9:24 am Post subject:
The first line shows
SYNCSORT FOR Z/OS 1.1DN TPF3A
is 1.1DN is the version? _________________ Thanks,
Zelwaa
-what matters most is how u c urself!!!
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Fri Dec 03, 2004 10:01 am Post subject:
Selvakumar,
You have the latest version of syncsort and it supports SPLICE operator. I assumed that your input file LRECL is 80 bytes and is of FB format.
Code:
//STEP0100 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
AAA
CCC
DDD
//IN2 DD *
AAA 00 12.00
AAA 01 13.00
BBB 00 11.00
CCC 04 01.00
AAA 02 23.00
BBB 02 12.00
//T1 DD DSN=&T1,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(X,Y),RLSE)
//T2 DD DSN=&T2,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(X,Y),RLSE)
//T3 DD DSN=&T3,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(X,Y),RLSE)
//CON DD DSN=&T1,VOL=REF=*.T1,DISP=(OLD,DELETE)
// DD DSN=&T2,VOL=REF=*.T2,DISP=(OLD,DELETE)
// DD DSN=&T3,VOL=REF=*.T3,DISP=(OLD,DELETE)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) USING(CTL1)
SELECT FROM(IN1) TO(T2) ON(1,3,CH) FIRSTDUP USING(CTL2)
COPY FROM(IN2) USING(CTL3)
SPLICE FROM(CON) TO(OUT) ON(1,3,CH) WITHALL WITH(1,81) -
USING(CTL4) KEEPNODUPS
//CTL1CNTL DD *
OUTFIL FNAMES=T1,OUTREC=(1,80,C'22')
//CTL2CNTL DD *
OUTFIL FNAMES=T2,OUTREC=(1,80,C'XX')
//CTL3CNTL DD *
OUTFIL FNAMES=T3,OUTREC=(1,80,C'11')
//CTL4CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(81,2,CH,EQ,C'12')
/*
Hope this helps....
Cheers
kolusu
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
Selvakumar Beginner Joined: 26 May 2004 Posts: 16 Topics: 6
Posted: Sat Dec 04, 2004 1:00 am Post subject:
It is working. Thankyou guys. _________________ Thanks,
Zelwaa
-what matters most is how u c urself!!!
Back to top
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