I need to know if there is any way if I can pass a parameter from a COBOL program to a JCL that can be used by sub-sequent steps in the JCL. Please let me know if there is any way.
Use the RETURN-CODE specialk register (an IBM extension to the Standard). Check the JCL manual if you don't know how the JCL uses return codes.
Stephen J Spiro
This is from the IBM Language Reference Manual:
1.1.3.5 RETURN-CODE
The RETURN-CODE special register can be used to pass a return code to the calling program or operating system when the current COBOL program ends.
X When a COBOL program ends:
If control returns to the operating system, the value of the RETURN-CODE special register is passed to the operating system as a user return code. The supported user return code values are determined by the operating system, and might not include the full range of RETURN-CODE special register values.
If control returns to a calling program, the value of the RETURN-CODE special register is passed to the calling program. If the calling program is a COBOL program, the RETURN-CODE special register in the calling program is set to the value of the RETURN-CODE special register in the called program.
The RETURN-CODE special register has the implicit definition:
01 RETURN-CODE GLOBAL PICTURE S9(4) USAGE BINARY VALUE ZERO
The following are examples of how to set the RETURN-CODE special register:
Jack,
I've written JCL to the internal reader from a CICS Cobol program in order to submit a job, but I'm not sure that's what is being asked for here. Sarma99 seems to me to be wanting to submit a job, of which the 1st step is a Cobol program, and then have that job pass back information to the job, which determines what it should do next. If it is just a case of having output from the Cobol step read in to another step, then surely a dataset, temporary or otherwise, would be the solution. If another job needs to be submitted, then writing JCL to the internal reader is an excellent idea. If, however, the question that is being asked is how to influence the running job, then Stephen's idea of using the return code is the approach.
I think it's back to Sarma99 for a bit of clarification on this one......
Marc
I hear what you're saying; the ques wasn't too precise. Rather than try to guess, I provided one possible solution and left it up to Sarma to pick and choose.
Return codes is the obvious answer, but that was taken, and creating datasets even more obvious, so ....
BTW, I think we've heard the last of Sarma; I hate when that happens.
Marc - you were correct in pin-pointing the problem. I was trying to pass the data to sub-sequent steps of a job. However my problem was solved by passing the return codes to the JCL.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.