krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
kalukakkad
As per the i/p specified, the code is as follows.
Code: |
//*******************************************************
//STEP001 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
H
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
AAAM090112345
AAAM090112342
AAAM090112341
H
BBBM090112325
BBBM090112326
BBBM090112321
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
SORT FROM(IN1) TO(OUT) USING(CP01)
/*
//CP01CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(903:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'H'),
OVERLAY=(903:SEQNUM,8,ZD,911:C'00000000')),
IFTHEN=(WHEN=NONE,
OVERLAY=(911:SEQNUM,8,ZD,
903:903,8,ZD,SUB,911,8,ZD,M11,LENGTH=8,
911:C'11111111'))
SORT FIELDS=(903,8,ZD,A,911,8,ZD,A,1,13,CH,A)
OUTFIL FNAMES=OUT,BUILD=(1,15)
/*
|
O/P OUT
Code: |
----+----1----+
***************
H
AAAM090112341
AAAM090112342
AAAM090112345
H
BBBM090112321
BBBM090112325
BBBM090112326
|
and regarding
Quote: |
Thanks Krisprems. But how to sort if there is no trailer record. |
you need to understand how the records are handled in groups!
So, check the explanation by Frank @ http://ibmmainframes.com/viewtopic.php?t=21781 |
|