IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to split a file into multiple output files.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rahul.banik

New User


Joined: 23 Jan 2007
Posts: 16
Location: Mysore

PostPosted: Tue Jan 29, 2008 1:49 pm
Reply with quote

Hi All,

My requirement is like that.

Create Jcl to split the input file into 10 files with each file containing 700,000 detail records and the last file containing all the remaining records. There is a header record in the input file and this needs to be copied to all the split files. If there are less number of records in the input file (less than 7 Million), some of the split files will have only the header record.
First record of the input is the header record and it's starting char is 'H'.

I need your help.

Thanks,
Rahul
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Jan 29, 2008 10:04 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. Be sure to use MOD for the OUTxx data sets.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//***>> USE MOD FOR OUTXX DATA SETS
//OUT01 DD DISP=MOD,DSN=...  output file 1
//OUT02 DD DISP=MOD,DSN=...  output file 2
...
//OUT10 DD DISP=MOD,DSN=...  output file 10
//TOOLIN   DD    *
COPY FROM(IN) USING(CTL1)
COPY FROM(IN) USING(CTL2)
/*
//CTL1CNTL DD *
  OPTION STOPAFT=1
  OUTFIL FNAMES=(OUT01,OUT02,OUT03,OUT04,OUT05,
    OUT06,OUT07,OUT08,OUT09,OUT10)
/*
//CTL2CNTL DD *
  OPTION SKIPREC=1
  OUTFIL FNAMES=(OUT01,OUT02,OUT03,OUT04,OUT05,
    OUT06,OUT07,OUT08,OUT09,OUT10),
    SPLIT1R=700000
/*
Back to top
View user's profile Send private message
rahul.banik

New User


Joined: 23 Jan 2007
Posts: 16
Location: Mysore

PostPosted: Fri Feb 08, 2008 5:39 pm
Reply with quote

Hi Frank,

I'm very sorry for the late response.Actually there was some mainframeID problem.Today I'm able to test your code.But I got return code 16,i.e. CC=0016.

Here is my job.
Code:

//S1    EXEC  PGM=ICETOOL                           
//TOOLMSG   DD  SYSOUT=*                           
//DFSMSG    DD  SYSOUT=*                           
//IN DD DSN=INPUT.TEST.FILE,DISP=SHR     
//OUT01 DD  DSN=OUTPUT.TEST1,         
//          DISP=(MOD,CATLG,DELETE),               
//          UNIT=WORK,SPACE=(TRK,(200,100),RLSE)   
//OUT02 DD  DSN=OUTPUT.TEST2,               
//          DISP=(MOD,CATLG,DELETE),               
//          UNIT=WORK,SPACE=(TRK,(200,100),RLSE)   
//OUT03 DD  DSN=OUTPUT.TEST3,                 
//          DISP=(MOD,CATLG,DELETE),               
//          UNIT=WORK,SPACE=(TRK,(200,100),RLSE)   
//OUT04 DD  DSN=OUTPUT.TEST4,                 
//          DISP=(MOD,CATLG,DELETE),               
//          UNIT=WORK,SPACE=(TRK,(200,100),RLSE)   
//TOOLIN   DD    *                                 
COPY FROM(IN) USING(CTL1)                           
COPY FROM(IN) USING(CTL2)                           
/*                                                 
//CTL1CNTL DD *                                     
  OPTION STOPAFT=1                                 
  OUTFIL FNAMES=(OUT01,OUT02,OUT03,OUT04)           
/*                                                 
//CTL2CNTL DD *                                     
  OPTION SKIPREC=1                                 
  OUTFIL FNAMES=(OUT01,OUT02,OUT03,OUT04),         
    SPLIT1R=30                                     
/*                                                 


Input file contains 100 records.

I got the following TOOLMSG

Code:
SYNCTOOL RELEASE 1.5.2 - COPYRIGHT 2004  SYNCSORT INC.                   
INITIAL PROCESSING MODE IS "STOP"                                       
"TOOLIN" INTERFACE BEING USED                                           
                                                                     
COPY FROM(IN) USING(CTL1)                                               
SYNCSORT CALLED WITH IDENTIFIER "0001"                                   
OPERATION COMPLETED WITH RETURN CODE 0                                   
                                                                     
COPY FROM(IN) USING(CTL2)                                               
SYNCSORT CALLED WITH IDENTIFIER "0002"                                   
SYNCSORT COMPLETED UNSUCCESSFULLY                                       
OPERATION COMPLETED WITH RETURN CODE 16                                 
                                                                     
PROCESSING MODE CHANGED FROM "STOP" TO "SCAN" DUE TO OPERATION FAILURE
                                                                     
SYNCTOOL PROCESSING COMPLETED WITH RETURN CODE 16                       


And from the DFSMSG I got this.
Code:
CTL2CNTL :                                       
  OPTION SKIPREC=1                               
  OUTFIL FNAMES=(OUT01,OUT02,OUT03,OUT04),       
    SPLIT1R=30                                   
    *                                           
WER428I  CALLER-PROVIDED IDENTIFIER IS "0002"
WER268A  OUTFIL STATEMENT  : SYNTAX ERROR       


I need your advice.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Feb 08, 2008 7:49 pm
Reply with quote

Hi,

You are geeting WERXXX mesaages, which means You use Synnsort. Why don't You guys state in the start of thread that which SORT product do You use, so that Franks' efforts are not 'wasted'.
Back to top
View user's profile Send private message
rahul.banik

New User


Joined: 23 Jan 2007
Posts: 16
Location: Mysore

PostPosted: Fri Feb 08, 2008 8:02 pm
Reply with quote

Hi Anuj,

Sorry,but what exact information you want?Whatever I've got from TOOLMSG and DFSMSG,I've mentioned.

Below information Only I've missed.

SYNCSORT FOR Z/OS 1.2.2.3RI
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Fri Feb 08, 2008 10:14 pm
Reply with quote

Rahul,

Your application will run fine with SyncSort for z/OS 1.3. The upgrade is free and is available for download at Use [URL] BBCode for External Links or you can request a tape.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Fri Feb 08, 2008 10:26 pm
Reply with quote

Note that the job I showed runs fine with DFSORT which has had the SPLIT1R function since April, 2006.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top