MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
Dragon_Lee Beginner Joined: 13 Feb 2006 Posts: 31 Topics: 17
Posted: Tue Jul 03, 2007 8:41 am Post subject: How to sort an input file by section?
Hello,
I want to sort an input file by section? Can anybody help me to achieve it?
The input file is as below
Code:
77777
55555
66666
22222
33333
*****
11111
22222
44444
33333
*****
88888
77777
*****
44444
The stars are dividing lines. I want to sort each section divided by the lines, i.e. the output file should be -
Code:
22222
33333
55555
66666
77777
*****
11111
22222
33333
44444
*****
77777
88888
*****
44444
Can this be done by DFSORT? Thanks in advance!! _________________ Dragon
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
Posted: Tue Jul 03, 2007 9:10 am Post subject:
Dragon_Lee ,
Just realized that all the tricks mentioned in the above links are kinda of complicated. here are the sort cards for this task.
I assumed that your input is FB recfm and 80 bytes length
Code:
//SYSIN DD *
OPTION EQUALS
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1,5,CH,NE,C'*****'),
OVERLAY=(89:SEQNUM,8,ZD,
81:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8)),
IFTHEN=(WHEN=NONE,
OVERLAY=(81:SEQNUM,8,ZD))
SORT FIELDS=(81,08,CH,A,
01,05,CH,A)
OUTREC BUILD=(01,80)
/*
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
Dragon_Lee Beginner Joined: 13 Feb 2006 Posts: 31 Topics: 17
Posted: Tue Jul 03, 2007 8:44 pm Post subject:
kolusu - Thanks a lot! _________________ Dragon
Back to top
Frank Yaeger Sort Forum Moderator Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri Sep 05, 2008 11:54 am Post subject:
You can now do this kind of thing more easily with the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
77777
55555
66666
22222
33333
*****
11111
22222
44444
33333
*****
88888
77777
*****
44444
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'*****'),
PUSH=(81:ID=8))
SORT FIELDS=(81,8,ZD,A,1,5,CH,A)
OUTREC BUILD=(1,80)
/*
For complete details on the WHEN=GROUP function and the other new functions available with PTF UK90013, see:
www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/ _________________ 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
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