如何擷取 Outq 的屬性?(Command RTVOUTQA with API QSPROUTQ)
File : QCLSRC
Member : RTVOUTQAC
Type : CLP
Usage : CRTCLPGM RTVOUTQAC
/*-------------------------------------------------------------------*/
/* */
/* Program . . : RTVOUTQAC */
/* Description : Retrieve output queue attributes */
/* - CPP for RTVOUTQA */
/* */
/* Author . . : Vengoal Chang */
/* Date . . . : 2008/11/18 */
/* */
/* Compile options: */
/* CrtClPgm Pgm( RTVOUTQAC ) */
/* SrcFile( QCLSRC ) */
/* SrcMbr( *PGM ) */
/* */
/*-------------------------------------------------------------------*/
PGM PARM(&OUTQFULL &RTNLIB &DSPDTA &JOBSEP +
&OPRCTL &SEQ &AUTCHK &DTAQ &DTAQL +
&NBRFILES &QSTATUS &WTRNAM &WTRUSR +
&WTRNBR &WTRSTS &PRTDEV +
&MSGQ &MSGQL &RMTSYSNAMT &RMTSYSNAME +
&NBRWTRS &CNNTYPE &DESTTYPE &TRANSFORM +
&MFRTYPMDL &WSCST &WSCSTL &IMGCFG +
&CLASS &FCB &SEPPAGE &RMTPRTQ &TEXT)
DCL &OUTQFULL *CHAR LEN(20)
DCL &OUTQ *CHAR LEN(10)
DCL &LIB *CHAR LEN(10)
DCL &QLFDNAME *CHAR LEN(20)
DCL &LEN *CHAR LEN(4)
DCL &PARM *CHAR LEN(2000)
DCL &ERRCDE *CHAR LEN(4)
DCL &DEC9 *DEC LEN(9 0)
DCL &CHAR22 *CHAR LEN(22)
DCL &RTNLIB *CHAR LEN(10)
DCL &DSPDTA *CHAR LEN(4)
DCL &JOBSEP *CHAR LEN(4)
DCL &OPRCTL *CHAR LEN(4)
DCL &DTAQ *CHAR LEN(10)
DCL &DTAQL *CHAR LEN(10)
DCL &SEQ *CHAR LEN(7)
DCL &AUTCHK *CHAR LEN(7)
DCL &NBRFILES *DEC LEN(9 0)
DCL &QSTATUS *CHAR LEN(10)
DCL &WTRNAM *CHAR LEN(10)
DCL &WTRUSR *CHAR LEN(10)
DCL &WTRNBR *CHAR LEN(6)
DCL &WTRSTS *CHAR LEN(10)
DCL &PRTDEV *CHAR LEN(10)
DCL &MSGQ *CHAR LEN(10)
DCL &MSGQL *CHAR LEN(10)
DCL &RMTSYSNAMT *CHAR LEN(1)
/* 0 No remote system name specified */
/* 1 Output is routed to the system using pass-throug */
/* 2 The name of the remote system */
/* 3 Internet address */
DCL &RMTSYSNAME *CHAR LEN(255)
/* value based on the Remote System Name Type */
/* If 0 Blank */
/* If 1 Blank */
/* If 2 System name */
/* If 3 Internet address (15 bytes) */
DCL &NBRWTRS *DEC LEN(5 0)
DCL &CNNTYPE *CHAR LEN(10)
DCL &DESTTYPE *CHAR LEN(10)
DCL &TRANSFORM *CHAR LEN(4)
DCL &MFRTYPMDL *CHAR LEN(17)
DCL &WSCST *CHAR LEN(10)
DCL &WSCSTL *CHAR LEN(10)
DCL &IMGCFG *CHAR LEN(10)
DCL &CLASS *CHAR LEN(1)
DCL &FCB *CHAR LEN(10)
DCL &SEPPAGE *CHAR LEN(4)
DCL &RMTPRTQ *CHAR LEN(128)
DCL &TEXT *CHAR LEN(50)
DCL &WORKN *DEC LEN(5 0)
/*-- Global error monitoring: --------------------------------------*/
MonMsg CPF0000 *N GoTo Error
CHGVAR &OUTQ %SST(&OUTQFULL 1 10)
CHGVAR &LIB %SST(&OUTQFULL 11 10)
CHKOBJ OBJ(&LIB/&OUTQ) OBJTYPE(*OUTQ)
CHGVAR &QLFDNAME (&OUTQ *CAT &LIB)
CHGVAR %BIN(&LEN 1 4) 1000
CHGVAR %BIN(&ERRCDE 1 4) 0
/* Use API to access info */
CALL QSPROUTQ PARM(&PARM &LEN OUTQ0100 +
&QLFDNAME &ERRCDE)
RTNLIB: CHGVAR &RTNLIB %SST(&PARM 19 10)
MONMSG MSGID(MCH3601)
SEQ: CHGVAR &SEQ %SST(&PARM 29 10)
MONMSG MSGID(MCH3601)
DSPDTA: CHGVAR &DSPDTA %SST(&PARM 39 10)
MONMSG MSGID(MCH3601)
JOBSEP: CHGVAR &DEC9 %BIN(&PARM 49 4)
IF (&DEC9 *EQ -2) DO /* *MSG */
CHGVAR &JOBSEP '*MSG'
MONMSG MSGID(MCH3601)
ENDDO /* *MSG */
IF (&DEC9 *NE -2) DO /* Use digits */
CHGVAR &CHAR22 &DEC9
CHGVAR &JOBSEP &CHAR22
MONMSG MSGID(MCH3601)
ENDDO /* Use digits */
OPRCTL: CHGVAR &OPRCTL %SST(&PARM 53 10)
MONMSG MSGID(MCH3601)
DTAQ: CHGVAR &DTAQ %SST(&PARM 63 10)
MONMSG MSGID(MCH3601)
DTAQL: CHGVAR &DTAQL %SST(&PARM 73 10)
MONMSG MSGID(MCH3601)
AUTCHK: CHGVAR &AUTCHK %SST(&PARM 83 10)
MONMSG MSGID(MCH3601)
NBRFILES: CHGVAR &NBRFILES %BIN(&PARM 93 4)
MONMSG MSGID(MCH3601)
QSTATUS: CHGVAR &QSTATUS %SST(&PARM 97 10)
MONMSG MSGID(MCH3601)
WTRNAM: CHGVAR &WTRNAM %SST(&PARM 107 10)
MONMSG MSGID(MCH3601)
WTRUSR: CHGVAR &WTRUSR %SST(&PARM 117 10)
MONMSG MSGID(MCH3601)
WTRNBR: CHGVAR &WTRNBR %SST(&PARM 127 6)
MONMSG MSGID(MCH3601)
/* The following offsets do not agree */
/* with the V2R2 manual */
WTRSTS: CHGVAR &WTRSTS %SST(&PARM 133 10)
MONMSG MSGID(MCH3601)
PRTDEV: CHGVAR &PRTDEV %SST(&PARM 143 10)
MONMSG MSGID(MCH3601)
MSGQ: CHGVAR &MSGQ %SST(&PARM 601 10)
MONMSG MSGID(MCH3601)
MSGQL: CHGVAR &MSGQL %SST(&PARM 611 10)
MONMSG MSGID(MCH3601)
RMTSYSNAMT: CHGVAR &RMTSYSNAMT %SST(&PARM 217 1)
MONMSG MSGID(MCH3601)
RMTSYSNAME: CHGVAR &RMTSYSNAME %SST(&PARM 218 255)
MONMSG MSGID(MCH3601)
NBRWTRS: CHGVAR &NBRWTRS %BIN(&PARM 209 4)
MONMSG MSGID(MCH3601)
CNNTYPE: CHGVAR &WORKN %BIN(&PARM 621 4)
IF (&WORKN *EQ 0) DO
CHGVAR &CNNTYPE '*NONE'
MONMSG MSGID(MCH3601)
ENDDO
IF (&WORKN *EQ 1) DO
CHGVAR &CNNTYPE '*SNA'
MONMSG MSGID(MCH3601)
ENDDO
IF (&WORKN *EQ 2) DO
CHGVAR &CNNTYPE '*IP'
MONMSG MSGID(MCH3601)
ENDDO
IF (&WORKN *EQ 3) DO
CHGVAR &CNNTYPE '*IPX'
MONMSG MSGID(MCH3601)
ENDDO
IF (&WORKN *EQ 5) DO
CHGVAR &CNNTYPE '*USRDFN'
MONMSG MSGID(MCH3601)
ENDDO
DESTTYPE: CHGVAR &WORKN %BIN(&PARM 625 4)
IF (&WORKN *EQ 0) DO
CHGVAR &DESTTYPE '*NONE'
MONMSG MSGID(MCH3601)
ENDDO
IF (&WORKN *EQ 1) DO
CHGVAR &DESTTYPE '*OS400'
MONMSG MSGID(MCH3601)
ENDDO
IF (&WORKN *EQ 2) DO
CHGVAR &DESTTYPE '*OS400V2'
MONMSG MSGID(MCH3601)
ENDDO
IF (&WORKN *EQ 3) DO
CHGVAR &DESTTYPE '*S390'
MONMSG MSGID(MCH3601)
ENDDO
IF (&WORKN *EQ 4) DO
CHGVAR &DESTTYPE '*PSF2'
MONMSG MSGID(MCH3601)
ENDDO
IF (&WORKN *EQ 5) DO
CHGVAR &DESTTYPE '*PSF2'
MONMSG MSGID(MCH3601)
ENDDO
IF (&WORKN *EQ 6) DO
CHGVAR &DESTTYPE '*NETWARE3'
MONMSG MSGID(MCH3601)
ENDDO
IF (&WORKN *EQ 7) DO
CHGVAR &DESTTYPE '*NETWARE4'
MONMSG MSGID(MCH3601)
ENDDO
IF (&WORKN *EQ -1) DO
CHGVAR &DESTTYPE '*OTHER'
MONMSG MSGID(MCH3601)
ENDDO
TRANSFORM: IF (%SST(&PARM 638 1) *EQ '1') DO
CHGVAR &TRANSFORM '*YES'
MONMSG MSGID(MCH3601)
ENDDO
ELSE DO
CHGVAR &TRANSFORM '*NO'
MONMSG MSGID(MCH3601)
ENDDO
MFRTYPMDL: CHGVAR &MFRTYPMDL %SST(&PARM 639 17)
MONMSG MSGID(MCH3601)
WSCST: CHGVAR &WSCST %SST(&PARM 656 10)
MONMSG MSGID(MCH3601)
WSCSTL: CHGVAR &WSCSTL %SST(&PARM 666 10)
MONMSG MSGID(MCH3601)
IMGCFG: CHGVAR &IMGCFG %SST(&PARM 1074 10)
MONMSG MSGID(MCH3601)
CLASS: CHGVAR &CLASS %SST(&PARM 629 1)
MONMSG MSGID(MCH3601)
FCB: CHGVAR &FCB %SST(&PARM 630 8)
MONMSG MSGID(MCH3601)
SEPPAGE: IF (%SST(&PARM 818 1) *EQ '1') DO
CHGVAR &SEPPAGE '*YES'
MONMSG MSGID(MCH3601)
ENDDO
ELSE DO
CHGVAR &SEPPAGE '*NO'
MONMSG MSGID(MCH3601)
ENDDO
RMTPRTQ: CHGVAR &RMTPRTQ %SST(&PARM 819 255)
MONMSG MSGID(MCH3601)
TEXT: CHGVAR &TEXT %SST(&PARM 153 50)
MONMSG MSGID(MCH3601)
RMVMSG CLEAR(*ALL)
RETURN /* Normal end of program */
/*-- Error processor ------------------------------------------------*/
Error:
Call QMHMOVPM ( ' ' +
'*DIAG' +
x'00000001' +
'*PGMBDY ' +
x'00000001' +
x'0000000800000000' +
)
Call QMHRSNEM ( ' ' +
x'0000000800000000' +
)
EndPgm:
EndPgm
File : QCMDSRC
Member : RTVOUTQA
Type : CMD
Usage : CRTCMD CMD(RTVOUTQA) PGM(RTVOUTQAC) SRCFILE( YourSourceFile ) ALLOW(*IPGM *BPGM)
/* =============================================================== */
/* = Command....... RtvOutQA = */
/* = CPP........... RtvOutQA CLP = */
/* = Description... Retrieve Output Queue Attributes = */
/* = = */
/* = The RTVOUTQA command retrieves the information produced by = */
/* = the QSPROUTQ API. One or more parameters may be returned = */
/* = = */
/* = CrtCmd Cmd( RtvOutQA ) = */
/* = Pgm( RtvOutQAC ) = */
/* = SrcFile( YourSourceFile ) = */
/* = Allow(*Ipgm *Bpgm) = */
/* =============================================================== */
/* = Date : 2008/11/18 = */
/* = Author: Vengoal Chang = */
/* =============================================================== */
CMD PROMPT('Retrieve Out Queue Attr - TAA')
PARM KWD(OUTQ) TYPE(QUAL1) MIN(1) +
PROMPT('Output queue')
PARM KWD(RTNLIB) TYPE(*CHAR) LEN(10) RTNVAL(*YES) +
PROMPT('Actual library name (10)')
PARM KWD(DSPDTA) TYPE(*CHAR) LEN(4) RTNVAL(*YES) +
PROMPT('Display data (4)')
PARM KWD(JOBSEP) TYPE(*CHAR) LEN(4) RTNVAL(*YES) +
PROMPT('Job separator (4)')
PARM KWD(OPRCTL) TYPE(*CHAR) LEN(4) RTNVAL(*YES) +
PROMPT('Operator control (4)')
PARM KWD(SEQ) TYPE(*CHAR) LEN(7) RTNVAL(*YES) +
PROMPT('Qutput sequence (7)')
PARM KWD(AUTCHK) TYPE(*CHAR) LEN(7) RTNVAL(*YES) +
PROMPT('Authority check (7)')
PARM KWD(DTAQ) TYPE(*CHAR) LEN(10) RTNVAL(*YES) +
PROMPT('Data queue (10)')
PARM KWD(DTAQL) TYPE(*CHAR) LEN(10) RTNVAL(*YES) +
PROMPT('Data queue library (10)')
PARM KWD(NBRFILES) TYPE(*DEC) LEN(9 0) +
RTNVAL(*YES) +
PROMPT('Number of files (9 0)')
PARM KWD(QSTATUS) TYPE(*CHAR) LEN(10) +
RTNVAL(*YES) +
PROMPT('Output queue status (10)')
PARM KWD(WTRNAM) TYPE(*CHAR) LEN(10) +
RTNVAL(*YES) +
PROMPT('Writer job name (10)')
PARM KWD(WTRUSR) TYPE(*CHAR) LEN(10) +
RTNVAL(*YES) +
PROMPT('Writer user name (10)')
PARM KWD(WTRNBR) TYPE(*CHAR) LEN(6) +
RTNVAL(*YES) +
PROMPT('Writer job number (6)')
PARM KWD(WTRSTS) TYPE(*CHAR) LEN(10) +
RTNVAL(*YES) +
PROMPT('Writer status (10)')
PARM KWD(PRTDEV) TYPE(*CHAR) LEN(10) +
RTNVAL(*YES) +
PROMPT('Printer device name (10)')
PARM KWD(MSGQ) TYPE(*CHAR) LEN(10) +
RTNVAL(*YES) +
PROMPT('Message queue (10)')
PARM KWD(MSGQLIB) TYPE(*CHAR) LEN(10) +
RTNVAL(*YES) +
PROMPT('Message queue library (10)')
PARM KWD(RMTSYSNAMT) TYPE(*CHAR) LEN(1 ) +
RTNVAL(*YES) +
PROMPT('Remote system name type (1)')
PARM KWD(RMTSYSNAME) TYPE(*CHAR) LEN(255) +
RTNVAL(*YES) +
PROMPT('Remote system name type (255)')
PARM KWD(NBRWTRS) TYPE(*DEC ) LEN(5 0) +
RTNVAL(*YES) +
PROMPT('Number of writers (5 0)')
PARM KWD(CNNTYPE) TYPE(*CHAR) LEN(10) +
RTNVAL(*YES) +
PROMPT('Connection type (10)')
PARM KWD(DESTTYPE) TYPE(*CHAR) LEN(10) +
RTNVAL(*YES) +
PROMPT('Destination type (10)')
PARM KWD(TRANSFORM) TYPE(*CHAR) LEN( 4) +
RTNVAL(*YES) +
PROMPT('Transformon (4)')
PARM KWD(MFRTYPMDL) TYPE(*CHAR) LEN(17) +
RTNVAL(*YES) +
PROMPT('Manufacture Type and Model(17)')
PARM KWD(WSCST ) TYPE(*CHAR) LEN(10) +
RTNVAL(*YES) +
PROMPT('Workstation CST Object (10)')
PARM KWD(WSCSTL ) TYPE(*CHAR) LEN(10) +
RTNVAL(*YES) +
PROMPT('Workstation CST Object Lib(10)')
PARM KWD(IMGCFG ) TYPE(*CHAR) LEN(10) +
RTNVAL(*YES) +
PROMPT('Image configuration (10)')
PARM KWD(CLASS ) TYPE(*CHAR) LEN(1 ) +
RTNVAL(*YES) +
PROMPT('VM/VMS class (1)')
PARM KWD(FCB ) TYPE(*CHAR) LEN(10) +
RTNVAL(*YES) +
PROMPT('Forms control buffer (10)')
PARM KWD(SEPPAG ) TYPE(*CHAR) LEN( 4) +
RTNVAL(*YES) +
PROMPT('Separator page (4)')
PARM KWD(RMTPRTQ ) TYPE(*CHAR) LEN(128) +
RTNVAL(*YES) +
PROMPT('Remote printer queue (128)')
PARM KWD(TEXT) TYPE(*CHAR) LEN(50) RTNVAL(*YES) +
PROMPT('Text description (50)')
QUAL1: QUAL TYPE(*NAME) LEN(10) MIN(1) EXPR(*YES)
QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) +
SPCVAL((*LIBL)) EXPR(*YES) +
PROMPT('Library name')
File : QCLSRC
Member : RTVOUTQAT
Type : CLP
Usage : CRTCLPGM RTVOUTQAT
測試程式 CALL RTVOUTQAT
PGM
DCL &AUTCHK *CHAR 7
DCL &JOBSEP *CHAR 4
DCL &OPRCTL *CHAR 4
DCL &MSG *CHAR 256
DCL &NBRFILES *DEC 9 0
DCL &NBRFILESC *CHAR 9
DCL &MSGQ *CHAR 10
DCL &MSGQL *CHAR 10
DCL &TRANSFORM *CHAR 4
DCL &CNNTYPE *CHAR 10
DCL &DSTTYPE *CHAR 10
DCL &SEPPAGE *CHAR 10
DCL &RMTSYSTYPE *CHAR 1
RTVOUTQA OUTQ(QPRINT) JOBSEP(&JOBSEP) OPRCTL(&OPRCTL) +
AUTCHK(&AUTCHK) NBRFILES(&NBRFILES) +
MSGQ(&MSGQ) MSGQLIB(&MSGQL) +
RMTSYSNAMT(&RMTSYSTYPE) CNNTYPE(&CNNTYPE) +
DESTTYPE(&DSTTYPE) TRANSFORM(&TRANSFORM) +
SEPPAG(&SEPPAGE)
CHGVAR &NBRFILESC &NBRFILES
CHGVAR &MSG (&JOBSEP *BCAT &OPRCTL *BCAT &NBRFILESC)
DMPCLPGM
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&MSG) +
MSGTYPE(*COMP)
ENDPGM
A blog about IBM i (AS/400), MQ and other things developers or Admins need to know.
星期三, 11月 08, 2023
2008-11-18 如何擷取 Outq 的屬性?(Command RTVOUTQA with API QSPROUTQ)
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言