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

Split One file into 10 files based on Dynamic control card


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
GOWTHAM PAINENI

New User


Joined: 16 Aug 2011
Posts: 7
Location: USA

PostPosted: Tue Aug 16, 2011 4:22 am
Reply with quote

Hi,
I need to split my INPUT file (say FILE1) into 10 different files (FILE2, FILE3.. FILE10) based on the KEY (of 9 characters) , which comes as an input at 1st position of every record. This KEY is dynamic.

eg:-
INPUT:- FILE1 of LRECL 500 & RECFM=FB & below is the sample data format...

111111111Alhgdlhgldhldhgdhlh9
111111111Blhgdlhgldhldhgdhlh9
222222222Adlghdlghdhgdlghd00
222222222Bdlghdlghdhgdlghd00
333333333Bbbklbdkbddhldhdl99
333333333Cbbklbdkbddhldhdl99
444444444Ddhdlhepueup-22ww
444444444Edhdlhepueup-22ww
........
.........
999999999Gbbbbljjs[wjjsjfsjfa
101010101Abbbbbljjs[wjjsjfsjfa
101010101Bbbbbbljjs[wjjsjfsjfa

OUT PUT:- I need to have 10 different files of same RECFM= FB, LRECL= 500.

FILE2:
111111111Alhgdlhgldhldhgdhlh9
111111111Blhgdlhgldhldhgdhlh9

FILE3:
222222222Adlghdlghdhgdlghd00
222222222Bdlghdlghdhgdlghd00

FILE4:
333333333Bbbklbdkbddhldhdl99
333333333Cbbklbdkbddhldhdl99

FILE5:
444444444Ddhdlhepueup-22ww
444444444Edhdlhepueup-22ww

FILE6:
.....
......

FILE9:
999999999Gbbbbljjs[wjjsjfsjfa
FILE10:
101010101Abbbbbljjs[wjjsjfsjfa
101010101Bbbbbbljjs[wjjsjfsjfa

NOTEs:

1) Input file is in SORTED order of the KEY (Position 1-9)
2) The KEY is Dynamic, it can be of any value in the input file based on the input data.
3) The max. no.of. UNIQUE Values in this key filed will be of 10.
4) Always the total no.of. OUTPUT files needs to be '10', of fixed DD DSN names.
5) Even if there are only 1 UNIQUE key in the input file, all the records in the input file should goto FILE2 & the remaining 9 output files needs to be created as EMPTY files.

I wanted to get this done using DFSORT/ICETOOL.. I couldn't find any similar post that gives me the results that I'm looking for... can some one help me with this pls... ?

The sample control card that I'm looking for is mentioned below, OR, it can be some other format that gives me desired result...
SYSIN DD * (or it can be in a file)
OPTION COPY
OUTFIL FILES=1,INCLUDE=(01,09,CH,EQ,C'111111111')
OUTFIL FILES=2,INCLUDE=(01,09,CH,EQ,C'222222222')
OUTFIL FILES=3,INCLUDE=(01,09,CH,EQ,C'333333333')
......
......
OUTFIL FILES=9,INCLUDE=(01,09,CH,EQ,C'999999999')
OUTFIL FILES=10,INCLUDE=(01,09,CH,EQ,C'1010101010')
/*

Thanks,
Gowtham
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Aug 16, 2011 4:45 am
Reply with quote

GOWTHAM PAINENI,


use the following DFSORT JCL which will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT 
//SYSOUT   DD SYSOUT=*   
//SORTIN   DD DSN=Your input file Fb 500 byte file,DISP=SHR
//OUT01    DD SYSOUT=*                                         
//OUT02    DD SYSOUT=*                                         
//OUT03    DD SYSOUT=*                                         
//OUT04    DD SYSOUT=*                                         
//OUT05    DD SYSOUT=*                                         
//OUT06    DD SYSOUT=*                                         
//OUT07    DD SYSOUT=*                                         
//OUT08    DD SYSOUT=*                                         
//OUT09    DD SYSOUT=*                                         
//OUT10    DD SYSOUT=*                                         
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                             
  OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,9),PUSH=(501:ID=2))   
  OUTFIL FNAMES=OUT01,BUILD=(1,500),INCLUDE=(501,2,ZD,EQ,01)   
  OUTFIL FNAMES=OUT02,BUILD=(1,500),INCLUDE=(501,2,ZD,EQ,02)   
  OUTFIL FNAMES=OUT03,BUILD=(1,500),INCLUDE=(501,2,ZD,EQ,03)   
  OUTFIL FNAMES=OUT04,BUILD=(1,500),INCLUDE=(501,2,ZD,EQ,04)   
  OUTFIL FNAMES=OUT05,BUILD=(1,500),INCLUDE=(501,2,ZD,EQ,05)   
  OUTFIL FNAMES=OUT06,BUILD=(1,500),INCLUDE=(501,2,ZD,EQ,06)   
  OUTFIL FNAMES=OUT07,BUILD=(1,500),INCLUDE=(501,2,ZD,EQ,07)   
  OUTFIL FNAMES=OUT08,BUILD=(1,500),INCLUDE=(501,2,ZD,EQ,08)   
  OUTFIL FNAMES=OUT09,BUILD=(1,500),INCLUDE=(501,2,ZD,EQ,09)   
  OUTFIL FNAMES=OUT10,BUILD=(1,500),INCLUDE=(501,2,ZD,EQ,10)   
//*
Back to top
View user's profile Send private message
GOWTHAM PAINENI

New User


Joined: 16 Aug 2011
Posts: 7
Location: USA

PostPosted: Tue Aug 16, 2011 5:39 am
Reply with quote

Thank you Kolusu !! The above JCL giving me exactly what I need, Thank you !!
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
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
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top