IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

Dynamic file read via JCL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 184
Location: Coimbatore

PostPosted: Fri Aug 14, 2020 11:51 am
Reply with quote

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
View user's profile Send private message
Apoorva

New User


Joined: 28 Jan 2020
Posts: 47
Location: India

PostPosted: Fri Aug 14, 2020 12:07 pm
Reply with quote

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
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1097
Location: Dublin, Ireland

PostPosted: Fri Aug 14, 2020 12:49 pm
Reply with quote

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
View user's profile Send private message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 184
Location: Coimbatore

PostPosted: Fri Aug 14, 2020 3:32 pm
Reply with quote

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
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 -> JCL & VSAM

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts FILE STATUS - 39 ON VARIABLE LENGTH V... COBOL Programming 1
No new posts COBOL VS SORT Utility for file format... COBOL Programming 6
No new posts How to find which file contains my se... DFSORT/ICETOOL 6
No new posts IGZ0035S THERE WAS AN UNSUCCESSFUL OP... COBOL Programming 3
No new posts Hex Value - vb file replace old date ... DFSORT/ICETOOL 14

Back to Top