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



Barbara & Scott,

Dang.  I was using just the date string without the D prefix in my testing.
Getting SQL syntax confused with RPG syntax.  My mistake.  I know it's a
'bad thing' to ask for the address of a constant variable (probably trying
to violate the constant condition) but what about %ADDR?

Why would I want to use a LIKE on a constant variable?  The linked constant
variable could be an array index start value.  I want to iterate through the
remainder of the array.  Would be nice to define the interator variable LIKE
the linked constant variable start value linked into the program.  As Scott
mentioned, it's almost as easy to link in a constant value and a
non-constant variable.  I just hate cluttering up my program with
unnecessary variables.

Why should I be prevented from passing a constant variable by reference to a
non-constant parameter?  Yes it's bad.  Give me a warning about it but don't
stop the compile.  Not my fault the developer of that interface left off the
const keyword.  I don't have control over the procedure definition.  You're
making me have to 'fix up' the constant variable into a work variable
(another reason for using LIKE) just to call the procedure?

Paul

-- 
Paul Morgan
Senior Programmer Analyst - Retail
J. Jill Group
100 Birch Pond Drive, PO Box 2009
Tilton, NH 03276-2009
Phone: (603) 266-2117
Fax:   (603) 266-2333

"Barbara Morris" wrote
> Paul Morgan wrote:
> >
> > 1) Some built in functions won't accept a constant value but require a
> > variable.  %SUBDT is an example.
>
> I was surprised by this so I tried the following program and it works
> fine.  Is there some other scenario or builtin where a constant doesn't
> work?
>
> C                   eval      n = %subdt(d'2005-01-06' : *years)
> C                   dsply                   n                 5 0
> C                   return
>
> >
> > 2) Different results from %LEN or %SIZE BIFs.  The constant would give
me
> > the length/size of the constant value.  The variable would provide the
> > length/size of the variable which would be different than the constant
value
> > stored in that variable.  (are these BIFs resolved at compile time or
run
> > time?)
>
> %SIZE is always resolved at compile time.  %LEN is resolved at compile
> time unless it's a varying length field.  I guess there might be times
> when you'd want a fixed length/size for all related constants.
>
> >
> > 3) The variable could be used in a LIKE definition. (but if type and
length
> > are not exported then this won't work)
>
> That's true that you could define something LIKE your constant field.
> I'm having a hard time thinking of a scenario where I'd currently want
> to define something LIKE a named constant.  Although I do vaguely
> remember someone wanting to do that once.
>
> >
> > 4) You could pass the variable as a parameter to a subprocedure which
> > requres a 'by reference' variable.
>
> No, the compiler wouldn't allow you pass a CONST variable by reference.
> If the parameter was passed by read-only-reference (CONST keyword), a
> named constant would work fine.




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.