Sunteți pe pagina 1din 4

COBOL Addressing Modes:

Storage and its addressability

| When you run your COBOL programs, the programs and the data that they use
| reside in virtual storage. Storage that you use with COBOL can be either
| below the 16-MB line or above the 16-MB line but below the 2-GB bar. Two
| modes of addressing are available to address this storage: 24-bit and
| 31-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, both above and below the 16-MB line.

| Enterprise COBOL does not directly exploit the 64-bit virtual addressing
| capability of z/OS, 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, or either 24-bit or 31-bit addressing. This attribute is AMODE
| 24, AMODE 31, or AMODE ANY, respectively. The object program, the load
| module, and the executing program each has an AMODE attribute. All
| Enterprise COBOL object programs are AMODE ANY.

| Residency mode (RMODE) is the attribute of a program load module 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.

| Enterprise COBOL uses Language Environment services to control the


| storage used at run time. Thus COBOL compiler options and Language
| Environment run-time options influence the AMODE and RMODE attributes of
| your program and data, alone and in combination:
RMODE

Default is: AUTO

Abbreviations are: None

| The RMODE option setting influences the the RMODE (residency mode) of your
| generated object program. A program compiled with the RMODE(AUTO) option will have
RMODE(24) if NORENT is specified, and RMODE(ANY) if RENT is specified.

A program compiled with the RMODE(24) option will have RMODE(24) whether NORENT or
RENT is specified.

A program compiled with the RMODE(ANY) option will have RMODE(ANY) whether NORENT
or RENT is specified.

DATA

Default is: DATA(31)


Abbreviations are: None

| Affects the location of storage for dynamic data areas and other dynamic
| run-time storage: either above (DATA(31)) or below (DATA(24)) the 16-MB
| line. For reentrant programs, the DATA(24|31) compiler option and the HEAP run-time
option control whether storage for dynamic data areas (such as WORKING-STORAGE
and FD record areas) is obtained from below the 16-MB line or from unrestricted storage.
(The DATA option does not affect the location of LOCAL-STORAGE data; the STACK
run-time option controls that location instead, along with the AMODE of the program. It
does affect the location of local WORKING-STORAGE data.)
When you specify the run-time option HEAP(,,BELOW), the DATA(24|31) compiler
option has no effect; the storage for all dynamic data areas is allocated from below the
16-MB line. However, with HEAP(,,ANYWHERE) as the run-time option, storage for
dynamic data areas is allocated from below the line if you compiled the program with the
DATA(24) compiler option or from unrestricted storage if you compiled with the
DATA(31) compiler option.
Specify the DATA(24) compiler option for programs running in 31-bit addressing mode
that are passing data arguments to programs in 24-bit addressing mode. This ensures that
the data will be addressable by the called program.

RMODE defines where the program may be loaded and the only reason to use
RMODE(31) or ANY is to reduce the amount of data & programs below 16MB.
That memory is a limited resource, which is already half used by the operating
system and other programs, so if your program does not need to be there, you
want to get it out of the <16MB area. The name given to that problem explains it
best: VSCR or Virtual Storage Constraint Relief
To understand RMODE you need to understand how an address is created.
(ignoring 64 bit, of course), an address is used from a register, and registers are 32
bits. The first bit (bit 0) is ignored as far as addressing goes (it has meaning, but
nothing relevent here). The remaining 31 bits define an address of 2GB. But in the
old days, only 24 bits were used (bits 7-31) because the machines were 16MB
machines and it only takes 24 bits to address that. So the remaining bits (0-7)
were often used for some other purpose and now that machines can address the
whole 31 bits, the machine needs a way to know to ignore those bits. That is what
AMODE does. To get back to your question about I/O, many of the I/O routines
use 24 bit addressing because they use that 1st byte for something else. Therefore,
the data that the I/O routines will use (control blocks, buffers, etc) must be below
16M; AMODE(24). There are I/O routines that can run 'above the line' that have
been around for years, so not all I/O requires AMODE(24). There are other
services as well that require AMODE(24) such as some TSO routines (TPUT),
and I'm sure many others. Frequently a program is written in 2 parts, the main part
is AMODE(31) and the 2nd AMODE(24), with appropriate code to switch modes
at runtime (See the BASM or BSM assembler instructions for example).
You can call a 31 bit program from a 24 bit program without any problem
But you cant call a 24 bit program from a 31 bit program as 24 bit program may
not access address mentioned 31 bit program.
AMODE(24) indicates 24-bit (three-byte) addressing - memory below the line.
AMODE(31) indicates 31-bit addressing - memory above and below the line.
AMODE=ANY indicates the program may use either of the addressing technique.

Run Mode/Residency Mode


RMODE(24) indicates that the program must be loaded into memory below the
line
RMODE(31) indicates that the program can be loaded either below or above the
line.
RMODE=ANY indicates that the program can be run in either 24 bit (below)or
31 bit memory(above).
In 24-bit addressing mode, the processor treats all virtual addresses as 24-bit values. This
makes it impossible for a program in 24-bit addressing mode to address virtual storage
with an address greater than 16,777,215 (16 megabytes) because that is the largest
number that a 24-bit binary field can contain.

In 31-bit addressing mode, the processor treats all virtual addresses as 31-bit values.A
virtual storage map of two gigabytes with MVS services to support programs executing
or residing anywhere in virtual storage.Two program attributes that specify expected
address length on entry and intended location in virtual storage. Bimodal operation, a
capability of the processor that permits the execution of programs with 24-bit addresses
as well as programs with 31-bit addresses.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IEA2A600/5.0?
SHELF=IEA2BK32&DT=20010118132535

S-ar putea să vă placă și