IMPORTED Declaration

An IMPORTED declaration can be specified only within a CONNECTION BLOCK declaration.

<imported declaration>

── IMPORTED ──<imported data specification>────────────────────────────┤

<imported data specification>

                ┌◄───────────────────── , ─────────────────────┐
──┬─<data type>─┴─<identifier>─┬─────────────────────────────┬─┴─┬─────┤
  │                            └─<library object attributes>─┘   │
  └─<imported array specification>───────────────────────────────┘

<imported array specification>

──┬──────────────────┬─ ARRAY ───────────────────────────────────────────────►
  ├─<data type>──────┤
  └─<character type>─┘
  ┌◄────────────────────────────────── , ─────────────────────────────────┐
►─┴─<identifier>── [ ──<lower bound>── ] ─┬─────────────────────────────┬─┴──┤
                                          └─<library object attributes>─┘

<library object attributes>

      ┌◄──────────────────────── , ────────────────────────┐
── ( ─┴─┬─/1\─ ACTUALNAME ── = ──<EBCDIC string literal>─┬─┴─ ) ───────┤
        └─<library object access mode>───────────────────┘

<data type>

──┬─ BOOLEAN ───┬──────────────────────────────────────────────────────┤
  ├─ COMPLEX ───┤
  ├─ DINTEGER ──┤
  ├─ DOUBLE ────┤
  ├─ EVENT ─────┤
  ├─ INTEGER ───┤
  ├─ INTERLOCK ─┤
  └─ REAL ──────┘

A program can give an imported access mode to a data library object by specifying a <library object access mode>. The READONLY option indicates that the importer wants read-only access to the data. The READWRITE option indicates that the importer wants both read and write access to the data. The access mode, if not specified, defaults to READONLY. An imported access mode is not allowed for an EVENT, an EVENT ARRAY, an INTERLOCK, or an INTERLOCK ARRAY.

The imported access mode, as well as the exported access mode, is used to determine whether two data library objects match each other. A library object exported READONLY matches only a library object imported READONLY. A library object exported READWRITE can match a library object imported either READONLY or READWRITE. If the library objects match, the actual access mode used for accessing the data is determined by the imported access mode. If the imported access mode is READONLY, any attempt to write to the data object results in a memory protection error.

Multidimensional arrays can be imported inside of Connection Blocks if they are specified with a READWRITE access mode.

Note: IMPORTED EVENTS and EVENT ARRAYS cannot be used as:
  • An <event designator> in an <event list> for the WAIT and WAITANDRESET statements

    However, if the compiler control option WAITIMPORT is set, an IMPORTED EVENT that is declared in a CONNECTION BLOCK can be used as an EVENT that is declared in a CONNECTION BLOCK can be used as an <event designator> in an <event list> for a WAIT or WAITANDRESET statement.

  • An <event designator> in a direct I/O READ or WRITE statement

  • An <event designator> in an ATTACH statement

  • An <event designator> for the LOCK Interlock statement

  • Actual parameters in a PROCEDURE INVOCATION statement or a PROCEDURE REFERENCE statement