kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12370 Topics: 75 Location: San Jose
|
Posted: Mon Jun 21, 2004 7:45 am Post subject: |
|
|
Arunkumar,
There are many ways of doing it. If you are header can be regenerated then the following JCl will give you the desired results. I assumed that your input file is 80 bytes in length and is of FB recfm.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
HHHHHHHHHHHHHHHHHHHHHHHHH
11111111111111111111111111111 |
22222222222222222222222222222 |---> DATA
33333333333333333333333333333 |
HHHHHHHHHHHHHHHHHHHHHHHHH
44444444444444444444444444444 |
55555555555555555555555555555 |----> DATA
66666666666666666666666666666 |
HHHHHHHHHHHHHHHHHHHHHHHHH
77777777777777777777777777777 |
88888888888888888888888888888 |----> DATA
//SORTOUT DD DSN=YOUR OUTPUT FILE,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OMIT COND=(1,1,CH,EQ,C'H')
OUTFIL REMOVECC,HEADER1=(80C'H')
/*
|
In the above code we first omit all the records with 'H' and use the HEADER1 parm to create the header which will be 80 bytes of 'H"
Method: 2 We add a seqnum at the end and using include cond on outfil we just include only the first header rec and other detail records.
Code: |
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
HHHHHHHHHHHHHHHHHHHHHHHHH
11111111111111111111111111111 |
22222222222222222222222222222 |---> DATA
33333333333333333333333333333 |
HHHHHHHHHHHHHHHHHHHHHHHHH
44444444444444444444444444444 |
55555555555555555555555555555 |----> DATA
66666666666666666666666666666 |
HHHHHHHHHHHHHHHHHHHHHHHHH
77777777777777777777777777777 |
88888888888888888888888888888 |----> DATA
//SORTOUT DD DSN=YOUR OUTPUT FILE,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
INREC FIELDS=(1,80,SEQNUM,8,ZD)
OUTFIL INCLUDE=((1,1,CH,EQ,C'H',AND,81,8,ZD,EQ,1),OR,1,1,CH,NE,C'H'),
OUTREC=(1,80)
/*
|
Method: 3 change the pgm to synctool if you have syncsort at your shop
Code: |
//STEP0200 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
HHHHHHHHHHHHHHHHHHHHHHHHH
11111111111111111111111111111 |
22222222222222222222222222222 |---> DATA
33333333333333333333333333333 |
HHHHHHHHHHHHHHHHHHHHHHHHH
44444444444444444444444444444 |
55555555555555555555555555555 |----> DATA
66666666666666666666666666666 |
HHHHHHHHHHHHHHHHHHHHHHHHH
77777777777777777777777777777 |
88888888888888888888888888888 |----> DATA
//SORTOUT DD DSN=YOUR OUTPUT FILE,
// DISP=(MOD,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//TOOLIN DD *
COPY FROM(IN) TO(OUT) USING(CTL1)
COPY FROM(IN) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
OPTION STOPAFT=1
//CTL2CNTL DD *
OMIT COND=(1,1,CH,EQ,C'H')
/*
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|