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 last published in March 2001

Dig Deeper on RPG iSeries programming

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close