Tip

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
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
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

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.