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

Split records in a dataset to multiple dataset


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

New User


Joined: 01 Feb 2006
Posts: 20
Location: Chennai

PostPosted: Wed Feb 08, 2006 4:41 pm
Reply with quote

How to split records in a dataset to multiple dataset.

Say there is a input dataset with 50,000 records. I want to copy them to 5 dataset 10,000 each. (based on the count)

Could any one provide solution for this.

Thanks in advance
Vidhya
Back to top
View user's profile Send private message
Rupesh.Kothari

Member of the Month


Joined: 27 Apr 2005
Posts: 463

PostPosted: Wed Feb 08, 2006 4:51 pm
Reply with quote

Hi Vidhya

This topic already discussed in forum so may times. Please make search you will get lot of material...

Regards
Rupesh
Back to top
View user's profile Send private message
rajesh_1183

Active User


Joined: 24 Nov 2005
Posts: 121
Location: Tadepalligudem

PostPosted: Wed Feb 08, 2006 5:18 pm
Reply with quote

Hi vidhya,

try this...

//step exec pgm=sort
//sortin dd dsn=input file
//sortof1 dd dsn=file1
//sortof2 dd dsn=file2
//sortof3 dd dsn=file3
//sortof4 dd dsn=file4
//sortof5 dd dsn=file5
//sysin dd *
option copy
outfil fnames=(1,2,3,4,5),splitby=10000
/*

This might work...
corrections welcomed...

Thanks,
Rajesh
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: Wed Feb 08, 2006 9:19 pm
Reply with quote

Quote:
outfil fnames=(1,2,3,4,5),splitby=10000


Actually, that should be FILES= not FNAMES=.

Quote:
Say there is a input dataset with 50,000 records. I want to copy them to 5 dataset 10,000 each. (based on the count)


Here are two ways to do this with DFSORT:

Code:

//S1 EXEC PGM=SORT
//SORTIN DD DSN=...  input file
//OUT1 DD DSN=...    output file1
//OUT2 DD DSN=...    output file2
//OUT3 DD DSN=...    output file3
//OUT4 DD DSN=...    output file4
//OUT5 DD DSN=...    output file5
//SYSIN DD *
  OPTION COPY
  OUTFIL FNAMES=(OUT1,OUT2,OUT3,OUT4,OUT5),SPLITBY=10000
/*


Code:

//S2 EXEC PGM=SORT
//SORTIN DD DSN=...  input file
//OUT1 DD DSN=...    output file1
//OUT2 DD DSN=...    output file2
//OUT3 DD DSN=...    output file3
//OUT4 DD DSN=...    output file4
//OUT5 DD DSN=...    output file5
//SYSIN DD *
  OPTION COPY
  OUTFIL FNAMES=OUT1,ENDREC=10000
  OUTFIL FNAMES=OUT2,STARTREC=10001,ENDREC=20000
  OUTFIL FNAMES=OUT3,STARTREC=20001,ENDREC=30000
  OUTFIL FNAMES=OUT4,STARTREC=30001,ENDREC=40000
  OUTFIL FNAMES=OUT5,SAVE
/*
Back to top
View user's profile Send private message
rajesh_1183

Active User


Joined: 24 Nov 2005
Posts: 121
Location: Tadepalligudem

PostPosted: Thu Feb 09, 2006 9:42 am
Reply with quote

Hi frank..

Is that FNAMES= or FILES= ...????

becoz u have also written FNAMES=...

clarify it plz..

Thanks,
Rajesh
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: Thu Feb 09, 2006 10:00 pm
Reply with quote

Rajesh,

You can use FNAMES or FILES, but you have to use them properly to connect up with the OUTFIL ddnames.

I prefer FNAMES because it can be used with any ddnames, e.g.

Code:

//OUT1 DD DSN=...
//OUT2 DD DSN=...
...
   FNAMES=(OUT1,OUT2)


If you use FILES, then the ddname must be of the form SORTOFx or SORTOFxx and you only specify x or xx, e.g.

Code:

//SORTOF1 DD DSN=...
//SORTOF2 DD DSN=...
...
   FILES=(1,2)


In your case, you needed FILES=(1,2,3,4,5) but you had FNAMES=(1,2,3,4,5).
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top