Submit a program from PDM

Imagine you've just compiled a program through PDM (it happens). Now you need to test it in a batch environment. This replaces keying the SBMJOB command with a PDM option and also works from the command line as SBMPGM.


PDM options file : Option = 'SB' (or whatever) Command = SBMPGM PROGRAM(*LIBL/&N) PROMPT(*YES)

COMMAND Source:
CMD PROMPT('Submit a pgm')

PARM KWD(PROGRAM) TYPE(PGMD) PROMPT('Program name')

PARM KWD(PROMPT) TYPE(*CHAR) LEN(4) RSTD(*YES) +
DFT(*NO) VALUES(*NO *YES) MIN(0) +
CHOICE('Prompt for additional parms?')

PGMD: QUAL TYPE(*NAME)
QUAL TYPE(*NAME) DFT(*LIBL) SPCVAL((*LIBL)) +
PROMPT('Library name')

****************** End of data ****************************************

CL PROGRAM source (some leading blanks removed)
PGM PARM(&PGM.LIB &PROMPT)
DCL VAR(&PGM.LIB) TYPE(*CHAR) LEN(20)
DCL VAR(&PGM) TYPE(*CHAR) LEN(10)
DCL VAR(&LIB) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&PROMPT) TYPE(*CHAR) LEN(4)
DCL VAR(&PROMPTSTR) TYPE(*CHAR) LEN(300)
DCL VAR(&PROMPTLNG) TYPE(*DEC) LEN(15 5) VALUE(300)
DCL VAR(&MSGKEY) TYPE(*CHAR) LEN(4)
DCL VAR(&MSGTYPES) TYPE(*CHAR) LEN(10) +
VALUE('*COMP')
DCL VAR(&TYPECOUNT) TYPE(*CHAR) LEN(4) +
VALUE(X'00000001')
DCL VAR(&STACKENTRY) TYPE(*CHAR) LEN(10) VALUE('*')
DCL VAR(&STACKCOUNT) TYPE(*CHAR) LEN(4) +
VALUE(X'00000001')
DCL VAR(&ERRORDS) TYPE(*CHAR) LEN(4) +
VALUE(X'00000000')
CHGVAR &PGM VALUE(%SST(&PGM.LIB 1 10))
CHGVAR &LIB VALUE(%SST(&PGM.LIB 11 10))
/* setup the SBMJOB cmd */
CHGVAR VAR(&PROMPTSTR) VALUE('SBMJOB ' *CAT &PGM +
*CAT ' CMD(CALL ' *CAT &LIB *TCAT '/' +
*CAT &PGM *CAT ')')
/* if prompt = *yes, add a '?' */
IF COND(&PROMPT *EQ *YES) THEN(DO)
CHGVAR VAR(&PROMPTSTR) VALUE('?' *CAT &PROMPTSTR)
ENDDO

/* do it */

CALL PGM(QCMDEXC) PARM(&PROMPTSTR &PROMPTLNG)

/* send back the resulting message */

CALL PGM(QMHMOVPM) PARM(&MSGKEY &MSGTYPES +
&TYPECOUNT &STACKENTRY &STACKCOUNT &ERRORDS)
ENDPGM

This was first published in March 2001

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.