Page 1 of 1

How to create dynamic out datasets based on i/p records?

PostPosted: Mon Nov 22, 2010 8:03 pm
by maandi
Hi,
My task is to create output datasets for each and every unique numbers present in my input file.

I have a input file which looks like this...

xxxxx 11001 xxxxxxxxxxxxxxxx
xxxxx 11002 xxxxxxxxxxxxxxxx
xxxxx 11003 xxxxxxxxxxxxxxxxx
xxxxx 11002 xxxxxxxxxxxxxxxxx

In this i have to dynamically create corresponding datasets for the unique numbers mentioned above.

for eg:
records which is having no as 11001 should be in one output dataset
records which are having 11002(here 2 records are there) should be in another out dataset...

The same scenario should continue for N no of records.... (in my case its max of 25)
Note: every time my unique numbers might change according to the input.... so i cant cross reference this with any hard coded data also.

I have no idea how far this can be done through JCL or cobol.
Thanks,
Maandi...

Re: How to create dynamic out datasets based on i/p records?

PostPosted: Mon Nov 22, 2010 8:53 pm
by NicC
You cannot do it with 'JCL' - that is not what JCL is about. Your best bet is probably to to look at the DFSORT tricks PDF and study the various ways a file may be split using DFSORT

Re: How to create dynamic out datasets based on i/p records?

PostPosted: Mon Nov 22, 2010 11:41 pm
by MrSpock
Maandi, I concur with reviewing the DFSORT Smart Tricks document and reviewing the SPLIT or SPLITBY functions. However, you haven't provided a crucial detail. How do you intend to deal with the required DD statements? Are you going to code 25 unique DD statements and datasets in the JCL? Are you passing the data through the process first to determine how many DD's and datasets will be required? Will you be generating some sort of dynamic JCL to be submitted to the JES Internal Reader, or will it be written to a dataset to be used by a subsequent job?

Re: How to create dynamic out datasets based on i/p records?

PostPosted: Tue Nov 23, 2010 1:12 am
by dick scherrer
Hello and welcome to the forum,

Actually splitting the file in cobol is fairly trivial. Managing the output datasets might not be. . .

How is the output to be used? Will these split files survive beyond their next use?

Why is there a need to create multiple files - why not sort the original file in the order needed for the subsequent processing?

Re: How to create dynamic out datasets based on i/p records?

PostPosted: Tue Nov 23, 2010 2:42 pm
by maandi
Hi All,

Thanks for the your suggestions. DFSORT tricks PDF might be useful for me..

Actually the process goes like this.... i will get the customer file individually from the front end in CSV format... Say for e.g. i get 'N' no of customer files (each customer file will have no of records)... those files will be converted and merged into single flat file and it will processed...
After processing i need to separate it and create the same 'N' no of outputs according to the customer no... say one PS file for one customer. These N no of PS files will be converted to their corresponding CSV formats and will be send back to front end.

Are you passing the data through the process first to determine how many DD's and datasets will be required?
Yes. First i need to determine the no of o/p datasets to be created based on the no of input files i get.

How is the output to be used? Will these split files survive beyond their next use?
The output will be converted to CSV formats individually and will be sent to front end server.

Thanks,
Maandi