Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help on passing parameter from COBOL program to JCL 1

Status
Not open for further replies.

sarma99

Programmer
Jul 15, 2002
3
IN
Hi,

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.

Thanks a lot.

 
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:




COMPUTE RETURN-CODE = 8



or




MOVE 8 to RETURN-CODE.

 
Hi Sarma,

Another approach is to write a cobol pgm that writes JCL cards to a SYSOUT dataset that points to the INTRDR.

This automatically submits the JCL written by the pgm to the JES Q. It also gives you the flexibility for decision making that you're looking for.

The sysout DD stmt looks something like this:

//SYSOUT DD SYSOUT=(*,INTRDR)

HTH, Jack.
 
Sarma,

I have used Slades solution in the past and it works superb.

Greg
 
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
 
Hi Mark,

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.

Regards, Jack.
 
Thanks a lot Stephen J Spiro,

I have used your soln. It worked fine for my problem.

Regards,
Sarma.
 
Greg/Jack/Marc,

Thanks for your inputs and suggestions.

I am sure that these would help me down the line.

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.

Thanks again to every one.

Regards,
Sarma.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top