× 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.




On 17/11/2006, at 8:36 AM, AGlauser@xxxxxxxxxxxx wrote:

Really?! I'm very surprised by that ... most other languages I can think
of insist on character literals being delimited in some way, to
differentiate them from variables.  Thinking about it from the point of
view of 'what would I actually type on the command line', I guess it sort
of makes sense.

That's exactly the reason. Commands in CL programs follow the same rules as commands entered on the command line. Would be very confusing otherwise.

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.

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

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')

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)

Regards,
Simon Coulter.
--------------------------------------------------------------------
   FlyByNight Software         AS/400 Technical Specialists

   http://www.flybynight.com.au/
   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175                                   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------



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.