工具:RTVSPLFA 擷取報表 Spooled file 屬性
File : QCLSRC
Member: RTVSPLFAC
Type : CLP
Usage : CRTCLPGM RTVSPLFAC
PGM PARM(&SPLF &FULLJOB &SPLNBR &FORMTYPE &OUTPTY +
&CPYLEFT &COPIES &MAXRCDS &FILESEP +
&SCHEDULE &HOLD &SAVE &DEVTYPE &PRTTYPE +
&DEVFILE &DEVFILEL &USRDTA &ACGCDE &OPNPGM +
&OPNPGML &OPNDAT &OPNTIM &PAGWTN &TOTPAG +
&RCDLEN &PAGLEN &PAGWDT &LPI &CPI &OVRFLW +
&FOLD &CTLCHAR &RPLUNPRT &ALIGN &PRTQLTY +
&FORMFEED &DRAWER &FONT &PAGRTT &JUSTIFY)
DCL &SPLF *CHAR LEN(10)
DCL &FULLJOB *CHAR LEN(26)
DCL &JOB *CHAR LEN(10)
DCL &USER *CHAR LEN(10)
DCL &JOBNBR *CHAR LEN(6)
DCL &SPLNBR *CHAR LEN(5)
DCL &SPLNBRD *DEC LEN(9 0)
DCL &SPLNBRB *CHAR LEN(4)
DCL &DATSEP *CHAR LEN(1)
DCL &FORMTYPE *CHAR LEN(10)
DCL &OUTPTY *CHAR LEN(1)
DCL &CPYLEFT *CHAR LEN(3)
DCL &COPIES *CHAR LEN(3)
DCL &MAXRCDS *CHAR LEN(10)
DCL &FILESEP *CHAR LEN(1)
DCL &SCHEDULE *CHAR LEN(8)
DCL &HOLD *CHAR LEN(4)
DCL &SAVE *CHAR LEN(4)
DCL &DEVTYPE *CHAR LEN(10)
DCL &PRTTYPE *CHAR LEN(5)
DCL &DEVFILE *CHAR LEN(10)
DCL &DEVFILEL *CHAR LEN(10)
DCL &USRDTA *CHAR LEN(10)
DCL &ACGCDE *CHAR LEN(15)
DCL &OPNPGM *CHAR LEN(10)
DCL &OPNPGML *CHAR LEN(10)
DCL &OPNDAT *CHAR LEN(8)
DCL &OPNTIM *CHAR LEN(8)
DCL &PAGWTN *CHAR LEN(10)
DCL &TOTPAG *CHAR LEN(10)
DCL &RCDLEN *CHAR LEN(5)
DCL &PAGLEN *CHAR LEN(3)
DCL &PAGWDT *CHAR LEN(3)
DCL &LPI *CHAR LEN(1)
DCL &CPI *CHAR LEN(2)
DCL &OVRFLW *CHAR LEN(3)
DCL &FOLD *CHAR LEN(4)
DCL &CTLCHAR *CHAR LEN(5)
DCL &RPLUNPRT *CHAR LEN(4)
DCL &ALIGN *CHAR LEN(4)
DCL &PRTQLTY *CHAR LEN(6)
DCL &FORMFEED *CHAR LEN(8)
DCL &DRAWER *CHAR LEN(1)
DCL &FONT *CHAR LEN(5)
DCL &PAGRTT *CHAR LEN(5)
DCL &JUSTIFY *CHAR LEN(3)
DCL &DS *CHAR LEN(1000)
DCL &DSLEND *DEC LEN(9 0)
DCL &DSLENB *CHAR LEN(4)
DCL &QLFJOB *CHAR LEN(26)
DCL &INTJOB *CHAR LEN(16)
DCL &INTSPLF *CHAR LEN(16)
DCL &WORK4 *CHAR LEN(4)
DCL &WORK6 *CHAR LEN(6)
DCL &DEC9 *DEC LEN(9 0)
DCL &WORK9 *CHAR LEN(9)
DCL &ERRORSW *LGL /* Standard error */
DCL &MSGID *CHAR LEN(7) /* Standard error */
DCL &MSG *CHAR LEN(512) /* Standard error */
DCL &MSGDTA *CHAR LEN(512) /* Standard error */
DCL &MSGF *CHAR LEN(10) /* Standard error */
DCL &MSGFLIB *CHAR LEN(10) /* Standard error */
DCL &KEYVAR *CHAR LEN(4) /* Standard error */
DCL &KEYVAR2 *CHAR LEN(4) /* Standard error */
DCL &RTNTYPE *CHAR LEN(2) /* Standard error */
MONMSG MSGID(MCH3601)
MONMSG MSGID(CPF0000) EXEC(GOTO STDERR1) /* Std err */
RTVSYSVAL SYSVAL(QDATSEP) RTNVAR(&DATSEP)
CHGVAR &JOB %SST(&FULLJOB 1 10)
CHGVAR &USER %SST(&FULLJOB 11 10)
CHGVAR &JOBNBR %SST(&FULLJOB 21 6)
IF (&JOB *EQ '*') DO /* Use current job */
RTVJOBA JOB(&JOB) USER(&USER) NBR(&JOBNBR)
ENDDO /* Use current job */
/* Build Qlfd job name for the call */
CHGVAR &QLFJOB (&JOB *CAT &USER *CAT &JOBNBR)
/* Determine SPLF number */
IF (&SPLNBR *EQ '*ONLY') DO /* ONLY */
CHGVAR &SPLNBRD 0
GOTO CVTSPLN
ENDDO /* ONLY */
IF (&SPLNBR *EQ '*LAST') DO /* LAST */
CHGVAR &SPLNBRD -1
GOTO CVTSPLN
ENDDO /* LAST */
/* If not *ONLY or *LAST, convert the nbr */
CHGVAR &SPLNBRD &SPLNBR
CVTSPLN: CHGVAR %BIN(&SPLNBRB 1 4) &SPLNBRD
/* Use 1000 byte len for DS - Cvt to bin */
CHGVAR &DSLEND 1000
CHGVAR %BIN(&DSLENB 1 4) &DSLEND
/* Call API to rtv SPLFA */
CALL QUSRSPLA PARM(&DS &DSLENB 'SPLA0100' +
&QLFJOB &INTJOB &INTSPLF &SPLF &SPLNBRB)
FORMTYPE: CHGVAR &FORMTYPE %SST(&DS 81 10)
OUTPTY: CHGVAR &OUTPTY %SST(&DS 182 1)
CPYLEFT: CHGVAR &WORK4 %SST(&DS 169 4)
CHGVAR &DEC9 %BIN(&WORK4 1 4)
CHGVAR &CPYLEFT &DEC9
COPIES: CHGVAR &WORK4 %SST(&DS 165 4)
CHGVAR &DEC9 %BIN(&WORK4 1 4)
CHGVAR &COPIES &DEC9
MAXRCDS: CHGVAR &WORK4 %SST(&DS 305 4)
CHGVAR &DEC9 %BIN(&WORK4 1 4)
CHGVAR &MAXRCDS &DEC9
IF (&DEC9 *EQ 0) CHGVAR &MAXRCDS '*NOMAX'
FILESEP: CHGVAR &WORK4 %SST(&DS 433 4)
CHGVAR &DEC9 %BIN(&WORK4 1 4)
CHGVAR &WORK9 &DEC9
CHGVAR &FILESEP %SST(&WORK9 9 1)
SCHEDULE: CHGVAR &SCHEDULE %SST(&DS 111 10)
HOLD: CHGVAR &HOLD %SST(&DS 121 4)
SAVE: CHGVAR &SAVE %SST(&DS 131 4)
DEVTYPE: CHGVAR &DEVTYPE %SST(&DS 309 10)
PRTTYPE: CHGVAR &PRTTYPE %SST(&DS 319 5)
DEVFILE: CHGVAR &DEVFILE %SST(&DS 216 10)
DEVFILEL: CHGVAR &DEVFILEL %SST(&DS 226 10)
USRDTA: CHGVAR &USRDTA %SST(&DS 91 10)
ACGCDE: CHGVAR &ACGCDE %SST(&DS 256 15)
OPNPGM: CHGVAR &OPNPGM %SST(&DS 236 10)
OPNPGML: CHGVAR &OPNPGML %SST(&DS 246 10)
OPNDAT: CHGVAR &WORK6 %SST(&DS 204 6)
CHGVAR &OPNDAT (%SST(&WORK6 1 2) *CAT &DATSEP +
*CAT %SST(&WORK6 3 2) *CAT &DATSEP +
*CAT %SST(&WORK6 5 2))
OPNTIM: CHGVAR &WORK6 %SST(&DS 210 6)
CHGVAR &OPNTIM (%SST(&WORK6 1 2) *CAT ':' +
*CAT %SST(&WORK6 3 2) *CAT ':' +
*CAT %SST(&WORK6 5 2))
PAGWTN: CHGVAR &WORK4 %SST(&DS 145 4)
CHGVAR &DEC9 %BIN(&WORK4 1 4)
CHGVAR &PAGWTN &DEC9
TOTPAG: CHGVAR &WORK4 %SST(&DS 141 4)
CHGVAR &DEC9 %BIN(&WORK4 1 4)
CHGVAR &TOTPAG &DEC9
RCDLEN: CHGVAR &WORK4 %SST(&DS 301 4)
CHGVAR &DEC9 %BIN(&WORK4 1 4)
CHGVAR &WORK9 &DEC9
CHGVAR &RCDLEN %SST(&WORK9 5 5)
PAGLEN: CHGVAR &WORK4 %SST(&DS 425 4)
CHGVAR &DEC9 %BIN(&WORK4 1 4)
CHGVAR &WORK9 &DEC9
CHGVAR &PAGLEN %SST(&WORK9 7 3)
PAGWDT: CHGVAR &WORK4 %SST(&DS 429 4)
CHGVAR &DEC9 %BIN(&WORK4 1 4)
CHGVAR &WORK9 &DEC9
CHGVAR &PAGWDT %SST(&WORK9 7 3)
LPI: CHGVAR &WORK4 %SST(&DS 173 4)
CHGVAR &DEC9 %BIN(&WORK4 1 4)
CHGVAR &WORK9 &DEC9
CHGVAR &LPI %SST(&WORK9 8 1)
CPI: CHGVAR &WORK4 %SST(&DS 177 4)
CHGVAR &DEC9 %BIN(&WORK4 1 4)
CHGVAR &WORK9 &DEC9
CHGVAR &CPI %SST(&WORK9 7 2)
OVRFLW: CHGVAR &WORK4 %SST(&DS 437 4)
CHGVAR &DEC9 %BIN(&WORK4 1 4)
CHGVAR &WORK9 &DEC9
CHGVAR &OVRFLW %SST(&WORK9 7 3)
/* FOLD changed from Rel 3 manual */
FOLD: CHGVAR &FOLD %SST(&DS 563 4)
/* CTLCHAR changed from Rel 3 manual */
CTLCHAR: CHGVAR &CTLCHAR %SST(&DS 573 5)
RPLUNPRT: CHGVAR &RPLUNPRT '*YES'
IF (%SST(&DS 423 1) *EQ 'N') DO /* No replace */
CHGVAR &RPLUNPRT '*NO'
ENDDO /* No replace */
/* ALIGN changed from Rel 3 manual */
ALIGN: CHGVAR &ALIGN %SST(&DS 583 4)
/* PRTQLTY changed from Rel 3 manual */
PRTQLTY: CHGVAR &PRTQLTY %SST(&DS 593 6)
/* FORMFEED changed from Rel 3 manual */
FORMFEED: CHGVAR &FORMFEED %SST(&DS 603 8)
DRAWER: CHGVAR &WORK4 %SST(&DS 525 4)
CHGVAR &DEC9 %BIN(&WORK4 1 4)
CHGVAR &WORK9 &DEC9
CHGVAR &DRAWER %SST(&WORK9 9 1)
FONT: CHGVAR &FONT %SST(&DS 529 5)
PAGRTT: CHGVAR &WORK4 %SST(&DS 545 4)
CHGVAR &DEC9 %BIN(&WORK4 1 4)
/* Convert minus values */
IF (&DEC9 *EQ -1) DO /* *AUTO */
CHGVAR &PAGRTT '*AUTO'
GOTO JUSTIFY
ENDDO /* AUTO */
IF (&DEC9 *EQ -2) DO /* *DEVD */
CHGVAR &PAGRTT '*DEVD'
GOTO JUSTIFY
ENDDO /* DEVD */
IF (&DEC9 *EQ -3) DO /* *COR */
CHGVAR &PAGRTT '*COR'
GOTO JUSTIFY
ENDDO /* COR */
/* Only positive values remain, convert */
CHGVAR &WORK9 &DEC9
CHGVAR &PAGRTT %SST(&WORK9 5 5)
JUSTIFY: CHGVAR &WORK4 %SST(&DS 549 4)
CHGVAR &DEC9 %BIN(&WORK4 1 4)
CHGVAR &WORK9 &DEC9
CHGVAR &JUSTIFY %SST(&WORK9 7 3)
ENDPGM:
RMVMSG CLEAR(*ALL)
RETURN /* Normal end of program */
STDERR1: /* Standard error handling routine */
IF &ERRORSW SNDPGMMSG MSGID(CPF9999) +
MSGF(QCPFMSG) MSGTYPE(*ESCAPE)
CHGVAR &ERRORSW '1' /* Set to fail on error */
RCVMSG MSGTYPE(*EXCP) RMV(*NO) KEYVAR(&KEYVAR)
STDERR2: RCVMSG MSGTYPE(*PRV) MSGKEY(&KEYVAR) RMV(*NO) +
KEYVAR(&KEYVAR2) MSG(&MSG) +
MSGDTA(&MSGDTA) MSGID(&MSGID) +
RTNTYPE(&RTNTYPE) MSGF(&MSGF) +
SNDMSGFLIB(&MSGFLIB)
IF (&RTNTYPE *NE '02') GOTO STDERR3
IF (&MSGID *NE ' ') SNDPGMMSG +
MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) MSGTYPE(*DIAG)
IF (&MSGID *EQ ' ') SNDPGMMSG +
MSG(&MSG) MSGTYPE(*DIAG)
RMVMSG MSGKEY(&KEYVAR2)
STDERR3: RCVMSG MSGKEY(&KEYVAR) MSGDTA(&MSGDTA) +
MSGID(&MSGID) MSGF(&MSGF) +
SNDMSGFLIB(&MSGFLIB)
SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) MSGTYPE(*ESCAPE)
ENDPGM
File : QCMDSRC
Member: RTVSPLFA
Type : CMD
Usage : CRTCMD CMD(RTVSPLFA) PGM(RTVSPLFAC) ALLOW((*IPGM) (*BPGM))
/* Retrieve Spooled File Attributes - RTVSPLFA */
/* PARMS PGM(RTVSPLFAC) ALLOW((*IPGM)(*BPGM)) */
/* */
/* The RTVSPLFA command retrieves the spooled file information */
/* One or more parameters may be returned */
/* */
/* The CPP is RTVSPLFAC */
/* */
CMD PROMPT('Rtv Spooled File Attr - TAA')
PARM KWD(SPLF) TYPE(*NAME) MIN(1) +
PROMPT('Spooled file')
PARM KWD(JOB) TYPE(QUAL1) DFT(*) SNGVAL(*) +
PROMPT('Job name')
PARM KWD(SPLNBR) TYPE(*CHAR) LEN(5) DFT(*ONLY) +
SPCVAL(*ONLY *LAST) +
PROMPT('Spooled file number')
PARM KWD(FORMTYPE) TYPE(*CHAR) LEN(10) +
RTNVAL(*YES) +
PROMPT('Form type (10)')
PARM KWD(OUTPTY) TYPE(*CHAR) LEN(1) RTNVAL(*YES) +
PROMPT('Output priority (1)')
PARM KWD(CPYLEFT) TYPE(*CHAR) LEN(3) RTNVAL(*YES) +
PROMPT('Number of copies left (3)')
PARM KWD(COPIES) TYPE(*CHAR) LEN(3) RTNVAL(*YES) +
PROMPT('Total number of copies (3)')
PARM KWD(MAXRCDS) TYPE(*CHAR) LEN(10) RTNVAL(*YES) +
PROMPT('Maximum records (10)')
PARM KWD(FILESEP) TYPE(*CHAR) LEN(1) RTNVAL(*YES) +
PROMPT('File separators (1)')
PARM KWD(SCHEDULE) TYPE(*CHAR) LEN(8) RTNVAL(*YES) +
PROMPT('Schedule (8)')
PARM KWD(HOLD) TYPE(*CHAR) LEN(4) RTNVAL(*YES) +
PROMPT('Hold file (4)')
PARM KWD(SAVE) TYPE(*CHAR) LEN(4) RTNVAL(*YES) +
PROMPT('Save after output (4)')
PARM KWD(DEVTYPE) TYPE(*CHAR) LEN(10) RTNVAL(*YES) +
PROMPT('Device type (10)')
PARM KWD(PRTTYPE) TYPE(*CHAR) LEN(5) RTNVAL(*YES) +
PROMPT('Printer type (5)')
PARM KWD(DEVFILE) TYPE(*CHAR) LEN(10) RTNVAL(*YES) +
PROMPT('Device file (10)')
PARM KWD(DEVFILEL) TYPE(*CHAR) LEN(10) +
RTNVAL(*YES) +
PROMPT('Device file library (10)')
PARM KWD(USRDTA) TYPE(*CHAR) LEN(10) RTNVAL(*YES) +
PROMPT('User data (10)')
PARM KWD(ACGCDE) TYPE(*CHAR) LEN(15) RTNVAL(*YES) +
PROMPT('Accounting code (15)')
PARM KWD(OPNPGM) TYPE(*CHAR) LEN(10) RTNVAL(*YES) +
PROMPT('Program which opened file (10)')
PARM KWD(OPNPGML) TYPE(*CHAR) LEN(10) RTNVAL(*YES) +
PROMPT('Pgm lib which opened file (10)')
PARM KWD(OPNDAT) TYPE(*CHAR) LEN(8) RTNVAL(*YES) +
PROMPT('Qpen date (8)')
PARM KWD(OPNTIM) TYPE(*CHAR) LEN(8) RTNVAL(*YES) +
PROMPT('Open time (8)')
PARM KWD(PAGWTN) TYPE(*CHAR) LEN(10) RTNVAL(*YES) +
PROMPT('Page being written (10)')
PARM KWD(TOTPAG) TYPE(*CHAR) LEN(10) RTNVAL(*YES) +
PROMPT('Total pages (10)')
PARM KWD(RCDLEN) TYPE(*CHAR) LEN(5) RTNVAL(*YES) +
PROMPT('Record length (5)')
PARM KWD(PAGLEN) TYPE(*CHAR) LEN(3) RTNVAL(*YES) +
PROMPT('Page length (3)')
PARM KWD(PAGWDT) TYPE(*CHAR) LEN(3) RTNVAL(*YES) +
PROMPT('Page width (3)')
PARM KWD(LPI) TYPE(*CHAR) LEN(1) RTNVAL(*YES) +
PROMPT('Lines per inch (1)')
PARM KWD(CPI) TYPE(*CHAR) LEN(2) RTNVAL(*YES) +
PROMPT('Characters per inch (2)')
PARM KWD(OVRFLW) TYPE(*CHAR) LEN(3) RTNVAL(*YES) +
PROMPT('Overflow line (3)')
PARM KWD(FOLD) TYPE(*CHAR) LEN(4) RTNVAL(*YES) +
PROMPT('Fold print line (4)')
PARM KWD(CTLCHAR) TYPE(*CHAR) LEN(5) RTNVAL(*YES) +
PROMPT('Control character (5)')
PARM KWD(RPLUNPRT) TYPE(*CHAR) LEN(4) RTNVAL(*YES) +
PROMPT('Replace unprintable char (4)')
PARM KWD(ALIGN) TYPE(*CHAR) LEN(4) RTNVAL(*YES) +
PROMPT('Align forms (4)')
PARM KWD(PRTQLTY) TYPE(*CHAR) LEN(6) RTNVAL(*YES) +
PROMPT('Print quality (6)')
PARM KWD(FORMFEED) TYPE(*CHAR) LEN(8) RTNVAL(*YES) +
PROMPT('Form feed (8)')
PARM KWD(DRAWER) TYPE(*CHAR) LEN(1) RTNVAL(*YES) +
PROMPT('Drawer (1)')
PARM KWD(FONT) TYPE(*CHAR) LEN(5) RTNVAL(*YES) +
PROMPT('Printer font (5)')
PARM KWD(PAGRTT) TYPE(*CHAR) LEN(5) RTNVAL(*YES) +
PROMPT('Page rotation (5)')
PARM KWD(JUSTIFY) TYPE(*CHAR) LEN(3) RTNVAL(*YES) +
PROMPT('Justification (3)')
QUAL1: QUAL TYPE(*NAME) LEN(10) MIN(1) EXPR(*YES)
QUAL TYPE(*NAME) LEN(10) MIN(0) +
PROMPT('User name')
QUAL TYPE(*CHAR) LEN(6) MIN(0) +
PROMPT('Number')
參考資訊 Retrieve Spooled File Attributes (QUSRSPLA) API
Retrieve Spooled File Attributes (QUSRSPLA) API
http://publib.boulder.ibm.com/html/as400/v5r1/ic2924/info/apis/QUSRSPLA.htm
A blog about IBM i (AS/400), MQ and other things developers or Admins need to know.
星期三, 11月 01, 2023
2002-01-31 工具:RTVSPLFA 擷取報表 Spooled file 屬性
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言