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


  • Subject: Re: Monitoring program
  • From: Billy Rowe <browe@xxxxxxxxxxxxx>
  • Date: Thu, 11 Feb 1999 12:58:01 -0500

Jeff Carey wrote:
> 
> 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?
> 
Jeff,

I have attached a command and CL program to this message that uses an
API to
retreive a job's status.

Hope this helps!!

billy
 /* Retreive job status command; CPP is RTVJOBSTS         */
          CMD        PROMPT('Retrieve Job Status')
          PARM       KWD(JOB) TYPE(*NAME) MIN(1) PROMPT('Job name')
          PARM       KWD(STATUS) TYPE(*CHAR) LEN(1) RTNVAL(*YES) +
                       MIN(1) PROMPT('CL var for STATUS        (1)')

/****************************************************************/
/*                                                              */
/* PURPOSE.. CPP For Retrieve Job Status (RTVJOBSTS) Command    */
/*                                                              */
/* PARMS.... &JOBNAME     Input   CHAR(10)                      */
/*           &RETURNCODE  Output  CHAR(1)                       */
/*                                                              */
/*                        '0' -> No jobs active with name       */
/*                               specified.                     */
/*                                                              */
/*                        '1' -> One or more jobs active with   */
/*                               name specified.                */
/*                                                              */
/*                        ' ' -> Error/undefined.               */
/*                                                              */
/****************************************************************/
 RTVJOBSTSC: PGM        PARM(&JOBNAME &RETURNCODE)
             DCL        VAR(&JOBNAME) TYPE(*CHAR) LEN(10)
             DCL        VAR(&RETURNCODE) TYPE(*CHAR) LEN(1)
             DCL        VAR(&QUALJOB) TYPE(*CHAR) LEN(26) /* +
                          Qualified job name */
             DCL        VAR(&QUALUSRSPC) TYPE(*CHAR) LEN(20) +
                          VALUE('RTVJOBSTS QTEMP') /* Qualified +
                          user space name */
             DCL        VAR(&USRSPC) TYPE(*CHAR) LEN(10) +
                          VALUE('RTVJOBSTS') /* User space name */
             DCL        VAR(&ATR) TYPE(*CHAR) LEN(10) VALUE('TEMP') +
                          /* Extended attribute for user space */
             DCL        VAR(&SIZE) TYPE(*CHAR) LEN(4) +
                          VALUE(X'00000400') /* Initial size of +
                          user space. (1024 in decimal) */
             DCL        VAR(&INLVAL) TYPE(*CHAR) LEN(1) VALUE(' ') +
                          /* Initial value for user space */
             DCL        VAR(&AUT) TYPE(*CHAR) LEN(10) VALUE('*ALL') +
                          /* Public authority for user space */
             DCL        VAR(&TEXT) TYPE(*CHAR) LEN(50) +
                          VALUE('Created by RTVJOBSTS command') /* +
                          Text for user space */
             DCL        VAR(&COUNT) TYPE(*CHAR) LEN(4) /* Active +
                          jobs found that match the name specified */
             DCL        VAR(&HEXZERO) TYPE(*CHAR) LEN(4) +
                          VALUE(X'00000000') /* Literal value of +
                          hex zero */
/****************************************************************/
/* Global Message Monitor Declares                              */
/****************************************************************/
             DCL        VAR(&##MSGFLIB) TYPE(*CHAR) LEN(10) /* +
                          Message File Library */
             DCL        VAR(&##MSGF) TYPE(*CHAR) LEN(10) /* Message +
                          File */
             DCL        VAR(&##MSGID) TYPE(*CHAR) LEN(7) /* Message +
                          ID */
             DCL        VAR(&##MSGDTA) TYPE(*CHAR) LEN(128) /* +
                          Message data */
/****************************************************************/
/*   Global Message Monitor                                     */
/****************************************************************/
             MONMSG     MSGID(CPF0000 MCH0000) EXEC(GOTO +
                          CMDLBL(##ERROR))
             GOTO       CMDLBL(##NOERROR)
##ERROR:     RCVMSG     MSGTYPE(*EXCP) MSGDTA(&##MSGDTA) +
                          MSGID(&##MSGID) MSGF(&##MSGF) +
                          MSGFLIB(&##MSGFLIB)
             MONMSG     MSGID(CPF0000 MCH0000) /* Just in case */
             SNDPGMMSG  MSGID(&##MSGID) MSGF(&##MSGFLIB/&##MSGF) +
                          MSGDTA(&##MSGDTA) TOPGMQ(*PRV) +
                          MSGTYPE(*ESCAPE)
             MONMSG     MSGID(CPF0000 MCH0000) /* Just in case */
             RETURN
##NOERROR:
/****************************************************************/
/*   Initialize Return Code                                     */
/****************************************************************/
             CHGVAR     VAR(&RETURNCODE) VALUE(' ')
/****************************************************************/
/*   Create User Space If Necessary                             */
/****************************************************************/
             CHKOBJ     OBJ(QTEMP/&USRSPC) OBJTYPE(*USRSPC)

             MONMSG     MSGID(CPF9801) EXEC(DO) /* Not found */
             CALL       PGM(QUSCRTUS) PARM(&QUALUSRSPC &ATR &SIZE +
                          &INLVAL &AUT &TEXT)
             ENDDO
/****************************************************************/
/*   List Active Jobs That Match The Name Specified             */
/****************************************************************/
             CHGVAR     VAR(&QUALJOB) VALUE(&JOBNAME)
             CHGVAR     VAR(%SST(&QUALJOB 11 10)) VALUE('*ALL')
             CHGVAR     VAR(%SST(&QUALJOB 21 6)) VALUE('*ALL')
             CALL       PGM(QUSLJOB) PARM(&QUALUSRSPC 'JOBL0100' +
                          &QUALJOB '*ACTIVE   ')
/****************************************************************/
/*   Chect List For Number Of Active Jobs                       */
/*                                                              */
/*   Use the following command to determine the number of       */
/*   active jobs found that match the name specified.  If 0,    */
/*   no job is active by that name.  Variable &COUNT is set     */
/*   to the number of jobs, in binary.  If &COUNT = X'00000000' */
/*   the job is not active.                                     */
/****************************************************************/

             CALL       PGM(QUSRTVUS) PARM(&QUALUSRSPC X'00000085' +
                          X'00000004' &COUNT)

             IF         COND(&COUNT *EQ &HEXZERO) THEN(CHGVAR +
                          VAR(&RETURNCODE) VALUE('0'))
             ELSE       CMD(CHGVAR VAR(&RETURNCODE) VALUE('1'))
RETURN
ENDPGM


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.