REFERENCE Command

The REFERENCE command lists the references to a particular identifier.

Unless modified by some of the options, the references are given in the following form:

The 8-digit sequence number of each line where the identifier is referenced is given.

The sequence number is preceded by an asterisk (*) if the value might be changed by the statement. The sequence number is followed by a number sign (#) if the reference occurred as part of an expanded DEFINE statement.

Syntax

── REFERENCE ──────────────────────────────────────────────────────────►
►─┬─────────────────────────────────────────────────────────┬──────────┤
  │ ┌◄────────────────────────────────────────────────────┐ │
  └─┴─┬─/1\─<identifier specification>──────────────────┬─┴─┘
      ├─/1\─ : ── RANGE ──<range specification>─────────┤
      ├─/1\─ : ── CHANGED ──────────────────────────────┤
      ├─/1\─ : ── ALIASES ──────────────────────────────┤
      ├─/1\─ : ── TEXT ─┬───────────────────────────────┤
      │                 └─<integer>─────────────────────┤
      ├─/1\─┬─ : ── ENVIRONMENTS ─┬──────────┬─┬────────┤
      │     │                     └─<number>─┘ └─ ONLY ─┤
      │     └─ : ── GLOBALENVIRONMENTS ─┬───────────────┤
      │                                 └─ ONLY ────────┤
      ├─/1\─ : ── PRINTER ──────────────────────────────┤
      ├─/1\─ : ── REMOTE ───────────────────────────────┤
      └─/1\─ : ── FILE ──<file name>────────────────────┘

Explanation

REFERENCE

Lists the references to the work identifier. The work identifier is the identifier used in the most recently entered LOCATE, REFERENCE, EXPAND, or SUMMARY command. If the work identifier is empty, an error occurs.

<identifier specification>

Specifies a particular identifier. All references to that identifier are listed.

RANGE <range specification>

Restricts the range over which references are to be listed. The default reference range, as specified by the RANGE command, is used if the RANGE option is not specified. If no RANGE command has been specified, the entire program is used.

CHANGED

Lists only references where the value of the identifier might be changed by the statement.

ALIASES

Produces a merged list of references to the identifier and all its aliases (if any exist). Sequence numbers where an alias is referenced are marked with a plus sign (+). Currently, only the NEWP language keeps track of aliases.

TEXT

Lists the text from the symbol file with each reference. You must load the symbol file to use the TEXT option.

TEXT <integer>

Causes the specified number of lines, centered at the line containing the reference, to be printed with each reference.

ENVIRONMENTS

Lists the names of the environments—procedures and blocks—where the references occur, appropriately interleaved with the references. If modified by a specified <number> value, then only <number> levels of environments are listed. If modified by ONLY, then only the environments and not the references are listed. ENVIRONMENTS ONLY and TEXT are mutually exclusive options.

GLOBALENVIRONMENTS

Similar to ENVIRONMENTS, except that references are broken down only by global environment —global procedure. When this command is modified by ONLY, then only the global environments and not the references are listed. GLOBALENVIRONMENTS ONLY and TEXT are mutually exclusive options.

PRINTER

Sends the output to the line printer by way of a file internally named LINE.

REMOTE

Sends the output to the terminal. This option can be used when PRINTER has been specified so that output goes to the terminal as well as to the printer.

FILE <file name>

Causes all referenced text lines from the symbol file to be output to a disk file with the specified file name. This file cannot already exist. The file name is created with the same FILETYPE value as the file loaded by the SYMBOL command. You must load the symbol file to use this option.

Examples

The following examples refer to the program under “Example INTERACTIVEXREF Program” in this section:

The following command locates the identifier MEAN used in procedure TWO and all procedures nested within it, and lists the associated line numbers:

REFERENCE MEAN: RANGE TWO
  MEAN  ::  REAL  (2,4)  ::  DECLARED  00001200
   *00003900  *00004200
  %

The following command locates the identifier MEAN used in procedure TWO and lists all associated line numbers for procedure TWO, but not the procedures nested within it:

REFERENCE MEAN: RANGE (TWO)
  MEAN  ::  REAL  (2,4)  ::  DECLARED  00001200
    *00004200
  %

The following command locates the identifier C used in procedure THREE of procedure TWO. A list of references where the value of C might be changed and the line of text corresponding to each reference is displayed.

REFERENCE C OF THREE OF TWO:CHANGED:TEXT
  C OF THREE OF TWO :: INTEGER  (4,2) :: DECLARED  00003700
   *00003800       C:= 5;
  %

The following command locates the identifier MEAN and lists all references with the associated text. The references are grouped by the procedures within which they occur. The name of the procedure precedes each group.

REFERENCE MEAN: TEXT: ENVIRONMENTS
  MEAN  :: REAL (2,4)  :: DECLARED  00001200
  ONE:
  *00002400     MEAN:=2;
  *00002600        MEAN:= MEAN * B;
   00002700        C:= C * MEAN;
  TWO:
  *00004200     MEAN:= MEAN / 3;
  THREE OF TWO:
  *00003900       MEAN:= MEAN + C;
  %