Users can check on jobs without compromising security.
Anxiety is what users experience when they submit a job to batch processing and it doesn't complete in the time they think it should take. In this case, users will probably call IS, asking what's going on. Another form of anxiety is the one that you'll experience when one of your users submits the same job for the second time only because he thought the first submission didn't "take," in many cases resulting in the failure of both jobs when they try to allocate the same files.
IBM gave us the Work with Submitted Jobs (WRKSBMJOB) command, as if you should allow your users to run it. This command, however, not only provides a command line (making many IS administrators nervous) but it also allows the user to run a number of options on each job-such as 2 to change or 4 to end. Even if you limit a user's capabilities to prevent him from running commands from the command line, he can still execute the change or end options from the WRKSBMJOB panel. This is not good for shops that are concerned with tight security.
Instead of training a few users how to run the Work with User Jobs (WRKUSRJOB) or Work with Subsystem Jobs (WRKSBSJOB) command, you should devise a method which lets your end users see their submitted jobs by themselves without the risk of changing anything. This not only reduces congestion in your IS telephone lines; it does away with some of the irritation of your IS personnel, as well. Plus, if you make it easy to use, you won't spend any time at all training your users. So here's the Display Submitted Jobs (DSPSBMJOB) command, which I list in 1.
Instead of training a few users how to run the Work with User Jobs (WRKUSRJOB) or Work with Subsystem Jobs (WRKSBSJOB) command, you should devise a method which lets your end users see their submitted jobs by themselves without the risk of changing anything. This not only reduces congestion in your IS telephone lines; it does away with some of the irritation of your IS personnel, as well. Plus, if you make it easy to use, you won't spend any time at all training your users. So here's the Display Submitted Jobs (DSPSBMJOB) command, which I list in Figure 1.
There's really not much to developing it-I was surprised. All it takes is running the WRKSBMJOB command to *PRINT, capturing this printout into a database file and giving this file to an RPG program to display with an output-only subfile. I'm using CL program SBM002CL (2), display file SBM002DF (3) and RPG program SBM002RG (4).
There's really not much to developing it-I was surprised. All it takes is running the WRKSBMJOB command to *PRINT, capturing this printout into a database file and giving this file to an RPG program to display with an output-only subfile. I'm using CL program SBM002CL (Figure 2), display file SBM002DF (Figure 3) and RPG program SBM002RG (Figure 4).
DSPSBMJOB has four parameters that add flexibility to the command. JOBQ: Whether to include jobs that are still in a job queue. This includes jobs with a status of JOBQ, SCD (scheduled), TFRBCH and TFRJOB (transferred). Defaults to *YES.
ACTIVE: Whether to include jobs that are currently running. This lists jobs with a status of ACTIVE, DSC (disconnected) and MSGW (message waiting). Defaults to *YES.
OUTQ: Whether to include jobs that have processed and produced printed output, although the output hasn't printed yet. Defaults to *NO.
END: Whether to include jobs that have ended. It includes jobs with a status of END (ended with ENDJOB), FIN (printed output already printed) and EOJ (ended by any other means). Defaults to *NO.
So now your operator can get back to running the computer and your programmers can enjoy their evenings with their families, because your users can independently check the status of the jobs they have submitted-without compromising security.
Editor's Note: Remember that this command only displays jobs that have been submitted to batch. Users will not see any job information for their interactive jobs with this command.
Bruce Knoll is a programmer/analyst at Lescoa, Inc. in Grand Rapids, MI. He has worked on the midrange platforms for more than eight years.
Let Users Display Their Submitted Jobs
Figure 1 Command DSPSBMJOB
DSPSBMJOB: CMD PROMPT('Display Submitted Jobs') PARM KWD(JOBQ) TYPE(*CHAR) LEN(4) RSTD(*YES) + DFT(*YES) VALUES(*YES *NO) EXPR(*YES) + PROMPT('Include jobs in job queue') PARM KWD(ACTIVE) TYPE(*CHAR) LEN(4) RSTD(*YES) + DFT(*YES) VALUES(*YES *NO) EXPR(*YES) + PROMPT('Include active in job queue') PARM KWD(OUTQ) TYPE(*CHAR) LEN(4) RSTD(*YES) + DFT(*NO) VALUES(*YES *NO) EXPR(*YES) + PROMPT('Include jobs in output queue') PARM KWD(END) TYPE(*CHAR) LEN(4) RSTD(*YES) + DFT(*NO) VALUES(*YES *NO) EXPR(*YES) + PROMPT('Include ended jobs')
Let Users Display Their Submitted Jobs
Figure 2 CL Program SBM002CL
SBM002CL: + PGM PARM(&JOBQ &ACTIVE &OUTQ &END) DCL VAR(&ACTIVE) TYPE(*CHAR) LEN(4) DCL VAR(&END) TYPE(*CHAR) LEN(4) DCL VAR(&JOBQ) TYPE(*CHAR) LEN(4) DCL VAR(&OUTQ) TYPE(*CHAR) LEN(4) DCL VAR(&REFRESH) TYPE(*CHAR) LEN(1) IF COND(&JOBQ *EQ '*NO' *AND &ACTIVE *EQ '*NO' *AND &OUTQ *EQ + '*NO' *AND &END *EQ '*NO') THEN(DO) SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('At least one + parameter must be *YES') MSGTYPE(*ESCAPE) RETURN ENDDO OVRPRTF FILE(QPDSPSBJ) HOLD(*YES) CRTPF FILE(QTEMP/DSPJOB) RCDLEN(132) MONMSG MSGID(CPF0000) REPEAT: + SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Gathering data. + Please wait') TOPGMQ(*EXT) MSGTYPE(*STATUS) WRKSBMJOB SBMFROM(*USER) OUTPUT(*PRINT) CPYSPLF FILE(QPDSPSBJ) TOFILE(QTEMP/DSPJOB) JOB(*) SPLNBR(*LAST) + TOMBR(*FIRST) MBROPT(*REPLACE) DLTSPLF FILE(QPDSPSBJ) JOB(*) SPLNBR(*LAST) CALL PGM(SBM002RG) PARM(&JOBQ &ACTIVE &OUTQ &END &REFRESH) IF COND(&REFRESH *EQ 'Y') THEN(GOTO CMDLBL(REPEAT)) ENDPGM
Let Users Display Their Submitted Jobs
Figure 3 Display File SBM002DF
A DSPSIZ(24 80 *DS3) A PRINT A CA03(03 'Exit') A CA05(05 'Refresh') A CA12(12 'Cancel') A R SFLRCD SFL A SFJOB 10A O 4 2 A SFJOB# 6A O 4 15 A SFSTSA 6A O 4 24 A SFSTSB 10A O 4 32 A SFFUNC 35A O 4 44 A R SFLCTL SFLCTL(SFLRCD) A BLINK OVERLAY A N51 SFLDSP A N51 AON53 SFLDSPCTL A 51 AON53 SFLCLR A N60 SFLEND A SFLSIZ(36) SFLPAG(18) A 1 31'Submitted Jobs List' DSPATR(HI) A 1 72DATE EDTCDE(Y) A 2 72TIME A 1 2'User:' A USER 10A O 1 8 A 3 2'Job Name' DSPATR(HI) A 3 15'Job #' DSPATR(HI) A 3 24'Status' DSPATR(HI) A 3 44'Function' DSPATR(HI) A R FKEYS A LOCK A 23 2'F3=Exit F5=Refresh F12=Cancel' A COLOR(BLU)
Let Users Display Their Submitted Jobs
Figure 4 RPG Program SBM002RG
FSBM002DFCF E WORKSTN F SFLINEKSFILE SFLRCD FDSPJOB IF F 132 DISK E JQT 4 4 6 E ACT 4 4 6 E OUT 1 1 6 E ENT 3 3 6 IDSPJOB NS I 4 13 JOB I 30 35 JOB# I 49 54 STSA I 58 66 STSB I 68 100 FUNC ISDS SDS I 254 263 USER C *ENTRY PLIST C PARM JOBQ 4 C PARM ACTIVE 4 C PARM OUTQ 4 C PARM END 4 C PARM F5 1 C WRITEFKEYS C MOVE *ON *IN53 C MOVE *ON *IN51 C WRITESFLCTL Clear subfile C MOVE *OFF *IN51 C Z-ADD0 SFLINE 30 C *IN99 DOUEQ*ON C READ DSPJOB 99 C *IN99 IFEQ *OFF C MOVEL*OFF *IN50 C JOBQ IFEQ '*YES' C STSA LOKUPJQT 50 C ENDIF C *IN50 IFEQ *OFF C ACTIVE ANDEQ'*YES' C STSA LOKUPACT 50 C ENDIF C *IN50 IFEQ *OFF C OUTQ ANDEQ'*YES' C STSA LOKUPOUT 50 C ENDIF C *IN50 IFEQ *OFF C END ANDEQ'*YES' C STSA LOKUPENT 50 C ENDIF C *IN50 IFEQ *ON C MOVELJOB SFJOB C MOVELJOB# SFJOB# C MOVELSTSA SFSTSA C MOVELSTSB SFSTSB C MOVELFUNC SFFUNC C ADD 1 SFLINE C WRITESFLRCD C ENDIF C ENDIF C ENDDO C SFLINE IFLT 1 C ADD 1 SFLINE C MOVEL'(None)' SFJOB P C WRITESFLRCD C ENDIF C EXFMTSFLCTL C *IN05 IFEQ *ON C MOVE 'Y' F5 C ELSE C MOVE 'N' F5 C ENDIF C MOVE *ON *INLR C RETRN ** JOBQ SCD TFRBCHTFRJOB ** ACTIVEDSC MSGW JOBLOG ** OUTQ ** END EOJ FIN
LATEST COMMENTS
MC Press Online