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 file with all one key records in one file..

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

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri May 08, 2009 6:18 pm    Post subject: Splitting file with all one key records in one file..
Reply with quote

Hi
I have one input file
LRECL=80,RECFM=FB
It can have maximum 10 Lac records. Below is sample
Code:

T01somedata
T01somedata
T01somedata
T02somedata
T03somedata
T04somedata
.
.
.


I have to split this file into 10 files with all one key records(pos 1 length 3) in one file.
records with 11th unique key should again get appended in to first file
records with 12th unique key should again get appended in to secod file
and so on....
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri May 08, 2009 6:30 pm    Post subject:
Reply with quote

do a search in the dfsort/icetool forum. this has been asked and answered.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri May 08, 2009 8:51 pm    Post subject:
Reply with quote

sambhaji,

Check this solution

http://ibmmainframes.com/viewtopic.php?p=180382#180382
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri May 08, 2009 10:42 pm    Post subject:
Reply with quote

Hi kolusu,
thanks for reply...

refered link is copying only one key value data in one file till tenth unique value leftover records are copied to other file...

In my case there are more than 500 unique keys..
and i want to split all data across 10 files ..

only constraint is "all records with one key value should come in only one file"
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Sat May 09, 2009 2:43 am    Post subject:
Reply with quote

Sambhaji wrote:
Hi kolusu,
thanks for reply...

refered link is copying only one key value data in one file till tenth unique value leftover records are copied to other file...

In my case there are more than 500 unique keys..
and i want to split all data across 10 files ..


only constraint is "all records with one key value should come in only one file"


Sambhaji,

The following JCL will give you the desired results. It will split every 50 unique key records into a single file and so on . Any unique key after 500 is copied to REST dd


If your input is already sorted on the key then change sort fields to COPY


Code:

//STEP0100 EXEC PGM=SORT 
//SYSOUT   DD SYSOUT=*   
//SORTIN   DD DSN=Your 80 Fb input 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=* 
//REST     DD SYSOUT=* 
//SYSIN    DD *                                                       
 SORT FIELDS=(1,3,CH,A)                                               
 OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,3))),   
 IFTHEN=(WHEN=GROUP,BEGIN=(81,8,ZD,EQ,1),PUSH=(89:ID=8)),             
 IFTHEN=(WHEN=(89,8,ZD,GT,000,AND,89,8,ZD,LE,050),OVERLAY=(97:C'01')),
 IFTHEN=(WHEN=(89,8,ZD,GT,051,AND,89,8,ZD,LE,100),OVERLAY=(97:C'02')),
 IFTHEN=(WHEN=(89,8,ZD,GT,101,AND,89,8,ZD,LE,150),OVERLAY=(97:C'03')),
 IFTHEN=(WHEN=(89,8,ZD,GT,151,AND,89,8,ZD,LE,200),OVERLAY=(97:C'04')),
 IFTHEN=(WHEN=(89,8,ZD,GT,201,AND,89,8,ZD,LE,250),OVERLAY=(97:C'05')),
 IFTHEN=(WHEN=(89,8,ZD,GT,251,AND,89,8,ZD,LE,300),OVERLAY=(97:C'06')),
 IFTHEN=(WHEN=(89,8,ZD,GT,301,AND,89,8,ZD,LE,350),OVERLAY=(97:C'07')),
 IFTHEN=(WHEN=(89,8,ZD,GT,351,AND,89,8,ZD,LE,400),OVERLAY=(97:C'08')),
 IFTHEN=(WHEN=(89,8,ZD,GT,401,AND,89,8,ZD,LE,450),OVERLAY=(97:C'09')),
 IFTHEN=(WHEN=(89,8,ZD,GT,451,AND,89,8,ZD,LE,500),OVERLAY=(97:C'10'))
                                                                     
 OUTFIL FNAMES=OUT01,BUILD=(1,80),INCLUDE=(97,2,ZD,EQ,01)             
 OUTFIL FNAMES=OUT02,BUILD=(1,80),INCLUDE=(97,2,ZD,EQ,02)             
 OUTFIL FNAMES=OUT03,BUILD=(1,80),INCLUDE=(97,2,ZD,EQ,03)             
 OUTFIL FNAMES=OUT04,BUILD=(1,80),INCLUDE=(97,2,ZD,EQ,04)             
 OUTFIL FNAMES=OUT05,BUILD=(1,80),INCLUDE=(97,2,ZD,EQ,05)             
 OUTFIL FNAMES=OUT06,BUILD=(1,80),INCLUDE=(97,2,ZD,EQ,06)             
 OUTFIL FNAMES=OUT07,BUILD=(1,80),INCLUDE=(97,2,ZD,EQ,07)             
 OUTFIL FNAMES=OUT08,BUILD=(1,80),INCLUDE=(97,2,ZD,EQ,08)             
 OUTFIL FNAMES=OUT09,BUILD=(1,80),INCLUDE=(97,2,ZD,EQ,09)             
 OUTFIL FNAMES=OUT10,BUILD=(1,80),INCLUDE=(97,2,ZD,EQ,10)             
 OUTFIL FNAMES=REST,SAVE                                             
/*
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Sat May 09, 2009 5:22 am    Post subject:
Reply with quote

Skolusu wrote:
The following JCL will give you the desired results. It will split every 50 unique key records into a single file and so on . Any unique key after 500 is copied to REST dd
Sometimes you can lead a horse to water, but not always will the horse drink.... icon_wink.gif
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 Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm


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