On 17 Apr 2012 14:17, dale janus wrote:
Then one of our customers has an email address with a hyphen in it.
The CMD blows up.
"Message: Expression operator not allowed for parameter EMAIL.
<<SNIP CPD0104 text>>
The most simplistic of email addresses are acceptable on a *CHAR
command parameter without being delimited, albeit with the side effect
that they are folded to upper case. However more generally, an email
address as a parameter value could cause many more errors than just the
CPD0104; i.e. an email address can contain a number of characters that
are not accepted by the CL parser, unless delimited and\or escaped. As
the CPD0104 message suggests, both the character-string and the
arithmetic operator characters will effect that failure message; not
only the dash [minus] symbol but the plus sign and bar symbol. Many of
the other characters that are allowable in the portion of the email
identifier\string that prefixes the @ symbol, could effect a variety of
other CPD00## errors and perhaps other errors\ranges; e.g. the question
mark which would be seen as prompting directive giving CPD0016, or the
percent sign seen as builtin function prefix giving CPD0019, or the
exclamation point which although not seen as having any capabilities
still giving CPD0018. The possibilities include CPD0013, CPD0014, and
CPD0020 which are likely to occur for an apostrophe in the email address
that is not [properly] escaped.
The problem, as described, seems probable to have occurred for a
command string that had been built something like the following:
Properly formatted, the CL command-string\request should be generated
Is there an easy way to edit the CMD parameters as part of the CMD?
Or if I edit in RPG and find a hyphen, what can I do to pass it
Presumably the "CMD parameters" means to suggest parameters of a *CMD
object rather than a CMD() parameter of a *CMD [CL command] object.?
Regardless, the parameter value(s) that are built as part of a command
string need to have apostrophes escaped and the string delimited with
The function and methodology Dennis gave should suffice. But FWiW,
the following SQL expression is something that I have used successfully
for [requested unconditionally against] an email address stored in a
database varchar column [e.g. named emailaddr]:
'''' concat replace(emailaddr , '''', '''''') concat ''''