Waiting for submitted job to complete



IBM's Command List programming language & Restructured Extended Executor

Waiting for submitted job to complete

Postby pcs2smf » Wed Aug 12, 2009 9:02 pm

I'm trying to submit a job from a rexx routine. It takes about 20 seconds to run, then when it completes browse the output dataset.
so far I have:
DUMMY = OUTTRAP("OUTLINE.","*")
"SUBMIT * END(GO)"
SAY "OUTPUT DATASET : "||DSNAME1
SAY " "
SAY "THIS MAY TAKE A MINUTE"
SAY "PLEASE WAIT UNTIL JOB COMPLETES"
SAY OUTLINE.2
JOBNAME = SUBWORD(OUTLINE.2,2,1)
JOBNAME = STRIP(SUBSTR(JOBNAME,1,8))

/* WAIT UNTIL THE JOB COMPLETES. */
I = 1
DO FOREVER
FINALMSG = OUTLINE.I
JB = SUBWORD(FINALMSG,4,1)
IF JB = JOBNAME THEN exit
I = I + 1
END
DUMMY = OUTTRAP("OFF")
'DELSTACK'
ADDRESS ISPEXEC "BROWSE DATASET("DSNAME1")"
EXIT

so far I will get the following:
OUTPUT DATASET : PRODWORK.PCS2SMF.ESP.REPORT

THIS MAY TAKE A MINUTE
PLEASE WAIT UNTIL JOB COMPLETES
JOB PPCS2SMF(JOB59492) SUBMITTED
11.29.38 JOB59492 $HASP165 PPCS2SMF ENDED AT UPSRRCH MAXCC=0 CN(INTERNAL)

unfortunately it never exits after job completes. Anyone have any ideas?
pcs2smf
 
Posts: 7
Joined: Wed Aug 12, 2009 5:17 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Waiting for submitted job to complete

Postby MrSpock » Wed Aug 12, 2009 9:42 pm

Honestly, what you're doing doesn't sound like a good idea (what if the job doesn't or can't run?). Why can't you create the required dataset in the foreground?

Anyway, I don't see any logic in the looping structure where you can check for the status of the job (you need to read up on what messages are and are not trappable via the Outtrap command). You might want to use the TSO OUTPUT command and keep waiting until the job is on the output queue. Or, make calls to your spool interface tool (SDSF, IOF, Sysview, etc.) and query on the status that way.
User avatar
MrSpock
Global moderator
 
Posts: 809
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: Waiting for submitted job to complete

Postby MrSpock » Wed Aug 12, 2009 9:44 pm

Or, you could just keep trying to allocate the dataset (DISP=OLD) until you're successful.
User avatar
MrSpock
Global moderator
 
Posts: 809
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: Waiting for submitted job to complete

Postby expat » Thu Aug 13, 2009 11:52 am

This has been discussed quite a few times on the main forum and every time the response is Do NOT do this

You lock up a terminal preventing any other work being done from that terminal until such time as the job completes and your program continues.

It is a bad idea.
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post