View previous topic :: View next topic
|
Author |
Message |
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
Hi All,
Need a help to the perform the below requirement.
1. I have an input file like the one below,
Code: |
jobcode dataset
A H1279CN.DATASET1
B H1279CN.DATASET1
A H1279CN.DATASET2
A H1279CN.DATASET3
C H1279CN.DATASET1
|
2. I need to read through the above file, open the dataset, fetch the trailer record from that file and write it in another output file.
Ex: For Jobcode A - fetch H1279CN.DATASET1 and get the trailer record, then go for H1279CN.DATASET2 and so on.
Once jobcode A is done, need to go for jobcode B & C, likewise till the end of input file.
Can you please let me know if this can achieved via JCL ?. |
|
Back to top |
|
|
Apoorva
New User
Joined: 28 Jan 2020 Posts: 49 Location: India
|
|
|
|
abdulrafi wrote: |
Hi All,
Need a help to the perform the below requirement.
1. I have an input file like the one below,
Code: |
jobcode dataset
A H1279CN.DATASET1
B H1279CN.DATASET1
A H1279CN.DATASET2
A H1279CN.DATASET3
C H1279CN.DATASET1
|
2. I need to read through the above file, open the dataset, fetch the trailer record from that file and write it in another output file.
Ex: For Jobcode A - fetch H1279CN.DATASET1 and get the trailer record, then go for H1279CN.DATASET2 and so on.
Once jobcode A is done, need to go for jobcode B & C, likewise till the end of input file.
Can you please let me know if this can achieved via JCL ?. |
This can't be achieved just by using JCL. You need to use either COBOL or REXX to do this. You need to first read the main dataset, and then dynamically allocate H1279.* datasets to read them. If you choose to use COBOL then you could use BPXWDYN interface to dynamically allocate H1279 datasets. |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
When you say "write it in another output file", are all the trailers written to the same output dataset?
Do the trailer records have a common identifier?
If both, then you could use your SORT product to extract the trailers to the output dataset.
If output is to different datasets, you could run separate SORTs (which could be dynamically invoked from, say, REXX).
Garry |
|
Back to top |
|
|
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
Garry - But I would need to loop through the input file (where the actual dataset name is present which I need to open). I have to open this dataset and then read the data. Will I be able to do it in JCL ?. |
|
Back to top |
|
|
|