AMODE - Addressing Mode
AMODE (Addressing Mode) specifies the size of the memory addresses that a program or routine can generate and use to access virtual storage in an IBM z/OS environment. It dictates the maximum virtual storage location a program can directly reference, thereby influencing its ability to utilize memory beyond certain boundaries, such as the 16MB or 2GB lines.
Key Characteristics
-
- Address Size: Defines the length of addresses a program can handle:
AMODE(24): Can generate and use 24-bit addresses, allowing access up to 16MB of virtual storage.AMODE(31): Can generate and use 31-bit addresses, allowing access up to 2GB of virtual storage.AMODE(64): Can generate and use 64-bit addresses, allowing access to the full 64-bit virtual address space (above 2GB).- Entry Point Attribute: AMODE is an attribute of a program's entry point, meaning different entry points within the same load module can have different AMODEs.
- Linkage Editor Assignment: AMODE is typically assigned to a load module or control section during the linkage editor (or binder) process using JCL parameters or control statements.
- Program Compatibility: Crucial for ensuring that calling and called programs can correctly pass addresses to each other without causing addressing exceptions or data corruption.
- Processor State: The AMODE of the currently executing program determines the processor's addressing mode (e.g., 24-bit, 31-bit, 64-bit) for instruction execution and address generation.
Use Cases
-
- Legacy Application Execution: Many older COBOL or Assembler programs, especially those developed before 31-bit addressing became prevalent, run in
AMODE(24). - Modern Application Development: New z/OS applications and system components are typically developed with
AMODE(31)orAMODE(64)to leverage larger virtual storage areas for data and code. - Inter-program Communication: When a program in one AMODE calls a program in a different AMODE, the calling program must ensure that any addresses passed as parameters are valid within the called program's AMODE.
- System Service Calls: Many z/OS system services (e.g., SVCs, PC routines) require the caller to be in a specific AMODE to correctly pass parameters or receive return values.
- Language Environment (LE): Programs compiled with Language Environment (COBOL, PL/I, C/C++) typically run in
AMODE(31)orAMODE(64)to utilize LE's extensive runtime services and memory management.
- Legacy Application Execution: Many older COBOL or Assembler programs, especially those developed before 31-bit addressing became prevalent, run in
Related Concepts
AMODE is closely related to RMODE (Residency Mode), which specifies where a program module must reside in virtual storage (e.g., RMODE(24) for below 16MB, RMODE(ANY) for anywhere). While AMODE dictates *how* a program addresses memory, RMODE dictates *where* it can be loaded. Both are critical attributes assigned by the Linkage Editor (or Binder) and directly impact a program's interaction with Virtual Storage. Switching between AMODEs often involves specific Program Call (PC) instructions or linkage conventions to manage the transition and ensure address validity.
- Match AMODE to Data Needs: Ensure the
AMODEof a program is sufficient to address all data structures it needs to access, especially large arrays, control blocks, or dynamically allocated memory. - Consistent Linkage: When calling subroutines, ensure
AMODEcompatibility. If calling a lowerAMODEroutine, ensure addresses passed are valid for that mode (e.g., below 16MB forAMODE(24)).