Posted: Mon Oct 27, 2025 6:35 am Post subject: Splitting file on the basis of different keywords
Hi Team,
I have query related to sort card.
We have one input file having different record types as below.
Code:
##header1
##file name
01 abc type 0011
02 dataline1
03 dataline2
10end of file
##header2
##file name
01 abc type 0022
02 dataline1
03 dataline2
10end of file
##header3
##file name
01 abc type 0011
02 dataline1
03 dataline2
10end of file
##header4
##file name
01 abc type 0033
02 dataline1
03 dataline2
10end of file
I want to split the file into 3 different files on the basis of different type(third rec of 4 bytes under each header, rec starting with '01' and field position is 13 i.e. 0011/0022/0033) under the ##Header1/2/3/...
The rec starts from ##Header and ends at 10end of file.
For ex: the output files should look like below:
First file :
Code:
##header1
##file name
01 abc type 0011
02 dataline1
03 dataline2
10end of file
##header3
##file name
01 abc type 0011
02 dataline1
03 dataline2
10end of file
Second file :
Code:
##header2
##file name
01 abc type 0022
02 dataline1
03 dataline2
10end of file
Third File:
Code:
##header3
##file name
01 abc type 0011
02 dataline1
03 dataline2
10end of file
The record seq should be same as input file. Could you please help me out on this. We are not able to achieve it in one step.
Joined: 26 Nov 2002 Posts: 12394 Topics: 75 Location: San Jose
Posted: Mon Oct 27, 2025 9:12 am Post subject:
Srishti Rawat,
You have been a member of this site for quite some time and yet you failed to provide the basic information such as the DCB properties of the input file.
Assuming your input has RECFM=FB and LRECL=80 and every group has '01' record, the following untested DFSORT JCL will give you the desired results.
Thanks a lot Kolusu. My bad I forgot to mention the file length. But this was good.
Just that, my input file is a volume file having around 50-60 million recs. So is there any way we can achieve the same solution in one step as above without using join keys.
Joined: 26 Nov 2002 Posts: 12394 Topics: 75 Location: San Jose
Posted: Wed Oct 29, 2025 1:05 am Post subject:
Srishti Rawat wrote:
Thanks a lot Kolusu. My bad I forgot to mention the file length. But this was good.
Srishti Rawat
And once again you forgot the DCB properties.
Srishti Rawat wrote:
Just that, my input file is a volume file having around 50-60 million recs. So is there any way we can achieve the same solution in one step as above without using join keys.
Srishti Rawat
huh? One step ? The solution above is indeed one step ? so what exactly is 1 step in your opinion ? Looks like I have some learning to do _________________ Kolusu
www.linkedin.com/in/kolusu
I meant same as the solution you have given in one step. Similarly can we have without join keys since the input file is too big.
I think my statement was not clear.
And you are a pro Kolusu, I am already so thankful for your help since years. I dont think there is anything you can learn from me or I can tell you which you dont know in DFSORT
Joined: 26 Nov 2002 Posts: 12394 Topics: 75 Location: San Jose
Posted: Wed Oct 29, 2025 4:19 am Post subject:
Srishti Rawat wrote:
I meant same as the solution you have given in one step. Similarly can we have without join keys since the input file is too big.
Srishti Rawat,
You do realize that JNF2 task is ONLY reading 1 record per group and it is a COPY operations for both tasks.
Srishti Rawat wrote:
I think my statement was not clear.
Indeed you keep on insisting on another solution and yet you fail to provide the important information. DCB properties of the input file.
Depending on DCB, you can
1. Push the header record( record # 1) to end of all the records in the group at the end. If the file is VB, then you need to change as you want to retain the variable record.
2. Push the 2nd record after the first record to all records in the group.
3. On OUTFIL omit the first 2 records and then use "/' to build the 2 records from the end that you pushed.
I highly doubt this will as efficient as the JOINKEYS solution.
Srishti Rawat wrote:
And you are a pro Kolusu, I am already so thankful for your help since years. I dont think there is anything you can learn from me or I can tell you which you dont know in DFSORT
There is always room to learn and am willing to learn that will be helpful in the long run. _________________ Kolusu
www.linkedin.com/in/kolusu
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