In my shop, many people have access to PDM-operators as well as programmers. I wanted to have a warning come up any time someone tried to use the user-defined option 'C' to call a program from PDM. I came up with a pop-up window that overlays the PDM screen and asks the users to confirm that they want to run the program.
I replaced the user-defined option 'C', which resides in the QAUOOPT file, with a call to my command, CALLPGM (see 7). I passed the library (&L) and object name (&N) supplied by PDM. The Command Processing Program (CPP) for the command is PGM006CL (see 8).
I replaced the user-defined option 'C', which resides in the QAUOOPT file, with a call to my command, CALLPGM (see Figure 7). I passed the library (&L) and object name (&N) supplied by PDM. The Command Processing Program (CPP) for the command is PGM006CL (see Figure 8).
Display file PGM006DF (see 9, page 74) uses the ASSUME and PUTOVR keywords and is compiled with the USRDSP option set to *YES. The window overlays the screen without erasing it. The option defaults to 'N' so that accidentally hitting the Enter key won't start the program. I display the library and the object name in the window so that users know exactly what program they are trying to run.
Display file PGM006DF (see Figure 9, page 74) uses the ASSUME and PUTOVR keywords and is compiled with the USRDSP option set to *YES. The window overlays the screen without erasing it. The option defaults to 'N' so that accidentally hitting the Enter key won't start the program. I display the library and the object name in the window so that users know exactly what program they are trying to run.
While this program doesn't prevent someone from accidentally running a dangerous program, it helps to slow them down and confirm their choices.
-Michael Veit
Run Confirmation Window
Figure 7 The CALLPGM Command
/*==================================================================*/ /* To compile: */ /* */ /* CRTCMD CMD(XXX/CALLPGM) PGM(XXX/PGM006CL) + */ /* SRCFILE(XXX/QCMDSRC) */ /* */ /*==================================================================*/ CALLPGM: CMD PROMPT('Call Program') PARM KWD(PGMNAME) TYPE(QUAL) PROMPT('Program name') QUAL: QUAL TYPE(*NAME) LEN(10) MIN(1) QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) + SPCVAL((*LIBL)) PROMPT('Library')
Run Confirmation Window
Figure 8 CPP CL Program PGM006CL
/*==================================================================*/ /* To compile: */ /* */ /* CRTCLPGM PGM(XXX/PGM006CL) SRCFILE(XXX/QCLSRC) */ /* */ /*==================================================================*/ PGM005CL: PGM PARM(&QNAME) DCL VAR(&QNAME) TYPE(*CHAR) LEN(20) DCL VAR(&LIB) TYPE(*CHAR) LEN(10) DCL VAR(&NAME) TYPE(*CHAR) LEN(10) DCL VAR(&DEV) TYPE(*CHAR) LEN(10) DCLF FILE(PGM006DF) CHGVAR VAR(&NAME) VALUE(%SST(&QNAME 1 10)) CHGVAR VAR(&LIB) VALUE(%SST(&QNAME 11 10)) RTVJOBA JOB(&DEV) CHGVAR VAR(&DRSPNC) VALUE('N') SNDRCVF DEV(&DEV) RCDFMT(SCRWIN) WAIT(*YES) IF COND(&IN12 *EQ '1') THEN(GOTO CMDLBL(ENDPGM)) IF COND(&DRSPNC *EQ 'Y') THEN(DO) CALL PGM(&LIB/&NAME) MONMSG MSGID(CPF0000) EXEC(DO) SNDBRKMSG MSG('Program could not execute properly') + TOMSGQ(&DEV) ENDDO ENDDO ENDPGM: ENDPGM
Run Confirmation Window
Figure 9 Display File PGM006DF
*=============================================================== * To compile: * * CRTDSPF FILE(XXX/PGM006DF) SRCFILE(XXX/QDDSSRC) * *=============================================================== *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 A DSPSIZ(24 80 *DS3) A CA12(12) A R DUMMY A PUTOVR A ASSUME A 1 2' ' A R SCRWIN A WINDOW(7 40 7 20) A OVERLAY A WDWBORDER((*COLOR WHT)) A WDWBORDER((*DSPATR RI)) A WDWBORDER((*CHAR ' ')) A 2 3'Confirm you want' A 3 8'to run:' A NAME 10A O 4 6COLOR(WHT) A 5 3'(Y = Yes, N = No)' A DRSPNC 1A B 6 11
LATEST COMMENTS
MC Press Online