IMPORT describes a function or external variable to be imported and the library member where it can be found.
The syntax of the IMPORT call is:
| [symbol] | IEWBIND | FUNC=IMPORT [,VERSION=version] |
If DLLNAME was not specified, the IMPORT statement will be ignored. Otherwise, if the symbol is unresolved at the end of autocall and all references have SCOPE=X, the IMPORT request will be converted to an entry in binder class B_IMPEXP. A bind job for a DLL application should include an IMPORT control statement for any DLLs that application expects to use. Otherwise if the DLL name is unresolved at static bind time it will not be accessible at run time (cannot be loaded).
Typically, a library of DLLs has an associated side file of IMPORT control statements, and you can include this side file when statically binding a module that imports functions or variables from that library. You can also edit the records in the side file or substitute your own IMPORT control statements so that some symbols are imported from DLLs in a different library.
The common binder API reason codes are shown in Table 1.
| Return Code | Reason Code | Explanation |
|---|---|---|
| 00 | 00000000 | Normal completion. The import request has been added to the binder's Import/Export list successfully. |
If your program does not use the IEWBIND macro, place the address of the IMPORT parameter list in general purpose register 1.
| PARMLIST | DS | 0F | |
| DC | A(IMPORT) | Function code | |
| DC | A(RETCODE) | Return code | |
| DC | A(RSNCODE) | Reason code | |
| DC | A(WORKMOD) | Workmod token | |
| DC | A(ITYPE) | Import type | |
| DC | A(DLLNAME) | DLL Name | |
| DC | A(INAME) | Section name | |
| DC | A(OFFSET) | Function descriptor offset | |
| IMPORT | DC | H'38' | IMPORT function code |
| DC | H'4' | Interface version number | |
| ITYPE | DC | CL1'C' | Import
Type 'C' = Code |
| DLLNAME | DC | H'nnn',CLnnn'dllname' | DLL containing symbol |
| INAME | DC | H'nnn',CLnnn'iname' | Imported function or variable |