ADDR

Use the ADDR compiler option to indicate whether a 32-bit or 64-bit object program should be generated.

ADDR option syntax

Read syntax diagramSkip visual syntax diagramADDR(6432)

Default is: ADDR(64)

Abbreviations are: None

Option specification:

You can specify the ADDR option in any of the ways that you specify other compiler options, as described in the related task about compiling programs. However, if you specify ADDR in a PROCESS (or CBL) statement:
  • In a batch compilation, you can specify ADDR only for the first program. You cannot change the value of the option for subsequent programs in the batch.
  • You must use the matching 32-bit or 64-bit option in the link step.

If you specify compiler options using the -q option of the cob2 command, you can abbreviate ADDR(32) as 32 or ADDR(64) as 64. For example:


cob2 -q64 prog64.cbl

Storage allocation:

The storage allocation for the following COBOL data types depends on the setting of the ADDR compiler option:

  • USAGE POINTER (also the ADDRESS OF special register, which implicitly has this usage)
  • USAGE PROCEDURE-POINTER
  • USAGE FUNCTION-POINTER
  • USAGE INDEX

If ADDR(32) is in effect, 4 bytes are allocated for each item in your program that has one of the usages listed above; if ADDR(64) is in effect, 8 bytes are allocated for each of the items.

If the SYNCHRONIZED clause is specified for a data item that has one of the usages shown above, the item is aligned on a fullword boundary if ADDR(32) is in effect, or on a doubleword boundary if ADDR(64) is in effect.

LENGTH OF special register:

If ADDR(32) is in effect, the LENGTH OF special register has this implicit definition:

PICTURE 9(9) USAGE IS BINARY
If ADDR(64) is in effect, the LENGTH OF special register has this implicit definition:

PICTURE 9(18) USAGE IS BINARY

LENGTH intrinsic function:

If ADDR(32) is in effect, the returned value of the LENGTH intrinsic function is a 9-digit integer. If ADDR(64) is in effect, the returned value is an 18-digit integer.

Programming requirements and restrictions:
  • All program components within an application must be compiled using the same setting of the ADDR option. You cannot mix 32-bit programs and 64-bit programs in an application.
  • Interlanguage communication: In multilanguage applications, COBOL programs can be linked with C, C++, or other compiled languages and can interoperate with Java via the Java Native Interface (JNI).
  • CICS®: COBOL programs that will run in the TXSeries® or CICS TX environment must be 32 bit.
    Note: Effective 9 August 2024, IBM withdraws from marketing IBM CICS TX Standard (5900-ALU) and IBM CICS TX Advanced (5737-K69).

Related references  
cob2 options  
Conflicting compiler options