On 21/04/2010, at 4:01 AM, Loyd Goodbar wrote:
When compiled, these messages are generated:
*RNF7030 The name or indicator COMMAND is not defined. [expected]
*RNF7503 Expression contains an operand that is not defined.
[command=...]
*RNF7503 Expression contains an operand that is not defined.
[execcmd(...]
*RNF5410 The prototype for the call is not defined. [Huh??]
Why does RNF5410 occur? The prototype definitely exists.
Because that's the way it is (, has always been [, and shall ever
be]). Make the following changes to your code:
d ExecCmd pr extpgm('QCMDEXC')
d CmdString 3000a const options(*varsize)
d CmdStringLen 15p 5 const
d CmdOption 3a const options(*nopass)
d command s 100
/free
command = 'ovrdbf file(myfile) tofile(loyd/myfile)';
execcmd(command:%len(%trim(command)));
execcmd(command: %trim(command) );
execcmd(command: length );
runcmd(command: length );
*inlr = *on;
return;
/end-free
COMMAND is now defined but LENGTH is not. The compiler appears happy
with the first call to EXECCMD but not the second or third:
Msg id Sv Number Seq Message text
*RNF7030 30 10 001000 The name or indicator LENGTH is not defined.
*RNF7030 30 11 001100 The name or indicator RUNCMD is not defined.
*RNF7536 30 9 000900 The type of parameter 2 specified for the
call does not
match the prototype.
*RNF7503 30 10 001000 Expression contains an operand that is not
defined.
*RNF5410 30 10 001000 The prototype for the call is not defined.
*RNF7503 30 11 001100 Expression contains an operand that is not
defined.
One might ask how can the prototype be undefined at line 1000 when it
was clearly found at line 900? One might more reasonably expect
RNF7536 in both cases. Note also that for RUNCMD the compiler knows
the name is not defined but doesn't issue RNF5410 even though a
prototype does not exist.
However I can see some logic to the current behaviour. If any of the
parameters are undefined then the call is undefined and therefore the
associated prototype is also undefined.
Should we care? I've always ignored this message and just treated it
as an expected partner of the RNF7503 error. Just be grateful the RPG
compiler doesn't get as completely hosed as the C compiler when it
encounters syntax errors. At least it can regroup and recover to give
sensible error messages for the remaining code whereas the C compiler
frequently just disappears down the sewer and spews out misleading and
erroneous messages for so-called 'problems' after the first error.
Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists
http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------
As an Amazon Associate we earn from qualifying purchases.