Technical data
7
Debugging and Testing HP COBOL DML
Programs
The Database Query utility (DBQ) commands and generic DML statements are
the tools you use to debug and test your HP COBOL program’s DML statements.
For example, you can use DBQ commands to display currency indicators, test
program loops, or check your program’s execution efficiency.
It is important to eliminate any logic errors prior to running an HP COBOL
DML program against a live database, because poorly written or incorrect logic
can corrupt a database. You can resolve some logic errors by desk-checking a
program. Desk-checking involves reviewing the logical ordering and proper use of
DML statements; for example, to check for executing a FIND when you intend to
execute a FETCH, or executing a CONNECT instead of a RECONNECT. You can
also use a debugger (refer to the debugging information in the HP COBOL User
Manual). However, neither method gives you information on currency indicators
and the effects DML statements have on them.
Another method of debugging HP COBOL DML programs is to test DML
statements using the DBQ utility. DBQ is an online interactive utility that uses
a split screen to show the results of each execution of a DML statement. It is
also an effective database programming learning tool. For a complete description
of the DBQ utility, refer to the Oracle CODASYL DBMS documentation on data
manipulation and programming.
We recommend that you use all of these tools to design, test, and debug your HP
COBOL DML programs.
7.1 DBQ Commands and DML Statements
The DBQ utility provides both generic DML statements and DBQ-specific
commands. Generic DML statements are similar to the HP COBOL DML
statements explained in Chapter 4. However, not all HP COBOL DML syntax is
applicable to the DBQ utility. These statements and entries do not apply:
• SUB-SCHEMA SECTION
• LD statement
• AT END phrase
• ON ERROR phrase
• Scope terminators
• USE statement
Debugging and Testing HP COBOL DML Programs 7–1