Howard Brazee wrote on 09/19/2007 11:07:40 AM: > I have a file that a vendor wants sorted. > > H 09/10/20071250COLOR > M top_right_message > M top_right_message > M top_right_message > M top_right_message > M top_right_message > M top_right_message > M top_right_message > M top_right_message > D 111111111detailsR07 > I 11111111108/15/2007 > ... > S 333333333SCHED > D 333333333detai > I 33333333308/15 > F 000000000007IN > > Where 111111111, and 333333333 are account numbers, and column 1 > indicates Header, Message, Detail, Invoice, Schedule, & Footer > > The vendor wants the first record to be the Header, the next few to be > the Message, and the last to be the Footer. But in between, he wants > the records for each account to be in Invoice, Detail, Schedule order. > > Can I stick a DFSort on it?
Howard, Here's a DFSORT job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes: //S1 EXEC PGM=ICEMAN //SYSOUT DD SYSOUT=* //SORTIN DD * H 09/10/20071250COLOR M top_right_message 1 M top_right_message 2 M top_right_message 3 M top_right_message 4 M top_right_message 5 M top_right_message 6 M top_right_message 7 M top_right_message 8 D 111111111detailsR07 I 11111111108/15/2007 S 333333333SCHED D 333333333detai I 33333333308/15 F 000000000007IN /* //SORTOUT DD SYSOUT=* //SYSIN DD * INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:3,9,90:C'1')), IFTHEN=(WHEN=(1,1,CH,EQ,C'D'),OVERLAY=(90:C'2')), IFTHEN=(WHEN=(1,1,CH,EQ,C'S'),OVERLAY=(90:C'3')), IFTHEN=(WHEN=(1,1,CH,EQ,C'M'), OVERLAY=(81:SEQNUM,9,BI,START=1)), IFTHEN=(WHEN=(1,1,CH,EQ,C'H'),OVERLAY=(81:9X'00')), IFTHEN=(WHEN=(1,1,CH,EQ,C'F'),OVERLAY=(81:X'FF')) SORT FIELDS=(81,10,BI,A) OUTREC BUILD=(1,80) /* SORTOUT would have: H 09/10/20071250COLOR M top_right_message 1 M top_right_message 2 M top_right_message 3 M top_right_message 4 M top_right_message 5 M top_right_message 6 M top_right_message 7 M top_right_message 8 I 11111111108/15/2007 D 111111111detailsR07 I 33333333308/15 D 333333333detai S 333333333SCHED F 000000000007IN Frank Yaeger - DFSORT Development Team (IBM) - [EMAIL PROTECTED] Specialties: PARSE, JFY, SQZ, ICETOOL, IFTHEN, OVERLAY, Symbols, Migration => DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort/ ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html