View previous topic :: View next topic
|
Author |
Message |
antonrino.b
New User
Joined: 10 Jan 2006 Posts: 76 Location: Germany
|
|
|
|
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 |
|
|
kamran
New User
Joined: 01 May 2005 Posts: 55
|
|
|
|
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 |
|
|
amitrath
New User
Joined: 30 Apr 2004 Posts: 28 Location: Carmel, USA.
|
|
|
|
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 |
|
|
Sahoo
New User
Joined: 08 Jun 2006 Posts: 53
|
|
|
|
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 |
|
|
antonrino.b
New User
Joined: 10 Jan 2006 Posts: 76 Location: Germany
|
|
|
|
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 |
|
|
feellikeneo
New User
Joined: 19 Mar 2007 Posts: 73 Location: Chennai
|
|
|
|
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 |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
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 |
|
|
|