HP OpenVMS Systems Documentation

Content starts here

HP COBOL
User Manual


Previous Contents Index

B.7 LIB$INITIALIZE Interaction Between C and COBOL

If you use LIB$INITIALIZE when the main program is written in HP COBOL on Alpha or I64, or on an OpenVMS VAX version prior to Version 7.1, and the initialize routine is written in HP C, the initialize routine will not be called. If you are using OpenVMS VAX Version 7.1 or higher, however, the routine will be called; also, it will be called if your main program is in C or in BASIC rather than COBOL, so this can be a practical workaround.

The problem is due to the quadword alignment with which C creates the LIB$INITIALIZE psect. The LIB$INITIALIZE psect requires longword alignment. The programmer can explicitly specify longword alignment on the extern_model pragma to avoid the problem.

B.8 Reserved Words

Depending on the use of the /RESERVED_WORDS qualifier or equivalent flag, there are a number of additional reserved words in HP COBOL on Alpha and I64 that are not reserved in HP COBOL on VAX. Refer to the appendix on reserved words in the HP COBOL Reference Manual for complete information.

B.9 Debugger Support Differences

HP COBOL debugger support on Alpha and I64 differs in several ways from VAX, as follows:

  • HP COBOL on Alpha and I64 issues the following informational message when the /DEBUG qualifier is used on the COBOL command line with the default optimization in effect:


    %COBOL-I-DEBUGOPT, /NOOPTIMIZE is recommended with /DEBUG
    

    You receive this message if you specify nothing about optimization when you specify /DEBUG. (/OPTIMIZE is the default for the compiler.) Unlike other informational messages, which are turned off by default, this message is always allowed through by the HP COBOL on Alpha and I64 compiler, even if /WARN=NOINFO is in effect. To turn the message off, use any form of the qualifier /[NO]OPTIMIZE on the COBOL command line (for example, /NOOPTIMIZE or /OPTIMIZE or /OPTIMIZE=LEVEL=x).
  • HP COBOL for OpenVMS VAX does not have the /OPTIMIZE qualifier.
  • With HP COBOL on Alpha and I64, unlike HP COBOL for OpenVMS VAX, the debugger sometimes changes underscores to hyphens and hyphens to underscores in variable names. This difference from HP COBOL for OpenVMS VAX can help you debug a program.

B.10 DECset/LSE Support Differences

HP COBOL on Alpha and I64 does not support the DECset/LSE Program Design Facility, the /DESIGN qualifier, design comments, or pseudocode placeholders.

B.11 DBMS Support

On OpenVMS, HP COBOL support for Oracle CODASYL DBMS has some differences depending on whether you are developing programs with HP COBOL on OpenVMS Alpha and I64 or with HP COBOL for OpenVMS VAX.

B.11.1 Compiling on Tru64 UNIX

In HP COBOL for Tru64 UNIX, Oracle CODASYL DBMS sub-schema access (DML for Oracle CODASYL DBMS) is not supported. Attempting to compile a program containing any Oracle CODASYL DBMS syntax results in the following diagnostic message:


cobol: Severe: ...DBMS Data Manipulation Language is not supported

Oracle CODASYL DBMS syntax includes the following language elements: COMMIT, CONNECT, DB, DB-EXCEPTION, EMPTY, ERASE, FETCH, FIND, FREE, GET, KEEP, LD, MEMBER, MODIFY, OWNER, READY, RECONNECT, RETAINING, ROLLBACK, STORE, SUB-SCHEMA, TENANT, and WHERE.

You might also receive the following general diagnostic message when you attempt to compile a program (on Tru64 UNIX) that contains variables defined in your Oracle CODASYL DBMS sub-schema:


cobol: Severe: ...Undefined name

B.11.2 Multistream DBMS DML

With HP COBOL for OpenVMS Alpha and OpenVMS I64, when you use multistream Oracle CODASYL DBMS DML, you must access different schemas or streams from separate source files.

<>


Appendix C
Programming Productivity Tools

Various programming productivity tools can help you increase your productivity as an HP COBOL programmer. These include the following:

  • Debugging tools for HP COBOL programs
    • Ladebug Debugger for the Tru64 UNIX operating system ( Section C.2)
    • OpenVMS Debugger for the OpenVMS operating system. ( Section C.3)
  • Language-Sensitive Editor (LSE) and Source Code Analyzer (SCA) ( Section C.4), available on the OpenVMS operating system.
  • Oracle CDD/Repository ( Section C.5), available on the OpenVMS operating system. <>

C.1 Debugging Tools for HP COBOL Programs

This appendix includes representative debugging sessions that demonstrate debugger features for both the OpenVMS Debugger and the Tru64 UNIX Ladebug Debugger. These tools are source-level, symbolic debuggers that support HP COBOL data types and use.

Both the OpenVMS Debugger and the Tru64 UNIX Ladebug Debugger let you:

  • Control the execution of individual source lines in a program.
  • Set stops (breakpoints) at specific source lines or under various conditions.
  • Change the value of variables within the debugging environment.
  • Refer to program locations by their symbolic names, using the debugger's knowledge of the HP COBOL language to determine the proper scoping rules and how the values should be evaluated and displayed.
  • Print the values of variables and set a trace (tracepoint) to notify you when the value of a variable changes.
  • Perform other functions, such as executing shell commands, examining core files, examining the call stack, or displaying registers.

The debugging examples in Section C.2 and Section C.3 focus on a sample program, shown in Example C-1. One common program has been used, to emphasize the portability of HP COBOL.

As you read the debugging sections that follow, refer to the code in Example C-1 to identify source lines.

The program, TESTA, accepts a character string from the terminal and passes it to contained program TESTB. TESTB reverses the character string and returns it (and its length) to TESTA.

Example C-1 Source Code Used in the Sample Debug Sessions

module TESTA
     1: IDENTIFICATION DIVISION.
     2: PROGRAM-ID.  TESTA.
     3: DATA DIVISION.
     4: WORKING-STORAGE SECTION.
     5:    01  TESTA-DATA        GLOBAL.
     6:        02   LET-CNT      PIC 9(2)V9(2).
     7:        02   IN-WORD      PIC X(20).
     8:        02   DISP-COUNT   PIC 9(2).
     9: PROCEDURE DIVISION.
    10: BEGINIT.
    11:     DISPLAY "ENTER WORD:".
    12:     MOVE SPACES TO IN-WORD.
    13:     ACCEPT IN-WORD.
    14:     CALL "TESTB" USING IN-WORD LET-CNT.
    15:     PERFORM SHOW-IT.
    16:     STOP RUN.
    17: SHOW-IT.
    18:     DISPLAY IN-WORD.
    19:     MOVE LET-CNT TO DISP-COUNT.
    20:     DISPLAY DISP-COUNT " CHARACTERS".
    21: IDENTIFICATION DIVISION.
    22: PROGRAM-ID.  TESTB    INITIAL.
    23: DATA DIVISION.
    24: WORKING-STORAGE SECTION.
    25:    01  SUB-1  PIC 9(2) COMP.
    26:    01  SUB-2  PIC S9(2)  COMP-3.
    27:    01  HOLD-WORD.
    28:        03      HOLD-CHAR PIC X OCCURS 20 TIMES.
    29:    01  HOLD-CHARS-REHOLD-WORD.
    30:        03  CHARS PIC X(20).
    31: LINKAGE SECTION.
    32:    01  TEMP-WORD.
    33:        03  TEMP-CHAR  PIC X OCCURS 20 TIMES.
    34:    01  TEMP-CHARS REDEFINES TEMP-WORD.
    35:        03  CHARS PIC X(20).
    36:    01  CHARCT  PIC 99V99.
    37: PROCEDURE DIVISION USING TEMP-WORD, CHARCT.
    38: STARTUP.
    39:     IF TEMP-WORD = SPACES
    40:         MOVE 0 TO CHARCT
    41:         EXIT PROGRAM.
    42:     MOVE SPACES TO HOLD-WORD.
    43:     PERFORM LOOK-BACK  VARYING SUB-1 FROM 20 BY -1
    44:         UNTIL TEMP-CHAR (SUB-1) NOT = SPACE.
    45:     MOVE SUB-1 TO CHARCT.
    46:     PERFORM MOVE-IT    VARYING SUB-2 FROM 1 BY 1   UNTIL SUB-1 = 0.
    47:     MOVE HOLD-WORD TO TEMP-WORD.
    48: MOVE-IT.
    49:     MOVE TEMP-CHAR (SUB-1) TO HOLD-CHAR (SUB-2).
    50:     SUBTRACT 1 FROM SUB-1.
    51: LOOK-BACK.
    52:     EXIT.
    53: END PROGRAM TESTB.
    54: END PROGRAM TESTA.


Previous Next Contents Index