CL程序:
PGM
DCL VAR(&JOB) TYPE(*CHAR) LEN(10)
DCL VAR(&USR) TYPE(*CHAR) LEN(10)
DCL VAR(&NBR) TYPE(*CHAR) LEN(06)
DCL VAR(&JOBC) TYPE(*CHAR) LEN(10)
DCL VAR(&USRC) TYPE(*CHAR) LEN(10)
DCL VAR(&NBRC) TYPE(*CHAR) LEN(06)
DCL VAR(&RTNC) TYPE(*CHAR) LEN(2)
DCL VAR(&INF) TYPE(*CHAR) LEN(256)
CHGVAR VAR(&JOBC) VALUE('QPADEV001X')
CHGVAR VAR(&usrC) VALUE('WUSER')
RTVJOBA JOB(&JOB) USER(&USR) NBR(&NBR)
CRTPF FILE(QTEMP/SPLF) RCDLEN(132)
MONMSG MSGID(CPF0000)
WRKUSRJOB USER(WUSER) STATUS(*ACTIVE) OUTPUT(*PRINT)
MONMSG MSGID(CPF0000)
CPYSPLF FILE(QPDSPSBJ) TOFILE(QTEMP/SPLF) +
JOB(&NBR/&USR/&JOB) SPLNBR(*LAST) +
MBROPT(*REPLACE)
MONMSG MSGID(CPF0000)
OVRDBF FILE(SPLF) TOFILE(QTEMP/SPLF)
CALL PGM(PTRLIB/PM0100) PARM(&JOBC &USRC &NBRC +
&RTNC)
CALL PGM(PTRLIB/PM0200) PARM(&JOBC &USRC &NBRC &INF)
Spooled File读取RPG程序:
FSPLF IF F 132 DISK KINFDS INFDS
ISPLF AA 01
I 4 13 W#JOB
I 17 26 W#USR
I 30 35 W#NBR
IINFDS DS
I B 397 4000W#RRN
C *ENTRY PLIST
C PARM ##JOB 10
C PARM ##USR 10
C PARM ##NBR 6
C PARM ##RTN 2
C*
C MOVEL'NG' ##RTN
C 6 SETLLSPLF
C READ SPLF 10
C *IN10 DOWEQ*OFF
C*
C W#JOB IFEQ ##JOB
C W#USR ANDEQ##USR
C MOVELW#JOB ##JOB
C MOVELW#USR ##USR
C MOVELW#NBR ##NBR
C MOVEL'OK' ##RTN
C LEAVE
C ENDIF
C*
C READ SPLF 10
C ENDDO
C*
C SETON LR
C RETRN
用API取JOB信息RPG程序:
I*****************************************************************
I*Record structure for QUSRJOBI JOBI0200 format
I*****************************************************************
I/COPY QSYSINC/QRPGSRC,QUSRJOBI
IJOBQUL DS
I 1 10 CTJOB
I 11 20 CTUSER
I 21 26 CTJOBN
I*
IOVRLAY DS
I B 1 40LEN
C *ENTRY PLIST
C PARM ##JOB 10
C PARM ##USER 10
C PARM ##JOBN 6
C PARM JOBINF256
C*
C MOVEL##JOB CTJOB
C MOVEL##USER CTUSER
C MOVEL##JOBN CTJOBN
C Z-ADD200 LEN
C CALL 'QUSRJOBI'
C PARM QUSD2
C PARM LEN
C PARM 'JOBI0200'FORMAT 8
C PARM JOBQUL
C PARM *BLANKS JOBINT 16
C MOVELQUSD2 JOBINF
C*
C SETON LR
C RETRN
取SBMJOB的Job Name,User Name和Job Number可以用
RCVMSG MSGDTA(&inf)
阅读(1823) | 评论(0) | 转发(2) |