Residency and addressing mode of programs

The control program ensures that each load module is loaded above or below 16 megabytes as appropriate and that it is invoked in the correct addressing mode (24-bit or 31-bit). The placement of the module above or below 16 megabytes depends on the residency mode (RMODE) that you define for the module. Whether a module executes in 24-bit or 31-bit addressing mode depends on the addressing mode (AMODE) that you define for the module.

The addressing modes have the following meanings:
  • When a program is running in 24-bit addressing mode, the system treats both instruction and data addresses as 24-bit addresses. This allows programs running in 24-bit addressing mode to address the first 16 megabytes (16,777,216 bytes) of storage in an address space.
  • When a program is running in 31-bit addressing mode, the system treats both instructions and data addresses as 31-bit addresses. This allows a program running in 31-bit addressing mode to address the first 2 gigabytes (2,147,483,648 bytes or 128x16 megabytes) of storage.
  • The system handles a program in 64-bit addressing mode differently. A program does not get control in 64-bit addressing mode. It starts running in either 24- or 31-bit addressing mode. To change its addressing mode, it uses the SAM64 Assembler instruction. While in 64-bit addressing mode, it continues to run below the 2-gigabyte address of the address space. However, it can access data that exists above the 2-gigabyte address. To give you an idea of the size of the 64-bit address space, consider that a 64-bit address space is 8 billion times the size of a 31-bit address space.

z/OS MVS Programming: Assembler Services Guide provides detailed information concerning the AMODE and RMODE of modules of storage. z/OS MVS Programming: Extended Addressability Guide provides more information about how programs use the 64–bit address space.

You can define the residency mode and the addressing mode of a program in the source code. Table 1 shows an example of the definition of the AMODE and RMODE attributes in the source code. This example defines the addressing mode of the load module as 31 and the residence mode of the load module as 24. Therefore, the program will receive control in 31-bit addressing mode and will reside below 16 megabytes in 24-bit addressable storage.
Table 1. Assembler Definition of AMODE/RMODE
     
SAMPLE CSECT  
SAMPLE AMODE 31
SAMPLE RMODE 24

The assembler places the AMODE and RMODE in the output object module for use by the linkage editor. The linkage editor passes this information on to the control program through the directory entry for the partitioned data set that contains the load module. You can also specify the AMODE/RMODE attributes of a load module by using linkage editor control cards. See z/OS MVS Program Management: User's Guide and Reference and z/OS MVS Program Management: Advanced Facilities for information concerning these control cards.