× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Simon Coulter wrote on 16/11/2006 06:09:45 PM:

However, if the compiler won't let me do:

CHGVAR VAR(var1) VALUE(&A + myCharLiteral + &B),

There are two things wrong with that statement:
   1) Missing & from var1 (which would cause CPD0081 "Variable name 
required for parameter")
   2) + is the ADDITION operator (which would cause CPD0130 "Operands 
must be numeric for parameter VALUE"). CL ain't RPG IV ya know.

Of course you are right about that ... I just made that example up quickly 
and didn't edit it carefully for CL-ness.  I think what had me confused 
about the bare literals (no quotes) is that most of my character literals 
contain spaces and/or mixed case.


However CL will allow:
      CHGVAR VAR(&var1) VALUE(&A *CAT myCharLiteral *CAT &B)
which is consistent with its own rules.

Single quotes are only required when:
   a) The value contains special characters like spaces
   b) The value must contain lower-case characters (and CASE(*MIXED) is 
not specified)

I think point b) contradicts that first bit.  It seems to me that, if I 
understand correctly, the solution to the problem that the developer had 
(which is a variable being interpreted as a literal if the & is forgotten) 
is to use mixed case for variables.


I'm not really sure why it would let me use a non-delimited character
literal in any context in a compiled program.

Makes no difference that CL is 'compiled' in a program. CL commands 
follow the same rules regardless of where they are used otherwise you 
might have to quote all sorts of things and how ugly would that be:
   dspobjd obj('MYLIB'/'MYOBJ') objtype(*pgm) output(*outfile) 
outfile('QTEMP'/'JUNK')

I guess I figured if certain commands are only allowed in a program 
context, it wouldn't be that big  a stretch to have slightly different 
quoting rules too.

Thanks for the detailed response,
Adam

#####################################################################################
Attention:
The above message and/or attachment(s) is private and confidential and is 
intended 
only for the people for which it is addressed. If you are not named in the 
address 
fields, ignore the contents and delete all the material. Thank you. Have a nice 
day.

For more information on email virus scanning, security and content
management, please contact administrator@xxxxxxxxxxxx
#####################################################################################

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.