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
 

 

Split the input file to 5 files having trailer

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

New User


Joined: 23 May 2008
Posts: 4
Location: 800 Chrysler Drive

PostPosted: Sat Aug 09, 2008 1:28 pm    Post subject: Split the input file to 5 files having trailer
Reply with quote

Hi,

I Have an input file having one trailer record with count. which is identified by 'TRAILER' FROM positon 1-7 in the input file and it is last record in the input file

Now I am splitting the input file to 5 datasets. while splitting I want the trailer record to be appended at the end of each file split with count.

The count for the trailer record is at 51-59 position in the input file. I want the trailer record with count in each split

I am using the below code to split the file to 5 files.

//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=(OUT1,OUT2,OUT3,OUT4,OUT5),SPLIT
END
/*

I request you to let me know how to achieve this.

Thanks
Venkata Perumala
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Sat Aug 09, 2008 2:16 pm    Post subject:
Reply with quote

when you have determined the criteria that would control the split, you can
then refer to this link:
http://www.ibm.com/systems/support/storage/software/sort/mvs/tricks/

which is tips and tricks for dfsort. there are several topics about splitting files and one about creating trailer records with counts.

The Sticky's in the DFSORT forum have other links to DFSORT documentation.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Sat Aug 09, 2008 2:17 pm    Post subject:
Reply with quote

Here is a link to the Sticky concerning DFSORT documentation:
http://ibmmainframes.com/viewtopic.php?t=1348&sid=d05e58903d25c15ce7e6b13ecccc64ed
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: Sat Aug 09, 2008 9:11 pm    Post subject:
Reply with quote

Venkata,

Are 'TRAILER' and the count the only fields in the trailer record?

If not, please show what the trailer record looks like. Are there fields in the original trailer record that cannot be recreated in a new trailer record? That is, could we rebuild the trailer record for each output file from scratch or are there fields that we can only get by copying them from the original trailer record?

What is the RECFM and LRECL of the input file?

Is the count in the trailer record a 9-byte ZD field or something else (what)?
Back to top
View user's profile Send private message
Venkata Perumala

New User


Joined: 23 May 2008
Posts: 4
Location: 800 Chrysler Drive

PostPosted: Sun Aug 10, 2008 1:20 pm    Post subject:
Reply with quote

Hi,

Thanks a lot for quick reply.

Yes the Trailer record has to be taken from the input file and the count position in the trailer reocrd has to be updated for each file splitted.

The count is 9 byte ZD

RECFM=FB
LRECL=700

Kindly let me know if more information is needed

Thanks & Regards
Venkata Perumala
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: Mon Aug 11, 2008 10:22 pm    Post subject:
Reply with quote

Is the count in the trailer record the count of the data records, or the count of the data records + the trailer record?
Back to top
View user's profile Send private message
Venkata Perumala

New User


Joined: 23 May 2008
Posts: 4
Location: 800 Chrysler Drive

PostPosted: Tue Aug 12, 2008 4:03 pm    Post subject:
Reply with quote

The count in the trailer records does not include the trailer record count
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Aug 13, 2008 12:01 am    Post subject: Reply to: Split the input file to 5 files having trailer
Reply with quote

Venkata Perumala,

The following DFSORT JCL will give you the desired results. We basically mimic the function of split using INREC. Since we are splitting the input into 5 files we add a 8 byte sequm at the end in pd format with a start number of 5, and then divide that seqnum by 5 and get the remainder. So the first record will have a remainder of 0 and the second record will have a remainder of 1, the third record will have a remainder of 2, the fourth record will have remainder of 3 and the 5th record will have a remainder of 4 and the 6th record once again will have a remainder of zero and the cycle of 5 records continues till the end.

Now using this number we start another seqnum on outrec to count the no: of records written to the output. We start with count of 0 because you dont want the trailer record to be counted as part of the total no:f records.

Using OUTFIL we split the records into different based on the remainder and while writting out we overlay the contents of the trailer records with the seqnum we added using outrec.



Code:

//STEP0100 EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD DSN=YOUR INPUT DSN TO BE SPLIT,DISP=SHR
//OUT1     DD SYSOUT=*
//OUT2     DD SYSOUT=*     
//OUT3     DD SYSOUT=*     
//OUT4     DD SYSOUT=*     
//OUT5     DD SYSOUT=*
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                 
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(701:SEQNUM,8,PD,START=5,INCR=1, 
                                   701,8,PD,MOD,+5,TO=ZD,LENGTH=1))
                                                                   
  OUTREC IFTHEN=(WHEN=(709,1,ZD,EQ,0,OR,1,7,CH,EQ,C'TRAILER'),     
         OVERLAY=(710:SEQNUM,9,ZD,START=0,INCR=1),HIT=NEXT),       
         IFTHEN=(WHEN=(709,1,ZD,EQ,1,OR,1,7,CH,EQ,C'TRAILER'),     
         OVERLAY=(720:SEQNUM,9,ZD,START=0,INCR=1),HIT=NEXT),       
         IFTHEN=(WHEN=(709,1,ZD,EQ,2,OR,1,7,CH,EQ,C'TRAILER'),     
         OVERLAY=(730:SEQNUM,9,ZD,START=0,INCR=1),HIT=NEXT),       
         IFTHEN=(WHEN=(709,1,ZD,EQ,3,OR,1,7,CH,EQ,C'TRAILER'),     
         OVERLAY=(740:SEQNUM,9,ZD,START=0,INCR=1),HIT=NEXT),       
         IFTHEN=(WHEN=(709,1,ZD,EQ,4,OR,1,7,CH,EQ,C'TRAILER'),     
         OVERLAY=(750:SEQNUM,9,ZD,START=0,INCR=1))                 
                                                                   
  OUTFIL FNAMES=OUT1,IFOUTLEN=700,                                 
  INCLUDE=(709,1,ZD,EQ,0,OR,1,7,CH,EQ,C'TRAILER'),                 
  IFTHEN=(WHEN=(1,4,CH,EQ,C'TRAILER'),OVERLAY=(51:710,9))           
                                                                   
  OUTFIL FNAMES=OUT2,IFOUTLEN=700,                                 
  INCLUDE=(709,1,ZD,EQ,1,OR,1,7,CH,EQ,C'TRAILER'),                 
  IFTHEN=(WHEN=(1,4,CH,EQ,C'TRAILER'),OVERLAY=(51:720,9))           
                                                                   
  OUTFIL FNAMES=OUT3,IFOUTLEN=700,                                 
  INCLUDE=(709,1,ZD,EQ,2,OR,1,7,CH,EQ,C'TRAILER'),                 
  IFTHEN=(WHEN=(1,4,CH,EQ,C'TRAILER'),OVERLAY=(51:730,9))           
                                                                   
  OUTFIL FNAMES=OUT4,IFOUTLEN=700,                                 
  INCLUDE=(709,1,ZD,EQ,3,OR,1,7,CH,EQ,C'TRAILER'),                 
  IFTHEN=(WHEN=(1,4,CH,EQ,C'TRAILER'),OVERLAY=(51:740,9))           
                                                                   
  OUTFIL FNAMES=OUT5,IFOUTLEN=700,                                 
  INCLUDE=(709,1,ZD,EQ,4,OR,1,7,CH,EQ,C'TRAILER'),                 
  IFTHEN=(WHEN=(1,4,CH,EQ,C'TRAILER'),OVERLAY=(51:750,9))           
                                                                   
/*
Back to top
View user's profile Send private message
Venkata Perumala

New User


Joined: 23 May 2008
Posts: 4
Location: 800 Chrysler Drive

PostPosted: Wed Aug 13, 2008 11:23 am    Post subject:
Reply with quote

Hi,

Thanks a lot for your help.

I will code this and if any issues during testing I will post reply again.


Thanks & Regards
Venkata Perumala
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 Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 1 Thu Jul 27, 2017 9:16 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am


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