View previous topic :: View next topic
|
Author |
Message |
husj
New User
Joined: 05 Sep 2005 Posts: 12 Location: P.R.C
|
|
|
|
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 |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
husj
New User
Joined: 05 Sep 2005 Posts: 12 Location: P.R.C
|
|
|
|
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 |
|
|
|