HP OpenVMS Systems Documentation
To debug source code that contains conditional compilation lines, you can use either the /CONDITIONALS qualifier or the WITH DEBUGGING MODE clause. The /CONDITIONALS qualifier is listed in Table 1-4. For more information about the /CONDITIONALS qualifier, invoke the online help facility for HP COBOL at the system prompt. For more information about the WITH DEBUGGING MODE clause, refer to the HP COBOL Reference Manual.
Using the WITH DEBUGGING MODE clause as part of the SOURCE-COMPUTER paragraph causes the compiler to process all conditional compilation lines in your program as COBOL text. If you do not specify the WITH DEBUGGING MODE clause, and if the /CONDITIONALS qualifier is not in effect, all conditional compilation lines in your program are treated as comments.
The WITH DEBUGGING MODE clause applies to: (1) the program that
specifies it, and (2) any contained program within a program that
specifies the clause.
18.104.22.168 Interpreting Messages from the Compiler
If there are errors in your source file when you compile your program, the HP COBOL compiler flags these errors and displays helpful messages. You can reference the message, locate the error, and, if necessary, correct the error in your program.
At line number n in name <>
On VAX, the general format of compiler messages is as follows:
%COBOL-s-ERROR nnn, (m) message-text
%COBOLThe facility or program name of the HP COBOL compiler. This prefix indicates that the HP COBOL compiler issued the message.
sThe severity of the error, represented in the following way:
F Fatal error. The compiler does not produce an object module. You must correct the error before you can compile the program to produce an object module. E Error. The compiler makes an assumption about what you intended and continues. However, the compiler's assumption may not relate to your intention. Correct the error. W Warning. The compiler attempts to correct the error in the statement, but you should verify that the compiler's action is acceptable. Otherwise, your program may produce unexpected results. I Informational. This message usually appears with other messages to inform you of specific actions taken by the compiler. No action is necessary on your part. Note that these messages are suppressed by default. You must invoke /WARN=ALL or /WARN=INFO to enable them.
ident (Alpha, I64)The message identification. This is a descriptive abbreviation of the message text. <>
nnn (VAX)The message identification number.
m (VAX)The message pointer number. <>
message-textThe compiler's message. In many cases, it consists of no more than one line of output. A message generally provides you with enough information to determine the cause of the error so that you can correct it.
At line number n in name (Alpha, I64)The integer n is the number of the line where the diagnostic occurs. The number is relative to the beginning of the file or text library module specified by name.
12 PROCEDURE DIVISION. 13 P-NAME 14 MOVE ABC TO XYZ. ................^ %COBOL-E-NODOT, Missing period is assumed 14 MOVE ABC TO XYZ. ............................^ %COBOL-F-UNDEFSYM, Undefined name
In the sample, the first diagnostic pointer (^) points to the MOVE statement in source line number 14, which is the closest approximation to where the error (P-NAME is not followed by a period) occurred. The second diagnostic pointer points to XYZ, an undefined name in source line number 14. Each diagnostic pointer is followed by a message line that identifies, in this order:
Although most compiler messages are self-explanatory, some require additional explanation. The online help facility for HP COBOL contains a list and descriptions of these HP COBOL compiler messages. Use the HELP COBOL Compiler Messages command to access this list. <>
On OpenVMS VAX, diagnostic messages look like this example:
12 PROCEDURE DIVISION. 13 P-NAME 14 MOVE ABC TO XYZ. 1 2 %COBOL-E-ERROR 65, (1) Missing period is assumed %COBOL-F-ERROR 349, (2) Undefined name
Here, error pointer (1) points to the approximate place where the error occurred (P-NAME has no period). Error pointer (2) points to an undefined name in source line number 14. The two error pointers are followed by two error message lines that each identify, in this order:
To examine messages that occurred during compilation, you can search
for each occurrence of %COBOL in the compiler listing file.
Section 22.214.171.124 describes listing files.
126.96.36.199 Using Compiler Listing Files
To generate a listing file, specify the /LIST qualifier when you compile your HP COBOL program interactively as in the following example for PROG_1.COB:
$ COBOL/LIST PROG_1.COB
If you compile your program as a batch job, the compiler creates a listing file by default. You can specify the /NOLIST qualifier to suppress creation of the listing file, if that suits your purposes. (In either case, however, the listing file is not automatically printed.) By default, the name of the listing file is the name of your source file followed by the file type .LIS. You can include a file specification with the /LIST qualifier to override this default.
For a description of each qualifier's function, invoke the online help facility for COBOL at the system prompt as follows:
$ HELP COBOL
A contained COBOL program listing file includes two additional program elements that provide nesting level information about the main program and the contained program. For additional information about contained programs, see Chapter 12, Interprogram Communication.