Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Only Detail record sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
sriramd

New User


Joined: 02 Nov 2006
Posts: 10

PostPosted: Thu Feb 07, 2008 6:13 am    Post subject: Only Detail record sort
Reply with quote

Hi,

I have a file which has a header and some detail records. Length of the file is 80 bytes.

Header
cccc
aaaa
dddd
bbbb

I want to have my output file like:

Header
aaaa
bbbb
cccc
dddd

I dont want to add a step wherein I can split the file and then sort and merge them back.

TIA...
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Feb 07, 2008 6:52 am    Post subject:
Reply with quote

You can use a DFSORT job like the following to 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.

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
Header
cccc
aaaa
dddd
bbbb
/*
//SORTOUT DD DSN=... output file
//SYSIN DD *
* Put special key of '1' in 81 for data records.
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'1')),
* For header record, put special key of '0' in 81.
    IFTHEN=(WHEN=(1,6,CH,EQ,C'Header'),OVERLAY=(81:C'0'))
* Sort by special key ('0' or '1') and then regular key.
  SORT FIELDS=(81,1,CH,A,1,4,CH,A)
* Remove special key.
  OUTREC FIELDS=(1,80)
/*


For more information, see the "Sort records between a header and trailer" Smart DFSORT Trick at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
sriramd

New User


Joined: 02 Nov 2006
Posts: 10

PostPosted: Thu Feb 07, 2008 10:11 pm    Post subject: Reply to: Only Detail record sort
Reply with quote

Thanks a lot....
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Aug 14, 2008 2:41 am    Post subject:
Reply with quote

With the new DATASORT operator of DFSORT's ICETOOL, available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008), you can do this kind of thing quite easily like this:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD *
Header
cccc
aaaa
dddd
bbbb
//OUT DD SYSOUT=*
//TOOLIN DD *
DATASORT FROM(IN) TO(OUT) HEADER USING(CTL1)
/*
//CTL1CNTL DD *
  SORT FIELDS=(1,4,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/
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us