Previous Topic Next topic Print topic


Data Storage Options

The data storage options control the behavior of certain data items and how they are stored.

The following compiler options are supported in Visual COBOL when using ccbl from the command line or the ACUOPT Compiler directive.

Option Definition
-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
-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.
-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.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.
-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.

-Dl1/2/4/8 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.
-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.
-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 e3000 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.
-Dw32 This option is checked for compatibility with the system's bit arrangement.
-Dw64 This option is checked for compatibility with the system's bit arrangement.
Previous Topic Next topic Print topic