Data Storage Options

See USAGE Clause for more information about the format of a data item in memory.

-Da       

This allows you to specify the data alignment modulus for level 01 and level 77 data items. Normally, level 01 and level 77 data items are aligned on a 4-byte boundary (modulus 4). This is optimal for 32-bit architectures. You can specify an alternate alignment boundary by following this option with the desired modulus. This should be specified as a single digit that immediately follows the -Da as part of the same argument. For example, -Da8 specifies that data should be aligned on 8-byte boundaries, which can provide improved performance on a 64-bit machine.

-Db This causes COMPUTATIONAL data items to be treated as if they were declared as BINARY data items. This is the default when you are using VAX COBOL compatibility mode.
-De This causes the compiler to generate MOVE code for all LINKAGE data items that works regardless of the alignment of the data item. The move is, however, less efficient. Please note that this option should be used only if the linkage is given values using the SET ADDRESS OF verb.
-Dca     This selects the ACUCOBOL-GT storage convention. It is the default setting. This convention is also compatible with data produced by RM/COBOL (not RM/COBOL-85) and previous versions of ACUCOBOL-GT. It also produces slightly faster code.
-Dcb

This selects the MBP COBOL sign storage convention.See the topic USAGE Clause for the specifics of sign storage.

Note that the MBP COBOL sign storage convention for USAGE DISPLAY directly conflicts with that used by IBM COBOL and some other COBOLs. As a result, signed USAGE DISPLAY items in the MBP format are correctly understood only when the program is compiled with -Dcb. This is unlike the other sign conventions in which the runtime can usually extract the correct value even when a mismatched sign convention is specified at compile time.

Also note that MBP COBOL does not have the COMP-2 storage type. The convention that ACUCOBOL-GT implements (Positive: X"0C"; Negative: X"0D") was chosen because MBP COBOL most closely matches the sign storage of other COBOLs that use that convention.

-Dci This selects the IBM storage convention. It is compatible with IBM COBOL, as well as with several others including RM/COBOL-85. It is also compatible with the X/Open COBOL standard.
-Dcm This selects the Micro Focus storage convention. It is compatible with Micro Focus COBOL when the Micro Focus ASCII sign-storage option is used (this is the Micro Focus default).
-Dcn This causes a different numeric format to be used. The format is the same as the one used when the -Dci option is used, except that positive COMP-3 items use X"0B" as the positive sign value instead of X"0C". This option is compatible with NCR COBOL.
-Dcr This selects the Realia sign storage convention. Sign information for S9(n) variables is stored using the conventions for Realia COBOL, and their conversion to binary decimal is the same as that performed by the Realia compiler.
-Dcv

This creates numeric sign formats that are compatible with VAX COBOL. These are identical to the IBM formats, except that unsigned COMP-3 fields place X"0C" in the sign position, instead of X"0F".

The ANSI definition of COBOL does not state how signs should be stored in numeric fields (except for the case of SIGN IS SEPARATE). As a result, different COBOL vendors use different conventions. By using the options -Dca, -Dci, -Dcm, -Dcn, or -Dcv, you may select alternate sign-storage conventions. Doing so is useful in the following cases:

  • If you need to export data to another COBOL system and need to match its sign-storage convention.
  • If you are importing data from another COBOL system, and that data contains key fields with signed data. Keys are treated alphanumerically, so if you use the incorrect sign-storage convention, ACUCOBOL-GT will not find a matching key when it is doing a READ.
The storage-convention affects how data appears in USAGE DISPLAY, COMP-2, and COMP-3 data types.

For additional information and tables, see USAGE Clause.

-Dd31 This option supports data items with up to 31-digits or 16 bytes. When this option is in effect, you may use as many as 31 X or 9 symbols in a PIC, instead of the usual 18. The maximum number of bytes in a COMP-X or COMP-N data item, whose picture contains only "X" symbols, is 16, instead of the usual 8. Intermediate results are calculated to 33 digits instead of the usual 20.
-Df

This option changes the way the compiler treats data items declared as COMP-1 and COMP-2. Some compilers use COMP-1 and COMP-2 to specify single- and double-precision floating-point data items. ACUCOBOL-GT, however, assigns a different meaning to COMP-1 and COMP-2 and uses FLOAT and DOUBLE to specify floating-point data items.When the -Df option is used, the compiler treats data items declared as COMP-1 as if they were declared FLOAT and data items declared as COMP-2 as if they were declared DOUBLE. With the -Df option, you have the following correspondence:

COMP-1   FLOAT    single precision
COMP-2   DOUBLE   double precision

The -Df option makes it easier to compile code originally written for another compiler — one that used COMP-1 and COMP-2 to specify floating point data items. The -Df option lets you compile such code without having to change COMP-1 and COMP-2 to FLOAT and DOUBLE.

-Di

This option causes the compiler to initialize Working-Storage. Normally, the compiler will initialize all data items to spaces or the value specified with the -Dv option, except for those items given a VALUE clause. If this option is specified, data items are initialized according to their type:

  • Alphabetic, alphanumeric, alphanumeric edited, and numeric edited items are initialized to spaces.
  • Numeric items are initialized to zero.
  • Pointer items are initialized to null.
  • Index items are initialized to 1.

Automatic initialization applies only to Working-Storage and does not apply to any item that (a) is given a VALUE clause, (b) is EXTERNAL, or (c) is subordinate to a REDEFINES phrase.

-Dl This option allows you to limit the maximum alignment modulus that will be used for SYNCHRONIZED data items. Normally, a synchronized data item is aligned on a 2-, 4-, or 8-byte boundary depending on its type. This option allows you to specify an upper bound to the modulus used. This is specified as a single digit that immediately follows the -Dl as part of the same argument. For example, -Dl4 specifies that the maximum synchronization boundary is a 4-byte boundary. If you want to make programs that are compliant with the 88/Open COBOL specification, you should specify -Dl4. This option can be specified in a compiler directive. See Conditional Compilation Options for more information.
-Dm This option causes any data item whose underlying type is binary to be stored in the minimum number of bytes needed to hold it. Normally, binary types are stored in two, four, or eight bytes. This option allows storage in any number of bytes ranging from one to eight. The exact number of bytes used for a particular data item is described under the USAGE clause in the ACUCOBOL-GT Reference Manual.
-Dq Causes the QUOTE literal to be treated as an apostrophe, or single quotation mark, rather than as a double quotation mark ("). One exception to this is the HP COBOL TRANSFORM verb, in which QUOTE is always treated as a double quotation mark.
-Ds This causes USAGE DISPLAY numeric items with no SIGN clause to be treated as if they were described with the SIGN IS TRAILING SEPARATE clause. Several versions of RM/COBOL behave this way (all versions before 2.0, and some versions afterward).
-Dv This option allows you to specify the default byte (initial value) used to initialize any data item not otherwise initialized when the program is loaded. The option must be followed by an equals sign (=) and the decimal value of the byte to use (for all current platforms, this is the ASCII value of the desired character). For example, to fill memory with the NULL character, use -Dv=0. To fill memory with the ASCII space character, use -Dv=32.

The default value is the space character.

-Dw

This option lets you modify the definition of certain data types. These data types are generally dependent on the host machine's native word size. You may use this option to:

  1. Maintain compatibility with COBOL source code written specifically for 32-bit machines (for example, to set the size of USAGE POINTER data items to 4 bytes).
  2. Make it easier to match a C structure for a particular machine.
  3. Optimize your data storage for a particular class of machines.

-Dw selects the maximum word size of the set of machines that you expect to run on. You follow this option with the maximum word size you desire, expressed as the number of bits per word. Currently, the legal forms are -Dw32 and -Dw64.

This option determines the maximum word size, not the exact word size.

The -Dw option affects the size of the following data types:

  • SIGNED-SHORT
  • SIGNED-INT
  • SIGNED-LONG
  • POINTER
  • UNSIGNED-SHORT
  • UNSIGNED-INT
  • UNSIGNED-LONG

It also affects the size of the RETURN-CODE special register.

Selecting a maximum word size does not inhibit the portability of your code. Instead, it limits the size of certain data items. If you attempt to use a data item that is too small for a particular machine, you may lose precision. For example, USAGE POINTER data items are stored in 4 bytes if you use -Dw32. If you attempt to run a program that stores an address in 4 bytes on a 64-bit machine, you may lose some of the address. While the program will technically run, the results may not be useful.

For maximum portability, you should use -Dw64. This will allow your code to run on all machines that run ACUCOBOL-GT. However, if your program will call Windows DLLs, you should use -Dw32. For strict compatibility with ACUCOBOL-85 Version 2.2 or earlier, you should use -Dw32. For programs prior to Version 2.3, the only real affect of shifting from -Dw32 to -Dw64 is the USAGE POINTER data types expand from 4 bytes to 8 bytes. If your program does not depend on the size of POINTER data items, then you should be able to use -Dw64 with no harm.

If you use any of the -C compile options that establish source compatibility with ACUCOBOL-85 Version 2.2 or earlier (for example, -C21, then the default setting is Dw32 If you do not use these options, then the default setting is -Dw64. You may override the default by using the -Dw option. For example, to compile for source compatibility with Version 2.1, but to set the target architecture to 64 bits, you would use -C21 -Dw64. In order to use -Dw64, you must use a Version 2.3 or later runtime.

See USAGE Clause for more information.

-Dy This option specifies that all data items whose underlying representation is binary should be treated as if they were described as SYNCHRONIZED. This option is not recommended unless you have a particular need for it. ACUCOBOL-GT is optimized for non-synchronized handling of binary data, so synchronization will usually not have beneficial results. Note, however, that you must specify this option if you want to make programs that are compliant with the 88/Open COBOL specification.
-Dz

This option causes the compiler to modify its size checking rules for numeric items. Instead of computing size error by examining the number of 9's in an item's picture, the compiler computes size error by examining the actual storage for that item. For example, normally a PIC 99 BINARY data item cannot hold a number larger than 99, although the storage for the item can hold a value up to 255. When -Dz is used, ACUCOBOL-GT will not cause a size error until a value greater than 255 is moved to this item. This option also affects truncation in MOVE statements and implied moves.

There are four truncation options in all. See Truncation Options for description and comparison information on these options.

-D1 This option causes any data item whose underlying type is binary to be stored in one byte if that data item has only one or two digits. Normally, such a data item would be stored in two bytes.
-D2 This option causes COMPUTATIONAL data items to be treated as if they were declared as COMPUTATIONAL-2. This is the default when you are using RM/COBOL compatibility mode.
-D5 This option causes data items declared as BINARY to be treated as if they were declared as COMPUTATIONAL-5. This causes the values to be stored in the host machine's native byte-ordering instead of the machine-independent byte-ordering normally used. This option should be used with caution, because it can lead to programs that are not portable.
-D6 This option causes unsigned data items declared as PACKED-DECIMAL to be treated as if they were declared as COMPUTATIONAL-6. This saves one-half of a byte because the compiler will not generate any storage for the sign.
-D7 This option allows you to match one of the binary storage conventions used by Micro Focus COBOL. That convention is identical to the ACUCOBOL-GT -Dm convention, except that a PIC 9(7) data item (unsigned) is stored in 3 bytes instead of 4 and a PIC 9(12) data item (unsigned) is stored in 5 bytes instead of 6. When you use this option, the size of a binary item is determined as follows (the value in the table is the number of bytes occupied by the data item):
Number of          Signed             Unsigned 
9's in PIC         Storage            Storage
1 - 2              1                  1
3 - 4              2                  2
5 - 6              3                  3
7                  4                  3
8 - 9              4                  4
10 - 11            5                  5
12                 6                  5
13 - 14            6                  6
15 - 16            7                  7
17 - 18            8                  8
--FpRounding

Simulates the behavior of other COBOL systems with regard to implied rounding when floating point is used in a math statement.

This case-insensitive option is followed by an equals sign (=) and one of the following:

  • OSVS means that any math statement that contains a floating-point data item as a sending item has ROUNDED implied for every receiving item.
  • VSC2 means that any math statement that contains a floating-point data item as either a sending item or a receiving item has ROUNDED implied for every receiving item.

If --FpRounding is not specified, rounding is not automatically implied.

For example, consider the following program fragment:

77 INT-1 PIC 99.
77 FLOAT-1 USAGE FLOAT.
MOVE 1.6 TO FLOAT-1
COMPUTE INT-1 = 3 * FLOAT-1.

Without this compiler option, the value moved to INT-1 is 4 (4.8 truncated). If either --FpRounding=OSVS or --FpRounding=VSC2 is specified, the value moved would be 5 instead (4.8 rounded up).

Alternatively, the following example:

77 INT-1 PIC 99.
77 DEC-1 PIC 99V99.
77 FLOAT-1 USAGE FLOAT.
MOVE 1.6 TO DEC-1
COMPUTE FLOAT-1, INT-1 = 3 * DEC-1

would move 5 to INT-1 only if --FpRounding=VSC2 is used (because the only floating item is a receiving item).

--lastWSDataSeg=# "#" is an integer between 1 and 32, inclusive.

This option sets the data segment number that will be the last one used by data items contained in Working-Storage. Note that this option applies only to Version 7.2 and earlier.

The compiler allocates up to 32 data segments per program, each of which can be up to 64 KB in size. Data outside of Working-Storage must fit within these segments. Data contained in Working-Storage need not, but it can be slightly more efficient to place Working-Storage data within these segments until it places some in the segment identified by --lastWSDataSeg=#. After that point, the compiler places all Working-Storage data into a separate address space (identified by addresses larger than x"40000000" in the symbol table listing). This reserves space for other data items that follow Working-Storage, such as the Screen Section or literals found in the Procedure Division.

The default setting is 24. This reserves 8 segments (512 KB) for use by the Screen Section and literals. This is normally much more than needed. If it is not enough, then setting --lastWSDataSeg=# to a lower value reserves more space.

When compiling for Version 6.0 or an earlier object format, the default setting is 32. This causes all of Working-Storage to be allocated in data segments. This sets an absolute limit of about two MB on the amount of small data that a program can allocate. The term small in this sense means data elements are individually smaller than 64 KB.

We recommend leaving this option at its default value unless you receive the error message Program exceeds 32 segments. Should this occur, try setting --lastWSDataSeg=# to a value smaller than the default of "24."

--noAlignLit This option inhibits use of the default algorithm for aligning literals in memory. Use the -Da option to specify an alignment modulus other than the default of 4.
--truncANSI There are four truncation options in all. See Truncation Options for description and comparison information on these options.
--noTrunc There are four truncation options in all. See Truncation Options for description and comparison information on these options.
--fastRefMod Directs the compiler to use an optimized method for handling code that performs reference modification. The result is faster runtime execution. Note that this option may not work with certain programs, resulting in unexpected results or compiler failure. If using this option, be sure to verify runtime results. When this option is not specified, the compiler uses the standard method for reference modification code handling.