IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Checking the status of job submitted through REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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
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
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
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
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
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: 2358
Location: Israel

PostPosted: Tue Jul 24, 2007 6:06 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top