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





1) Some built in functions won't accept a constant value but require a variable. %SUBDT is an example.


Actually, you can use a constant value with %SUBDT, but it has to be coded as a date. For example:


     D COOLDATE        c                   d'2005-01-06'
     D year            s             10I 0

      /free
          year = %subdt(COOLDATE: *YEARS);
          dsply ('Year = ' + %char(year));
          *inlr = *on;
      /end-free



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 resolved at compile time, %len() is sometimes compiletime and sometimes runtime, I think.

I don't see why you would ever care about the size/length of a constant, though.


3) The variable could be used in a LIKE definition. (but if type and length
are not exported then this won't work)

That might be nice -- but having a separate constant for the value, and "template" variable for the LIKE definition doesn't bother me much, and it's probably more efficient on memory.



4) You could pass the variable as a parameter to a subprocedure which
requres a 'by reference' variable.

You can already do that with a named constant if the parameter is defined as CONST. If the parameter's not defined as CONST, you couldn't do it with a constant variable, either! (Because it would allow you to change the value of a constant, thus defeating the whole purpose of making it a constant!)


I'd also like to mention the possibility of Reflection APIs on service
programs if variable type/length were exported (including procedure
variables).  Could do some very interesting things with that API.

That might be nice... especially if it eliminated the need to explicitly code a prototype. That way, you could just code the procedure interface, and not have to deal with maintaining two identical parameter lists for every procedure (Which, frankly, is a pain in the butt.)




As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.