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
 

 

Splitting records using DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
sunnyk

New User


Joined: 20 Oct 2004
Posts: 59

PostPosted: Thu Jun 29, 2006 12:31 pm    Post subject: Splitting records using DFSORT
Reply with quote

Hi,
I have a requirement wherein i want to split one file(containing multiple Headers/Records/Trailers) into "n" number of files. The records in the input file are like :

HEADER1
record1....
record2....
recordn....
TRAILER1
HEADER2
record1....
record2....
recordn....
TRAILER2
TRAILER1
HEADERn
record1....
record2....
recordn....
TRAILERn

I want to put each Header/Records/Trailer records into separate files.

And i don't know how many records are there in the file(so don't know how many output files will be created).

But assuming there won't be more than 50 records in the input file, is there any way to do this using DFSORT?

Regds
Sunny
Back to top
View user's profile Send private message

prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Thu Jun 29, 2006 6:46 pm    Post subject:
Reply with quote

Try this link, Frank has provided this link

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/srtmtrck.html#a02
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 Jun 29, 2006 9:30 pm    Post subject:
Reply with quote

You can use a DFSORT job like the one below to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, and you can have up to 50 output files. The first header/detail/trailer group will go to OUT01, the second to OUT02, etc. If you have less than 50 groups (e.g. 40), then the remaining OUTnn files will be empty (e.g. OUT41-OUT50).

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//OUT01 DD DSN...  output file 01 (FB/80)
//OUT02 DD DSN...  output file 02 (FB/80)
...
//OUT50 DD DSN...  output file 50 (FB/80)
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,2,ZD)),               
        IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),                       
                OVERLAY=(81:SEQNUM,2,ZD)),                         
        IFTHEN=(WHEN=NONE,                                         
                OVERLAY=(83:SEQNUM,2,ZD,                           
                         81:81,2,ZD,SUB,83,2,ZD,M11,LENGTH=2))     
  OUTFIL FNAMES=OUT01,INCLUDE=(81,2,ZD,EQ,+1),BUILD=(1,80)         
  OUTFIL FNAMES=OUT02,INCLUDE=(81,2,ZD,EQ,+2),BUILD=(1,80)
  ...       
  OUTFIL FNAMES=OUT50,INCLUDE=(81,2,ZD,EQ,+50),BUILD=(1,80)         
/*
Back to top
View user's profile Send private message
sunnyk

New User


Joined: 20 Oct 2004
Posts: 59

PostPosted: Fri Jun 30, 2006 11:12 am    Post subject:
Reply with quote

Hi Frank,
Thanks for your quich response. But i guess i need to check with client if there is ICEMAN tool available. Can we do it using some other tool also?

And i was not able to understand the following IFTHEN:
IFTHEN=(WHEN=NONE,
OVERLAY=(83:SEQNUM,2,ZD,
81:81,2,ZD,SUB,83,2,ZD,M11,LENGTH=2))

I understand what WHEN=NONE does but in OVERLAY what are we actually trying to do, can you please explain with some example.
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: Fri Jun 30, 2006 8:22 pm    Post subject:
Reply with quote

PGM=ICEMAN invokes DFSORT. If you have z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213, then you can use IFTHEN. These PTFs have been available since Dec, 2004.

For an explanation of the IFTHEN "group" technique, see these Smart DSORT Tricks:

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/srtmtrck.html#d01

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/srtmtrck.html#d02

For complete details on the Dec, 2004 DFSORT PTF functions, see:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/

For complete details on the April, 2006 DFSORT PTF functions, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm


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