|
SBMJOB's RQSDTA Parameter
Hey, Ted:
In the "SBMJOB's RQSDTA Parameter" column that was published in Midrange Guru on December 11, 2002, a reader (Tom) wrote about an alternative choice to use the Request Data (RQSDTA) parameter instead of the Command (CMD) parameter.
He said: "In general, building a command string and using RQSDTA allows you to be precise, while using CMD to build the command string for you allows you to take advantage of the command prompter for formatting."
We experienced the same garbage problem using RQSDTA with relation to quotes in the RQSDTA string. We modified the provided source to point this out. Here is the program that submits to batch:
TstSbmPgm: pgm
dcl &message *char 11 value('''Hello Jan''')
dcl &cmdstr *char 64
dcl &garbage *char 64 value( '?') +
/*===============================================================*/
/* This works! */
/*===============================================================*/
chgvar var(&cmdstr) +
value('SNDMSG Hello Jan')
sbmjob ??rqsdta( 'call TstSndMsg parm(' +
*tcat '''' +
*tcat &CmdStr +
*cat ''' ''' +
*tcat &Garbage +
*cat '''' +
*tcat ')' +
)
monmsg cpf0000
/*===============================================================*/
/* This does not work: */
/* */
/* The calling program sends: */
/* Variable Value */
/* *...+....1....+....2....+ */
/* &CMDSTR 'SNDMSG MSG(''Hello Jan'')' */
/* ' TOUSR(JAN) ' */
/* ' ' */
/* &GARBAGE '? ' */
/* ' ' */
/* ' ' */
/* ' ' */
/* The called program receives: */
/* Variable Value */
/* *...+....1....+....2....+ */
/* &PCMDSTR 'SNDMSG MSG('Hello Jan') T' */
/* 'OUSR(JAN) ' */
/* ' ?' */
/* &PXGARBAGE '? ' */
/* ' ' */
/* ' ' */
/* Why? */
/* Double quotes will be received as single quotes, */
/* thus the called program receives a variable of only */
/* 62 positions in stead of 64 positions. This opens the */
/* door for adding garbage at the end (from pos 62 + 2). */
/* */
/*===============================================================*/
chgvar var(&cmdstr) +
value('SNDMSG MSG(' +
*tcat '''' +
*tcat &message +
*tcat '''' +
*tcat ')' +
*bcat 'TOUSR(JAN)')
sbmjob ??rqsdta( 'call TstSndMsg parm(' +
*tcat '''' +
*tcat &CmdStr +
*cat ''' ''' +
*tcat &Garbage +
*cat '''' +
*tcat ')' +
)
monmsg cpf0000
/*===============================================================*/
/* This works. */
/* An extra blank position was appended after &cmdstr */
/*===============================================================*/
sbmjob ??rqsdta( 'call TstSndMsg parm(' +
*tcat '''' +
*tcat &CmdStr +
*cat ' '' ''' +
*tcat &Garbage +
*cat '''' +
*tcat ')' +
)
monmsg cpf0000
return
endpgm
Here's the batch program:
TstSndMsg: pgm ( +
&pCmdStr +
&pXGarbage +
)
dcl &pCmdStr *char 64
dcl &pXGarbage *char 64
dcl &CmdLen *dec ( 15 5 ) value( 64 )
call QCmdExc ( +
&pCmdStr +
&CmdLen +
)
return
endpgm
-- Jan
Sponsored By
inFORM DECISIONS
|
|
ELIMINATE THE COSTS OF PRE-PRINTED FORMS, LABOR AND POSTAGE WITH inFORM Decisions iDocs 'Suite'
iSeries based e-Forms, e-Checks, e-Mail, e-FAX, and Document Retrieval from the Web are available as individual modules or as a complete e-Document processing 'Suite'.
Click to Download the Complete Suite or Individual Modules today www.inFORMDecisions.com or call (800) 858-5544
|
|
Editors
Howard Arner
Joe Hertvik
Ted Holt
David Morris
Managing Editor
Mari Barrett
Publisher and
Advertising Director:
Jenny Thomas
Advertising Sales Representative
Kim Reed
Contact the Editors
Do you have a gripe, inside dope or an opinion?
Email the editors:
editors@itjungle.com
|