MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
edkir98 Beginner Joined: 27 Aug 2007 Posts: 102 Topics: 42 Location: Chennai
Posted: Fri Apr 25, 2008 7:51 am Post subject: Exclude Header and Trailer
Suppose if this is my input file
Code: HEADER
1111AAAA
3333CCCC
2222BBBB
TRAILER
I want to sort this input file excluding the HEADER and TRAILER but the HEADER and TRAILER should be in the output of the sorted file.
i.e this should be the output
Code: HEADER
1111AAAA
2222BBBB
3333CCCC
TRAILER
Is there a way to do it? _________________ Thanks
Back to top
Nic Clouston Advanced Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
Posted: Fri Apr 25, 2008 8:24 am Post subject:
What Search keywords did you use? I found several references to this type of problem including one to the Smart DFSORT Tricks document. _________________ Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
edkir98 Beginner Joined: 27 Aug 2007 Posts: 102 Topics: 42 Location: Chennai
Posted: Fri Apr 25, 2008 9:30 am Post subject:
Nick,
I'm sorry I was not able to track any. Can you give me the link for the exact post? Thankful if you would help. _________________ Thanks
Back to top
Nic Clouston Advanced Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
Posted: Fri Apr 25, 2008 9:40 am Post subject:
try searching on sort header trailer _________________ Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12367 Topics: 75 Location: San Jose
Posted: Fri Apr 25, 2008 10:15 am Post subject:
edkir98 ,
The following DFSORT JCL will give you the desired results
Code:
//STEP0100 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
HEADER
1111AAAA
3333CCCC
2222BBBB
TRAILER
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION EQUALS
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'1')),
IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),OVERLAY=(81:C'0')),
IFTHEN=(WHEN=(1,7,CH,EQ,C'TRAILER'),OVERLAY=(81:C'2'))
SORT FIELDS=(81,01,CH,A,
01,10,CH,A)
OUTREC BUILD=(01,80)
//*
Hope this helps... _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
www.linkedin.com/in/kolusu
Back to top
Frank Yaeger Sort Forum Moderator Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Jul 29, 2008 12:59 pm Post subject:
You can do this kind of thing quite easily with the new DATASORT operator of DFSORT's ICETOOL available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008). Here's an example:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//OUT DD DSN=... output file
//TOOLIN DD *
DATASORT FROM(IN) TO(OUT) HEADER TRAILER USING(CTL1)
/*
//CTL1CNTL DD *
SORT FIELDS=(1,8,CH,A)
/*
For complete details on the new DATASORT 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