[next] [previous] [contents]

  5.6 Constants
  A constant is a value that does not change during pro-
  gram execution. Constants can be either literals or named
  constants and can be of any data type except RFA. You can
  use the DECLARE CONSTANT statement to create named
  constants. Constants can be of the following types:

  .
        Integer
  .
        Floating-point
  .
        Packed decimal
  .
        String

  In addition, predefined constants are provided and are useful
  for the following:

  .
        Formatting program output to improve clarity
  .
        Making source code easier to understand
  .
        Using nonprinting characters without having to look up
        their ASCII values

  Table 5-1 lists the predefined constants.

  These predefined constants simplify the task of using non-
  printing characters in your programs. For example, the
  following statement causes a bell to sound on your terminal:
  PRINT BEL

  To print and underline the same word on a VT-100 series
  video display terminal, use the following statement. Note that
  m in the following example must be lowercase:
  PRINT ESC + "[4mNAME:" + ESC + "[0m"

  You can also create your own predefined constants with the
  DECLARE CONSTANT statement. The following statements
  define and print a constant that underlines the string NAME:
  DECLARE STRING CONSTANT Underlined_word = ESC + "[4mNAME:" + ESC + "[0m"
  PRINT Underlined_word

  For more information about constants, see Chapter 8 and
  the DEC BASIC and VAX BASIC for OpenVMS Systems
  Reference Manual
.