Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : When you specified V for RECFM parameter, LRECL value is largest record in the file plus 4 bytes. These four bytes contain the actual length of each variable length record in the file

Google
 
Web mainframegurukul.com

Split an input file into n output file dynamically
Goto page 1, 2  Next
 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities
  View previous topic :: View next topic  
Author Message
sharmi
Member


Joined: 17 Jul 2013
Posts: 13

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Jul 17, 2013 3:46 pm    Post subject: Split an input file into n output file dynamically Reply with quote

Hi,
I have an input file with 21 million records.I need to split these records by 10 million records in each output file.
I have already read the posts related to this query and it worked fine.
But i need to create output file dynamically.
Ex:
If input = 21 million records,
1st output file = 10 million
2nd output file = 10 million
3rd output file = 1 million
If input = 20 million records,
1st output file = 10 million
2nd output file = 10 million
Only 2 files are created here.
And my output file naming convention is like
psa.prod.output.cyc01
psa.prod.output.cyc02
When the output file is created the file name should be cyc03,cyc04,etc..
Note:
1.The number of records in input file is unknown.
2.The number of ouput files to be created is unknown.


Thanks.
Back to top
View user's profile Send private message Send e-mail
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

sharmi
Member


Joined: 17 Jul 2013
Posts: 13

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Jul 23, 2013 5:06 pm    Post subject: Reply with quote

HI,
I have tried my requirement in the following way,
JCL:
1)chk whether my inp file is empty or not
2)If not empty, exec cobol pgm
COBOL:
1)open input file
2)read first record
3)perform dynamic allocation para
4)where i will move my value to the sub program
5)if allocation is success
open output file
6)increment counter by 1
7)chk if record count is < limit
8)If yes read second record.
9)If no,perform dynamic allocation para again.
Back to top
View user's profile Send private message Send e-mail
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
sharmi
Member


Joined: 17 Jul 2013
Posts: 13

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Jul 23, 2013 5:47 pm    Post subject: Reply with quote

HI,
But i got the following error while executing the jcl
ENTERING PROCEDURE DIVISION
===== START OF PROGRAM - SAPSPL =====
ENTERING 00100-OPEN-INPUT-FILE.
EXITING 00100-OPEN-INPUT-FILE-EXIT.
ENTERING 00500-MAIN-PROCESS-PARA.
ENTERING 00600-READ-UNLD-FILE.
EXITING 00600-READ-UNLD-FILE-EXIT.
ENTERING 00700-OPEN-SPLIT-FILE-PARA.
CEE3203S The system detected an execute exception (System Completion Code=0C3). From compile unit SAPSPL at entry point SAPSPL at statement 491 at compile unit offset +00000EE2 at entry offset +00000EE2 at address 26200EE2.
491:
CALL WS77-DNALLOC-PGM USING DYNALLOC-PARMS
Can anyone guide me in this abend
Thanks,
Sharmi
Back to top
View user's profile Send private message Send e-mail
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
DikDude
Moderator


Joined: 22 Jul 2011
Posts: 1001
Location: usa

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Jul 24, 2013 12:29 am    Post subject: Reply with quote

We will have trouble helping you with what you have posted. . .

Suggest you set this program aside and write a tiny program that only allocates a file dynamically.

If that fails, post the code and the failure. Someone should be able to clarify.

Once the dynamic allocation works correctly, write 1 record, clost that file, and open a second file dynamically. Write 1 reord to the second file.

Once this works, go back to the actual program.
_________________
Have a good one
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
William Collins
Active Member


Joined: 24 May 2012
Posts: 732

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Jul 24, 2013 2:14 am    Post subject: Reply with quote

Have you considered SPLITBY or SPLIT1R with SORT. Define more OUTFILs that you need, and delete the datasets which contain no data.

S0C3. I've never seen that one....
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
DikDude
Moderator


Joined: 22 Jul 2011
Posts: 1001
Location: usa

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Jul 24, 2013 2:28 am    Post subject: Reply with quote

The SPLIT wanted is:
If input = 21 million records,
1st output file = 10 million
2nd output file = 10 million
3rd output file = 1 million
rather than 3 files of 7 million each.

I'd like to see the diagnostic info from the abend. . .
_________________
Have a good one
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
William Collins
Active Member


Joined: 24 May 2012
Posts: 732

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Jul 24, 2013 4:17 am    Post subject: Reply with quote

Quote:
Example 6
OPTION COPY
OUTFIL FNAMES=(A1,A2,A3),SPLIT
OUTFIL FNAMES=(B1,B2,B3),SPLITBY=25
OUTFIL FNAMES=(C1,C2,C3),SPLIT1R=25
This example illustrates different ways to split 77 input records among three
OUTFIL data sets.
The first OUTFIL statement uses SPLIT to rotate the records among the three
OUTFIL data sets one record at a time. A1 will have records 1, 4, ...,76. A2 will
have records 2, 5, ...,77. A3 will have records 3, 6, ...,75. A1 will have 26 records. A2
will have 26 records. A3 will have 25 records. A1, A2 and A3 will each have
non-contiguous records.
The second OUTFIL statement uses SPLITBY=25 to rotate the records among the
three OUTFIL data sets 25 records at a time. B1 will have records 1-25 and 76-77.
B2 will have records 26-50. B3 will have records 51-75. B1 will have 27 records. B2
will have 25 records. B3 will have 25 records. B1 will have non-contiguous records.
B2 and B3 will have contiguous records.
The third OUTFIL statement uses SPLIT1R=25 to rotate the records once among the
three OUTFIL data sets 25 records at a time. C1 will have records 1-25. C2 will
have records 26-50. C3 will have records 51-77. C1 will have 25 records. C2 will
have 25 records. C3 will have 27 records. C1, C2 and C3 will have contiguous
records.


SPLIT will get the 7m per.

SPLITBY=10000000 will get 10m, 10m, 1m
SPLIT1=10000000 will get 10m, 10m, 1m

The difference between SPLITBY and SPLIT1 is where any surplus goes. If enough OUTILs are specified to ensure no surplus, then they will be the same. Output datasets with no data can be deleted, ADRDSSU for instance.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
sharmi
Member


Joined: 17 Jul 2013
Posts: 13

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Jul 24, 2013 5:51 pm    Post subject: Reply with quote

Thank you all for your replies.
Sorry for late reply..
Hi DikDude,
I face problem while allocating file dynamically.I am calling a utility specific in CTS..Whenever it hits CALL statement it is getting abended with S0C3.. Crying or Very sad
Hi William Collins,
I tried using split1R..But my lead doesn't want files to be created and deleted unneccesarily

Thanks in advance
Back to top
View user's profile Send private message Send e-mail
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
William Collins
Active Member


Joined: 24 May 2012
Posts: 732

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Jul 24, 2013 11:29 pm    Post subject: Reply with quote

Smile

Your lead would prefer you to spend time writing programs (which don't work yet) than using a standard utility.

If you know the number of records that are on the file, from earlier processing, then you can use that information to generate the JCL and Control Cards. I guess you can't use the INTRDR either.

If the problem with creating/deleting is the tying-up of DASD during the step, you could specify a nominal amount for the primary SPACE, and use the secondary, as though it were the primary, for the actual allocation.

SORT IO is going to be much faster than IO in a COBOL program. Client pays, I suppose.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
sharmi
Member


Joined: 17 Jul 2013
Posts: 13

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Jul 25, 2013 9:45 am    Post subject: Reply with quote

Ya...You are right..Almost my requirement is complete by using splitby but with small problem..Files which i mention in outfil need not be created unless records are going to be written in it..But they are getting created..
Is there any way to avoid this..

Thanks a lot..
Back to top
View user's profile Send private message Send e-mail
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
DikDude
Moderator


Joined: 22 Jul 2011
Posts: 1001
Location: usa

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Jul 26, 2013 12:50 am    Post subject: Reply with quote

What is CTS? What utility is being called?

Is there some reason no one is willing (or able) to get the dynamic allocation for a single file working? Is there no technical support?

The files are being created because the JCL says to create them. . . ?

Obviously, i am missing something . . . Confused
_________________
Have a good one
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
sharmi
Member


Joined: 17 Jul 2013
Posts: 13

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Jul 30, 2013 11:46 am    Post subject: Reply with quote

DikDude wrote:
Once the dynamic allocation works correctly, write 1 record, clost that file, and open a second file dynamically. Write 1 reord to the second file.

Once this works, go back to the actual program.


This is the method i followed and it is working very fine...
Thanks a lottt...
Back to top
View user's profile Send private message Send e-mail
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
DikDude
Moderator


Joined: 22 Jul 2011
Posts: 1001
Location: usa

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Jul 31, 2013 1:29 am    Post subject: Reply with quote

Good to hear it is working! Thanks for the update Smile

dd
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
sharmi
Member


Joined: 17 Jul 2013
Posts: 13

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Aug 14, 2013 12:07 pm    Post subject: Reply with quote

Hi DikDude,
One more requirement to add with this..
As i said I need to split records based on the count 10 million..To add with that,
If the first 3 fields of my input say,

9999999 th record- 1 sharmi cse
1000000 th record- 1 sharmi cse
10000001 th record- 1 sharmi cse

are same then i need to write all these 3 records in my second output file. It is not fixed that only 3 records will be same.It might be any number of number of records which are same.

Please help me in this..Let me know if it is possible to do this..


Thanks a lot in advance.
Back to top
View user's profile Send private message Send e-mail
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
William Collins
Active Member


Joined: 24 May 2012
Posts: 732

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Aug 14, 2013 1:57 pm    Post subject: Reply with quote

Of course it is possible. Save the key of th 10,000,000th (or whatever) record, and keep writing to that output file when the key is equal to the saved key.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities All times are GMT + 5 Hours
Goto page 1, 2  Next
Page 1 of 2



 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-7166.html