On 2023-11-18 03:38, Bernd Oppolzer wrote:
Sorry for jumping in VERY late.

If you have something like

    DCL X CHAR (6);

    X = DATE;

then you will get strange results, because DATE is not recognized as the
well-known builtin function DATE which returns the
current date. But instead it is a DECIMAL FLOAT(6) variable

Not when you specify explicit declarations.
In his case, the identifier is marked as not declared, and it is treated
as a compile-time ERROR.

The default in PL/I (F) days for undeclared identifiers whose initial
letter was A-H and O-Z was FLOAT BINARY.

with an undefined value (given the "normal" default rules, inherited
from FORTRAN, which defines an undefined variable depending on its first letter ... and, of course, if you don't have the more modern compiler options which prevent you from using undefined variables etc.).

Now, if you want the compiler to use the builtin function DATE instead of this undefined variable, you have two choices:

- declare DATE as a BUILTIN function

   DCL DATE BUILTIN;
   X = DATE;

- put parantheses after DATE; that is:

   X = DATE ();

   this way, DATE is known to be the BUILTIN function "by context".

Both variants will do.

Same goes for all other builtin functions without arguments.

HTH,
kind regards

Bernd

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to