z/OS MVS Program Management: Advanced Facilities
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


IMPORT: Import a function or external variable

z/OS MVS Program Management: Advanced Facilities
SA23-1392-00

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:

FUNC=IMPORT
Requests import of a function or external variable.
VERSION=1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
Specifies the version of the parameter list to be used. The default value is VERSION=1.
Note: If Version = 1, 2, or 3 is specified for the IMPORT call, OFFSET cannot be specified as a macro keyword. The parameter list ends with the XINAME parameter (with the high-order bit set).
RETCODE=retcode — RX-type address or register (2-12)
Specifies the location of a fullword integer that is to receive the return code returned by the binder.
RSNCODE=rsncode — RX-type address or register (2-12)
Specifies the location of a 4-byte hexadecimal string that is to receive the reason code returned by the binder.
WORKMOD=workmod — RX-type address or register (2-12)
Specifies the location of an 8-byte area that contains the workmod token returned on the CREATEW request. This token must not be changed.
ITYPE=CODE | DATA | CODE64 | DATA64
Specifies whether the imported symbol represents code (a function entry point, for example) or a data item. CODE64 and DATA64 are used in conjuction with 64-bit addressing.
DLLNAME=dllname — RX-type address or register (2-12)
Specifies the name of an area containing a halfword length field followed by the member or alias name of the module containing the imported function or variable. The length field defines the number of characters in the member name and must not be larger than 8 bytes for a directory member or alias, or 1024 bytes for a z/OS UNIX System Services filename.
INAME=iname — RX-type address or register (2-12)
Specifies the name of an area containing a halfword length field followed by the name of the symbol to be processed. The length field defines the number of characters in the symbol name and must not be larger than 32767.
OFFSET=offset — RX-type address or register (2-12)
Specifies the name of an area containing a fullword integer. This value is not interpreted by the binder, but will be stored in the import-export table entry for the symbol if the import is for CODE and it is determined that the symbol specified on the IMPORT statement is to be dynamically resolved.

Processing notes

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.

Return and reason codes

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.

Parameter list

If your program does not use the IEWBIND macro, place the address of the IMPORT parameter list in general purpose register 1.

Table 1. IMPORT parameter list
       
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
  'D' = Data
  'E' = Code64
  'F' = Data64

DLLNAME DC H'nnn',CLnnn'dllname' DLL containing symbol
INAME DC H'nnn',CLnnn'iname' Imported function or variable
       
Note: X'80000000' must be added to either the NAME parameter (for Version 1 through 3) or the OFFSET parameter (for Version 4 or higher).

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014