Page 1 of 1

Dynamic Splitting of files

PostPosted: Tue Mar 22, 2011 9:14 am
by ratheesh2011
Hi ,

I have a requirement as below.

My input file looks like below

line-1
line-2
line-3
$$$
line-4
line-5
$$$
line-6
line-7
line-8
line-9
$$$
line-10
line-11
line-12
$$$

I have to split this file into multiple files,
FIle-1
----------
line-1
line-2
line-3

FIle-2
----------
line-4
line-5

FIle-3
----------
line-6
line-7
line-8
line-9

FIle-4
----------
line-10
line-11
line-12

The input file can have many sets of records ( here it is 4 sets ) , it can be dynamic. The file has to be splitted by the delimiter '$$$' at the 1st 3 chars.
Please help me to get a solution for this.

Thanks
Ratheesh

Re: Dynamic Splitting of files

PostPosted: Tue Mar 22, 2011 11:04 am
by NicC
And I suppose there can be up to 2000 output files as per the topic on the other board?

Re: Dynamic Splitting of files

PostPosted: Tue Mar 22, 2011 1:17 pm
by BillyBoyo
Nah, 2000? Then read each, and know that you read once and only once, of those and do "something". Just sounds silly. You'll have to make your output more complicated to keep your later inputs manageable. Or do it on Unix/PC so we someone else has to wonder what you are doing...

Do you have a real requirement? If you explain, perhaps we can suggest something. Although perhaps we won't if you're already getting other people to look at this for you (you think!).

Re: Dynamic Splitting of files

PostPosted: Tue Mar 22, 2011 1:24 pm
by enrico-sorichetti
the topic looks dangerously like

http://ibmmainframes.com/about53891.html

Re: Dynamic Splitting of files

PostPosted: Tue Mar 22, 2011 1:44 pm
by BillyBoyo
Can I suggest the dataset names?

After your standard high-level stuff, put "HAHA.GOTYOU.STORAGE.TEAM.Vxxxxxx". Where Vxxxxxx is unique, per write if possible in SORT, and should give them a good scare that more are on the way. Make them GDGs as well.

If you want to screw up OPS instead, put them all to tape. Leave them as GDGs if you think the storage people deserve a little something.

Re: Dynamic Splitting of files

PostPosted: Tue Mar 22, 2011 10:28 pm
by Alissa Margulies
ratheesh2011 wrote:it can be dynamic. The file has to be splitted by the delimiter '$$$' at the 1st 3 chars.

SyncSort cannot dynamically generate the DD statements required for the output files.

Re: Dynamic Splitting of files

PostPosted: Wed Mar 23, 2011 3:54 am
by ratheesh2011
Thanks for your replies.
Or I want to get my input to be splitted into 2 files as below,

File-1
----------
line-1
line-2
line-3

File-2
-----------
line-4
line-5
$$$
line-6
line-7
line-8
line-9
$$$
line-10
line-11
line-12
$$$

I think we can make possible this by WHEN=GROUP. But I don't know how. Please help me to get this resolved.

Re: Dynamic Splitting of files

PostPosted: Mon Apr 04, 2011 10:24 pm
by Alissa Margulies
This will split the input into 2 files:
//SORT1  EXEC PGM=SORT
//SORTIN   DD DISP=SHR,DSN=INPUT.FILE.FB80               
//SORTOF01 DD SYSOUT=*
//SORTOF02 DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SYSIN    DD *                                                 
  INREC IFTHEN=(WHEN=GROUP,END=(1,3,CH,EQ,C'$$$'),PUSH=(81:ID=1))
  SORT FIELDS=COPY                                               
  OUTFIL FILES=01,INCLUDE=(81,1,ZD,EQ,1),BUILD=(1,80)           
  OUTFIL FILES=02,SAVE,BUILD=(1,80)                             
/*       

SORTOF01 contains the following records:
LINE-1
LINE-2
LINE-3
$$$   

SORTOF02 contains the following records:
LINE-4
LINE-5
$$$   
LINE-6
LINE-7
LINE-8
LINE-9
$$$   
LINE-10
LINE-11
LINE-12
$$$