IBM Support

Jobs are Held instead of ended CPI112D and CPI112E (How to revert back)

Question & Answer


Question

After installing PTF SI42845 and in release R720, jobs that exceed their CPU Time or Max Temporary Storage are now placed on hold instead of being ended. Would like to have them end instead.

Cause

After installing PTF SI42845 and by default in release R720, jobs that exceed their CPU Time or Max Temporary Storage are now placed on hold instead of being ended. Would like to revert to previous behavior.

Answer

With the introduction of PTF SI42845 for R710 and the release of version R720 of the Operating system, jobs that exceed their Maximum CPU Time or Maximum Temporary Storage are now placed on hold and not ended. Once the job is place on hold a message is sent to the QSYSOPR message queue alerting that a job was placed on hold.


This change allows the system operator to determine whether the jobs should be ended or if they should be allowed to continue to run to completion.

Once the PTF is installed and by default on release R720, there is no way to revert back to the previous behavior when the jobs were ended.

The following watch program can be used to monitor for the messages and end the jobs.

Step 1

Create a CL program that monitors for the message in QSYSOPR and takes the action to end it.
 
Caution: This code is for demonstration purposes and is provided AS IS and not supported by IBM.
 
/**************************************************************************/
/* Sample watch program to end maximum CPU job                            */
/*                                                                        */
/*                                                                        */
/* To create the watch program                                            */
/* CRTCLPGM PGM(QGPL/WATCH)                                               */
/* SRCFILE(QGPL/QCLSRC)                                                   */
/* USRPRF(*OWNER)                                                         */
/*                                                                        */
/* To start the watch:                                                    */
/* STRWCH SSNID(*GEN) WCHPGM(QGPL/WATCH)                                  */
/* WCHMSG((CPI112D))                                                      */
/*                                                                        */
/**************************************************************************/

PGM PARM(&WATCH_OPT &SESSION_ID +
&ERR_DETECT &EVENT_DATA)
DCL VAR(&WATCH_OPT) TYPE(*CHAR) LEN(10)
DCL VAR(&SESSION_ID) TYPE(*CHAR) LEN(10)
DCL VAR(&ERR_DETECT) TYPE(*CHAR) LEN(10)
DCL VAR(&EVENT_DATA) TYPE(*CHAR) LEN(600)

/*********************************************************/
/* Message id and offset to message replacement          */
/*********************************************************/

DCL VAR(&EVENT_MSG) TYPE(*CHAR) STG(*DEFINED) +
LEN(7) DEFVAR(&EVENT_DATA 5)
DCL VAR(&OFFSET_MSG) TYPE(*UINT) STG(*DEFINED) +
LEN(4) DEFVAR(&EVENT_DATA 441)
DCL VAR(&WRKOFFSET) TYPE(*UINT) LEN(4)

/*********************************************************/
/* Job name in message replacement data (CPI112D)        */
/*********************************************************/

DCL VAR(&MSG_DATA1) TYPE(*PTR)
DCL VAR(&JOBNAME) TYPE(*CHAR) STG(*BASED) +
LEN(10) BASPTR(&MSG_DATA1)
DCL VAR(&MSG_DATA2) TYPE(*PTR)
DCL VAR(&JOBUSER) TYPE(*CHAR) STG(*BASED) +
LEN(10) BASPTR(&MSG_DATA2)
DCL VAR(&MSG_DATA3) TYPE(*PTR)
DCL VAR(&JOBNMBR) TYPE(*CHAR) STG(*BASED) +
LEN(6) BASPTR(&MSG_DATA3)

/*********************************************************/
/* Set no error detected, check for CPI112D message      */
/*********************************************************/

CHGVAR VAR(&ERR_DETECT) VALUE(' ')
IF COND(&WATCH_OPT *EQ '*MSGID ') THEN(GOTO +
CMDLBL(CONTINUE)) /* Message event? */
GOTO CMDLBL(EXIT)
CONTINUE: IF COND(&EVENT_MSG *EQ 'CPI112D') THEN(GOTO +
CMDLBL(ENDJOB)) /* Held for CPU message? */
GOTO CMDLBL(EXIT)

/*********************************************************/
/* Set pointers to job name in message data              */
/*********************************************************/

ENDJOB: CHGVAR VAR(&MSG_DATA1) VALUE(%ADDRESS(&EVENT_DATA))
CHGVAR VAR(&WRKOFFSET) VALUE(%OFFSET(&MSG_DATA1))
CHGVAR VAR(&WRKOFFSET) VALUE(&WRKOFFSET + &OFFSET_MSG)
CHGVAR VAR(%OFFSET(&MSG_DATA1)) VALUE(&WRKOFFSET)
CHGVAR VAR(&MSG_DATA2) VALUE(%ADDRESS(&EVENT_DATA))
CHGVAR VAR(&WRKOFFSET) VALUE(&WRKOFFSET + 10)
CHGVAR VAR(%OFFSET(&MSG_DATA2)) VALUE(&WRKOFFSET)
CHGVAR VAR(&MSG_DATA3) VALUE(%ADDRESS(&EVENT_DATA))
CHGVAR VAR(&WRKOFFSET) VALUE(&WRKOFFSET + 10)
CHGVAR VAR(%OFFSET(&MSG_DATA3)) VALUE(&WRKOFFSET)

/*********************************************************/
/* End the job that exceeded CPU                         */
/*********************************************************/

ENDJOB JOB(&JOBNMBR/&JOBUSER/&JOBNAME) OPTION(*IMMED)
MONMSG MSGID(CPF0000)
EXIT: ENDPGM



Step 2

Create the CLP Program:

CRTCLPGM PGM(QGPL/WATCH) SRCFILE(QGPL/QCLSRC) USRPRF(*OWNER)


Step 3

Start the watch
STRWCH SSNID(*GEN) WCHPGM(QGPL/WATCH) WCHMSG((CPI112D))

The watch needs to be restarted after an IPL, you may want to add it to your startup program.

Notes:

The sample program monitors for the CPI112D – Job held by the system, CPUTIME limit exceeded, it can be modified to monitor for the CPI112E – Job held by the system, MAXTMPSTG limit exceeded.

To start the watch for the CPI112E message use:

STRWCH SSNID(*GEN) WCHPGM(QGPL/WATCH) WCHMSG((CPI112E))


Ending jobs requires job control authority.
Starting a watch requires *ALLOBJ authority

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m3p000000GoLkAAK","label":"Job and Work Management-\u003EManaging jobs"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.1.0;7.2.0;7.3.0;7.4.0;7.5.0"}]

Document Information

Modified date:
13 September 2022

UID

nas8N1020082