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

How to read records sequentially in JCL?


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

New User


Joined: 05 Sep 2005
Posts: 12
Location: P.R.C

PostPosted: Wed Jan 04, 2006 1:54 pm
Reply with quote

Hi,

Can JCL complete following function?

1. read one record in FILEA,
2. run PROGRAMA(COBOL) with the record as input,
3. run PROGRAMB(COBOL) with the record as input,
4. read next record in FILEA,
5. if at end, run PROGRAMC(COBOL).

Thanks

Jerry
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Jan 04, 2006 4:06 pm
Reply with quote

JCL by itself can't read anything. It's just CONTROL LANGUAGE. You need some utility or program to do that.

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

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Jan 04, 2006 7:07 pm
Reply with quote

I agree with ofer71's comment. JCL does not read and process records. You would need a program to handle that. I would also add that this process would make more sense to do with a program rather than a batch job.

That being said, yes, theoretically you could do this as a batch process:

1. read one record in FILEA.

You would need to, as mentioned before, use a program to accomplish this. You would obviously need to provide a value to the program, each time it is called, of which record number to start the read on. This program will also need to set a Return-Code value when the End-Of-File condition is found, to meet your requirement for Step 5. The one record should be copied to a temporary dataset for use by the subsequent steps.

2. run PROGRAMA(COBOL) with the record as input.

Yes, using the temporary dataset from Step1 as the input.

3. run PROGRAMB(COBOL) with the record as input.

Yes, same as above.

4. read next record in FILEA.

At this point, you would need to make a decision of how to continue. You could code more job steps to repeat the process of steps1-3 as needed, changing the value for the starting record each time, if there are not a substantial amount of records to process. Otherwise, you might want to submit a new job for each record to be processed, again, providing an input value to each for the record number to process.

5. if at end, run PROGRAMC(COBOL).

This would use the Return-Code value from Step1 to run only on the End-Of-File condition.
Back to top
View user's profile Send private message
husj

New User


Joined: 05 Sep 2005
Posts: 12
Location: P.R.C

PostPosted: Thu Jan 05, 2006 7:59 am
Reply with quote

Hi,superk and ofer71,

Thanks for your help.But I am not sure how to write looping statement to repeat step1 to step3 in JCL .
And how to change the value of record number to start read. I just know the SYSIN DD that used a constant for the parameter, but the record number should be a variable.

regards

Jerry
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 Error to read log with rexx CLIST & REXX 11
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Random read in ESDS file by using RBA JCL & VSAM 6
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top