View previous topic :: View next topic
|
Author |
Message |
senmainframe Currently Banned New User
Joined: 09 Oct 2007 Posts: 30 Location: USA
|
|
|
|
I have two jobs and when I am executing my following rexx program, only firs job is submitted and second job is not exectued.
could yu please guide me where I am wrong. What is the problem in my below code. Do I need to clear queue for every count of loop or some other error?
jcl name (with same jobcard)
JCL1
JCL2
My rexx code
Code: |
/*REXX*/
/*Accepting the input */
SAY 'ENTER A NEW BLOCK NAME:'
PARSE PULL NEWBLK
NEWBLK1=STRIP(NEWBLK)
CNT = 2
NEWBLK=NEWBLK1
DO JCLNUM = 1 TO 2
SAY JCLNUM
CALL EDIT_JCL
CALL SUB_JCL
END
CALL EXIT
/* Sub-routine for editing the Job to be submitted */
EDIT_JCL:
"ALLOC DD(INDD) DA('CAA1035.REXX.JCL(JCL"JCLNUM")') SHR
REU"
"EXECIO * DISKR INDD (STEM IN. FINI"
index = IN.0
DO record = 1 to index
IF POS('OC12',IN.record) > 0 THEN DO
POS1 = POS('OC12',IN.record)
SAY POS1
IN.record = OVERLAY(NEWBLK,IN.record,POS1,4)
SAY IN.record
END
IF POS('DATASET(',IN.record) > 0 THEN
DO
TEMP = "DATASET("DSNPROF")"
IN.record = OVERLAY(TEMP,IN.record,1,80)
SAY IN.record
END
END
"FREE FILE(INDD)"
RETURN 0
/* Sub-routine for submiting the Job prepared */
SUB_JCL:
DO onq = 1 to index
QUEUE IN.onq
END
QUEUE "$$"
CALL OUTTRAP 'out.'
ADDRESS TSO "SUBMIT * END($$)"
CALL OUTTRAP 'OFF'
SAY 'Output from SUBMIT cmd...'
DO i = 1 TO out.0
SAY i out.i
END i
DO i = 1 TO out.0
PARSE VAR out.i . 'JOB ' . '(' jobid ')'
IF jobid <> '' THEN LEAVE
END i
IF jobid = ''
THEN SAY 'Job submission failed, rc='rc
ELSE SAY 'Job submitted successfully, job number is: 'jobid
EXIT:
EXIT 0 |
|
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
I don't see a RETURN statement in SUB_JCL:. |
|
Back to top |
|
|
senmainframe Currently Banned New User
Joined: 09 Oct 2007 Posts: 30 Location: USA
|
|
|
|
I added and it is working fine. Also one more help, if first job get abends or fails, second jobs should not be run. How I can check in this? |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Well, your code shows that you seem to be pretty adept with the typical TSO commands. Ask yourself how you would do what you want in TSO, and you'll have your answer.
As another hint, usually, when you enter the TSO HELP command without any other parameters, you'll get a list of all the TSO commands grouped by function. There should be a group for FOREGROUND INITIATED BACKGRUND COMMANDS, of which SUBMIT and STATUS and some others belong to. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Or, you could search the forums, as this topic is posted by someone just about every day. |
|
Back to top |
|
|
senmainframe Currently Banned New User
Joined: 09 Oct 2007 Posts: 30 Location: USA
|
|
|
|
Hi,
Thank you very mcuh. We can use TSO command STATUS, but I dont know how to use in my REXX properly. Could you guide or any other method is available? |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Well, in your code you're capturing the jobname and jobid from the TSO SUBMIT command. Once you know both of those, you then typically use the TSO STATUS command to retrieve the current status of the job. First, TSO STATUS JOBNAME(JOBID) will return the message:
IKJ56211I JOB JOBNAME(JOBID) EXECUTING
and will keep returning that message every time you invoke the command until the job completes, at which time if will then say:
IKJ56192I JOB JOBNAME(JOBID) ON OUTPUT QUEUE
Now, you know it's completed. Then, you just need to use the TSO OUTPUT command to retrieve the job output:
TSO OUTPUT JOBNAME(JOBID) PRINT(dsname) BEGIN HOLD KEEP |
|
Back to top |
|
|
|