MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to detemine if the JCL is complete in COBOL program

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
ashutosh_agl3
Beginner


Joined: 14 Aug 2003
Posts: 28
Topics: 15

PostPosted: Tue Nov 23, 2004 5:16 am    Post subject: How to detemine if the JCL is complete in COBOL program Reply with quote

I am creating and submitting a JCL dynamically through a COBOL program.

Is there any way to determine if the job has been completed and what is the return code for the job?
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Nov 23, 2004 5:46 am    Post subject: Reply with quote

ashutosh_agl3,

Quote:

I am creating and submitting a JCL dynamically through a COBOL program.


why not create two additional steps in the same dynamic jcl.

one step to notify you about successful completion
another step to notfiy you about when the program abends.

Check this links for a sample JCL for notify

http://www.mvsforums.com/helpboards/viewtopic.php?t=2273&highlight=notify

Check this link for a sample rexx exec to get the return code of the job

http://www.mvsforums.com/helpboards/viewtopic.php?t=44&highlight=return+code


Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
MFBaba
Beginner


Joined: 24 Nov 2004
Posts: 8
Topics: 4

PostPosted: Wed Nov 24, 2004 1:56 am    Post subject: Reply with quote

Kolusu,

Is there some way by which I can come to know when the JOB completes/abends in the same COBOL program which submitted the JCL ??

Thanks,
MFBaba.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed Nov 24, 2004 9:07 am    Post subject: Reply with quote

MFBaba,

You can code a wait logic in your cobol pgm to wait untill the submitted job completes and sweep thru the control blocks to see if the job completed successfully or if it abended.

Search for "ILBOWAT0" in the application programming forum and you will find examples of it.

But this approach is a mere waste of resources and I wouldn't recommend it

Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ashutosh_agl3
Beginner


Joined: 14 Aug 2003
Posts: 28
Topics: 15

PostPosted: Thu Nov 25, 2004 1:04 am    Post subject: Reply with quote

The objective here is to somehow identify the return code of the JCL in the same COBOL program which is submitting the JCL.

Currently the module submits and then exits.

I need a way to have COBOL module wait till the time JCL finshes normally/abnormally and also a way to identify the return code of JCL.
Back to top
View user's profile Send private message Yahoo Messenger
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Nov 25, 2004 1:29 am    Post subject: Reply with quote

Ashutosh,

If you could provide us some more info as to what u r trying to do, probably we can suggest an alternate solution. How many steps do u have in the JCL which u submit internally. Can you show us ur JCL ? (the one which is going to be submitted by ur cobol program). Instead of submitting you can execute the entire JCL from inside the COBOL program itself, so that U donot have to wait for the JCL to complete.

Thanks,
Phantom
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu Nov 25, 2004 10:28 am    Post subject: Reply with quote

Quote:

I need a way to have COBOL module wait till the time JCL finshes normally/abnormally and also a way to identify the return code of JCL.

ashutosh_agl3,

Did you read my post which was posted just above your post? There are atleast 2 examples in this forum for the wait logic.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ashutosh_agl3
Beginner


Joined: 14 Aug 2003
Posts: 28
Topics: 15

PostPosted: Fri Nov 26, 2004 12:10 am    Post subject: Reply with quote

Kolusu

The ILBOWAT0 reference you had provided explained a way to wait for a specified (X no.. of secs).

However what i need is to wait till JCL has finished executing (normally or abnormally)

The purpose out here is that since this JCL is being built and submitted dynamically thru a COBOL-CICS module, so the objective is to show some kind of information obtained as output of JCL.
For this the as per the current solution I was thinking it there was someway to determine JCL has finished in COBOL program then it might solve our purpose.

I am open to any other suggested solutions also.
Back to top
View user's profile Send private message Yahoo Messenger
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Fri Nov 26, 2004 1:13 am    Post subject: Reply with quote

Ashutosh,

Read Kolusu's message carefully.
Code:

You can code a wait logic in your cobol pgm to wait untill the submitted job completes and sweep thru the control blocks to see if the job completed successfully or if it abended.

Search for "ILBOWAT0" in the application programming forum and you will find examples of it.



He wanted you to use ILBOWAT0 to make the COBOL program wait for some time say 10 secs then read the control blocks (TCB, TIOT...) to check whether the job completed or not, if so, what is the return code etc....If Not, then wait for another 10 secs and so on......

But as Kolusu said, this is not recommended as it wastes lot of CPU, unnecessarily looping during the wait period. Instead you can invoke the program called by the JCL direcly from within ur cobol program. This way do not have to wait for a jcl to complete.

Show us ur JCL and we'll tell you how.

Thanks,
Phantom
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group