Page 1 of 2

Can we submit a JCL and get the return code in COBOL?

PostPosted: Mon Mar 18, 2013 12:21 pm
by Kevin Q M Cai
Hello Guys,

Can we launch a JCL in COBOL?
if you have any ideas, please don't hesitate to let me know.

Many thanks all

Re: Can we submit a JCL and get the return code in COBOL?

PostPosted: Mon Mar 18, 2013 12:26 pm
by enrico-sorichetti
the issue has been debated quite a few times
did You search the forum ???

anyway
submit a JCL... YES
get the return code ... NO

and, last but not least
do not try to write Your own scheduling system

Re: Can we submit a JCL and get the return code in COBOL?

PostPosted: Mon Mar 18, 2013 12:42 pm
by Kevin Q M Cai
Dear Enrico,
about how to submit JCL in cobol, could you give something such as tutorial or example? thanks
and about "do not try to write Your own scheduling system", could you explain that in detail, I am sorry,
I am a newcomer for this, many things I need to learn.

Regards
Kevin

Re: Can we submit a JCL and get the return code in COBOL?

PostPosted: Mon Mar 18, 2013 12:44 pm
by enrico-sorichetti
for what reason would You want to know the <return code> of a jcl You submitted ???

Re: Can we submit a JCL and get the return code in COBOL?

PostPosted: Mon Mar 18, 2013 1:30 pm
by Kevin Q M Cai
If the submitted job returns right code, then some statements need to be executed, else they will be ignored,
and about how to submit a JCL in COBOL , could you advise me something.

Thanks a lot
Kevin

Re: Can we submit a JCL and get the return code in COBOL?

PostPosted: Mon Mar 18, 2013 1:30 pm
by Kevin Q M Cai
If the submitted job returns right code, then some statements need to be executed, else they will be ignored,
and about how to submit a JCL in COBOL , could you advise me something.

Thanks a lot
Kevin

Re: Can we submit a JCL and get the return code in COBOL?

PostPosted: Mon Mar 18, 2013 1:37 pm
by enrico-sorichetti
what is that it was not clear when I replied ...
get the return code ... NO


it would be more productive to sit down with the <person> who set the requirement
before wasting time asking on how to do something that cannot be done

Re: Can we submit a JCL and get the return code in COBOL?

PostPosted: Mon Mar 18, 2013 1:49 pm
by NicC
It seems a strange request to "Launch a JCL in COBOL". One assumes that you mean "submit". Why in COBOL? Why not using Rexx which is the more favoured approach should such a thing NEED to be done. IEBGENER will also work as will the TSO SUBMIT comman - either in foreground or in batch. Whichever way there are examples on the forum which you can find yourself - we are not a "read the forum for you" service.

Re: Can we submit a JCL and get the return code in COBOL?

PostPosted: Mon Mar 18, 2013 1:54 pm
by BillyBoyo
Perhaps you are used to some other Operating System? z/OS and its ancestors are not like those. If you send something to the "internal reader", it is just another method of getting something on the job input queue. Same with SUBMIT. There's no way your program "sits around waiting for 'it' to finish" by default, and it is a bad idea to code it out yourself (locks your session up until you get the return, which may be hours, and you don't even have a terminal to check on what is happening).

Re: Can we submit a JCL and get the return code in COBOL?

PostPosted: Mon Mar 18, 2013 2:48 pm
by Robert Sample
Rethink your design. You have posted two topics that basically ask the same question, and you are being told -- REPEATEDLY -- that what you want to do is not a good idea or even possible.

If you submit a batch job from a COBOL program (which is easily done using the internal reader -- although you will have to research this in the IBM documentation and check your site standards), you cannot get any information back from that submitted job to your COBOL program. The submitted job runs completely and totally independently of your COBOL program. It is not possible, under any circumstances, for you to submit a batch job using the internal reader and then have your COBOL code do any kind of conditional logic based on the batch job and its results. Such things are the function of a job scheduler such as OPC or CA-7 or Zeke, and you are STRONGLY encouraged not to attempt to replicate them in your coding. Each of them took hundreds of thousands or millions of man-hours to develop and you, on your own, do not have the time to replicate them.