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

[{"Line of Business":{"code":"LOB08","label":"Cognitive Systems"},"Business Unit":{"code":"BU054","label":"Systems w/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CHAAA2","label":"Operating System"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.1.0;7.2.0;7.3.0;7.4.0"},{"Product":{"code":"SWG60","label":"IBM i"},"Business Unit":{"code":"BU054","label":"Systems w/TPS"},"Component":"Operating System","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.2.0;7.2;7.1.0;7.1","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}},{"Product":{"code":"SSC5L9","label":"IBM i 7.2"},"Business Unit":{"code":"BU054","label":"Systems w/TPS"},"Component":" ","Platform":[{"code":"","label":null}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}},{"Product":{"code":"SSC52E","label":"IBM i 7.1"},"Business Unit":{"code":"BU054","label":"Systems w/TPS"},"Component":" ","Platform":[{"code":"","label":null}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}}]

Document Information

Modified date:
17 September 2020

UID

nas8N1020082