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

Mainframe dataset split


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
purushottam

New User


Joined: 26 Feb 2007
Posts: 37
Location: pune

PostPosted: Tue Aug 29, 2017 12:28 pm
Reply with quote

Hi ,

I have one Mainframe dataset say (xyz.psfile) which is having a particular sets of data , as below :-

123456789 --- header
aaaaaaaaaaaaa --- data
bbbbbbbbbbbbbbbb --- data
cccccccccccccc --- data
987654321 --- footer
123456789 --- header
aaaaaaaaaaaaa --- data
bbbbbbbbbbbbbbbb --- data
987654321 --- footer


Now this above format can be repeating any number of times in my Dataset (xyz.psfile) i.e. it is dynamic ,but with same ( header + data + footer) format .


What I need is , to run a job and split my Dataset into separate datasets with each having data from 1st header to 1st footer in one dataset ,2nd header to 2nd footer in 2nd dataset and so on.

Note :- number of headers and footers are dynamic so , we don't know how many headers and footers can come in my (xyz.psfile) .


Some one please guide me with appropriate solution using JCL .
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue Aug 29, 2017 2:19 pm
Reply with quote

You cannot do this using JCL. You can use JCL to specify a program, probaby your sort product (whichever that is), and the resiurces required by the program. But you should know that as you have been a member for 10 years. You should alos know to use the code tags when presenting data.

Have you read the document on splitting data in various ways using DFSort? If not, why not? That is your first resource.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2011
Location: USA

PostPosted: Tue Aug 29, 2017 7:07 pm
Reply with quote

purushottam wrote:
Some one please guide me with appropriate solution using JCL .

JCL solution is very simple:
Code:
//SPLIT EXEC PGM={splitter program}
//SYSPRINT DD  SYSOUT=*     printed log
//INPUT    DD  DISP=SHR,DSN={your input dataset}
//HEADER1  DD  DSN={...}
// . . . . . . . . .
//DATAONLY DD  DSN={...}
//FOOTER1  DD  DSN={...}
// . . . . . . . . .
//SYSIN    DD  *
 . . . {control statements for splitter program} . . . . . .
//*


P.S.
It is a very bad idea, to place unknown number of "headers", and "footers" into unpredicted number of datasets. It is possible to implement, but it is a stupid idea.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Tue Aug 29, 2017 10:15 pm
Reply with quote

In a JCL you have to tell how many datasets you would want as output and name those datasets.

If you want to do this dynamically then, you'll have to build your job on the go.

To do this, create a Cobol (or any other language) program, read the input dataset and write multiple output JCL statements (may be SORT as your program) and submit to Internal reader.

.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Aug 29, 2017 10:20 pm
Reply with quote

Quote:
To do this, create a Cobol (or any other language) program, read the input dataset and write multiple output JCL statements (may be SORT as your program) and submit to Internal reader.
Remember, too, that there is an upper limit to the number of DD statements you are allowed in a single job. That limit can vary by site but is no higher than 3273. Depending upon the number of data sets you want to create, you may need multiple jobs to do this.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2011
Location: USA

PostPosted: Tue Aug 29, 2017 10:31 pm
Reply with quote

RahulG31 wrote:
In a JCL you have to tell how many datasets you would want as output and name those datasets.

If you want to do this dynamically then, you'll have to build your job on the go.

To do this, create a Cobol (or any other language) program, read the input dataset and write multiple output JCL statements (may be SORT as your program) and submit to Internal reader.

It is a very, very bad idea: to place each single header record in a separate dataset. It would make sense to split the input into three datasets: all headers, all data, and all trailers.

The idea to have "one record <-> one dataset" comes from a mind "not burdened with any knowledge of data processing methods"

As I already mentioned: it can be done technically (in many ways), but it is a stupid approach from the system architecture point of view.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Tue Aug 29, 2017 11:08 pm
Reply with quote

I don't know how to do it using 'JCL', but the solution is simple using REXX.

I have done something similar this way.

Just an option, that is all.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Tue Aug 29, 2017 11:28 pm
Reply with quote

sergeyken wrote:
RahulG31 wrote:
In a JCL you have to tell how many datasets you would want as output and name those datasets.

If you want to do this dynamically then, you'll have to build your job on the go.

To do this, create a Cobol (or any other language) program, read the input dataset and write multiple output JCL statements (may be SORT as your program) and submit to Internal reader.

It is a very, very bad idea: to place each single header record in a separate dataset. It would make sense to split the input into three datasets: all headers, all data, and all trailers.

The idea to have "one record <-> one dataset" comes from a mind "not burdened with any knowledge of data processing methods"

As I already mentioned: it can be done technically (in many ways), but it is a stupid approach from the system architecture point of view.

Here is it again what TS wants:
Quote:
What I need is , to run a job and split my Dataset into separate datasets with each having data from 1st header to 1st footer in one dataset ,2nd header to 2nd footer in 2nd dataset and so on.

Nobody wants 3 datasets containing Header, data and footer. All TS wants is each Group in separate datasets.

I hope you understand by now.

I would request the moderators to delete the misleading/unnecessary posts by 'sergeyken' and clean up the thread.

.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2011
Location: USA

PostPosted: Wed Aug 30, 2017 1:47 am
Reply with quote

The whole thing resembled me an old joke:

- Why are you digging this deep hole under the tree?
- I need to do it ASAP: my teacher in mathematics requested me to find a square root within an hour!

Let's continue finding square roots under trees...
Back to top
View user's profile Send private message
purushottam

New User


Joined: 26 Feb 2007
Posts: 37
Location: pune

PostPosted: Wed Aug 30, 2017 12:15 pm
Reply with quote

The file which I have as input is containing data with different headers and trailers .

And for each set of headers and trailers , I need them to split in different datasets.


Please help me with some the solution in JCL , i tried using IEBGENER
to convert PS to PDS. But , i don't know how to use that with HEADERS and TRAILORS.


Thanks in Advance icon_smile.gif
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Aug 30, 2017 3:41 pm
Reply with quote

Creating a dataset for each group of lines is not very practical.

What about creating a member in a PDSE for each group of lines ?

That would be much better and easier.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Aug 30, 2017 4:04 pm
Reply with quote

purushottam wrote:
i tried using IEBGENER to convert PS to PDS. But , i don't know how to use that with HEADERS and TRAILERS.

Look at that:
Code:
//TEST01   EXEC PGM=IEBGENER
//SYSPRINT DD   SYSOUT=*   
//SYSUT1   DD   *           
123456789 --- HEADER 1     
AAAAAAAAAAAAA --- DATA 1   
BBBBBBBBBBBBBBBB --- DATA 1
CCCCCCCCCCCCCC --- DATA 1   
987654321 --- FOOTER 1     
123456789 --- HEADER 2     
AAAAAAAAAAAAA --- DATA 2   
BBBBBBBBBBBBBBBB --- DATA 2
987654321 --- FOOTER 2     
123456789 --- HEADER 3     
AAAAAAAAAAAAA --- DATA 3   
BBBBBBBBBBBBBBBB --- DATA 3
CCCCCCCCCCCCCC --- DATA 3   
DDDDDDDD --- DATA 3         
EEEEEEEEEEEEE --- DATA 3   
987654321 --- FOOTER 3     
123456789 --- HEADER 4     
AAAAAAAAAAAAA --- DATA 4   
BBBBBBBBBBBBBBBB --- DATA 4
CCCCCCCCCCCCCC -- DATA 4   
987654321 --- FOOTER 4                   
//SYSUT2   DD   DISP=SHR,DSN=my.existing.pdse
//SYSIN    DD   *                             
    GENERATE MAXNAME=4,MAXGPS=4 
    MEMBER NAME=MEMBER1         
GRP RECORD IDENT=(8,'98765432',1)
    MEMBER NAME=MEMBER2         
GRP RECORD IDENT=(8,'98765432',1)
    MEMBER NAME=MEMBER3         
GRP RECORD IDENT=(8,'98765432',1)
    MEMBER NAME=MEMBER4         
GRP RECORD IDENT=(8,'98765432',1)
/*

Input is no problem, it is your input dataset,
Output no problem either, it is your recipient PDSE (but must make sure members don't already exist),
SYSIN is what you have to build dynamically (I would use my sort product to do this)
Back to top
View user's profile Send private message
purushottam

New User


Joined: 26 Feb 2007
Posts: 37
Location: pune

PostPosted: Wed Aug 30, 2017 4:28 pm
Reply with quote

Marso wrote:
purushottam wrote:
i tried using IEBGENER to convert PS to PDS. But , i don't know how to use that with HEADERS and TRAILERS.

Look at that:
Code:
//TEST01   EXEC PGM=IEBGENER
//SYSPRINT DD   SYSOUT=*   
//SYSUT1   DD   *           
123456789 --- HEADER 1     
AAAAAAAAAAAAA --- DATA 1   
BBBBBBBBBBBBBBBB --- DATA 1
CCCCCCCCCCCCCC --- DATA 1   
987654321 --- FOOTER 1     
123456789 --- HEADER 2     
AAAAAAAAAAAAA --- DATA 2   
BBBBBBBBBBBBBBBB --- DATA 2
987654321 --- FOOTER 2     
123456789 --- HEADER 3     
AAAAAAAAAAAAA --- DATA 3   
BBBBBBBBBBBBBBBB --- DATA 3
CCCCCCCCCCCCCC --- DATA 3   
DDDDDDDD --- DATA 3         
EEEEEEEEEEEEE --- DATA 3   
987654321 --- FOOTER 3     
123456789 --- HEADER 4     
AAAAAAAAAAAAA --- DATA 4   
BBBBBBBBBBBBBBBB --- DATA 4
CCCCCCCCCCCCCC -- DATA 4   
987654321 --- FOOTER 4                   
//SYSUT2   DD   DISP=SHR,DSN=my.existing.pdse
//SYSIN    DD   *                             
    GENERATE MAXNAME=4,MAXGPS=4 
    MEMBER NAME=MEMBER1         
GRP RECORD IDENT=(8,'98765432',1)
    MEMBER NAME=MEMBER2         
GRP RECORD IDENT=(8,'98765432',1)
    MEMBER NAME=MEMBER3         
GRP RECORD IDENT=(8,'98765432',1)
    MEMBER NAME=MEMBER4         
GRP RECORD IDENT=(8,'98765432',1)
/*

Input is no problem, it is your input dataset,
Output no problem either, it is your recipient PDSE (but must make sure members don't already exist),
SYSIN is what you have to build dynamically (I would use my sort product to do this)

Thanks a lot icon_smile.gif

It would be really nice if you guide me with that SYSIN DD * part , which is to be dynamically generated
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Sun Sep 03, 2017 4:52 pm
Reply with quote

Guide:
1. You will have a 2 steps job: step 1 will be a SORT and step 2 will be an IEBGENER.
2. Your dataset will be input to the SORT , output will be a temporary file containing the GENERATE, RECORD and MEMBER statements.
3. in the IEBGENER step you have 2 inputs: your dataset again (as SYSUT1), and the temporary file from step 1 (as SYSIN).

4. The SORT output contains 1 GENERATE statement and a couple of lines for each group of data in your dataset.
5. Obviously, the GENERATE will be in the HEADER1 parameter.

6. Luckily for you, you do not have to give the exact numbers in MAXNAME and MAXGPS. You can try "GENERATE MAXNAME=3276,MAXGPS=2520" and it will work.
7. On the down side, you know now that there is a limit of 2520 groups of data in your input dataset.

8. You have to define you groups of data with INREC, IFTHEN and WHEN=GROUP
9. Use OUTFIL to generate the RECORD and MEMBER lines (use "/" to separate the lines)

10. search the sort forums with keywords like "WHEN=GROUP" to see some examples.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 7
No new posts Mainframe openings in Techmahnidra fo... Mainframe Jobs 0
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Allocated cylinders of a dataset DB2 12
Search our Forums:

Back to Top