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



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.