Storage and its addressability

When you run COBOL programs, the programs and the data that they use reside in virtual storage. Storage that you use with COBOL can be Start of changebelow the 16 MB line, above the 16 MB line but below the 2 GB bar, and above the 2 GB bar. Three modes of addressing are available to address this storage: 24-bit, 31-bit, and 64-bit.End of change

You can address storage below (but not above) the 16 MB line with 24-bit addressing. You can address storage either above or below the 16 MB line with 31-bit addressing. Unrestricted storage is addressable by 31-bit addressing and therefore encompasses all the storage available to your program Start of changebelow the 2 GB barEnd of change.

Enterprise COBOL Start of changecan nowEnd of change directly exploit the 64-bit virtual addressing capability of z/OS® Start of changewith the LP(64) compiler optionEnd of change; however, COBOL applications running in 31-bit or 24-bit addressing mode are fully supported on 64-bit z/OS systems.

Addressing mode (AMODE) is the attribute that tells which hardware addressing mode is supported by your program: 24-bit addressing, 31-bit addressing, either 24-bit or 31-bit addressing, Start of changeand 64-bit addressingEnd of change. These attributes are AMODE 24, AMODE 31, AMODE ANY, Start of changeand AMODE 64End of change respectively. The program object and the executing program each have an AMODE attribute. Enterprise COBOL Start of change6End of change object programs are either AMODE MIN for cases where AMODE 24 is possible, AMODE 31, Start of changeor AMODE 64End of change. See Restrictions for AMODE.

Residency mode (RMODE) is the attribute of a program object that identifies where in virtual storage the program will reside: below the 16 MB line, or either below or above. This attribute is RMODE 24 or RMODE ANY.
Note: Start of changeEnterprise COBOL 6 does not support RMODE 64.End of change

Enterprise COBOL uses Language Environment® services to control the storage used at run time. Thus COBOL compiler options and Language Environment runtime options influence the AMODE and RMODE attributes of your program and data, alone and in combination:

DATA
Compiler option that influences the location of storage for WORKING-STORAGE data, I-O buffers, and parameter lists for programs compiled with RENT.
RMODE
Compiler option that influences the residency mode.
RENT
Compiler option to generate a reentrant program.
HEAP
Runtime option that controls storage for the runtime heap. For example, COBOL WORKING-STORAGE is allocated from heap storage when the COBOL program is compiled with the RENT option and is in one of the following cases:
  • Compiled with Enterprise COBOL 4.2 or earlier releases
  • Compiled with the DATA(24) compiler option
  • Running in CICS®
  • A COBOL 5.1.1 or later program in a program object that contains only COBOL programs (except COBOL 5.1.0) and assembler. There are no Language Environment interlanguage calls within the program object and no COBOL 5.1.0 programs.
  • A COBOL 5 program in a program object where the main entry point is COBOL 5. In this case, the program object can contain Language Environment interlanguage calls, with COBOL statically linking with C, C++ or PL/I. All COBOL 5 programs within such program objects (even if they are not the main entry point) have their WORKING-STORAGE allocated from heap storage.
  • A COBOL 6.1 or later program
STACK
Runtime option that controls storage for the runtime stack. For example, COBOL LOCAL-STORAGE is allocated from stack storage.
ALL31
Runtime option that specifies whether an application can run entirely in AMODE 31.

Restrictions for AMODE

AMODE 24 execution is not supported in the following cases, and the applications must run in AMODE 31. This is the same set of AMODE 24 restrictions as COBOL 3 and 4.
  • Programs containing XML PARSE statements
  • Programs containing XML GENERATE statements
  • Program objects containing COBOL bound together with C, C++, or PL/I programs, and communicating via static CALL
  • Programs containing object-oriented language syntax, such as INVOKE statements, or object-oriented class definitions
  • Programs compiled with any of the following compiler options:
    • DLL
    • PGMNAME(LONGUPPER)
    • PGMNAME(LONGMIXED)
  • Multithreaded applications
    Note: A program compiled with the THREAD option can run in AMODE 24, but only in an application that does not have multiple threads or PL/I tasks.
  • Programs run from the z/OS UNIX file system
    Note: An AMODE 31 driver program resident in the z/OS UNIX file system can contain a dynamic call to an AMODE 24 program module resident in an MVS™ PDSE.
  • Programs used as COBOL compiler exit modules that are specified on the EXIT compiler option
  • Language Environment enclaves that use XPLINK, including either the enclaves that contain non-COBOL programs compiled with the XPLINK compiler option, or run with the XPLINK runtime option
Note:
  • To run COBOL programs with addressing mode 24, you must compile all COBOL programs with Enterprise COBOL 5.1.1, or later versions; or Enterprise COBOL 4.2 or earlier versions. If any component of a program object is compiled with Enterprise COBOL 5.1.0, the program object must run in addressing mode 31. COBOL programs that run with addressing mode 24 must be linked with the binder option RMODE(24).
  • Start of changeTo run COBOL programs with addressing mode 64, you must compile all COBOL programs with Enterprise COBOL 6.3, or later versions, and use the LP(64) compiler option.End of change

Settings for RMODE

The RMODE and RENT options determine the RMODE attribute of your program.

Table 1. Effect of RMODE and RENT compiler options on the RMODE attribute
RMODE compiler option RENT compiler option RMODE attribute
RMODE(AUTO) RENT RMODE ANY
RMODE(AUTO) NORENT RMODE 24
RMODE(24) RENT or NORENT RMODE 24
RMODE(ANY) RENT RMODE ANY
RMODE(ANY) NORENT Compiler option conflict.
If the NORENT option is
specified, the RMODE(24)
or RMODE(AUTO) compiler
option must be specified.

Link-edit considerations: When the object code that COBOL generates has an attribute of RMODE 24, you must link-edit it with RMODE 24. When the object code that COBOL generates has an attribute of RMODE ANY, you can link-edit it with RMODE ANY or RMODE 24.

Storage restrictions for passing data

Do not pass parameters that are allocated in storage above the 16 MB line to AMODE 24 subprograms. Force the WORKING-STORAGE data and parameter lists below the line for programs that run in 31-bit addressing mode and pass data to programs that run in AMODE 24:
  • Compile with the RENT and DATA(24) compiler options, or if the WORKING-STORAGE is on the HEAP (see previous description of the HEAP option), run them with the HEAP(,,BELOW) runtime option.
  • Compile with the NORENT compiler option.

Location of data areas

For reentrant programs, the DATA compiler option, and the HEAP runtime option control whether storage for data areas such as WORKING-STORAGE SECTION and FD record areas is obtained from below the 16 MB line or from unrestricted storage. Compile programs with RENT and RMODE(ANY) or RMODE(AUTO) if they will be run with 31-bit addressing in virtual storage addresses above the 16 MB line. The DATA option does not affect programs that are compiled with NORENT.

Storage for LOCAL-STORAGE data

The location of LOCAL-STORAGE data items is controlled by the STACK runtime option and the AMODE of the program. LOCAL-STORAGE data items are acquired in unrestricted storage when the STACK(,,ANYWHERE) runtime option is in effect and the program is running in AMODE 31. Otherwise LOCAL-STORAGE is acquired below the 16 MB line. The DATA compiler option does not influence the location of LOCAL-STORAGE data.

Storage for external data

In addition to affecting how storage is obtained for dynamic data areas (WORKING-STORAGE, FD record areas, and parameter lists), the DATA compiler option can also influence where storage for EXTERNAL data is obtained. Storage required for EXTERNAL data is obtained from unrestricted storage if the following conditions are met:
  • The program is compiled with the DATA(31) and RENT compiler options.
  • The HEAP(,,ANYWHERE) runtime option is in effect.
  • The ALL31(ON) runtime option is in effect.

In all other cases, the storage for EXTERNAL data is obtained from below the 16 MB line. If you specify the ALL31(ON) runtime option, all the programs in the run unit must be capable of running in 31-bit addressing mode.

Storage for QSAM input-output buffers

The DATA compiler option can also influence where input-output buffers for QSAM files are obtained. See the related references below for information about allocation of buffers for QSAM files and the DATA compiler option.

Storage for ALLOCATE statement

Start of changeThe DATA compiler option setting influences how ALLOCATE acquires storage:
  • If DATA(24) is in effect and the LOC 31 phrase of the ALLOCATE statement is not specified, ALLOCATE acquires storage from below the 16 MB line.
  • If DATA(31) is in effect and the LOC 24 phrase of the ALLOCATE statement is not specified, ALLOCATE will attempt to acquire storage from above the 16 MB line.
End of change

Related concepts  
AMODE switching
AMODE considerations for heap storage (Language Environment Programming Guide)

Related tasks  
Using subprograms  
Sharing data

Related references  
Allocation of buffers for QSAM files  
Allocation of record areas for VSAM files
  
DATA  
RENT  
RMODE  
Performance-related compiler options  
ALLOCATE statement (Enterprise COBOL for z/OS Language Reference)
HEAP, STACK, ALL31 (Language Environment Programming Reference)
MVS Program Management: User's Guide and Reference