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

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: 49
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: 1193
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

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top