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 below 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.
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 below the 2 GB bar.
Enterprise COBOL can
now directly exploit the 64-bit virtual addressing capability
of z/OS® with the LP(64) compiler option;
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, and 64-bit addressing. These attributes are AMODE
24, AMODE 31, AMODE ANY, and AMODE 64 respectively. The program object and the executing
program each have an AMODE attribute. Enterprise COBOL 6 object
programs are either AMODE MIN for cases where AMODE
24 is possible, AMODE 31, or AMODE 64. See Restrictions for AMODE.
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.RMODE
64.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-STORAGEdata, I-O buffers, and parameter lists for programs compiled withRENT. 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-STORAGEis allocated from heap storage when the COBOL program is compiled with theRENToption 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-STORAGEallocated from heap storage. - A COBOL 6.1 or later program
STACK- Runtime
option that controls storage for the runtime stack. For example, COBOL
LOCAL-STORAGEis 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 PARSEstatements - Programs containing
XML GENERATEstatements - 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
INVOKEstatements, or object-oriented class definitions - Programs compiled with any of the following compiler options:
DLLPGMNAME(LONGUPPER)PGMNAME(LONGMIXED)
- Multithreaded applicationsNote: A program compiled with the
THREADoption can run inAMODE 24, but only in an application that does not have multiple threads or PL/I tasks. - Programs run from the z/OS UNIX file systemNote: An
AMODE 31driver program resident in the z/OS UNIX file system can contain a dynamic call to anAMODE 24program module resident in an MVS PDSE. - Programs used as COBOL compiler exit modules that are specified
on the
EXITcompiler option - Language Environment enclaves
that use
XPLINK, including either the enclaves that contain non-COBOL programs compiled with theXPLINKcompiler option, or run with theXPLINKruntime option
- 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). - To 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.
Settings for RMODE
The RMODE and RENT options
determine the RMODE attribute of your program.
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
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
RENTandDATA(24)compiler options, or if theWORKING-STORAGEis on the HEAP (see previous description of theHEAPoption), run them with theHEAP(,,BELOW)runtime option. - Compile with the
NORENTcompiler 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
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)andRENTcompiler 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
DATA compiler
option setting influences how ALLOCATE acquires storage: - If
DATA(24)is in effect and theLOC 31phrase of theALLOCATEstatement is not specified,ALLOCATEacquires storage from below the 16 MB line. - If
DATA(31)is in effect and theLOC 24phrase of theALLOCATEstatement is not specified,ALLOCATEwill attempt to acquire storage from above the 16 MB line.
AMODE switching
AMODE considerations for heap storage (Language Environment Programming Guide)
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