DTRHELP.HLB  —  Commands Statements Clauses, DECLARE Statement
       Defines a global or a local variable.

       Format

         DECLARE  variable-name  variable-definition .

1  –  Arguments

    variable-name

       Is the name of the variable being defined. The name must conform
       to the rules for names listed in the DEC DATATRIEVE User's Guide.

    variable-definition

       Is the definition of the variable, which consists of field
       definition clauses. If you include more than one such clause,
       separate them with spaces, tab characters, or carriage returns.
       Refer to the chapter on record definitions in the DEC DATATRIEVE
       User's Guide for information on field definition clauses.

    . (period)

       Ends the DECLARE statement.

2  –  Examples

       Declare the global variable NEW_BEAM as a 2-digit numeric field
       with a DEFAULT value of 10:

       DTR> DECLARE NEW_BEAM PIC 99 DEFAULT VALUE IS 10.
       DTR> PRINT NEW_BEAM

       NEW
       BEAM

        10

       DTR>

       Declare the global variable X as a single-precision floating-
       point number, with a MISSING VALUE of 36:

       DTR> DECLARE X REAL MISSING VALUE IS 36.
       DTR> PRINT X

           X

       36.0000000

       DTR> SHOW VARIABLES
       Global variables
          X    <Number>
          Declared as: X REAL MISSING VALUE IS 36.

       DTR> RELEASE X
       DTR> SHOW FIELDS
       No ready sources or global variables declared.
       DTR>

       Declare the variable DUE as a date. Assign today's date to DUE
       and suppress the header with a hyphen in parentheses:

       DTR> DECLARE DUE USAGE IS DATE.
       DTR> DUE = "TODAY"
       DTR> PRINT DUE (-)

       22-Sep-90

       DTR>
Close Help