>
> Christopher J. Jewell (Jewell Consulting) wrote:
> >
> > >
> > > Does anyone know of an equivalent CL command to the S/36 OCL
> Statement:
> > >
> > > // IF ACTIVE-PROGNAME
> > >
> >
> > If you mean you want to check the status of a job, and you know the job
> > name/number, you could use the QUSRJOBI parameter. Putting into
> a procedure
> > would be a good idea, an example is shown below.
> >
> > ......... code snipped from message .....

>
> Chris will this work if I only know the Job Name and Subsystem ?
>
> John Hall

John:

Yes this will work, but you don't need to know the subsystem, just the
quailified job name, (or just '*' if you want information about the job in
which the call is taking place).

So, you might do the following on submission of the job which you wish to
track:-

        SBMJOB .....
        RCVMSG PGMQ(*SAME) MSGTYPE(*COMP) RMV(*NO) MSGDTA(&MSGDTA) MSGID(&MSGID)
MSGF(&MSGF) MSGFLIB(&MSGFLIB)
        /* record submission on message queue (you could use a database file if 
you
wish) */
        SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) MSGDTA(&MSGDTA)
TOMSGQ({your-log-queue}) MSGTYE(*COMP)


and then to track the status of the job you could do the following (with
extra code not shown here for validating your message etc. ):-
        ....
        /* following could be in a loop */
        RCVMSG MSGQ({your-log-queue}) MSGTYPE(*NEXT) MSGKEY(*TOP) RMV(*NO)
MSGDTA(&MSGDTA) MSGID(&MSGID) MSGF(&MSGF) MSGFLIB(&MSGFLIB)

        CHGVAR &CHKJOBN %SST(&MSGDTA 1 10) /* Job Name */
        CHGVAR &CHKJOBU %SST(&MSGDTA 11 10) /* Job User */
        CHGVAR &CHKJOB# %SST(&MSGDTA 21 6) /* Job Number */
        CALLPRC PRC(GN0_GETJOBINFO) PARM(&CHKJOBN &CHKJOBU &CHKJOB# &CHKJOBI
&CHKJOBSTAT)
        IF COND(&CHKJOBSTAT = *ACTIVE) THEN(DO)
        ...
        ENDDO
        /* as above for *ERROR, *OUTQ, *JOBQ , etc. */

Of course you would also have to do the usual ILE stuff: best to create a
service program with a module which includes the procedure in the previous
message, then create the calling program to run in the same activation group
as the service program etc.

Hope this helps.

Chris Jewell











+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact [javascript protected email address].