MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
yrcreddy Beginner Joined: 28 Dec 2005 Posts: 27 Topics: 12
Posted: Sat Jan 20, 2007 9:49 am Post subject: Extract Records based on the Count
Hi,
I have an input file which is in FB formate.The I/P is:
Code:
AAAAAAAAXU11060689
AAAAAAAAYU11060689
AAAAAAAAXU19959793
AAAAAAAAYU19959793
AAAAAAAAZU19959793
AAAAAAAAXU03594349
AAAAAAAAYU03594349
AAAAAAAAXU03594374
AAAAAAAAYU03594374
AAAAAAAAZU03594374
The layout of the input file is:
Code:
Fields Length
-------- --------
SYSNAME Char 8
STATUS Char 1
REL_STAT Char 1
CONTRACT_NO Char 8
The Status field contains the value X/Y/Z.
I want to extract contract no's which are matching for all status values.
Expected O/P is:
Code:
X19959793
Y19959793
Z19959793
X03594374
Y03594374
Z03594374
Please help me is there any way to achieve above result. _________________ Thanks,
Ramachandra Reddy
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Sat Jan 20, 2007 11:21 am Post subject:
yrcreddy ,
Assuming that you don't dups on status & contract_no combo, the following jcl will give you the desired results.
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AAAAAAAAXU11060689
AAAAAAAAYU11060689
AAAAAAAAXU19959793
AAAAAAAAYU19959793
AAAAAAAAZU19959793
AAAAAAAAXU03594349
AAAAAAAAYU03594349
AAAAAAAAXU03594374
AAAAAAAAYU03594374
AAAAAAAAZU03594374
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(02,08,CH,A)
INCLUDE COND=(9,1,SS,EQ,C'XYZ')
INREC FIELDS=(09,01,
11,08,
C'001')
SUM FIELDS=(10,03,ZD)
OUTFIL INCLUDE=(10,3,ZD,EQ,3),
OUTREC=(C'X',02,08,/,
C'Y',02,08,/,
C'Z',02,08)
/*
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
Frank Yaeger Sort Forum Moderator Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Sat Jan 20, 2007 12:00 pm Post subject:
yrcreddy,
Assuming that you don't have dups on status & contract_no combo, you can also use this DFSORT/ICETOOL job to do what you asked for.
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
AAAAAAAAXU11060689
AAAAAAAAYU11060689
AAAAAAAAXU19959793
AAAAAAAAYU19959793
AAAAAAAAZU19959793
AAAAAAAAXU03594349
AAAAAAAAYU03594349
AAAAAAAAXU03594374
AAAAAAAAYU03594374
AAAAAAAAZU03594374
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(11,8,CH) EQUAL(3) USING(CTL1)
/*
//CTL1CNTL DD *
INCLUDE COND=(9,1,SS,EQ,C'XYZ')
OUTFIL FNAMES=OUT,OUTREC=(9,1,11,8)
/*
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
yrcreddy Beginner Joined: 28 Dec 2005 Posts: 27 Topics: 12
Posted: Sun Jan 21, 2007 10:44 pm Post subject:
Thank you very much kolusu and Frank.
Both JCL's are working for me. _________________ Thanks,
Ramachandra Reddy
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