Re: CL Corrupt Parm



Ken Sims wrote:
Hi Tom -

<snip>

Hi Ken,

The CMD() parm was apparently intended to support prompting of structured commands. But CALL does not structure its PARMS(). The result of prompting the CMD() parameter value is a command string that SBMJOB passes into RQSDTA() internally.

Stripping off trailing blanks in the process. That's busted behavior.

But... _exactly_ what blanks are stripped?

Consider this trivial program:

pgm ( +
&p1 +
&p2 +
)

dcl &p1 *char 50
dcl &p2 *char 50

sndmsg ( &p1 *cat &p2 ) kensims

dmpclpgm

return

endpgm

And this:

sbmjob cmd(CALL PGM(TSTSBM) PARM('here is a 50-char string <pad to 50-char>' 'and here is another...<pad to 50-char>'))

When the two parms have blanks added out to the *CHAR (50) lengths defined in the CL program, everything runs fine on my system here. No garbage if I CALL interactively and none when I SBMJOB.

OTOH, if I simply prompt a CALL command and type the strings _without_ quoting out to the proper lengths, the parms only contain the significant characters. Blanks aren't "stripped" or truncated; they simply never existed. Garbage results.

Is that IBM's responsibility? I.e., if I don't supply correct values, aren't I at fault?

--
Tom Liotta
http://zap.to/tl400
.



Relevant Pages

  • Re: Problem with parameters from RPGIV to CL
    ... I have an RPG IV program which calls a CL program which then submits ... The second issue is that the CALL in the submit job is much like a command line invocation, but those strings as character variables, will be truncated to the last non-blank, irrespective of the declared length. ... At a command line the issue is prevented by explicitly including all of the blanks, to pad the quoted string to match the full length of the declared variable. ... In the CLP which uses SBMJOB with a CALL command request in the CMDparameter, versus a direct CALL to the program, the same manner as what is done from a command line can prevent the issue. ...
    (comp.sys.ibm.as400.misc)
  • TIP #185: Null Handling
    ... nulls, and command modifications for manipulating them. ... Tcl deals with strings, the universal medium for representing data. ... is know and it is an empty string, but if a respondent forgets to give ...
    (comp.lang.tcl)
  • Re: Determine how Word was launched
    ... inspect the command line used to launch Word. ... Private Declare Function GetCommandLineA Lib "kernel32" As Long ... Public Function GetCommandLineAs String ... Dim lngCmdLinePtr As Long ...
    (microsoft.public.office.developer.vba)
  • Re: Class.getMethod in classs static initializer block
    ... I just wanted to add that I had some similar code for a "command line server" project. ... static private final boolean DEBUG = true; ... {public ReturnCode runCommand(String s) ... public ReturnCode parseLine(String line) ...
    (comp.lang.java.programmer)
  • Re: New "base document" available
    ... How to go about retrieving command line parameters? ... the command line arguments (and environment variables) ... Keyword and positional parameters can be mixed in the same command line. ... clp-name points to a string containing "P1" ...
    (comp.lang.cobol)