LOAD description

The LOAD macro is used to bring the load module containing the specified entry name into virtual storage, if a usable copy is not available in virtual storage. Control is not passed to the load module; instead, the load module's entry point address is returned in GPR 0.

LOAD services place the load module in storage above or below 16 megabytes or above 2 gigabytes, depending on the module's RMODE.

The responsibility count for the load module is increased by one.

The load module remains in virtual storage until the responsibility count is reduced to 0 through task terminations. The module also remains until the effects of all outstanding LOAD requests for the module are canceled by using the DELETE macro. There are no other requirements for the module.

Environment

The requirements for the caller are:

Environmental factor Requirement
Minimum authorization: Problem state and any PSW key
Dispatchable unit mode: Task
Cross memory mode: PASN=HASN=SASN
AMODE: 24- or 31- or 64-bit
ASC mode: Primary
Interrupt Status: Enabled for I/O and external interrupts
Locks: No locks held
Control parameters: Must be in the primary address space

Programming requirements

If you code the parameters LSEARCH, LOADPT, or LOADPT64, you obtain a macro-generated parameter list. Therefore, except for the error routine address, all addresses must be specified as A-type addresses or registers (2) - (12).

Restrictions

  • Any module loaded by a task will not be removed from virtual storage unless the task that loaded the module invokes the DELETE macro or terminates.
  • The load module entry name must be listed as a member name or alias in a partitioned data set directory or specified previously by using the IDENTIFY macro. If the LOAD macro cannot find the specified entry name, the caller's task is abended unless the caller provides an ERRET exit.
  • The caller cannot have an EUT FRR established.

Input register information

The caller does not have to place information into any register before issuing the LOAD macro. If the caller is using the LOAD macro in register notation for a particular parameter, or as a base register, the caller must place information into the register.

Output register information

If the LOAD is successful, the GPRs contain the following when control returns to the caller:
Register
Contents
0
Entry point address of the requested load module. Load services set 64-bit GPR 0 according to the load module's AMODE:
  • AMODE 24: bits 32 and 63 are both 0, and bits 0–31 are all set to 0.
  • AMODE 31: bit 32 is 1, bit 63 is 0, and bits 0–31 are all set to 0.
  • AMODE 64: bit 63 is 1
If the module's AMODE is ANY, it indicates AMODE 24 if the caller is AMODE 24, or AMODE 31 if the caller is AMODE 31 or AMODE 64.
1
The high-order byte contains the load module's APF authorization code.
The low-order 3 bytes contain one of the following values (in priority order):
  • If the module is a program object with more than one segment (extent), zeros.
    To obtain the length and load point information for each segment, use the information returned by way of the EXTINFO parameter or issue the CSVQUERY macro with the OUTXTLST parameter.
    Note: A program object might have more than one segment. One example is the use of the binder RMODE(SPLIT) attribute.
  • If the module’s length, in doublewords, is greater than or equal to 16 M (224) bytes, zeros.

    To obtain the module length, use the information returned by way of the EXTINFO parameter or issue the CSVQUERY macro with the OUTLENGTH or OUTXTLST parameters.

  • Otherwise, the module length, in doublewords.

If the module is a program object, which is bound with the FETCHOPT=NOPACK option, the returned length value is round to the full-page multiple area obtained with GETMAIN to hold the program object. If the program object is bound with the FETCHOPT=PACK option, the returned length value is the size indicated in the directory entry. For further information, view the z/OS MVS Program Management: User's Guide and Reference and z/OS MVS Program Management: Advanced Facilities.

2-13
Unchanged.
14
Used as a work register by the system.
15
Zero, indicating successful completion.
If the LOAD is not successful and the caller provided an ERRET exit to receive control, the GPRs contain:
Register
Contents
0
Used as a work register by the system.
1
System completion code for the abend that would have been issued had the caller not provided an ERRET exit.
2-13
Unchanged.
14
Used as a work register by the system.
15
Reason code (never zero) associated with the system completion code contained in GPR 1.

When control returns to the caller or the ERRET exit receive control, the access registers (ARs) are unchanged.

Some callers depend on register contents remaining the same before and after issuing a service. If the system changes the contents of registers on which the caller depends, the caller must save them before issuing the service, and restore them after the system returns control.

Performance implications

None.

Syntax

The standard form of the LOAD macro is written as follows:

Syntax Description
   
   name name: Symbol. Begin name in column 1.
   
One or more blanks must precede LOAD.
   
LOAD  
   
One or more blanks must follow LOAD.
   
EP=entry name entry name: Symbol.
EPLOC=entry name addr entry name addr: If LSEARCH or LOADPT is specified, A-type address or register (2) - (12); otherwise, RX-type address or register (0) or (2) - (12).
DE=list entry addr list entry addr: If EXTINFO, LOADPT, or LSEARCH is specified, A-type address or register (2) - (12); otherwise, RX-type address, or register (2) - (12).
   
   ,DCB=dcb addr dcb addr: If EXTINFO, LOADPT, or LSEARCH is specified, A-type address or register (2) - (12); otherwise, RX-type address, or register (1) or (2) - (12).
   
   ,ERRET=err rtn addr err rtn addr: RX-type address or register (2) - (12).
   
   ,LSEARCH=NO Default: NO
   ,LSEARCH=YES  
   
   ,LOADPT=addr addr: A-type address or register (2) - (12).
   ,LOADPT64=addr addr: A-type address or register (2) - (12).
   
   ,EXTINFO=addr addr: A-type address or register (2) - (12).
   
   ,RELATED=value  
   

Parameters

The parameters are explained as follows:

EP=entry name
EPLOC=entry name addr
DE=list entry addr
Specifies the following:
  • When EP, specifies the entry name
  • When EPLOC, specifies the address of the name, which must be padded to 8 bytes if necessary
  • When DE, specifies the address of the name field in a 62-byte list entry for the entry name that was constructed using the BLDL macro
The system ignores the information you specify on the DE parameter if the parameter does one or both of the following:
  • Specifies an entry in an authorized library (that is, defined in IEAAPFxx member of parmlib)
  • Requests access to a program or library that is controlled by the System Authorization Facility (SAF)

Instead, the system uses the BLDL macro to construct a new list entry containing the DE information.

Note: When you use the DE parameter with the LOAD macro, BLDL and LOAD must be issued from the same task; otherwise, the system might terminate the program with an abend code of 106 and a return code of 15.
,DCB=dcb addr
Specifies the address of the opened data control block for the partitioned data set containing the entry name described previously. This parameter must indicate the same DCB specified in the BLDL used to locate the entry name.

If the DCB parameter is omitted or if DCB=0 is specified when the LOAD macro is issued by the job step task, the data sets referred to by either the STEPLIB or JOBLIB DD statement is first searched for the entry name. If the entry name is not found, the link library is searched.

If the DCB parameter is omitted or if DCB=0 is specified when the LOAD macro is issued by a subtask, the data sets associated with one or more data control blocks. They are referred by the TASKLIB operand of previous ATTACH macro in the sub-tasking chain and are first searched by the entry name. If the entry name is not found, the search is continued as if the LOAD had been issued by the job step task.

Note: DCB must exist in 24-bit addressable storage.
,ERRET=err rtn addr
Specifies the address of a routine to receive control when an error condition that would cause an abnormal termination of the task is detected. Register 1 contains the abend code that would have ended had the task abended, and register 15 contains the reason code that is associated with the abend. The routine does not receive control when input parameter errors are detected.
,LSEARCH=NO
,LSEARCH=YES
Specifies whether (YES) or not (NO) the search is to be limited to the job pack area and the first library in the normal search sequence.
,LOADPT=addr
Specifies that the starting address at which the module was loaded is to be returned to the caller at the indicated address.
,LOADPT64=addr
Specifies an 8-byte area at which the starting address at which the module was loaded is to be returned to the caller.
,EXTINFO=addr
Specifies a 304–byte area, which contains extended information upon return. This area is mapped by dsect EXTI within macro CSVEXTI. Included in this area are:
  • The extent list (each entry is mapped by dsect EXTIXE within macro CSVEXTI)
  • The authorization code
  • The entry point address

By using the EXTINFO keyword, you can avoid the need to call CSVQUERY after doing the LOAD to obtain information that would not otherwise be returned by LOAD. For example, if a program object length were greater than 128 megabytes or had been bound with RMODE=SPLIT, LOAD would not otherwise return the length information.

,RELATED=value
Specifies information used to self-document macros by ‘relating’ functions or services to corresponding functions or services. The format and contents of the information specified are at the discretion of the user, and may be any valid coding values.

The RELATED parameter is available on macros that provide opposite services (for example, ATTACH/DETACH, GETMAIN/FREEMAIN, and LOAD/DELETE), and on macros that relate to previous occurrences of the same macros (for example, CHAP and ESTAE).

For example, the RELATED parameter can be used as follows:
LOAD1   LOAD       EP=APGIOHK1,RELATED=(DEL1,'LOAD APGIOHK1')
  .
  .
  .
DEL1    DELETE     EP=APGIOHK1,RELATED=(LOAD1,'DELETE APGIOHK1')

Return and reason codes

When the LOAD macro returns control to the caller, GPR 15 is set to zero if the load request was successful. If the load request was not successful and a caller-provided error routine (specified using the ERRET keyword) receives control, GPR 1 contains the abend code for the abend that would have been issued had the caller not provided an ERRET exit. GPR 15 contains the reason code associated with the abend code in GPR 1.

Example 1

Bring a load module containing a specified entry name (PGMLKRUS) into virtual storage. Allows the system to find the module from available libraries.
LOAD     EP=PGMLKRUS

Example 2

Bring a load module containing the entry name EPNAME into virtual storage. Indicate that register 7 contains the address of the DCB associated with the partitioned data set that contains this load module. Return the load address of the requested module in the location pointed to by register 8. If an error occurs during this processing, transfer control to the error routine at ERRADDR.
LOAD EP=EPNAME,DCB=(7),LOADPT=(8),ERRET=ERRADDR