Page 1 of 1

Split into files

PostPosted: Fri Jul 17, 2009 12:40 am
by lodemoss
I need to split an input file into four outputs. If I use the "split", option, the input data gets parsed to the outputs with the first input record going to the 1st output, the 2nd input record to the 2nd file, etc. How can I send the first 25% of the input file to the first output file, the 2nd 25% to the 2nd file, etc. I will not know the number of records on the input file. Is there another option other than "split"?

Re: Split into files

PostPosted: Fri Jul 17, 2009 2:03 am
by dick scherrer
Hello and welcome to the forum,

I am not aware of a way to "split" by some %. . .

What is the business requirement to split this way?

Re: Split into files

PostPosted: Sat Jul 18, 2009 3:19 am
by Alissa Margulies
Try this SyncSort for z/OS 1.3 job:
//S1    EXEC PGM=SORT 
//SYSOUT  DD SYSOUT=*                                               
//SORTIN  DD DSN=INPUT.FILE,DISP=SHR                                       
//SORTOUT DD DSN=&TEMP1,DISP=(NEW,PASS)...                                 
//SYSIN   DD *                                                       
  SORT FIELDS=COPY                                                 
  OUTFIL FILES=OUT,REMOVECC,NODETAIL,                             
  TRAILER1=(COUNT=(M11,LENGTH=8))                                 
//*                                                               
//S2    EXEC PGM=SORT
//SYSOUT  DD SYSOUT=*                                                 
//SORTIN  DD DSN=&&TEMP1,DISP=(OLD,PASS)                           
//SORTOUT DD DSN=&&TEMP2,DISP=(NEW,PASS)...                                       
//SYSIN   DD *                                                       
  SORT FIELDS=COPY                                                 
  OUTREC BUILD=(2X,C'SPLIT1R=',1,8,ZD,DIV,+4,TO=ZDF,LENGTH=8,80:X)
//*                                                               
//S3     EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                     
//SORTIN   DD DSN=INPUT.FILE,DISP=SHR               
//SORTOF01 DD DSN=First25.Percent
//SORTOF02 DD DSN=Second25.Percent           
//SORTOF03 DD DSN=Third25.Percent
//SORTOF04 DD DSN=Fourth25.Percent
//SYSIN    DD *                             
  SORT FIELDS=COPY                       
  OUTFIL FILES=(01,02,03,04),           
//         DD DSN=&&TEMP2,DISP=(OLD,PASS)