COBOL - Group home

Add AMODE 64 COBOL programs to your existing application without recompiling all of it

By Nicole Trudeau posted 9 days ago

The Enterprise COBOL 6.3 September 2021 Compiler and Runtime PTFs contain a substantial new feature that allows you to add AMODE 64 COBOL programs to your existing AMODE 31 COBOL application without recompiling all of it. This is accomplished through the interoperability of AMODE 31 and AMODE 64 COBOL programs and is available on z/OS 2.3, 2.4, and 2.5. 

AMODE 64 COBOL programs without the need for a full AMODE 64 application
COBOL can create AMODE 31 and AMODE 64 programs. Most existing COBOL programs are AMODE 31, but there may be a need to recompile some programs to run in AMODE 64 (see below). Previously, Enterprise COBOL did not allow mixing of AMODE 31 and AMODE 64 programs, so if one program was compiled with AMODE 64, all programs within the application must also be compiled to run in AMODE 64. Starting with the COBOL 6.3 September 2021 Compiler and Runtime PTFs, if needed, you can now gradually recompile some programs to run in AMODE 64, while keeping the rest running in AMODE 31. z/OS offers the revolutionary feature to easily mix AMODE 31 and AMODE 64 programs that other major architectures do not offer for their 32-bit and 64-bit architectures. This feature is meant to be a temporary solution while you move your full application to AMODE 64.

Your AMODE 31 COBOL programs will be able to call the AMODE 64 programs and vice versa using dynamic calls. Behind the scenes, the compiler and the COBOL runtime library take advantage of a new Language Environment (LE) feature to manage AMODE switching. This LE feature allows a DLL subprogram to have a different AMODE from its caller. If you have an existing application running in AMODE 31 using dynamic calls, take advantage of this feature with minimal or no changes to most programs. This feature is available on the new z/OS 2.5 and is also available on z/OS 2.3 or z/OS 2.4 with the PTF for LE APAR PH28966. Learn more here.

What is an AMODE 64 COBOL program?
The z/OS architecture uses virtual storage and address spaces. A COBOL program running in an address space can reference all of the storage associated with that address space (assuming it has access authorization). z/OS architecture can define storage addresses as 31 bits in length, which allows the user program to access an address space of 2 GB. z/OS architecture can also define storage addresses as 64 bits in length. With 64-bit addressing, each address space, called a 64-bit address space, is potentially 16 EB in size (an exabyte is slightly more than one billion gigabytes). The addressing mode is called AMODE and can be set to 31 or 64.

An AMODE 64 COBOL program executes in the address space below 2 GB but program data can be stored in the address space above 2 GB (up to 16 EB), extending the available space for program data. With AMODE 31, this storage was previously limited to the address space below 2 GB. Learn more here.

Why would I want an AMODE 64 COBOL program?
AMODE 64 allows you to get more space for your growing COBOL program data. The size of the working storage section in your COBOL programs may be hitting the limit of running in AMODE 31.  Once you hit these limits you will start to see errors such as the one below, and the solution is to either recompile to run in AMODE 64 or make complicated changes to the logic of the program.
  • IGYDS1267-S   The size of the "WORKING-STORAGE SECTION" exceeded the compiler limit of 2 gigabytes of memory.  Execution results are unpredictable.

COBOL and Java interoperability
It is no longer a requirement for your COBOL programs to be running in AMODE 64 to communicate with AMODE 64 Java programs. IBM SDK for z/OS, Java Technology Edition V8.0.6.36 (JVM), has AMODE 31/AMODE 64 interoperability functionality that allows AMODE 31 applications (including COBOL applications) to communicate with AMODE 64 Java applications. A future blog will discuss this feature in more detail. In the meantime, learn more here.