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

Splitting input file into multiple output files


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

New User


Joined: 04 Apr 2007
Posts: 38
Location: Chennai

PostPosted: Sun Oct 27, 2013 1:50 am
Reply with quote

Hello,

I want to split my input file into multiple o/p files.
Input file has thousands of records.

I want to split in to 15000 record in to one O/P1 and other 15000 to O/P2 and so on.. But before splitting the file I want to check the last record is NOT "A" at first position.

I/P contains

A 2013
1234
B 21222

-
0 11221 TOTAL AMPUNT 2110.22

A12 2013
2235
B 41222
0 1111TOTAL AMPUNT 543.22
A02 2013

My outout should be

O/P1

A 2013
1234
B 21222

-
0 11221 TOTAL AMPUNT 2110.22

O/P2

A12 2013
2235
B 41222
0 1111TOTAL AMPUNT 543.22

O/P3

A02 2013

record format - FBA
lrecl-133

Can anyone suggest me how to acheive this using sort, icetool

thanks!
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Oct 27, 2013 4:57 am
Reply with quote

Have a look here.
Back to top
View user's profile Send private message
PORYES

New User


Joined: 04 Apr 2007
Posts: 38
Location: Chennai

PostPosted: Mon Oct 28, 2013 9:14 am
Reply with quote

Hi Bill,

I'm not not clear that will satisfy my requirement.
My input has thousands of records...

For eg:
Input
A 2013
1234
B 21222
blanks
-
A 2013
1234
B 21222
o
blanks
A 2013
1234
B 21222

And want to split each out put should have 15000, while splitting It has to split the before record "A". While checking the condition the output doesn't have exactly 15000. but it should close to 15000, ie 14990 to 15100. The last output file should contain the rest of the records.. But the first record should start with "A"

Hope its clear.. Any help is appreciated..
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Oct 28, 2013 1:06 pm
Reply with quote

Well, how about becoming clear whether it will satisfy your requirement? What is it specifically which makes you think it won't?

"Split a file but keeping groups together" seems to be what you want.
Back to top
View user's profile Send private message
PORYES

New User


Joined: 04 Apr 2007
Posts: 38
Location: Chennai

PostPosted: Mon Oct 28, 2013 6:27 pm
Reply with quote

I want the first 15000 records in OUT1 but the last record shouldn't be "A" record. Next 15000 in OUT2 but the first record should be "A" record.
Back to top
View user's profile Send private message
PORYES

New User


Joined: 04 Apr 2007
Posts: 38
Location: Chennai

PostPosted: Tue Oct 29, 2013 12:02 am
Reply with quote

Ran using the sort card and I'm getting the below error.

OPTION COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,8,ZD)),
IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,5),PUSH=(144:139,4))
*
OUTFIL FILES=01,INCLUDE=(144,4,ZD,EQ,00),BUILD=(1,133)
OUTFIL FILES=02,INCLUDE=(144,4,ZD,EQ,01),BUILD=(1,133)
OUTFIL FILES=OV,SAVE,BUILD=(1,133)
WER268A INREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE

Any help
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Oct 29, 2013 12:23 am
Reply with quote

Please post the entire body of SYSOUT messages in Code tags.
Back to top
View user's profile Send private message
PORYES

New User


Joined: 04 Apr 2007
Posts: 38
Location: Chennai

PostPosted: Tue Oct 29, 2013 12:45 am
Reply with quote

Here is the entire jcl

Code:
//STEP01   EXEC PGM=SORT                           
//SYSOUT DD SYSOUT=*                               
//SORTIN DD DSN=my.dataset.name,DISP=SHR
//SORTOF01 DD SYSOUT=*                             
//SORTOF02 DD SYSOUT=*                             
//SORTOFOV DD SYSOUT=*                             
//SORTOUT DD SYSOUT=*                             
//SYSIN DD *         
//SYSIN DD *                                             
  OPTION COPY                                           
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,10,ZD)),   
        IFTHEN=(WHEN=GROUP,BEGIN=(1,5),PUSH=(144:139,4))
  OUTFIL FILES=01,INCLUDE=(144,4,ZD,EQ,00),BUILD=(1,133)
  OUTFIL FILES=02,INCLUDE=(144,4,ZD,EQ,01),BUILD=(1,133)
  OUTFIL FILES=OV,SAVE,BUILD=(1,133)   


error is
Code:
WER251A  INCLUDE/OMIT INVALID FORMAT         
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE


and the version is SYNCSORT 1.4.0.

Pls let me know if any additional details required.

Code'd
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Oct 29, 2013 6:19 am
Reply with quote

I can't see anything wrong with either of the INCLUDEs, but your BEGIN is malformed. You have taken a DFSORT KEYBEGIN and chopped off the word KEY, I think.

SyncSort doesn't have KEYBEGIN. If you need to emulate it, look at SEQNUM with RESTART=
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Oct 29, 2013 6:34 am
Reply with quote

Hi,

I think there is another error you are not showing.



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

New User


Joined: 04 Apr 2007
Posts: 38
Location: Chennai

PostPosted: Tue Oct 29, 2013 7:52 am
Reply with quote

Is there a way I can extract multiple blocks,

ie 1 st record to 15000, and check the last record before write?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Oct 29, 2013 2:56 pm
Reply with quote

Yes. You've made a start.

You make a sequence number for each record.

You make a GROUP using BEGIN= with the value "A". For this you PUSH the sequence number on to each record of the group.

You use the PUSHed sequence number in the OUTFILs for selection.

If the 15,000th is an A, all records of that group will have the PUSHed sequence number as 15000.
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 Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
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
Search our Forums:

Back to Top