kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Tue Jan 25, 2011 4:50 pm Post subject: |
|
|
oneofspace,
Concatenate the same file twice and use the following DFSORT JCL to get the desired results
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
$$
// DD *
ABG-SERVICES(5MEMBERS)
MARS-EXECUTIVES(7MEMBERS)
ZER-INSTITUTE(9MEMBERS)
// DD *
$$
// DD *
ABG-SERVICES(5MEMBERS)
MARS-EXECUTIVES(7MEMBERS)
ZER-INSTITUTE(9MEMBERS)
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'$$'),
PUSH=(81:ID=1,SEQ=1)),
IFTHEN=(WHEN=INIT,PARSE=(%01=(ENDBEFR=C'-',FIXLEN=8),
%02=(ENDBEFR=C'(',FIXLEN=15),
%03=(ENDBEFR=C')',FIXLEN=8)),
BUILD=(%02,C' CATEGORY ',31:%01,%02,61:%03,81:81,2))
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(81,2,ZD,EQ,12),PUSH=(83:31,25)),
IFTHEN=(WHEN=INIT,OVERLAY=(83:83,25,SQZ=(SHIFT=LEFT,MID=C'-')))
OUTFIL REMOVECC,IFOUTLEN=80,
OMIT=(81,1,ZD,EQ,1,AND,31,2,CH,EQ,C'$$'),
IFTHEN=(WHEN=(81,1,ZD,EQ,1,AND,31,2,CH,NE,C'$$'),
BUILD=(01,29,SQZ=(SHIFT=LEFT,MID=C' '),C': ',
31,25,SQZ=(SHIFT=LEFT,MID=C'-'))),
IFTHEN=(WHEN=(81,1,ZD,EQ,2,AND,31,2,CH,EQ,C'$$'),
BUILD=(/,C'MEMBER LIST:',/)),
IFTHEN=(WHEN=(81,1,ZD,EQ,2,AND,31,2,CH,NE,C'$$'),
BUILD=(05:31,8,15:C': ''',61,9,JFY=(SHIFT=LEFT,TRAIL=C''''))),
TRAILER1=(25'*',/,C'COURTESY ',15:C': ',83,25)
//* |
The output from this job is
Code: |
SERVICES CATEGORY : ABG-SERVICES
EXECUTIVES CATEGORY : MARS-EXECUTIVES
INSTITUTE CATEGORY : ZER-INSTITUTE
MEMBER LIST:
ABG : '5MEMBERS'
MARS : '7MEMBERS'
ZER : '9MEMBERS'
*************************
COURTESY : ABG-SERVICES
|
_________________ Kolusu
www.linkedin.com/in/kolusu |
|