Chapter 6: AMODE

If your application includes Assembler programs, or you are mixing OS/VS dialect programs with other COBOL dialects, you may be affected by the AMODE setting, which affects addressing mode.

On the mainframe, storage can be allocated either above or below "the line". "The line" means the point at which memory addresses require four bytes of storage to hold them rather than three bytes - that is, addresses above 16Mb. The mainframe is limited to 31-bit addressing, but pointer variables are always 32 bits long and the unused bits are available for use by user programs. The format of these pointer variables on the mainframe is different to that native to the Intel PC platform, and to cope with this Workbench used a variety of different techniques (CONVERTPTR, REDEFPTR and recently MFPM AMODE).

Older mainframe compilers such as OS/VS COBOL were created before MVS supported addresses above the line and so only support 24-bit addressing. Newer compilers such as VS COBOL II support both 31-bit and (for interoperability) 24-bit addressing. This support is provided by the mainframe compiler directive DATA(24|31) and linker directives AMODE(24|31|ANY) and RMODE(24|ANY).

When a program is compiled with the DATA(24) directive, the data items declared in its Data Division are allocated in storage below the line. This enables those data items to be passed as CALL parameters to 24-bit programs such as OS/VS programs - if these parameters were not allocated below the line you would most likely receive an S0C4 abend.

Mainframe Express more fully emulates the addressing modes of the mainframe than did Workbench. It does this through the use of Mainframe Pointer Manager (MFPM). This maintains a mainframe virtual address space to map mainframe-style "above and below the line" addresses to real 32-bit PC memory addresses. Pointer variables in your programs are MFPM addresses stored in mainframe format and so you can redefine and manipulate them just as you would on the mainframe.

6.1 COBOL Programs

For COBOL programs, this is enabled by the settings AMODE(24|31) and DATA(24|31). The OS/VS COBOL dialect uses AMODE(24) DATA(24) and this is not configurable (just like the mainframe compiler). Other COBOL dialects default to AMODE(31) DATA(31) but these can be altered. With Workbench the AMODE directive was available but was not enabled by default and there was no DATA directive. The AMODE and DATA settings in Mainframe Express make the CONVERTPTR and REDEFPTR directives obsolete.

You set AMODE and DATA in the Addressing mode and Data mode fields, which are on the Dialect dialog box accessed by clicking on the General tab of the COBOL tab in the Build Settings dialog box.

6.2 Assembler Programs

For Assembler programs addressing mode is controlled by the AMODE setting. There is also an RMODE setting that controls whether the program itself must reside in memory above or below the line. For autolinked load modules you set AMODE and RMODE on the Link page of the Assembler page in the Build Settings for Project dialog box. For programs that require a link file, you set AMODE using the Addressing mode field on the General page of the Linker page, and RMODE using the Residency mode field on the Advanced page of the Linker page. The AMODE setting decides the addressing mode in which the first Assembler module in an executable program is called. By default it is set to AMODE 31. If your Assembler program expects to be started in 24-bit mode, ensure you set AMODE to AMODE 24. This replaces the MF/370 option AMODE370

The amount of storage allocated to your progam at execution time is configurable using the Max. memory below 16Mb and the Max. memory above 16Mb fields on the Execution tab of the Project Settings dialog box. This replaces the MF/370 option VM370.

For further information see the chapter Run-time Considerations in your Assembler Option Technical Guide .

6.3 CICS Shared Storage

CICS shared storage may be restricted to below the line or may extend above the line depending on the setting of the Region addressing mode dropdown list on the CICS tab of the Project Settings dialog box. If your region contains 24-bit programs that need to access this storage, ensure the setting of Region addressing mode is AMODE 24, which is the default. If all the programs that access the storage are 31-bit, you can safely change this setting to AMODE 31. This replaces the configuration option in the SIT for CICS Option for Workbench.

6.4 Some Simple Guidelines

To summarize the above:

6.5 Mixing Addressing Modes

Just as on the mainframe, mixing addressing modes in your application with Mainframe Express can be complex. If you get the settings wrong the error message you are most likely to receive is RTS error 205, although you might receive RTS error 114 in some circumstances. On the mainframe you would usually receive a S0C5 abend. The most common causes of the problems which you may run into are the following:

6.6 AMODE and Non-mainframe Dialect

If you compile a COBOL program using the Non-mainframe dialect, this is not by default enabled for MFPM. This means that pointer variables cannot be exchanged between these programs and programs which are MFPM-enabled, for example COBOL programs in a mainframe dialect.

To enable your Non-mainframe program for MFPM specify the AMODE(31) DATA(24|31) directives in the Additional directives field on the COBOL tab of the Build Settings dialog box.


Copyright © 2001 Micro Focus International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.