如何限制使用者使用 CHGJOB 更改 Job 的 Job Priority 及 Run Priority 或 Batch Job 的 Job Queue ?
有時候使用者會用到 WRKSBMJOB 指令或應用軟體中有 WRKSBMJOB,WRKACTJOB 的選項時,
那使用者就有機會使用選項 2=Change(CHGJOB) 針對自己的工作站 Job 或 自己所送出的
Batch Job 更改 Run Priority 或 Batch Job 的JobQ,那就可以使用 CHGCMD 指令設定
該指令參數VLDCKR 檢核程式來加以限制只有某些使用者可以更改 JOB RUNPTY 及 JOBQ 屬性。
CHGCMD CMD(CHGJOB) VLDCKR(libery/CHGJOBVLDC)
File : QCLSRC
Member: CHGJOBVLDC
Type : CLP
Usage : CRTCLPGM CHGJOBVLDC
CHGCMD CMD(CHGJOB) VLDCKR(libery/CHGJOBVLDC)
/* You can use CHGCMD to include a validity checking program */
/* (VLDCKR)that will prevent all but designated users or groups */
/* of users from using the CHGJOB command. Below is an example */
/* of such a program: */
PGM PARM(&JOBNAM &JOBQ &JOBPTY &OUTPTY &PRTTXT +
&MSGLG &MSGL2 &MSGL3 &BRKMS &STSMSG +
&PRTDV &OUTQ &DDM &SCDDT &SCDTM &JOBDT +
&DATSEP &PARM18 &PARM19 &PARM20 &PARM21 +
&RUNPTY &PARM23 &PARM24 &PARM25 &PARM26 +
&PARM27 &PARM28 &PARM29 &PARM30 &PARM31 +
&PARM32 &PARM33 &PARM34 &PARM35 &PARM36 +
&PARM37)
DCL VAR(&USRCLS) TYPE(*CHAR) LEN(10)
DCL VAR(&GRPPRF) TYPE(*CHAR) LEN(10)
DCL VAR(&USRPRF) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBNAM) TYPE(*CHAR) LEN(26)
DCL VAR(&JOBQ) TYPE(*CHAR) LEN(20)
DCL VAR(&JOBPTY) TYPE(*CHAR) LEN(1)
DCL VAR(&OUTPTY) TYPE(*CHAR) LEN(1)
DCL VAR(&PRTTXT) TYPE(*CHAR) LEN(30)
DCL VAR(&MSGLG) TYPE(*CHAR) LEN(8)
DCL VAR(&MSGL2) TYPE(*CHAR) LEN(1)
DCL VAR(&MSGL3) TYPE(*CHAR) LEN(1)
DCL VAR(&BRKMS) TYPE(*CHAR) LEN(7)
DCL VAR(&STSMSG) TYPE(*CHAR) LEN(7)
DCL VAR(&PRTDV) TYPE(*CHAR) LEN(10)
DCL VAR(&OUTQ) TYPE(*CHAR) LEN(20)
DCL VAR(&DDM) TYPE(*CHAR) LEN(1)
DCL VAR(&SCDDT) TYPE(*CHAR) LEN(7)
DCL VAR(&SCDTM) TYPE(*CHAR) LEN(7)
DCL VAR(&JOBDT) TYPE(*CHAR) LEN(7)
DCL VAR(&DATSEP) TYPE(*CHAR) LEN(3)
DCL VAR(&PARM18) TYPE(*CHAR) LEN(250)
DCL VAR(&PARM19) TYPE(*CHAR) LEN(250)
DCL VAR(&PARM20) TYPE(*CHAR) LEN(250)
DCL VAR(&PARM21) TYPE(*CHAR) LEN(250)
DCL VAR(&RUNPTY) TYPE(*CHAR) LEN(2)
DCL VAR(&PARM23) TYPE(*CHAR) LEN(250)
DCL VAR(&PARM24) TYPE(*CHAR) LEN(250)
DCL VAR(&PARM25) TYPE(*CHAR) LEN(250)
DCL VAR(&PARM26) TYPE(*CHAR) LEN(250)
DCL VAR(&PARM27) TYPE(*CHAR) LEN(250)
DCL VAR(&PARM28) TYPE(*CHAR) LEN(250)
DCL VAR(&PARM29) TYPE(*CHAR) LEN(250)
DCL VAR(&PARM30) TYPE(*CHAR) LEN(250)
DCL VAR(&PARM31) TYPE(*CHAR) LEN(250)
DCL VAR(&PARM32) TYPE(*CHAR) LEN(250)
DCL VAR(&PARM33) TYPE(*CHAR) LEN(250)
DCL VAR(&PARM34) TYPE(*CHAR) LEN(250)
DCL VAR(&PARM35) TYPE(*CHAR) LEN(250)
DCL VAR(&PARM36) TYPE(*CHAR) LEN(250)
DCL VAR(&PARM37) TYPE(*CHAR) LEN(250)
/*-------------------------------------------------------------------*/
/* GLOBAL MONMSG */
/*-------------------------------------------------------------------*/
MONMSG (CPF0000 MCH0000) EXEC(GOTO ERROR)
RTVUSRPRF RTNUSRPRF(&USRPRF) GRPPRF(&GRPPRF) +
USRCLS(&USRCLS)
IF COND(&USRCLS = '*SECOFR' *OR +
&GRPPRF = '*PGMR' *OR +
&USRPRF = 'QSYSOPR' *OR +
&USRCLS = '*SYSOPR' *OR +
&USRPRF = 'JONES' *OR +
&USRCLS = '*SECADM') THEN( GOTO OK)
/*-------------------------------------------------------------------*/
/* REFERENCE JOBQ PARAMETER &JOBQ TO SEE IF A POINTER IS SET. */
/* JOBPTY PARAMETER &JOBPTY */
/* RUNPTY PARAMETER &RUNPTY */
/*-------------------------------------------------------------------*/
CHGVAR &JOBQ '*SAME'
MONMSG MCH3601 EXEC(GOTO JOBPTY)
GOTO NOTAUT
JOBPTY:
CHGVAR &JOBPTY '*SAME'
MONMSG MCH3601 EXEC(GOTO RUNPTY)
GOTO NOTAUT
RUNPTY:
CHGVAR &RUNPTY '*SAME'
MONMSG MCH3601 EXEC(GOTO OK)
/*-------------------------------------------------------------------*/
/* USER IS NOT AUTHORIZED TO THE RUNPTY PARAMETER OR JOBQ PARAMETER */
/*-------------------------------------------------------------------*/
NOTAUT:
SNDPGMMSG MSGID(CPD0006) +
MSGF(QSYS/QCPFMSG) +
MSGDTA('0000NOT AUTHORIZED TO CHANGE RUN PRIORITY OR +
JOBQ.') +
TOPGMQ(*PRV) +
MSGTYPE(*DIAG)
SNDPGMMSG MSGID(CPF0002) +
MSGF(QSYS/QCPFMSG) +
TOPGMQ(*PRV) +
MSGTYPE(*ESCAPE)
/*-------------------------------------------------------------------*/
/* REMOVE THE MCH3601 MESSAGE FROM THE JOB MESSAGE QUEUE (JOBLOG) */
/*-------------------------------------------------------------------*/
OK:
RCVMSG MSGQ(*PGMQ) +
MSGTYPE(*LAST) +
RMV(*YES)
RETURN
/*-------------------------------------------------------------------*/
/* ERROR HANDLER */
/*-------------------------------------------------------------------*/
ERROR:
SNDPGMMSG MSGID(CPD0006) +
MSGF(QSYS/QCPFMSG) +
MSGDTA('0000ERROR IN CHGJOB VALIDITY CHECKING PROGRAM. +
SEE JOBLOG.') +
TOPGMQ(*PRV) +
MSGTYPE(*DIAG)
MONMSG (CPF0000 MCH0000)
SNDPGMMSG MSGID(CPF0002) +
MSGF(QSYS/QCPFMSG) +
TOPGMQ(*PRV) +
MSGTYPE(*ESCAPE)
MONMSG (CPF0000 MCH0000)
/*-------------------------------------------------------------------*/
/* END OF PROGRAM */
/*-------------------------------------------------------------------*/
ENDPGM
A blog about IBM i (AS/400), MQ and other things developers or Admins need to know.
星期三, 11月 01, 2023
2002-06-13 如何限制使用者使用 CHGJOB 更改 Job 的 Job Priority 及 Run Priority 或 Batch Job 的 Job Queue ?
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言