AMODE

Provides support when performing arithmetic on mainframe-style pointers.

Syntax:

 >>-.---.-.-------AMODE--"format"---.---------><  
    +-/-+ +---NO--AMODE-------------+

Parameters:

format
The storage format of pointers:
24
All pointers are stored in a 24-bit format. This format is compatible with "below-the-line" storage on the mainframe. The top 8 bits of the pointer are masked off when the address of a linkage item is set from the pointer. This means that, as on the mainframe, the top 8 bits can be manipulated directly by the user's code.
31
All pointers are stored in a 31-bit format. This format is compatible with "above-the-line" storage on the mainframe. The top bit of the pointer is masked off when the address of a linkage item is set from the pointer. This means that, as on the mainframe, the top bit can be manipulated directly by the user's code.
64
All pointers are stored in a 64-bit format. This format is compatible with "above-the-bar" storage on the mainframe, enabled via the LP(64) compiler option introduced in Enterprise COBOL 6.3 for z/OS compiler.

Properties:

Default: NOAMODE
Phase: Syntax check
$SET: Initial

Dependencies:

AMODE"31" sets DATA"31" immediately. AMODE"64" sets DATA"64" immediately. AMODE"64" requires both DIALECT"ENTCOBOL" and P64 directives to be set.

Comments:

You need the AMODE directive for any program module that uses arithmetic containing mainframe-style pointers. For example:
01 ptr pointer.
01 ptr-comp pic 9(9) comp redefines ptr.

add 24 to ptr-comp.

In general, to eliminate potential problems that might occur when trying to be selective about which programs are compiled with this directive, we strongly recommended that you use the AMODE directive on all programs in the application, and that you use the same value for format for each subprogram.

The AMODE directive cannot be used for programs that need to call a Micro Focus library routine or an external API that expects pointer items to be in the native machine format, or for subprograms that use any of the CBL_ALLOC_* or CBL_FREE_* library routines. It also has no effect on items defined as usage PROCEDURE-POINTER.

AMODE is required when compiling applications that call assembler programs.

On the mainframe, the Enterprise COBOL 6.3 for z/OS release introduced AMODE 64 support with the LP(64) compiler option, which allows a COBOL program full access to the 64-bit address space. The AMODE"64" directive emulates this and provides support for 64-bit mainframe POINTER types. See the Enterprise COBOL for z/OS Programming Guide for further details of the LP(64) compiler option.

Programs compiled with the AMODE"64" directive set cannot contain XML GENERATE/PARSE, JSON GENERATE/PARSE, ALTER, GO TO, and DISPLAY ... UPON SYSPUNCH statements.

When NOAMODE is set, a POINTER variable is a real pointer. Pointer items behave as expected. Compatibility with mainframe pointers is not supported.