ILE RPG Language Reference
The IMPORT keyword specifies that storage for the data item being
defined is allocated in another module, but may be accessed in this
module. The external_name parameter, if specified, must be a character
literal or constant.
If a name is defined as imported but no module in the program contains
an exported definition of the name, an error will occur at link time.
See EXPORT{(external_name)}.
The IMPORT keyword on the definition specification is used to import
data items and cannot be used to import procedure names. Procedure
names are imported implicitly, to all modules in the program, when
the EXPORT keyword is specified on a procedure specification.
The following restrictions apply when IMPORT is specified:
- The data item may not be initialized (the INZ keyword is not allowed).
The exporting module manages all initialization for the data.
- An imported field cannot be defined as a compile-time or prerun-time
array or table, or as a data area. (Keywords CTDATA, FROMFILE, TOFILE,
EXTFMT, PERRCD, and DTAARA are not allowed.)
- An imported field may not be specified as an argument to the RESET
operation code since the initial value is defined in the exporting
module.
- You cannot specify an imported field in the Result-Field entry
of a PARM in the *ENTRY PLIST.
- You cannot define an imported field as based (the keyword BASED
is not allowed).
- This keyword is not allowed for unnamed data structures.
- The only other keywords allowed are DIM, EXTNAME, LIKE, OCCURS,
and PREFIX.
- The same external field name cannot be specified more than once
per module and also cannot be used as an external procedure name.
For a multiple-occurrence data structure or table, each module
will contain its own copy of the occurrence number or table index.
An OCCUR or LOOKUP operation in any module will have only a local
impact since the occurrence number or index is local to each module.
[ Top of Page | Previous Page | Next Page | Contents |
Index ]