ANS85 

The EXTERNAL Clause

The EXTERNAL clause specifies that a data item or a file connector is external. The constituent data items and group items of an external data record are available to every run-time system element in the run unit that describes that record.

General Format


Syntax for the EXTERNAL clause

Syntax Rules

  1. The EXTERNAL clause can be specified only in file description entries, or in record description entries in the Working-Storage Section.
  2. In the same source element, the externalized name of the subject of the entry that includes the EXTERNAL clause must not be the same as the externalized name of any other entry that includes the EXTERNAL clause.
  3. The VALUE clause must not be used in any data description entry that includes, or is subordinate to an entry that includes, the EXTERNAL clause. The VALUE clause can be specified for condition-name entries associated with such data description entries.
  4. MF Literal-1 must be a nonnumeric or a national literal and must not be a figurative constant.
  5. ISO2002 The EXTERNAL clause must not be specified for a data item of class object.
  6. MF You can specify EXTERNAL in the data division of a method but not as instance data.

General Rules

  1. The data contained in the record named by the data-name clause is external and can be accessed and processed by any run-time system element in the run unit which describes and, optionally, redefines it subject to the following general rules.
  2. Within a run unit, if two or more source elements describe the same external data record, each record-name of the associated record description entries must be the same and the records must define the same number of standard data format characters. However, a source element which describes an external record can contain a data description entry including the REDEFINES clause which redefines the complete external record, and this complete redefinition need not occur identically in other source elements in the run unit, unless the storage area required for the redefinition is larger than the storage area required for the external data record. See the topic The REDEFINES Clause.
  3. Use of the EXTERNAL clause does not imply that the associated file-name or data-name is a global name. See the topic The GLOBAL Clause.
  4. The file connector associated with this description entry is an external file connector.

    MF See your COBOL system documentation on file handling for further information on files with the EXTERNAL attribute.

  5. MF Literal-1 identifies the external name of an external data item or file connector. The same external name must be used by all source elements that reference the same external data item or file connector.
  6. MF When EXTERNAL is specified in the data division of a method, the addressability of the EXTERNAL data is established on each entry to the method.