[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP COBOL
User Manual


Previous Contents Index


DBG> EXAMINE CHARCT
TESTA\TESTB\CHARCT:    3.00
  • Deposit four characters into CHARCT.


    DBG> DEPOSIT CHARCT=15.95
    
  • CHARCT now contains 15.95.


    DBG> EXAMINE CHARCT
    TESTA\TESTB\CHARCT:     15.95
    
  • Deposit an integer larger than CHARCT's definition. The debugger returns an error message.


    DBG> DEPOSIT CHARCT=2890
    %DEBUG-E-DECOVF, decimal overflow at or near DEPOSIT
    
  • Examine the contents of CHARCT.


    DBG> EXAMINE CHARCT
    TESTA\TESTB\CHARCT:     15.95
    
  • You can examine any character of a subscripted data item by specifying the character position. The following EXAMINE command accesses the second character on TEMP-CHAR.


    DBG> EXAMINE TEMP-CHAR(2)
    TEMP-CHAR of TESTA\TESTB\TEMP-WORD(2):  "b"
    
  • You can use the DEPOSIT command to put a value into any element of a table and examine its contents. In this example, "x" is deposited into the second character position of TEMP-CHAR.


    DBG> DEPOSIT TEMP-CHAR(2)="x"
    DBG> EXAMINE TEMP-CHAR(2)
    TEMP-CHAR of TESTA\TESTB\TEMP-WORD(2):  "x"
    
  • You can qualify data names in debug commands as you can in COBOL. For example, if you examine IN-WORD while you debug your program, you can use the following DEBUG command:


    DBG> EXAMINE IN-WORD of TESTA-DATA
    IN-WORD OF TESTA\TESTA-DATA:  "axc"
    
  • Deposit a value into CHARCT.


    DBG> DEPOSIT CHARCT=8.00
    
  • Resume execution with the GO command. The program TESTA displays the reversed word. When the image reaches line 19 in TESTA, the debugger detects that an instruction changed the contents of DISP-COUNT. Because you set a watchpoint on DISP-COUNT, the debugger displays the old and new values, then returns control to you.


    DBG> GO
    cba
    trace at TESTA\%LINE 15
        15:     PERFORM SHOW-IT.
    watch of DISP-COUNT of TESTA\TESTA-DATA at TESTA\%LINE 19+52
        19:        MOVE LET-CNT TO DISP-COUNT.
            old value =  0
            new value =  3
    break at TEST-A\%LINE 20
       20:  DISPLAY DISP-COUNT " CHARACTERS".
    
  • To see the image's current location, use the SHOW CALLS command.


    DBG> SHOW CALLS
    module name     routine name             line     rel PC    abs PC
    *TESTA           TESTA                    22     00000120  00030120
                                                     00000080  000306C0
                    LIB$INITIALIZE                   85739D00  8576A530
                                                     00000080  7FE61F30
    
  • Resume execution with the GO command. TESTA executes its final display. The debugger regains control when STOP RUN executes.


    DBG> GO
    03 CHARACTERS
    %DEBUG-I-EXITSTATUS, is '%SYSTEM-S-NORMAL, normal successful completion'
    
  • At this point, you can either examine the contents of data items or end the session with the EXIT command.


    DBG> EXIT
    $                                                          <>
    

    C.3.3.1 Separately Compiled Programs

    When you debug an HP COBOL program, the default module (which will be brought into the debugger) is the main module name. If your program consists of multiple separately compiled programs (SCPs), and was compiled with the /SEPARATE_COMPILATION qualifier (see Section 1.2.2.4 and Section B.4.2.8), each module that you wish to debug other than the main module must be identified to the debugger.

    For example:


    DBG> SET BREAK %LINE 43
    

    In the previous example, the default module is the main module name. You can specify a different module in those cases where you use multiple separately compiled programs as follows:


    DBG> SET BREAK modulename \ %LINE 43
    

    In the preceding example, the default debug module becomes modulename. The same result can be obtained by using SET MODULE, as follows:


    DBG> SET MODULE modulename
    DBG> SET BREAK %LINE 43
    

    If modulename is a valid module, the default will be set to that module name and the debugger prompt will be returned. You can then set a breakpoint (or any other valid debugger action) in the new module source. If it is not a valid module, the system will advise you as follows:


    DBG> SET MODULE invalidmodulename
    %DEBUG-E-NOSUCHMODU, module INVALIDMODULENAME is not in module chain
    

    C.4 Language-Sensitive Editor and the Source Code Analyzer (OpenVMS)

    The Language-Sensitive Editor (LSE) is a powerful and flexible text editor designed specifically for software development. The Source Code Analyzer (SCA) is an interactive tool for program analysis.

    These products are closely integrated; generally, you can invoke SCA through LSE. LSE provides additional editing features that make SCA program analysis more efficient. In conjunction with the HP COBOL compiler, the two tools provide a set of new enhancements supporting source code design and review.

    LSE also provides the following software development features:

    • Formatted language constructs, or templates, for the programming languages it supports, including HP COBOL. These templates include the keywords and punctuation used in source programs.
    • Commands to compile, review, and correct compilation errors from within the editor. The HP COBOL compiler for Alpha and I64 issues some diagnostics in a different sequence from HP COBOL for OpenVMS VAX. The LSE review of compilation errors reflects the sequence in which the particular compiler issues the diagnostics.
    • Integration with Code Management System (CMS). You can issue CMS commands from within the editor to make source file management more efficient. Refer to the Guide to Code Management System for VMS Systems for more information.

    SCA performs the following types of program analysis:

    • Cross-referencing, which supplies information about program symbols and source files
    • Static analysis, which provides information on how subprograms, symbols, and files are related

    LSE and SCA together, in conjunction with compilers for supported languages, provide the following software design features:

    • View support, which provides a reverse-design facility. LSE commands compress program code into overview line summaries. If you choose to edit these overview lines, the program code reflects the modifications you make.
    • A report tool, callable through LSE, which can print views, standard design reports, and customized reports.

    C.4.1 Notes on HP COBOL Support

    HP COBOL supports the LSE and SCA program creation, analysis, and compilation features described in the preceding sections. HP COBOL on OpenVMS Alpha and OpenVMS I64 does not support the LSE Program Design Facility (PDF) design comments, pseudocode placeholders, or the /DESIGN qualifier.

    The following sections provide entry, exit, and language-specific information on the combined use of LSE and SCA.

    For More Information:

    • On LSE--Refer to the Guide to Language-Sensitive Editor.
    • On SCA--Refer to the Guide to Source Code Analyzer for VMS Systems.
    • On CMS--Refer to the Guide to Code Management System for VMS Systems.

    C.4.2 Preparing an SCA Library

    SCA stores data generated by the HP COBOL compiler in an SCA library. The data in an SCA library contains information about all symbols, modules, and files encountered during a specific compilation of the source. You must prepare this library before you enter LSE to invoke SCA by following these steps:

    1. Create a directory for your SCA library. For example:


      $ CREATE/DIRECTORY PROJ:[USER.LIB1]
      
    2. Initialize and set the library with the SCA CREATE LIBRARY command. For example:


      $ SCA CREATE LIBRARY [.LIB1]
      

      If you have an existing SCA library that has been initialized, you make its contents visible to SCA by setting it with the SCA SET LIBRARY command. For example:


      $ SCA SET LIBRARY [.EXISTING_SCA_LIBARAY]
      

      A message appears in the message buffer at the bottom of your screen, indicating whether or not your SCA library selection succeeded.
    3. Direct the COBOL compiler to generate data analysis files by appending the /ANALYSIS_DATA qualifier to the COBOL command. For example:


      $ COBOL/ANALYSIS_DATA PG1,PG2,PG3
      

      This command line compiles the input files PG1.COB, PG2.COB and PG3.COB, and generates corresponding output files for each input file, with the file types OBJ and ANA. The COBOL compiler puts these files in your current default directory.
    4. Load the information in the data analysis files into your SCA library with the LOAD command. For example:


      Previous Next Contents Index