Troubleshooting
Problem
This document describes how to enable the system inactivity timer to disconnect or end specific jobs by use of a program to monitor a message queue specified by system value QINACTMSGQ. A sample program is provided.
Resolving The Problem
To restrict the effects of the system inactivity interval timer (QINACTITV) to a particular set of jobs, the system value QINACTMSGQ must specify a message queue name rather than *ENDJOB or *DSCJOB. Then, a never-ending batch job needs to monitor the message queue for CPI1126 messages (indicating that the inactivity timer has expired for a job) and extract either the job name or job user from the message to determine what action should be taken. Below is a sample CL program which does the following:
The program can be enhanced to do other actions, including pulling the list of users, workstations, and actions from a file so it would not need to be recompiled each time a change is required.
SAMPLE PROGRAM:
o |
Leaves the console and jobs for user TAA alone. |
o | Sends a break message to the workstation for users CKOUR and CHANTHA. |
o | Ends any jobs for workstation P002039. |
o | Disconnects all other jobs as the default action. |
SAMPLE PROGRAM:
PGM
DCL &THEQUEUE *CHAR 20 /* QINACTMSGQ SYSTEM VALUE */
DCL &INACTLIB *CHAR 10 /* QUEUE'S LIBRARY */
DCL &INACTQUEUE *CHAR 10 /* QUEUE NAME */
DCL &INACTDATA *CHAR 100 /* RAW MESSAGE DATA */
DCL &JOBNAME *CHAR 10 /* INACTIVE JOB NAME */
DCL &USER *CHAR 10 /* INACTIVE JOB USER */
DCL &NUMBER *CHAR 6 /* INACTIVE JOB NUMBER */
DCL &MSGDTALEN *DEC (5 0)
DCL &MSGID *CHAR 7 /* MESSAGE TAKEN FROM THE QUEUE*/
/* */
/* GET THE NAME OF THE QUEUE TO MONITOR FROM THE SYSTEM VALUE */
/* */
RTVSYSVAL SYSVAL(QINACTMSGQ) RTNVAR(&THEQUEUE)
CHGVAR &INACTQUEUE %SUBSTRING(&THEQUEUE 1 10)
CHGVAR &INACTLIB %SUBSTRING(&THEQUEUE 11 10)
/* */
/* MAIN LOOP. */
/* */
LOOP:
/* */
/* WAIT FOR MESSAGE ON THE MESSAGE QUEUE */
/* */
RCVMSG MSGQ(&INACTLIB/&INACTQUEUE) WAIT(*MAX) +
MSGDTA(&INACTDATA) MSGDTALEN(&MSGDTALEN) +
MSGID(&MSGID)
/* */
/* CHECK TO SEE IF IT IS THE RIGHT MESSAGE, IF NOT, SKIP IT. */
/* */
IF (&MSGID *NE 'CPI1126') THEN(GOTO SKIP)
CHGVAR &JOBNAME %SUBSTRING(&INACTDATA 1 10) /* GET JOB NAME */
CHGVAR &USER %SUBSTRING(&INACTDATA 11 10) /* GET USER NAME*/
CHGVAR &NUMBER %SUBSTRING(&INACTDATA 21 6) /* GET JOB NUM */
/* */
/* SPECIAL USERS */
/* */
IF (&USER *EQ 'TAA') THEN(GOTO SKIP) /* leave alone*/
IF (&JOBNAME *EQ 'DSP01') THEN(GOTO SKIP) /* console */
IF (&USER *EQ 'CKOUR') THEN(GOTO ACTION1)
IF (&USER *EQ 'CHANTHA') THEN(GOTO ACTION1)
IF (&JOBNAME *EQ 'P002039') THEN(GOTO ACTION2)
/* */
/* DEFAULT ACTION */
/* */
DSCJOB JOB(&NUMBER/&USER/&JOBNAME)
MONMSG CPF0000 /* VIRTUAL TERMINALS CANNOT BE DISCONNECTED */
/* SO IGNORE ANY MESSAGES THAT MAY CAUSE */
GOTO SKIP
/* */
ACTION1:
SNDBRKMSG MSG('Chantha, you left your terminal on AGAIN!') +
TOMSGQ(&JOBNAME)
GOTO SKIP
/* */
ACTION2:
ENDJOB JOB(&NUMBER/&USER/&JOBNAME)
GOTO SKIP
/* */
/* OTHER ACTIONS GO HERE */
/* */
SKIP:
GOTO LOOP /* GO GET MORE MESSAGES ABOUT OTHER TERMINALS */
ENDPGM
[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CHjAAM","label":"Job and Work Management"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]
Historical Number
3271633
Was this topic helpful?
Document Information
Modified date:
07 October 2024
UID
nas8N1016268