Description

The LOAD macro brings 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 places the load module in storage above or below 16 megabytes depending on the RMODE of the module. 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 or until the effects of all outstanding LOAD requests for the module have been canceled (using the DELETE macro described in z/OS MVS Programming: Assembler Services Reference ABE-HSP), and there is no other requirement for the module.

Environment

The requirements for the caller are:

Environmental factor Requirement
Minimum authorization: Problem state or supervisor state, and any PSW key. The GLOBAL, EOM, ADDR, ADDR64, ADRNAPF and ADRNAPF64 parameters are restricted to authorized users (APF authorized, PSW key 0-7, or supervisor state).
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 any of the parameters LSEARCH, ADDR, ADRNAPF, GLOBAL, EOM, or LOADPT, you will 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

Register information

After the caller issues the macro, the system might use some registers as work registers or might change the contents of some registers. When the system returns control to the caller, the contents of these registers are not the same as they were before the macro was issued. Therefore, if the caller depends on these registers containing the same value before and after issuing the macro, the caller must save these registers before issuing the macro and restore them after the system returns control.

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. The Load service sets bits within the entry point address to indicate the load module's AMODE:
  • AMODE 24: Within the 32-bit GPR, the high-order and low-order bits are both 0.
  • AMODE 31: Within the 32-bit GPR, the high-order bit is 1, low-order bit is 0.
  • AMODE 64: The 64-bit GPR contains the entry point address. Bit 63 is 1.
If the module's AMODE is ANY, it indicates AMODE 24 if the caller is AMODE 24 (the high order bit is 0), or AMODE 31 if the caller is AMODE 31 or AMODE 64 (the high order bit is 1).
1
The high-order byte contains the load module's APF authorization code.

If the module's length value in doublewords is less than 16M (2**24) and the module does not have the RMODE(SPLIT) attribute, then the low-order three bytes contain the module length in doublewords.

If the module's length value in doublewords is greater than or equal to 16M (2**24), the low-order three bytes contain zeros. To obtain the module length, issue the CSVQUERY macro with the OUTLENGTH parameter.

If the module is a program object with the RMODE(SPLIT) attribute, the low-order three bytes contain zeros. To obtain the length and load point information for each segment, issue the CSVQUERY macro with the OUTXTLST parameter.

When the module is a program object, bound with FETCHOPT=NOPACK option, multiplying by eight the returned length value (to get the total number of bytes) always results in a multiple of one page (4096 bytes) (this is the full size of the area obtained with GETMAIN to hold the program object). If the program object is bound with FETCHOPT=PACK, the length value returned is the virtual storage size indicated in the directory entry. See z/OS MVS Program Management: User's Guide and Reference for further information.

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 receives control, the access registers (ARs) are unchanged.

Performance implications

None.

Syntax

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: RX-type address or register (0), (2) - (12); A-type
DE=list entry addr list entry address: If ADDR, ADRNAPF, EOM,EXTINFO, GLOBAL, LOADPT, or LSEARCH is specified, A-type address or register (2) - (12); otherwise, RX-type address, or register (2) - (12).
   
   ,DCB=dcb addr dcb address: If ADDR, ADRNAPF, EOM,EXTINFO, GLOBAL, 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: LSEARCH=NO
   ,LSEARCH=YES  
   
   ,ADDR=load addr load addr: A-type address or register (2) - (12).
   ,ADRNAPF=load addr  
   ,ADDR64=load addr64 load addr64: AD-type address or 64-bit register (2) - (12).
   ,ADRNAPF64=load addr64  
   
   ,GLOBAL=YES Default: GLOBAL=NO
   ,GLOBAL=(YES,P) If GLOBAL=YES is specified, the default is GLOBAL=(YES,P).
   ,GLOBAL=(YES,F)  
   ,GLOBAL=NO  
   
   ,EOM=NO Default: EOM=NO
   ,EOM=YES
Note: GLOBAL must be specified with EOM=YES.
   
   ,LOADPT=addr addr: A-type address or register (2) - (12).
 
Note: ADDR(or ADDR64) and ADRNAPF(or ADRNAPF64) cannot be specified with LOADPT or GLOBAL or EXTINFO.
   
   ,EXTINFO=addr addr: A-type address or register (2) - (12).
   
   ,RELATED=value  
   
  ,PLISTVER=IMPLIED_VERSION Default: PLISTVER=IMPLIED_VERSION
  ,PLISTVER=MAX  
  ,PLISTVER=1  
  ,PLISTVER=0  
   

Parameters

The parameters are explained below:

EP=entry name
EPLOC=entry name addr
DE=list entry addr
Specifies the entry name, the address of the name, or the address of the name field in a 62-byte list entry for the entry name that was constructed using the BLDL macro. If EPLOC is coded, the name must be padded to eight bytes, if necessary.
Note: When you use the DE parameter with the LOAD macro, DE specifies the address of a list that was created by a BLDL macro. The LOAD and the BLDL must be issued from the same task. Otherwise, the system might terminate the program with a system completion code of 106 and a return code of 15. Therefore, do not issue an ATTACH or DETACH between issuances of BLDL and LOAD.
,DCB=dcb addr
Specifies the address of the data control block for the partitioned data set containing the entry name described above. This parameter must indicate the same DCB used in the BLDL mentioned above.

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 are 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 referred to by the TASKLIB operand of previous ATTACH macros in the subtask chain are first searched for 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 reside 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. GPR 1 contains the abend code that would have resulted had the task abended, and GPR 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) you want the library search limited to the job pack area and to the first library in the normal search sequence.
,ADDR=load addr
,ADRNAPF=load addr
Specifies that the module is to be loaded at the designated address. The address must begin on a doubleword boundary. Storage for the module must have been previously allocated in the key of the eventual user. The system does not search for the module and does not maintain a record of the module when it is loaded. If you code ADDR or ADRNAPF, you must also code the DCB parameter (not DCB=0) and you must not code GLOBAL or LOADPT. ADDR and ADRNAPF are only allowed with PLISTVER=0.
Note: The system assumes that the RMODE of the module is consistent with this address, but the system does not check.

To code: Specify the RS-type address, or address in register (2)-(12), of a 4–byte field.

If your program requires that the module be in an APF-authorized library, use ADDR; otherwise, use ADRNAPF.
  • For the ADDR parameter, the system checks that the module being loaded is in an APF-authorized library.
  • For the ADRNAPF parameter, the system does not check that the module resides in an APF-authorized library. Therefore, if the module is not in an APF-authorized library, the program must make sure that the loaded programs receive control only in problem state.
,ADDR64=load addr64
,ADRNAPF64=load addr64
Specifies that the module is to be loaded beginning at the designated address. The address must begin on a doubleword boundary. Storage for the module must have been previously allocated in the key of the eventual user. The system does not search for the module and does not maintain a record of the module when it is loaded. If you code ADDR64 or ADRNAPF64, you must also code the DCB parameter (not DCB=0), and you must not code GLOBAL or LOADPT. ADDR64 and ADRNAPF64 are only allowed with PLISTVER=1 or PLISTVER=MAX. The SYSSTATE ARCHLVL value (by specifying SYSSTATE ARCHLVL=n) must be greater than 1.
Note: The system assumes that the RMODE of the module is consistent with this address, but the system does not check. The data set from which an ADDR64 or ADRNAPF64 request is met must not be a VIO data set.

To code: Specify the AD-type address, or address in 64-bit register (2)-(12), of an 8-byte field.

If your program requires that the module is in an APF-authorized library, use ADDR64; otherwise, use ADRNAPF64.
  • For the ADDR64 parameter, the system checks that the module being loaded is in an APF-authorized library.
  • For the ADRNAPF64 parameter, the system does not check whether the module resides in an APF-authorized library. Therefore, if the module is not in an APF-authorized library, the program must make sure that the loaded programs receive control only in problem state.
,GLOBAL=YES
,GLOBAL=(YES,P)
,GLOBAL=(YES,F)
,GLOBAL=NO
Specifies whether the module is to be loaded into the pageable common service area (CSA) (GLOBAL=(YES,P) or GLOBAL=YES), or loaded into fixed CSA (GLOBAL=(YES,F)), or not loaded into CSA (GLOBAL=NO). (When the module is to be loaded into CSA, the module must not have been previously loaded with different attributes by the same job step. The module must also be reentrant and must reside in an APF-authorized library.)

For GLOBAL=(YES,F), the module must not be marked as requiring alignment on a page boundary. If you code the GLOBAL parameter, you cannot code the ADDR or ADRNAPF parameter.

If the requested module resides in the link pack area, the LOAD request performs as though the GLOBAL parameter was omitted. The LOAD request locates the module in the link pack area and allows access to it, but the request does not load a copy of the desired module into the common service area.

Note: A load request with the GLOBAL=YES, (YES,P), or (YES,F) option does not cause the loaded module to be implicitly known to other address spaces. The loaded module can be accessed by other address spaces, however, only the task that loaded the module may delete it.
,EOM=YES
,EOM=NO
Indicates whether a module in global storage is to be deleted when the address space terminates (EOM=YES) or when the task terminates (EOM=NO). If you code EOM, you must also code GLOBAL.
,LOADPT=addr
Specifies that the starting address at which the module was loaded is to be returned to the caller at the indicated address. If you code LOADPT, you cannot code ADDR or ADRNAPF.
,EXTINFO=addr
Specifies a 304-byte area which upon return is to contain extended information. 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.
,PLISTVER=IMPLIED_VERSION
,PLISTVER=MAX
,PLISTVER=1
,PLISTVER=0
An optional input parameter that specifies the version of the macro. PLISTVER determines which parameter list the system generates. PLISTVER is an optional input parameter on all forms of the macro, including the list form. When using PLISTVER, specify it on all macro forms used for a request and with the same value on all of the macro forms. The values are:
  • IMPLIED_VERSION, which is the lowest version that allows all parameters specified on the request to be processed. If you omit the PLISTVER parameter, IMPLIED_VERSION is the default.
  • MAX, if you want the parameter list to be the largest size currently possible. This size might grow from release to release and affect the amount of storage that your program needs.

    If you can tolerate the size change, IBM recommends that you always specify PLISTVER=MAX on the list form of the macro. Specifying MAX ensures that the list-form parameter list is always long enough to hold all the parameters you might specify on the execute form, when both forms are assembled with the same level of the system. In this way, MAX ensures that the parameter list does not overwrite nearby storage.

  • 1, may be used with any currently available parameters.
  • 0, if you use any currently available parameters other than ADDR64 or ADRNAPF64; may not be used with ADDR64 and ADRNAPF64.
To code: Specify one of the following versions:
  • IMPLIED_VERSION
  • MAX
  • A decimal value of 0 or 1

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 system completion 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 system completion code in GPR 1.

Example 1

Bring a load module with entry name PGMLKRUS into virtual storage. Let the system find the module from available libraries.
LOAD  EP=PGMLKRUS

Example 2

Bring a load module with entry name PGMEOM into pageable CSA storage and return the load address at location PGMLPT.
LDPGM    LOAD  EP=PGMEOM,EOM=YES,LOADPT=PGMLPT,GLOBAL=(YES,P)
         .
         .
         .
PGMLPT   DS    A                    LOAD ADDRESS RETURNED HERE