如何免手動開關機設定 ASP 硬碟儲存區的臨界值(Threshold Value) ?
AS/400(iSeries)的硬碟儲存區是將許多實體的硬碟(例如 10 顆 36G 的硬碟組合成
一個邏輯磁碟區。)組合而成一個 ASP。系統將之視為與記憶體一體,當記憶體不夠用
時,系統會自動將硬碟區視為記憶體的一部份,已增加系統整體效能,由於有如此功能,
為了防止硬碟空間不足,所以需要設定臨界值來通知相關人員採取適當措施(增加硬碟),
但是要更改這個臨界值,需要手動開機設定,步驟較煩瑣,所以在此介紹利用 System API
來完成這項工作。
此工具可適用於 OS/400 V4R4以後,且須具有 *ALLOBJ 或 *SERVICE 特殊權限者才能執行。
File : QCLSRC
Member: DSPASPC
Type : CLP
Usage : CRTCLPGM DSPASPC
PGM
/* ***************************************************************** */
/* This job uses API QYASPOL to determine the current ASP Threshold. */
/* If this is being run Interactively, the details will be displayed */
/* on the users screen, prior to being written to file ASPTHRESH2, */
/* via Query ASPTHRESH. */
/* */
/* */
/* ***************************************************************** */
/* API parameters */
DCL VAR(&RCVR) TYPE(*CHAR) LEN(116)
DCL VAR(&LEN) TYPE(*CHAR) LEN(4)
DCL VAR(&LIST) TYPE(*CHAR) LEN(80)
DCL VAR(&NUMR) TYPE(*CHAR) LEN(4)
DCL VAR(&NUMF) TYPE(*CHAR) LEN(4)
DCL VAR(&FLTR) TYPE(*CHAR) LEN(16)
DCL VAR(&FMT) TYPE(*CHAR) LEN(8) VALUE('YASP0200')
DCL VAR(&ERR) TYPE(*CHAR) LEN(80)
DCL VAR(&FSIZE) TYPE(*CHAR) LEN(4)
DCL VAR(&FKEY) TYPE(*CHAR) LEN(4)
DCL VAR(&FFDSIZE) TYPE(*CHAR) LEN(4)
DCL VAR(&FDATA) TYPE(*CHAR) LEN(4)
/* Terminal Id */
DCL VAR(&TERMINAL) TYPE(*CHAR) LEN(10)
DCL VAR(&TYPE) TYPE(*CHAR) LEN(1)
/* ASP No */
DCL VAR(&APIASPNO) TYPE(*DEC) LEN(2 0)
DCL VAR(&ASPNO) TYPE(*CHAR) LEN(2)
/* ASP Threshold */
DCL VAR(&APIASPTHLD) TYPE(*DEC) LEN(2 0)
DCL VAR(&ASPTHLD) TYPE(*CHAR) LEN(2)
/* ASP %used */
DCL VAR(&APIASPUSE) TYPE(*CHAR) LEN(5)
DCL VAR(&PERUSED) TYPE(*DEC) LEN(5 2)
/* ASP Total */
DCL VAR(&APIASPTOT) TYPE(*DEC) LEN(11 0)
DCL VAR(&ASPTOT) TYPE(*CHAR) LEN(11)
/* ASP Available */
DCL VAR(&APIASPAVL) TYPE(*DEC) LEN(11 0)
RTVJOBA JOB(&TERMINAL) TYPE(&TYPE)
CREATEFILE: CRTPF FILE(QGPL/ASPTHRESH) RCDLEN(132)
MONMSG MSGID(CPF0000) EXEC(CLRPFM +
FILE(QGPL/ASPTHRESH))
CRTDTAARA: CRTDTAARA DTAARA(QGPL/ASPTHRESH) TYPE(*CHAR) LEN(2) +
TEXT('ASP Threshold')
MONMSG MSGID(CPF0000) EXEC(CHGDTAARA +
DTAARA(QGPL/ASPTHRESH) VALUE(' '))
CHGVAR VAR(%BIN(&FSIZE 1 4)) VALUE(16)
CHGVAR VAR(%BIN(&FKEY 1 4)) VALUE(1)
CHGVAR VAR(%BIN(&FFDSIZE 1 4)) VALUE(4)
CHGVAR VAR(%BIN(&FDATA 1 4)) VALUE(-1)
CHGVAR VAR(&FLTR) VALUE(&FSIZE *CAT &FKEY *CAT +
&FFDSIZE *CAT &FDATA)
CHGVAR VAR(%BIN(&ERR 1 4)) VALUE(80)
CHGVAR VAR(%BIN(&ERR 5 4)) VALUE(0)
CHGVAR VAR(%SST(&ERR 9 72)) VALUE(' ')
CHGVAR VAR(%BIN(&LEN 1 4)) VALUE(116)
CHGVAR VAR(%BIN(&NUMF 1 4)) VALUE(1)
CHGVAR VAR(%BIN(&NUMR 1 4)) VALUE(1)
/* Call API QYASPOL */
CALL PGM(QGY/QYASPOL) PARM(&RCVR &LEN &LIST &NUMR +
&NUMF &FLTR &FMT &ERR)
/* Parse info received from API */
CHGVAR VAR(&APIASPNO) VALUE(%BIN(&RCVR 3 2))
CHGVAR VAR(&APIASPTOT) VALUE(%BIN(&RCVR 9 4))
CHGVAR VAR(&APIASPAVL) VALUE(%BIN(&RCVR 13 4))
CHGVAR VAR(&APIASPTHLD) VALUE(%bin(&RCVR 63 2))
/* Calculate ASP %used */
CHGVAR VAR(&PERUSED) VALUE(100 - ((&APIASPAVL / +
&APIASPTOT) * 100))
/* Move *DEC to *CHAR fields */
CHGVAR VAR(&APIASPUSE) VALUE(&PERUSED)
CHGVAR VAR(&ASPTOT) VALUE(&APIASPTOT)
CHGVAR VAR(&ASPNO) VALUE(&APIASPNO)
CHGVAR VAR(&ASPTHLD) VALUE(&APIASPTHLD)
IF COND(&TYPE *EQ '0') THEN(GOTO CMDLBL(BATCH))
SNDBRKMSG MSG('ASP No: ' *CAT &ASPNO *CAT ' ASP +
%Threshold: ' *CAT &ASPTHLD *CAT ' +
ASP %Used: ' *CAT &APIASPUSE) +
TOMSGQ(&TERMINAL)
batch:
/* Set up file ASPTHRESH2, containing ASP Threshold% */
CHGDTAARA DTAARA(QGPL/ASPTHRESH) VALUE(&ASPTHLD)
DSPDTAARA DTAARA(QGPL/ASPTHRESH) OUTPUT(*PRINT)
CPYSPLF FILE(QPDSPDTA) TOFILE(QGPL/ASPTHRESH) +
SPLNBR(*LAST) MBROPT(*REPLACE)
RUNQRY: RUNQRY QRYFILE((ASPTHRESH))
ENDPGM
File : QCMDSRC
Member: DSPASP
Type : CMD
Usage : CRTCMD CMD(your-lib/DSPASP) PGM(your-lib/DSPASPC)
/* CPP DSPASPC */
CMD PROMPT('Display ASP Threshold')
File : QCLSRC
Member: CHGASPC
Type : CLP
Usage : CRTCLPGM CHGASPC
/**********************/
/* COMMAND CHGASP CPP */
/**********************/
PGM PARM(&ASP &THRESHOLD)
DCL VAR(&TERMINAL) TYPE(*CHAR) LEN(10)
DCL VAR(&ASP) TYPE(*CHAR) LEN(4)
DCL VAR(&THRESHOLD) TYPE(*CHAR) LEN(4)
DCL VAR(&COUNTER) TYPE(*DEC) LEN(1)
/* API parameters */
DCL VAR(&HANDLE) TYPE(*CHAR) LEN(8)
DCL VAR(&ERROR) TYPE(*CHAR) LEN(96)
DCL VAR(&BYTESPROV) TYPE(*CHAR) LEN(4)
DCL VAR(&BYTESAVAIL) TYPE(*CHAR) LEN(4)
DCL VAR(&EXCEPID) TYPE(*CHAR) LEN(7)
DCL VAR(&RESERVED) TYPE(*CHAR) LEN(1)
DCL VAR(&EXCEPDATA) TYPE(*CHAR) LEN(80)
DCL VAR(&OPKEY) TYPE(*CHAR) LEN(4)
DCL VAR(&OPVAR) TYPE(*CHAR) LEN(8)
DCL VAR(&OPVARLEN) TYPE(*CHAR) LEN(4)
DCL VAR(&FORMAT) TYPE(*CHAR) LEN(8) +
VALUE('DMOP0100')
DCL VAR(&ASPNO) TYPE(*CHAR) LEN(4)
DCL VAR(&ASPTHRESH) TYPE(*CHAR) LEN(4)
RTVJOBA JOB(&TERMINAL)
/* Start DASD Management Session - QYASSDMS API */
CHGVAR VAR(%BIN(&BYTESPROV 1 4)) VALUE(0)
CHGVAR VAR(&ERROR) VALUE(&BYTESPROV *CAT +
&BYTESAVAIL *CAT &EXCEPID *CAT &RESERVED +
*CAT &EXCEPDATA)
STARTSESS: CALL PGM(QYASSDMS) PARM(&HANDLE &ERROR)
MONMSG MSGID(CPFBA21) EXEC(DO) /* session already +
active */
CHGVAR VAR(&COUNTER) VALUE(&COUNTER + 1)
IF COND(&COUNTER *EQ 3) THEN(DO)
SNDBRKMSG MSG('CHGASP: DASD Management session still +
in use - job will now end') TOMSGQ(&TERMINAL)
GOTO CMDLBL(END)
ENDDO
SNDBRKMSG MSG('DASD Management session still in use - +
please wait for 6 mins to allow the +
previous session to end. Press enter to +
continue.') TOMSGQ(&TERMINAL)
DLYJOB DLY(360)
GOTO CMDLBL(STARTSESS)
ENDDO
/* Start DASD Management Operation - QYASSDMO API */
CHGVAR VAR(%BIN(&OPKEY 1 4)) VALUE(1)
CHGVAR VAR(%BIN(&aspno 1 4)) VALUE(&ASP)
CHGVAR VAR(%BIN(&ASPTHRESH 1 4)) VALUE(&THRESHOLD)
CHGVAR VAR(&OPVAR) VALUE(&ASPNO *CAT &ASPTHRESH)
CALL PGM(QYASSDMO) PARM(&HANDLE &OPKEY &OPVAR +
&OPVARLEN &FORMAT &ERROR)
/* End DASD Management Operation - QYASEDMO API */
CALL PGM(QYASEDMO) PARM(&HANDLE &ERROR)
MONMSG MSGID(CPFBA46) /* not active */
/* End DASD Management Session - QYASEDMS API */
CALL PGM(QYASEDMS) PARM(&HANDLE &ERROR)
DSPASP
MONMSG MSGID(CPF0000)
END: ENDPGM
File : QCMDSRC
Member: CHGASP
Type : CMD
Usage : CRTCMD CMD(your-lib/CHGASP) PGM (your-lib/CHGASPC)
/* CPP CHGASPC */
CMD PROMPT(' Set ASP Threshold ')
PARM KWD(ASP) TYPE(*CHAR) LEN(4) RSTD(*NO) +
DFT('1') CHOICE(' Eg ''1'' ') +
PROMPT('Enter ASP No: ''1'', ''2'' etc ')
PARM KWD(THRESHOLD) TYPE(*CHAR) LEN(4) RSTD(*NO) +
DFT('80') CHOICE(' Eg ''80'' ') +
PROMPT('Enter ASP Threshold')
A blog about IBM i (AS/400), MQ and other things developers or Admins need to know.
星期一, 11月 06, 2023
2003-05-13 如何免手動開關機設定 ASP 硬碟儲存區的臨界值(Threshold Value) (Command DSPASP, CHGASP)?
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言