Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Checking the status of job submitted through REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
antonrino.b

New User


Joined: 10 Jan 2006
Posts: 76
Location: Germany

PostPosted: Wed Jun 07, 2006 1:56 pm    Post subject: Checking the status of job submitted through REXX
Reply with quote

Hi,

I am submitting a JCL through REXX and want my program to proceed only after the job has finished.

How does the REXX routine can identify the end of a Job?

I outtrapped the job id and tried finding the status of job. But If I use that in a loop to poll the status of job, the job is staying at some point indefinitely..

How to get around this problem?

Thanks,
Antu
Back to top
View user's profile Send private message

kamran

New User


Joined: 01 May 2005
Posts: 55

PostPosted: Wed Jun 07, 2006 3:09 pm    Post subject: Re: Checking the status of job submitted through REXX
Reply with quote

Hi,
In your rexx program which is submitting the jcl you can call a wait routine to wait for a second and then you can scan ascb control block chain to find if your job is active.if it is active you can wait for another second and again search the ascb control block.
you can search for sample rexx programs for the wait and the search routines.


antonrino.b wrote:
Hi,

I am submitting a JCL through REXX and want my program to proceed only after the job has finished.

How does the REXX routine can identify the end of a Job?

I outtrapped the job id and tried finding the status of job. But If I use that in a loop to poll the status of job, the job is staying at some point indefinitely..

How to get around this problem?

Thanks,
Antu
Back to top
View user's profile Send private message
amitrath

New User


Joined: 30 Apr 2004
Posts: 28
Location: Carmel, USA.

PostPosted: Wed Jun 07, 2006 8:08 pm    Post subject: Re: Checking the status of job submitted through REXX
Reply with quote

Here is the solution. Definitely works in my system.


/* PREPARE THE JCL */
ADDRESS ISPEXEC "FTOPEN TEMP"
ADDRESS ISPEXEC "FTINCL COMPILE"
ADDRESS ISPEXEC "FTCLOSE"
ADDRESS ISPEXEC "VGET (ZTEMPF)"

/* SUBMIT */
X = OUTTRAP('LOG.')
"SUBMIT '"ZTEMPF"'"
X = OUTTRAP('OFF')

PARSE VAR LOG.1 "JOB" JOBNAME "("JOBID")" MESSAGE
SAY "JOB "JOBNAME"("JOBID") "MESSAGE

DO FOREVER
X = OUTTRAP('LOG.')
"STATUS "JOBNAME"("JOBID")"
X = OUTTRAP('OFF')
PARSE VAR LOG.1 "JOB" JOBNAME "("JOBID")" STATUS
IF STATUS = 'ON OUTPUT QUEUE' THEN
DO
"CANCEL "JOBNAME"("JOBID") PURGE"
IF RC = 0 THEN SAY "JOB "JOBNAME"("JOBID") "PURGED
LEAVE
END
END
END
Back to top
View user's profile Send private message
Sahoo

New User


Joined: 08 Jun 2006
Posts: 53

PostPosted: Sun Jun 25, 2006 1:51 pm    Post subject: Re: Checking the status of job submitted through REXX
Reply with quote

Hi,
You can split the current program in two parts. One which will submit a JCL and the Other which will be executed after the Job ends. You can introduce a step in the JCL using COND parameter to execute the second rexx program.


Ex :

//STEP1 EXEC PGM=YOUR program
//..
//..
//STEP2 EXEC PGM=IKJEFT01,COND=(0,NE)
//SYSTSIN DD *
Here you give your second part of the Program
Back to top
View user's profile Send private message
antonrino.b

New User


Joined: 10 Jan 2006
Posts: 76
Location: Germany

PostPosted: Mon Jun 26, 2006 11:32 am    Post subject:
Reply with quote

Hey Sahoo, That was an interesting solution. I never thought of it.. Thanks..

Thanks Amitrath. Your solution also works fine. I have done some other mistake in the JCL and hence it was waiting.

Kamran, If you could throw light on ascb control block, it would be more helpful.

-Anton
Back to top
View user's profile Send private message
feellikeneo

New User


Joined: 19 Mar 2007
Posts: 73
Location: Chennai

PostPosted: Tue Jul 24, 2007 4:42 pm    Post subject:
Reply with quote

Hello amitrath,

I had similar kind of requirement and the code that you gave, perfectly matched my requirement and I am successful in using your code..
A wonderful piece of code.


Thanks a lot....

Cheers,
Neo icon_biggrin.gif
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Tue Jul 24, 2007 6:06 pm    Post subject:
Reply with quote

There are some very good examples of using MVS Data Areas in Google Groups.

ASCB is the Address Spaces Control Block, and it is well documented in the fine manual.

O.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
This topic is locked: you cannot edit posts or make replies. Rexx to execute spool commands upendrasri CLIST & REXX 5 Wed Oct 04, 2017 6:54 am
This topic is locked: you cannot edit posts or make replies. Rexx to execute spool commands upendrasri CLIST & REXX 47 Fri Sep 29, 2017 1:08 pm
No new posts ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us