ADDR

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

Read syntax diagramSkip visual syntax diagram
ADDR option syntax

         .-32-.     
>>-ADDR(-+-64-+-)----------------------------------------------><

Default is: ADDR(32)

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 (using cob2 or ld).

If you specify compiler options using the -q option of the cob2 command (or its variants cob2_j or cob2_r), 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:

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.

The setting of the ADDR option affects several compiler limits. For details, see the related reference about compiler limits.

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, 64-bit COBOL programs can be combined with 64-bit C/C++ programs, and 32-bit COBOL programs can be combined with 32-bit C/C++ or PL/I programs.
  • Object-oriented applications: 64-bit COBOL applications that use object-oriented syntax require a 64-bit JDK. 32-bit COBOL applications that use object-oriented syntax require a 32-bit JDK.
  • CICS: COBOL programs that will run in the CICS TXSeries environment must be 32 bit.

related concepts  
JDK support