Changes Affecting Version 2.1

The following section details changes that can affect programs originally written for the Version 2.1 ACUCOBOL-85 compiler.

Compiler Changes

For machines using MS-DOS, ACUCOBOL-GT Version 3.0 requires MS-DOS version 3.0 or later. ACUCOBOL-85 Version 2.1 required only MS-DOS version 2.0.

Beginning with Version 3.0, ACUCOBOL-GT fully supports 64-bit machines without restriction. At the current time, the only machine that fits this classification is the DEC Alpha machine running OSF (Open/VMS also runs on the Alpha machine, but it runs in 32-bit mode). Version 2.1 of ACUCOBOL-85 also runs on 64-bit machines, but it contains some restrictions.

In Version 2.1, the following items are restricted:

  • Since RETURN-CODE is only 32 bits in size, it cannot hold a long value properly. This makes it inappropriate for receiving pointer or long return values from a C subroutine.
  • USAGE POINTER data items are also 32 bits, and so cannot actually hold a real machine address.
  • The direct C interface cannot be used for pointer or long parameters since the 2.1 compiler does not allow you to pass a 64-bit item BY VALUE.

Beginning with Version 3.0, these restrictions do not apply. We made certain changes to the rules of ACUCOBOL-85, beginning with Version 2.3. These changes affect only a few existing COBOL programs, but they have the potential of causing a working program to stop working. Because of this, there is a method available to inhibit these changes. See the -Dw option in Data Storage Options.

The specific changes are:

  • USAGE POINTER data items now occupy 8 bytes instead of 4 bytes. This allows a USAGE POINTER item to hold a full address on any machine architecture. On a machine that is smaller than 64 bits, only the first 32 bits of the POINTER item are used. The rest of the item is treated as FILLER.

    This is the change that is most likely to affect existing programs. You can be affected if you have POINTER data items as part of a group item, since the group item's size will change. If you have this case, then either allow the size of the group to change and adjust any external references or redefinitions of it, or use the option described below to keep POINTER items in 4 bytes.

  • The special register RETURN-CODE was changed from PIC S9(9) COMP-5 to USAGE SIGNED-LONG. See USAGE Clausein the ACUCOBOL-GT Reference Manual for a description of SIGNED-LONG. This change allows RETURN-CODE to hold 64-bit values on 64-bit machines, and so it can be used to hold any return value from a called routine. This change should not affect any existing program.
  • You may now pass 8-byte data items BY VALUE to a called routine. If you are on a 16- or 32-bit machine, then only the low-order 32 bits are actually passed. On a 64-bit machine, all 64 bits are passed. This provides a portable solution to the problem of passing long data. This change does not affect any existing programs.

For related topics, see

RETURN-CODE Changes

As discussed in the previous section, the special register RETURN-CODE has changed. In versions of ACUCOBOL-85 prior to 2.3, RETURN-CODE was implicitly defined as:

77  RETURN-CODE   PIC S9(9)  COMP-5, EXTERNAL.
In Version 2.3 and later, it is defined as:
77  RETURN-CODE   SIGNED-LONG, EXTERNAL.

This change should have no noticeable effect on existing code, but it allows RETURN-CODE to be used sensibly on 64-bit machines. This change is inhibited if you compile for compatibility with a prior version of ACUCOBOL-85. For example, if you use -C21 to maintain source compatibility with Version 2.1, then this change does not take place.

There is also a special register that redefines RETURN-CODE called RETURN-UNSIGNED. Its definition is:

77  RETURN-UNSIGNED 
    REDEFINES RETURN-CODE  UNSIGNED-LONG, EXTERNAL.

You should use RETURN-UNSIGNED when handling pointer or unsigned long data types that are returned from an external routine. If you use RETURN-CODE in these cases, you can get errors if the value is large enough to set the high-order bit of RETURN-CODE. The problem is that these values are negative when interpreted as signed values, therefore COBOL will remove the sign if you move them to an unsigned destination.

The RETURN-UNSIGNED special register is not defined if you compile for compatibility with prior versions of ACUCOBOL-85.

Runtime Changes

For machines using MS-DOS, ACUCOBOL-GT Version 3.1 and later versions do not run under standard 16-bit DOS but do support 32-bit Extended DOS. Version 3.0 requires MS-DOS version 3.0 or later. ACUCOBOL-85 Version 2.1 required only MS-DOS version 2.0.