× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Jeff:

I submitted a couple of responses to another similar question recently.

I've attached them, if you're interested.

Regards

Chris Jewell


 

> -----Original Message-----
> From: owner-midrange-l@midrange.com
> [mailto:owner-midrange-l@midrange.com]On Behalf Of Jeff Carey
> Sent: Wednesday, February 10, 1999 2:07 PM
> To: MIDRANGE-L@midrange.com
> Subject: Monitoring program
> 
> 
> We are trying to write a CL that would monitor a set of jobs running in a
> subsystem to see if they are all up, and if not to submit the appropriate
> missing job(s).
> 
> I'm sure there must be an API or something that we could use to test if a
> job of a given name is active - can someone give us some guidance?
> 
> Thanks!
> 
> 
> +---
> | 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
> +---
> 

Christopher J. Jewell.vcf





>
> 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
+---






>
> 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.

Hope this helps.

Chris Jewell
mailto://jewellcj@jewellconsult.com


 *****************************************************************
      *
      * GN0_GetJobInfo  : Get information for job      : MS_GN0
      *
      * Input:  Job Name/User/Number (or '*' in name to indicate 'retrieve
current')
      * Input/Output : Job Name, User, Number
      * Output : Job Running Interactively?
      *          Job Status : ACTIVE, JOBQ, OUTQ , NOEXST
      *
      *----------------------------------------------------------------
     PGN0_GetJobInfo   B                   EXPORT
      *
     D                 PI
     D P#JobName                     10A
* = current
     D P#JobUser                     10A
     D P#JobNumber                    6A
     D P##JobInter                         LIKE(*IN01)
Interactive?
     D P#JobStatus                   10A
*ACTIVE/*JOBQ/*OUTQ
      *
*ERROR
     D  resultDS       DS
     D   rtnlen                       5B 0
     D   rtnavl                       5B 0
     D   rtnjob                      10A
     D   rtnuser                     10A
     D   rtnnum                       6A
     D   rtnint                      16A
     D   rtnstatus                   10A
     D   rtntype                      1A
      *
     D  o#Resultlen    S              5B 0
      *
     D  o#job          S             26A
      *
      * processing
      *
      *
     C                   If        P#JobName = '*'
     C                   Eval      P#JobNumber = *Blanks
     C                   Eval      P#JobUser = *Blanks
     C                   EndIf
      *
      * Form fully qualified job id
     C                   Eval      o#job = P#JobName  + P#JobUser +
P#JobNumber
      *
      * following gets the status of the job
     C                   Call      'QUSRJOBI'                           6060
     C     resultDS      Parm                    o#Result         61
     C                   Parm      61            o#ResultLen
     C                   Parm      'JOBI0100'    o#jobid           8
     C                   Parm                    o#job
     C                   Parm                    o#jobint         16
      *
     C                   If        *IN60 = *ON
     C                   Eval      P#JobStatus  = '*ERROR'
     C                   Else
      *
     C                   Eval      P#JobNumber = rtnnum
     C                   Eval      P#JobUser = rtnuser
     C                   Eval      P#JobName = rtnjob
     C                   Eval      P#JobStatus  = rtnstatus
     C                   Eval      P##JobInter  = (rtntype = 'I')
      *
     C                   EndIf
*IN60
      *
     C                   Return
      *
     PGN0_GetJobInfo   E
      *
      *****************************************************************

+---
| 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
+---



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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 on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.