# Compaq COBOL
User Manual

Previous | Contents | Index

/ALIGNMENT=PADDING, -align padding

The Compaq Alpha Calling Standards require that data fields be aligned on specific addresses (shown in those standards). The same standards specify that the lengths of all data records and group data items must be multiples of their alignments.

If /ALIGNMENT=PADDING or `-align padding` is present on the compile command line, COBOL group data-items will be aligned on their natural boundaries and those group items will be padded out to multiples of their alignments. Refer to the Compaq COBOL Reference Manual for detailed information about elementary data item alignment with Alpha alignment and padding in effect.

## B.3.3 Qualifiers Only on Compaq COBOL for OpenVMS VAX

Table B-4 lists the command-line qualifiers and qualifier-option combinations that are specific to Compaq COBOL on VAX. Except as noted, these qualifiers have no equivalents on Alpha systems.

Table B-4 Compaq COBOL for OpenVMS VAX Specific Qualifiers
Qualifier | Comments
--- | ---
/DESIGN | Controls whether the compiler processes the input file as a detailed design.
/INSTRUCTION_SET[=option] | Improves run-time performance on single-chip VAX processors, using different portions of the VAX instruction set.
/STANDARD=OPENVMS_AXP | Produces informational messages on language features that are not supported by the Compaq COBOL compiler on Alpha. (See the section on /STANDARD=OPENVMS_AXP in this appendix, and refer to the Compaq COBOL for OpenVMS VAX release notes.)
/STANDARD=PDP11 | Produces informational messages on language features that are not supported by the COBOL-81 compiler.
/WARNINGS=STANDARD | Produces informational messages on language features that are Compaq extensions. The Compaq COBOL equivalent on Alpha is the /STANDARD=SYNTAX qualifier or the `-std syntax` flag.

/STANDARD=V3, -std v3

Compaq COBOL on Alpha does not support a number of features supported by the implementation of the /STANDARD=V3 qualifier on VAX, as follows:

- When subscripts are evaluated in STRING, UNSTRING, and INSPECT (Format 3) statements and the REMAINDER phrase of the DIVIDE statement
- When reference modification is evaluated in STRING, UNSTRING, and INSPECT (Format 3) statements
- When an out-of-range expression specifying the starting position or length of reference modification is detected; Compaq COBOL on Alpha detects the out-of-range expression at run time (if /CHECK=BOUNDS is used), whereas Compaq COBOL on VAX in some cases detects it at compile time
- When the variable associated with the VARYING phrase is augmented in PERFORM... VARYING... AFTER statements (Format 4)
- How PIC P digits are interpreted in some moves
- When the size of variable-length tables (OCCURS DEPENDING ON) is determined in the MOVE statement

The /WARNINGS=ALL qualifier or the `-warn all` flag can help you determine the effects of /STANDARD=V3 and `-std v3` ; in particular, the Compaq COBOL compiler on Alpha will generate the following informational messages if /STANDARD=V3 or `-std v3` has been specified:

- For items that may be affected by evaluation order in the INSPECT, STRING, UNSTRING, and DIVIDE statements:

      /STANDARD=V3 evaluation order not supported for this construct

- For destinations where OCCURS DEPENDING ON requires different behavior in the MOVE statement:

      /STANDARD=V3 variable length item rules not supported for this construct

For full information on the differences in the Compaq COBOL for OpenVMS Alpha implementation of the /STANDARD=V3 qualifier, refer to the online help for Compaq COBOL for OpenVMS Alpha.

/STANDARD=OPENVMS_AXP

Compaq COBOL for OpenVMS VAX Version 5.1 (and higher) provides a flagging system, via the /STANDARD=OPENVMS_AXP qualifier option, to identify language features in your existing programs that are not available in Compaq COBOL on the OpenVMS Alpha system. (There may be additional language features not available on the Tru64 UNIX system.)

When you specify /STANDARD=OPENVMS_AXP, the Compaq COBOL for OpenVMS VAX compiler generates informational messages to alert you to language constructs that are not available in Compaq COBOL on OpenVMS Alpha. (You must also specify /WARNINGS=ALL or /WARNINGS=INFORMATIONAL to receive these messages.) You can use this information to modify your program.

Specify /STANDARD=NOOPENVMS_AXP, which is the default, to suppress these informational messages.

# B.4 Compaq COBOL Behavior Differences on VAX and Alpha

This section describes behavior differences between Compaq COBOL on its Alpha and VAX platforms.

## B.4.1 Program Structure Messages

In some cases, the Compaq COBOL compiler (whether on the OpenVMS Alpha or the Tru64 UNIX system) generates more complete messages about unreachable code or other logic errors than does the Compaq COBOL for OpenVMS VAX compiler.

The following example illustrates a sample program and the messages issued, or not issued, by the Compaq COBOL compiler on each of the three platforms:

Source file

           IDENTIFICATION DIVISION.
           PROGRAM-ID. T1.
           ENVIRONMENT DIVISION.
           PROCEDURE DIVISION.
           P0.
               GO TO P1.
           P2.
               DISPLAY "This is unreachable code".
           P1.
               STOP RUN.

On OpenVMS VAX systems

    $ COBOL /ANSI/WARNINGS=ALL T1.COB
    $

The program compiles. The Compaq COBOL for OpenVMS VAX compiler produces no messages.

On OpenVMS Alpha systems

    $ COBOL/ANSI/OPTIMIZE/WARNINGS=ALL T1.COB
           P2.
    .......^
    %COBOL-I-UNREACH, code can never be executed at label P2
    at line number 7 in file DISK$YOURDISK:[TESTDIR]T1.COB;1

On Tru64 UNIX systems

    % cobol -ansi -O -warn all T1.COB
    cobol: Info: T1.COB, line 7: code can never be executed at label P2
           P2
    -------^

Compaq COBOL on either Alpha platform is an optimizing compiler. One use of optimization is to perform analysis for uncalled routines and unreachable paragraphs. The compiler performs the unreachable code analysis for all levels of optimization, including /NOOPTIMIZE or the equivalent `-O0` flag. Compaq COBOL for OpenVMS VAX does not have an /OPTIMIZE qualifier.

## B.4.2 Program Listing Differences

Some differences appear in program listings depending upon whether they were produced by the Compaq COBOL compiler on OpenVMS Alpha, OpenVMS VAX, or Tru64 UNIX.

### B.4.2.1 Machine Code

With Compaq COBOL on Alpha, /NOOBJECT and `-noobject` cause the compiler to suppress code generation, so no machine code is produced either for the listing or for the object module.

If you want the machine code to be included in the program listing, do not use /NOOBJECT or `-noobject` .

On VAX, /NOOBJECT suppresses just the creation of the .OBJ file. The compiler still does all the work to generate the object code so it can be placed in the listing.

### B.4.2.2 Module Names

With Compaq COBOL on Alpha, the name of the first program is the module name throughout the compilation. On VAX, the module name changes as the various programs are encountered.

### B.4.2.3 COPY and REPLACE Statements

The Compaq COBOL compiler produces output in slightly different formats on Alpha and VAX when listing annotations for the COPY statement in COBOL programs.

The following two compiler listing files illustrate the difference in the position of the listing annotations, represented by the letter "L":

Compaq COBOL on Alpha Listing File for COPY Statement

                  1 IDENTIFICATION DIVISION.
                  2 PROGRAM-ID. DCOP1B.
                  3 *
                  4 *       This program tests the copy library file.
                  5 *       with a comment in the middle of it.
                  6 *       It should not produce any diagnostics.
                  7         COPY
                  8 *       this is the comment in the middle
                  9                 LCOP1A.
    L            10 ENVIRONMENT DIVISION.
    L            11 INPUT-OUTPUT SECTION.
    L            12 FILE-CONTROL.
    L            13 SELECT FILE-1
    L            14         ASSIGN TO "FILE1.TMP".
                 15 DATA DIVISION.
                 16 FILE SECTION.
                 17 FD      FILE-1.
                 18 01      FILE1-REC       PIC X.
                 19 WORKING-STORAGE SECTION.
                 20 PROCEDURE DIVISION.
                 21 PE.     DISPLAY "***END***"
                 22         STOP RUN.

Compaq COBOL on VAX Listing File for COPY Statement

        1         IDENTIFICATION DIVISION.
        2         PROGRAM-ID. DCOP1B.
        3        *
        4        *    This program tests the copy library file.
        5        *    with a comment in the middle of it.
        6        *    It should not produce any diagnostics.
        7             COPY
        8        *    this is the comment in the middle
        9                     LCOP1A.
       10L        ENVIRONMENT DIVISION.
       11L        INPUT-OUTPUT SECTION.
       12L        FILE-CONTROL.
       13L        SELECT FILE-1
       14L            ASSIGN TO "FILE1.TMP".
       15         DATA DIVISION.
       16         FILE SECTION.
       17         FD  FILE-1.
       18         01  FILE1-REC       PIC X.
       19         WORKING-STORAGE SECTION.
       20         PROCEDURE DIVISION.
       21         PE. DISPLAY "***END***"
       22             STOP RUN.

### B.4.2.4 Multiple COPY Statements

The Compaq COBOL compiler also produces output in slightly different formats on Alpha and VAX when listing a COBOL program with multiple COPY statements on a single line.

The following two compiler listing files illustrate the difference in the position of the listing annotations, represented by the letter "L," for multiple COPY statements on a single line:

Compaq COBOL on Alpha Listing File for Multiple COPY Statements

                  1 IDENTIFICATION DIVISION.
                  2 PROGRAM-ID. DCOP1J.
                  3 *
                  4 *       Tests copy with three copy statements on 1 line.
                  5 *
                  6 ENVIRONMENT DIVISION.
                  7 DATA DIVISION.
                  8 PROCEDURE DIVISION.
                  9 THE.
                 10         COPY LCOP1J. COPY LCOP1J. COPY LCOP1J.
    L            11         DISPLAY "POIUYTREWQ".
    L            12         DISPLAY "POIUYTREWQ".
    L            13         DISPLAY "POIUYTREWQ".
                 14         STOP RUN.

Compaq COBOL on VAX Listing File for Multiple COPY Statements

        1         IDENTIFICATION DIVISION.
        2         PROGRAM-ID. DCOP1J.
        3        *
        4        *    Tests copy with three copy statements on 1 line.
        5        *
        6         ENVIRONMENT DIVISION.
        7         DATA DIVISION.
        8         PROCEDURE DIVISION.
        9         THE.
       10             COPY LCOP1J.
       11L            DISPLAY "POIUYTREWQ".
       12C                         COPY LCOP1J.
       13L            DISPLAY "POIUYTREWQ".
       14C                                      COPY LCOP1J.
       15L            DISPLAY "POIUYTREWQ".
       16             STOP RUN.

### B.4.2.5 COPY Insert Statement

The compiler listing file for a Compaq COBOL program differs on Alpha and VAX when a COPY statement inserts text in the middle of a line.

In the following two compiler listing files, LCOP5D.LIB contains "O". The Compaq COBOL on Alpha compiler keeps the same line and inserts the COPY file contents below the source line. On VAX, the compiler splits the original source line into parts.

Compaq COBOL on Alpha Listing File for COPY Statement

            -----------------------------------------------------------
               13 P0.     MOVE COPY LCOP5D. TO ALPHA.
            L  14              "O"

Compaq COBOL on VAX Listing File for COPY Statement

            -----------------------------------------------------------
            13         P0. MOVE COPY LCOP5D.
            14L                 "O"
            15C                              TO ALPHA.

### B.4.2.6 REPLACE and COPY REPLACING Statements

For the REPLACE and COPY REPLACING statements, the line numbers in compiler listing files differ between Alpha and VAX. Compaq COBOL on Alpha arranges the line number for the replacement line to correspond to its line number in the original source text, while subsequent line numbers differ. Compaq COBOL for OpenVMS VAX arranges the line numbers consecutively.

The following source program produces compiler listing files with different ending line numbers on Alpha and VAX:

Source File

                    REPLACE ==A VERY LONG STATEMENT== by ==EXIT PROGRAM==.
                    A
                    VERY
                    LONG
                    STATEMENT.
                    DISPLAY "To REPLACE or not to REPLACE".

Compaq COBOL on Alpha Listing File for REPLACE Statement

            -----------------------------------------------------------------
                    1 REPLACE ==A VERY LONG STATEMENT== by ==EXIT PROGRAM==.
                    2 EXIT PROGRAM.
                    6 DISPLAY "To REPLACE or not to REPLACE".

Compaq COBOL on VAX Listing File for REPLACE Statement

            -----------------------------------------------------------------
                    1 REPLACE ==A VERY LONG STATEMENT== by ==EXIT PROGRAM==.
                    2 EXIT PROGRAM.
                    3 DISPLAY "To REPLACE or not to REPLACE".

The diagnostic messages for the COBOL source statements REPLACE and DATE-COMPILED result in compiler listing files that contain multiple instances of the source line.

On Alpha, for a REPLACE statement in a Compaq COBOL on Alpha program, if the Compaq COBOL on Alpha compiler issues a message on the replacement text, the message corresponds to the original text in the program, as shown in the following:

Compaq COBOL on Alpha Listing File for REPLACE Statement

                         18 P0.     REPLACE ==xyzpdqnothere==
                         19                         BY ==nothere==.
                         20
                         21         copy "drep3hlib".
            L            22         display xyzpdqnothere.
                         ...................1
                 %COBOL-F-UNDEFSYM, (1) Undefined name

            LR           22     display nothere.

On VAX, the compiler message corresponds to the replacement text, as shown in the following:

Compaq COBOL on VAX Listing File for REPLACE Statement

            18         P0. REPLACE ==xyzpdqnothere==
            19                             BY ==nothere==.
            20
            21             copy "drep3hlib".
            22LR           display nothere.
                                   1
                 %COBOL-F-ERROR  349, (1) Undefined name

### B.4.2.7 DATE COMPILED Statement

The following two compiler listing files demonstrate the difference between using the DATE-COMPILED statement with Compaq COBOL on Alpha and VAX.

Compaq COBOL on Alpha Listing File for DATE-COMPILED Statement

                 33 *
                 34 date-compiled
                    .............1
    %COBOL-E-NODOT, (1) Missing period is assumed

                 34 date-compiled  16-Jul-1992.
                 35 security. none.

Compaq COBOL on VAX Listing File for DATE-COMPILED Statement

       33        *
       34         date-compiled   16-Jul-1992.
                               1
    %COBOL-E-ERROR   65, (1) Missing period is assumed
       35         security. none.

### B.4.2.8 Compiler Listings and Separate Compilations (OpenVMS)

On OpenVMS Alpha, the /SEPARATE_COMPILATION qualifier produces distinct listings. For separately compiled programs (SCP) compiled without /SEPARATE_COMPILATION, the listings are ordered as follows:

- PROGRAM_1 source listing
- PROGRAM_2 source listing
- PROGRAM_3 source listing
- PROGRAM_1 machine code listing
- PROGRAM_2 machine code listing
- PROGRAM_3 machine code listing

With /SEPARATE_COMPILATION, the listings are ordered as follows (consistent with the order on VAX):

- PROGRAM_1 source listing
- PROGRAM_1 machine code listing
- PROGRAM_2 source listing
- PROGRAM_2 machine code listing
- PROGRAM_3 source listing
- PROGRAM_3 machine code listing

## B.4.3 Output Formatting

Control Byte Sequences

Compaq COBOL on Alpha and Compaq COBOL on VAX may use different control byte sequences in VFC files to accomplish similar output file formatting.

VFC Files

VFC formatted REPORT WRITER or LINAGE files are normally viewed by using the TYPE command or by printing them out. If you need to mail reports through electronic mail or to bring them up in an editor, you can do so by compiling with /NOVFC on the compile command line.

All REPORT WRITER and LINAGE files that are opened in a single .COB source file will have the same format (either VFC or NOVFC). VFC is the default. For example:

       $ COBOL A/NOVFC,B/VFC,C/NOVFC,D

In this example, source files B and D will produce reports in VFC format. (Behavior is different when the source file list items are separated by plus (+) signs. See Section 1.2.2.1, Format of the COBOL Command on OpenVMS.)

On Tru64 UNIX, the REPORT WRITER and LINAGE files produce ASCII file output, which can be viewed or mailed electronically.

## B.4.4 Compaq COBOL Statement Differences on Alpha and VAX

The following COBOL statements and clause behave differently on Alpha and VAX:

- ACCEPT
- DISPLAY
- EXIT PROGRAM
- LINAGE clause
- MOVE
- SEARCH

### B.4.4.1 ACCEPT and DISPLAY Statements

When you use any extended feature of ACCEPT or DISPLAY within your program, visible differences in behavior between Compaq COBOL on Alpha and VAX exist in some instances. The Alpha behavior in these instances is as follows:

- When you mix ANSI ACCEPT statements and extended ACCEPT statements in a program, the editing keys used by the extended ACCEPT statements are also used by the ANSI ACCEPT statements. (See Table 11-3 for a complete list of editing keys.)
- When your terminal is set to no-wrap mode and you display an item whose characters extend past the edge of the screen, all characters past the rightmost column are truncated. For example, if you specify a display of "1234" at column 79 on an 80-column screen, Compaq COBOL on Alpha will display 12. By contrast, Compaq COBOL on VAX overstrikes the character in the rightmost column and displays 14.
- If your application uses the Compaq extensions to the ACCEPT or DISPLAY statements, Compaq COBOL on Alpha positions the cursor in the upper left corner of the screen prior to the execution of the first ACCEPT or DISPLAY statement.
  This difference is clearly shown when the first ACCEPT or DISPLAY statement does not contain the LINE and COLUMN clauses. In this case Compaq COBOL on Alpha moves the cursor to the top of the screen to perform the ACCEPT or DISPLAY, whereas Compaq COBOL on VAX does not move the cursor.

Screen update behavior is not identical for Compaq COBOL on Alpha and Compaq COBOL on VAX, and they sometimes use different escape sequences for ACCEPT and DISPLAY to accomplish similar screen formatting.

If you attempt to use extended ACCEPT/DISPLAY with input redirected from a file or output redirected to a file, the operation differs between Compaq COBOL on VAX and Compaq COBOL on Alpha. In general, on Alpha, the Compaq COBOL RTL attempts to use ANSI ACCEPT/DISPLAY to handle all ACCEPT and DISPLAY statements in this situation. For example, if you use DISPLAY AT LINE or ACCEPT DEFAULT, the RTL will ignore the extensions (that is, LINE or DEFAULT) if you redirect output to a file or input from a file. On VAX, the RTL ignores some, but not all, ACCEPT/DISPLAY extensions when input is redirected from a file or output is redirected to a file.

END-DISPLAY Difference

In Compaq COBOL on Alpha, a DISPLAY statement in an ON EXCEPTION for an ACCEPT statement must be terminated, with, for example, END-DISPLAY. END-DISPLAY is supported for all formats of DISPLAY on Alpha.

In Compaq COBOL on VAX, END-DISPLAY is not supported. If you convert code with ACCEPT ON EXCEPTION to handle DISPLAY on both VAX and Alpha, you need to PERFORM a paragraph with the DISPLAY from the ON EXCEPTION processing in the ACCEPT.

For more information about ACCEPT and DISPLAY, including sample programs, see Chapter 11, Using ACCEPT and DISPLAY Statements for Input/Output and Video Forms.

Previous | Next | Contents | Index