如何限制 SYSREQ (System request) 功能 ?
System Request
System: xxxxxxx
Select one of the following:
1. Display sign on for alternative job
2. End previous request
3. Display current job
4. Display messages
5. Send a message
6. Display system operator messages
7. Display work station user
80. Disconnect job
90. Sign off
!
Bottom
Selection
F3=Exit F12=Cancel
(C) COPYRIGHT IBM CORP. 1980, 2002.
========================================================================================
這些選項相關的指令放置於訊息檔 QCPFMSG 的 MSGID CPX2313 中, 可以由 DSPMSGD CPX2313取得,
Select Message Details to Display
System: xxxxxxx
Message ID . . . . . . . . . : CPX2313
Message file . . . . . . . . : QCPFMSG
Library . . . . . . . . . : QSYS
Message text . . . . . . . . : ENDRQS WRKJOB DSPMSG SNDMSG SI
GNOFF DSPMSG DSCJOB DSPWSUSR ENDRDBRQS
Select one of the following:
1. Display message text
5. Display message attributes
30. All of the above
!
Selection
F3=Exit F12=Cancel
========================================================================================
其中選項 1 是開啟第二個 SignOn 畫面, 便於同時有兩個工作互相切換,此時當然只有一個工作是
執行中,另一個在背景等待 SYSREQ 1 切換能繼續執行.
選項 2 (ENDRQS) 是終止目前執行中的作業, 這個功能最令 IT 人員既愛又恨, 因為它可以將某些不
正常執行的線上作業馬上終止, 但是一般使用者若是使用這個功能時, 就令人討厭了, 因為它也會造
成正常作業因為不正常結束導致 IT 人員需要做其他相關回復動作.
選項 3 (DSPJOB)是顯示目前作業的相關屬性, 或檢視報表. 這可以透過 WRKMSG QCPFMSG 找到
CPX2313 使用選項 2 更改 DSPJOB 為 WRKJOB, 相信管理目前工作相關報表會很好用, 不過要記住更換
時, 不能多於六個英文字, 因為這個訊息中每個指令的內容長度是固定的, 所以 DSPJOB 可以改 WRKJOB.
其餘的我就不多說了.
有些應用軟體或環境需要限制 SYSREQ (System request) 所有功能, 應該要如何做呢 ?
這就需要透過系統提供的 System Request Exit Point: QIBM_QWT_SYSREQPGMS(V3R7 開始才有)
及設定 User Profile 才能達成.
* 要啟用時, 需將 Exit program 加入 Exit point:
* ADDEXITPGM EXITPNT(QIBM_QWT_SYSREQPGMS)
* FORMAT(SREQ0100) PGMNBR(1)
* PGM(QGPL/SYSREQEXIT)
* 要取消此功能時請使用下列指令移除
* RMVEXITPGM EXITPNT(QIBM_QWT_SYSREQPGMS) FORMAT(SREQ0100) PGMNBR(1)
* 設定要限制某些人存取 SYSREQ 功能
* 限制!
==> CALL SETATNINF ('user-profile' '1')
* 解除限制 ==> CALL SETATNINF ('user-profule' '0')
File : QRPGLESRC
Member: SYSREQEXIT
Type : RPGLE
Usage : CRTBNDRPG PGM(SYSREQEXIT)
****************************************************************************
*
* To compile: CRTBNDRPG PGM(QGPL/SYSREQEXIT) SRCFILE(xxx/QRPGLESRC)
* SRCMBR(SYSREQEXIT)
*
****************************************************************************
* Attach this program to the Exit Point: QIBM_QWT_SYSREQPGMS
* Use WRKREGINF to add the exit program to QIBM_QWT_SYSREQPGMS or
*
* For any users that you wish to deny access to the attention key menu
* set the paramater SysReqDsp to anything other than 1.
*
* NOTE: To enable this exit program to be called, you must set the user
* profile so that it will look for this exit program. You do that
* by calling the API QWTSETPX for each user profile and tell it which
* of the eight possible exit programs can be called for this exit
* point, which one to call for that profile.
*
* The RPGLE program named xxx/SETATNINF can be called, passing
* to it as a parameter the user profile you wish to block from using
* the attention key menu.
****************************************************************************
*
H Debug
*
DPgmDs SDS
D JobName 244 253
D UserName 254 263
D JobNumber 264 269
**-- API error data structure: ----------------------------------
D ApiError Ds
D AeBytPrv 10i 0 Inz( %Size( ApiError ))
D AeBytAvl 10i 0
D AeExcpId 7a
D !
1a
D AeExcpDta 128a
**-- Send message: ----------------------------------------------
D SndMsg Pr ExtPgm( 'QMHSNDDM' )
D SmMsgId 7a Const
D SmMsgFq 20a Const
D SmMsgDta 512a Const Options( *VarSize )
D SmMsgDtaLen 10i 0 Const
D SmMsgTyp 10a Const
D SmMsgQq 1000a Const Options( *VarSize )
D SmMsgQnbr 10i 0 Const
D SmMsgQrpy 20a Const
D SmMsgKey 4a
D SmError 10i 0 Const
D SysReqDsp S 10i 0
D SysUsrDta S 128a
D MsgKey s 4a
D Msg_Str S 256
*=====================================================================
C *Entry Plist
C Parm SysReqDsp
C Parm SysUsrDta
*
C Eval SysReqDsp = 0
*
* Send Info message
*
C Eval Msg_Str = '** User ' + %trim(UserName) +
C ' is not authorized to ' +
C 'System request function!'
C Callp(e) SndMsg(
C 'CPF9897':'QCPFMSG *LIBL ':
C msg_str: 256 :
C '*INFO ':
C 'QSYSOPR *LIBL ':
C 1: *blanks : msgkey :
C 0)
C* ApiError)
C
*
C Eval *Inlr = *On
File : QRPGLESRC
Member: SETATNINF
Type : RPGLE
Usage : CRTBNDRPG PGM(SETATNINF)
限制 ==> CALL SETATNINF ('user-profile' '1')
解除限制 ==> CALL SETATNINF ('user-profule' '0')
**************************************************************************
* Sets User Profile Information for Attention Key Exit Program Processing
*
* You MUST pass the user profile for that user to this
* program in order to change the profile for that user
*
**************************************************************************
*
* To Create: CrtBndRPG(xxx/SETATNINF)
*
***************************************************************************
H DFTACTGRP(*NO) BNDDIR('QC2LE')
**----------------------------------------------------------------
** Set Profile Exit Programs API
**
** Parameters:
** NumEnt = Number of Exit Program flags being passed in
** ExtFlags = Array of number of elements (1 to 8).
** - 0 = Don't Call
** - 1 = Yes Call
** - -1 = Do Not Change This Value
** Format = 'ATTN0100' - Preattention Key program processing flags
** = 'SREQ0100' - System Request program processing flags
** UserID = The user profile to update
** ErrorCode = API error code, used to return any errors.
**
**----------------------------------------------------------------
D SetProfExt PR ExtPgm('QWTSETPX')
D NumEnt 10i 0 const
D ExtFlags 10i 0 DIM(8) const
D Format 8a const
D UserID 10A const
D ErrorCode 32766A options(*varsize: *nopass)
D ErrDs DS
!
D BytesPrv 1 4I 0 INZ(256)
D BytesAvl 5 8I 0 INZ(0)
D ErrMsgID 9 15
D Reserved 16 16
D ErrMsgDta 17 256
DToUser S 10a
DEnable S 1a
*
C *Entry Plist
C Parm ToUser
C Parm Enable
*
c If Enable = '1'
c callp SetProfExt(1:1:'SREQ0100':ToUser:ErrDS)
c callp SetProfExt(1:1:'ATTN0100':ToUser:ErrDS)
c Else
c callp SetProfExt(1:0:'SREQ0100':ToUser:ErrDS)
c callp SetProfExt(1:0:'ATTN0100':ToUser:ErrDS)
c EndIf
C Eval *Inlr = *On
A blog about IBM i (AS/400), MQ and other things developers or Admins need to know.
星期二, 11月 07, 2023
2006-03-23 如何限制 SYSREQ (System request) 功能 ?
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言