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

Splitiing the file into 10 equal parts.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nareshkareti

New User


Joined: 22 Jul 2008
Posts: 33
Location: Chennai

PostPosted: Tue Mar 10, 2009 12:19 pm
Reply with quote

Here is my req..

I have an input file in which the data might always change.It has some millions of records and i want that file to be splitted into 10 equal parts.
Can we achieve that in a jcl with sort steps...

Please help.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Mar 10, 2009 12:25 pm
Reply with quote

Have you searched the forum, because this has been asked and answered before.

Please search before posting !!!
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Wed Mar 11, 2009 1:23 am
Reply with quote

Naresh,

Here is a sample SORT application:

Code:
//S1     EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=input.file,...
//SORTOF01 DD DSN=output.file1,...
   .
   .
   .
//SORTOF10 DD DSN=output.file10,...
//SYSIN    DD *
  SORT FIELDS=COPY
  OUTFIL FILES=(01,02,03,04,05,06,07,08,09,10),SPLIT
/*


Hope this helps.
Back to top
View user's profile Send private message
nareshkareti

New User


Joined: 22 Jul 2008
Posts: 33
Location: Chennai

PostPosted: Thu Mar 12, 2009 1:12 pm
Reply with quote

Thanks for the above solution...It is not giving me the reqd output..

I will explain my req with an example..
Consider my input is having 10001 records..i wanted to split into 10 files.So i want first 1000 in file1, next 1000 in file2.........and last 1001 in file10.

If the count is exactly divisible by 10..i can use spliyby...but that is not the case for me...

The record count in the input file always varies and may not be divisible by 10...
Back to top
View user's profile Send private message
nareshkareti

New User


Joined: 22 Jul 2008
Posts: 33
Location: Chennai

PostPosted: Thu Mar 12, 2009 3:00 pm
Reply with quote

i will give few more details on my req...

1.i have to get the record count of the input file
2.divide that by 10
3.give the quotient to the other step where we use SPLITBY function..

can we achieve this in a jcl with 1 r more sort steps..
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Mar 12, 2009 7:43 pm
Reply with quote

Hello,

Did you run the code Alissa provided?

If not, do so now and post back here what happens and if there is some reason this will not work for your requirement.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Thu Mar 12, 2009 9:02 pm
Reply with quote

Dick,

I believe Naresh is saying that the "round-robin" technique of SPLIT is not what they need, but rather consecutive chunks of records in each OUTFIL...
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Mar 12, 2009 9:19 pm
Reply with quote

Hi Alissa,

Yup, you're probably right on - sorry 'bout that. . .
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 Mar 12, 2009 9:39 pm
Reply with quote

Naresh,

You can use the technique shown in the "Split a file to n output files dynamically" Smart DFSORT Trick at:

Use [URL] BBCode for External Links

Note that SPLIT1R is a better choice than SPLITBY.
Back to top
View user's profile Send private message
nareshkareti

New User


Joined: 22 Jul 2008
Posts: 33
Location: Chennai

PostPosted: Fri Mar 13, 2009 11:12 am
Reply with quote

I have searched the forum and built a code according to my req...but giving some error..can anyone pls solve that..

1. i am creating a file with the following string and value generated dynamically.
Code:
SORT FIELDS=COPY                                             
OUTREC FIELDS=(C'  SPLIT1R=',1,15,ZD,DIV,+10,M11,LENGTH=15)
2. I am giving the above generated file in the following step..
Code:
//SYSIN    DD  *                               
  SORT FIELDS=COPY                             
  OUTFIL FILES=(01,02,03,04,05,06,07,08,09,10),
//         DD DSN=TEST.CNTL.CARD.COUNT,     
//            DISP=SHR                         
/* 

the error in the sysout is as follows
Code:
SYSIN :                                         
  SORT FIELDS=COPY                             
  OUTFIL FILES=(01,02,03,04,05,06,07,08,09,10),
    SPLIT1R=000000000001000                     
WER274A  CONTINUATION STATEMENT ERROR FOUND     
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE



Edited: Please use BBcode when You post some code/error, that's rather readable, Thanks... Anuj
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Mar 13, 2009 12:59 pm
Reply with quote

nareshkareti,

SPLIT1R is Supported only by SyncSort 1.3 or later. Are you running an older version?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Mar 13, 2009 1:19 pm
Reply with quote

Hi,

if SPLIT1R is not supported, it would generate
Code:
WER274A  CONTINUATION STATEMENT ERROR FOUND


is there non blank values before SPLIT1R ?

Gerry
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Mar 13, 2009 1:22 pm
Reply with quote

oops it should have said if SPLIT1R is not supported, it would not generate
Code:
WER274A  CONTINUATION STATEMENT ERROR FOUND


Gerry
Back to top
View user's profile Send private message
nareshkareti

New User


Joined: 22 Jul 2008
Posts: 33
Location: Chennai

PostPosted: Fri Mar 13, 2009 3:33 pm
Reply with quote

I am using SYNCSORT FOR Z/OS 1.3.1.0N

The string in the cntl card file looks like this
Code:
----+----1----+----2----+--

    SPLIT1R=000000000001000
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Mar 13, 2009 5:06 pm
Reply with quote

Hi,

have you checked with HEX ON to see if the first 4 bytes are blank.

Also
Code:
OUTREC FIELDS=(C'  SPLIT1R=',1,15,ZD,DIV,+10,M11,LENGTH=15)
shows 2 spaces before SPLIT1R, yet
Code:
----+----1----+----2----+--

    SPLIT1R=000000000001000
shows 4 spaces.

Gerry
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Mar 13, 2009 5:33 pm
Reply with quote

Naresh,

The SYSIN control card is supposed to have an LRECL=80. Hence change your sort card in step1 to this,
Code:
OUTREC FIELDS=(C'  SPLIT1R=',1,15,ZD,DIV,+10,M11,LENGTH=15,80:X)
Back to top
View user's profile Send private message
nareshkareti

New User


Joined: 22 Jul 2008
Posts: 33
Location: Chennai

PostPosted: Fri Mar 13, 2009 7:13 pm
Reply with quote

Thank u very much Arun...
I made the lrecl of the cntl file as 80 and made the values after the string as spaces and it worked...

Here is how i built the cntl card
Code:
SORT FIELDS=COPY                                               
OUTREC FIELDS=(C'  SPLIT1R=',1,15,ZD,DIV,+10,M11,LENGTH=15,26:X)
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Mar 13, 2009 9:39 pm
Reply with quote

Naresh,

You're welcome. Glad that it worked for you. icon_smile.gif

But it should have been 80:X instead of 26:X
Back to top
View user's profile Send private message
nareshkareti

New User


Joined: 22 Jul 2008
Posts: 33
Location: Chennai

PostPosted: Sun Mar 15, 2009 4:59 pm
Reply with quote

Arun,

Could you please tell me why it should be 80:X...as the first 25 places are occupied by the string..
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Sun Mar 15, 2009 8:48 pm
Reply with quote

Hi,

What LRECL do you expect for the outputs?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon Mar 16, 2009 5:05 am
Reply with quote

Hi Naresh,

Quote:
Could you please tell me why it should be 80:X...as the first 25 places are occupied by the string..



80:X - increases the record length of the output record to 80 padded with blanks.


Gerry
Back to top
View user's profile Send private message
sudhir1507

New User


Joined: 10 Nov 2009
Posts: 4
Location: India

PostPosted: Tue Nov 24, 2009 1:23 pm
Reply with quote

use this Jcl

OPTION COPY
OUTFIL FNAMES=SORTOUT4,ENDREC=1000
OUTFIL FNAMES=SORTOUT5,STARTREC=1001,ENDREC=2000
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Nov 24, 2009 2:40 pm
Reply with quote

Will this really give what had been asked...nearly 8 months back?
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
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
Search our Forums:

Back to Top