$DEFINE Compiler Directive |
|
|
The $DEFINE directive is used to associate a value with a symbolic name at compile time. The standard include records in the SYSCOM file contain many examples of $DEFINE.
Format
$DEFINE name value
where name is the symbol to be used in the program and value is a constant.
Although it is valid for name to correspond to a built-in function, statement or reserved word, use in this way is discouraged as the function, statement or reserved word becomes inaccessible. As an aid to detecting this situation, particularly when migrating an existing application to QM, use of the STRICT.EQUATE setting of the $MODE compiler directive will generate a compiler warning for name clashes.
The token QM is automatically defined and may be used with $IFDEF to determine whether a program is being compiled on the QM database. The token QM.WINDOWS, QM.LINUX, QM.FREEBSD, QM.MAC, QM.AIX, QM.SOLARIS, QM.RPI or QM.PDA is defined corresponding to the underlying operating system. Because these are only relevant at compile time, take care when using them in programs that may be moved between platforms. The SYSTEM() function with key 1010 (SYS$PLATFORM) can be used to determine platform type at run time.
See $IFDEF for an example of use of define tokens to control conditional compilation, allowing a single source stream to be used in different multivalue environments.
See also: |