Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 6968
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 Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
No new posts editting the file by inserting zeros ... pramodrsingh DFSORT/ICETOOL 9 Mon Aug 21, 2017 5:58 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us