Messages [ HP COBOL II/XL Programmer's Guide ] MPE/iX 5.0 Documentation
HP COBOL II/XL Programmer's Guide
Messages
This section explains the messages that help you debug your program.
They are of two types, compile-time messages and run-time error messages.
Compile-time messages are issued by the compiler, and are not always
associated with errors. Run-time error messages are issued by the COBOL
run-time library, and are always associated with errors.
Text for both types of errors comes from the file COBCAT.PUB.SYS (COBOL
CATalog). Beneath the text of each error message, COBCAT.PUB.SYS has an
explanation of the message. Each line of the explanation begins with a
dollar sign ($). For instructions for printing COBCAT.PUB.SYS, refer to
the HP COBOL II/XL Reference Manual.
[REV BEG]
For run-time error processing, the COBOL run-time library accesses the
COBMAC.PUB.SYS (COBOL MACro) file, as well as COBCAT.PUB.SYS. The COBMAC
file is used to provide additional information when a trap is
detected.[REV END]
Compile-Time Messages
Compile-time messages are issued by the compiler. They are of six
severities: warning, questionable, serious, disastrous, nonstandard, and
informational. The severity of a message determines its effect on the
compiler--whether it continues to compile, whether it generates code, and
whether the code executes correctly.
When the compiler issues a message, it sets the Job Control Word (JCW).
You can have your job stream compile your program and then check the JCW.
If the JCW setting is FATAL (in which case the program did not compile
successfully), your job stream will end, rather than try to link and
execute the program.
For each class of compile-time message, Table 7-2 gives the message
number range, the JCW setting, an explanation, and advice.
Table 7-2. Compile-Time Message Severities
---------------------------------------------------------------------------------------------------
| | | | | |
| | Message | | | |
| Message | Number | JCW | | |
| Severity | Range | Setting | Explanation | Advice |
| | | | | |
---------------------------------------------------------------------------------------------------
| | | | | |
| Warning (W) | 1-99 | Not set. | The compiler generated | If the "worst case" could |
| | | | code for the program, but | happen, change the code |
| | | | it will not execute | so that it will execute |
| | | | correctly in the "worst | correctly in that case. |
| | | | case." | |
| | | | | |
---------------------------------------------------------------------------------------------------
| | | | | |
| Questionable | 100-399 | WARN | The compiler generated | Change the program to |
| Error (Q) | | | code for the program, but | eliminate this error. |
| | | | it will probably not | |
| | | | execute correctly. | |
| | | | | |
---------------------------------------------------------------------------------------------------
| | | | | |
| Serious Error | 400-449 | FATAL | The compiler could not | Change the program to |
| (S) | | | generate code for the | eliminate this error. |
| | | | program. | |
| | | | | |
---------------------------------------------------------------------------------------------------
| | | | | |
| Disastrous | 450-499 | FATAL | The compiler could not | Check the spellings of |
| Error (D) | | | generate code for the | the file names in the |
| | | | program and cannot | file equations and the |
| | | | continue to compile it. | commands that invoked the |
| | | | The compiler listing | compiler. |
| | | | includes a stack dump. | |
| | | | (Most disastrous errors | |
| | | | are caused by file errors | |
| | | | from the files that the | |
| | | | compiler accesses; for | |
| | | | example, when the | |
| | | | compiler cannot find the | |
| | | | file that COBTEXT | |
| | | | references.) | |
| | | | | |
---------------------------------------------------------------------------------------------------
| | | | | |
| Nonstandard | 500-539 | Not set | The compiler generated | If the program is to run |
| Warning (N) | | | code for the program, but | on non-HP computers, |
| | | | it may not execute | change the program to |
| | | | correctly on non-HP | eliminate this warning. |
| | | | computers. A nonstandard | |
| | | | warning flags an HP | |
| | | | extension to standard | |
| | | | COBOL or a standard COBOL | |
| | | | feature that is above the | |
| | | | level that the control | |
| | | | option STDWARN specifies. | |
| | | | | |
---------------------------------------------------------------------------------------------------
| | | | | |
| Informational | 900-999 | Not set | Usually caused by other | Correct the other errors |
| Messages (I) | | | errors in the program. | in the program and |
| | | | | recompile. |
| | | | | |
---------------------------------------------------------------------------------------------------
Run-Time Error Messages
[REV BEG]
Run-time error messages are numbered from 500 to 755 and are issued by
the HP COBOL II/XL run-time library.[REV END] Unlike compile-time
messages, they are always associated with errors. The errors fall into
two classes: input-output errors and traps.[REV BEG] This section
explains input-output errors and data validation, a related issue. This
section only briefly describes traps. The HP COBOL II/XL Reference
Manual explains traps and how to handle them. The section "Debugging
Trap Errors" later in this chapter has example programs that illustrate
these errors.[REV END]
Input-Output Errors.
Input-output errors cause most run-time error messages. When an
input-output error occurs, the following happens:
1. The error message is printed.
2. If the error is file-related (most are), the file system error
number and message are printed and the intrinsic PRINTFILEINFO
executes, displaying file information. If the error is not
file-related, only the error message is printed.
3. If the program contains a FILE STATUS clause, INVALID KEY phrase,
AT END phrase, or USE procedure (that is, if the program can
detect the error), then execution continues without printing any
error message or file information; otherwise, the program aborts
(see Figure 5-3 ).
[REV BEG]
Some of the COBOL functions call routines in the Compiler Library or
FORTRAN library. If a Compiler Library or FORTRAN routine detects an
error, the Compiler Library will output an error message. These error
messages are documented in the Compiler Library/XL Reference Manual.[REV
END]
Run-Time Traps.
A run-time trap is an interruption of the flow of program control, caused
by an exception condition. After a trap-handling routine executes, the
program can sometimes be restarted, depending on how you set the
environment variable COBRUNTIME.
The COBOL compiler supports the following traps:
[REV BEG]
* Illegal Decimal Digit (Error 710).
* Illegal ASCII Digit (Error 711).
* Bad Parameter (Error 745)
* No Exception Phrase on CALL (Error 746)
* No SIZE ERROR phrase (Error 747)
* Paragraph Stack Overflow (Error 748).
* Subscript, Index, Reference Modifier, or DEP-ON Bounds Error
(Error 751).
* Address Alignment (Error 753).
* Invalid GO TO (Error 754).
For traps to do anything other than abort the program, you must compile
your program with $CONTROL VALIDATE and $CONTROL BOUNDS, and set the
global variable COBRUNTIME before you run your program.
For a complete discussion of these traps and COBRUNTIME, see the appendix
"MPE XL System Dependencies" in the HP COBOL II/XL Reference Manual.
For example programs that illustrate these traps, see "Debugging Trap
Errors" later in this chapter.[REV END]
Data Validation.
When you use the control option VALIDATE and the run-time error handling
option M or N in colunm 1 of COBRUNTIME, and an illegal ASCII or decimal
digit is encountered,[REV BEG] in most cases[REV END] the trap handler
changes the source field itself, rather than a copy of it. That is, the
source field is also the target field.
Table 7-3 gives the valid ASCII digits with which invalid unsigned
ASCII digits are replaced if you specify the run-time error handling
option M or N. Any invalid unsigned ASCII digit that does not appear in
Table 7-3 is replaced by zero.
Table 7-3. Valid Replacements for Invalid Unsigned ASCII Digits
---------------------------------------------------------------------------------------------
| Invalid Unsigned | Valid |
| ASCII Digit | Replacement Digit |
---------------------------------------------------------------------------------------------
- A, a, J, j, / - 1 -
---------------------------------------------------------------------------------------------
- B, b, K, k, S, s - 2 -
---------------------------------------------------------------------------------------------
- C, c, L, l, T, t - 3 -
---------------------------------------------------------------------------------------------
- D, d, M, m, U, u - 4 -
---------------------------------------------------------------------------------------------
- E, e, N, n, V, v - 5 -
---------------------------------------------------------------------------------------------
- F, f, O, o, W, w - 6 -
---------------------------------------------------------------------------------------------
- G, g, P, p, X, x - 7 -
---------------------------------------------------------------------------------------------
- H, h, Q, q, Y, y - 8 -
---------------------------------------------------------------------------------------------
- I, i, R, r, Z, z - 9 -
---------------------------------------------------------------------------------------------
Table 7-4 gives the valid ASCII digits with which invalid signed
ASCII digits are replaced if you specify the run-time error handling
option M or N. Any invalid signed ASCII digit that does not appear in
Table 7-4 is replaced by positive zero ({).
Table 7-4. Valid Replacements for Invalid Signed ASCII Digits
----------------------------------------------------------------------------------------------
| Invalid Signed | Valid | Value of |
| ASCII Digit | Replacement Digit | Replacement Digit |
----------------------------------------------------------------------------------------------
- a, /, 1 - A - +1 -
----------------------------------------------------------------------------------------------
- b, s, S, 2 - B - +2 -
----------------------------------------------------------------------------------------------
- c, t, T, 3 - C - +3 -
----------------------------------------------------------------------------------------------
- d, u, U, 4 - D - +4 -
----------------------------------------------------------------------------------------------
- e, v, V, 5 - E - +5 -
----------------------------------------------------------------------------------------------
- f, w, W, 6 - F - +6 -
----------------------------------------------------------------------------------------------
- g, x, X, 7 - G - +7 -
----------------------------------------------------------------------------------------------
- h, y, Y, 8 - H - +8 -
----------------------------------------------------------------------------------------------
- i, z, Z, 9 - I - +9 -
----------------------------------------------------------------------------------------------
- j - J - -1 -
----------------------------------------------------------------------------------------------
- k - K - -2 -
----------------------------------------------------------------------------------------------
- l - L - -3 -
----------------------------------------------------------------------------------------------
- m - M - -4 -
----------------------------------------------------------------------------------------------
- n - N - -5 -
----------------------------------------------------------------------------------------------
- o - O - -6 -
----------------------------------------------------------------------------------------------
- p - P - -7 -
----------------------------------------------------------------------------------------------
- q - Q - -8 -
----------------------------------------------------------------------------------------------
- r - R - -9[REV BEG] -
----------------------------------------------------------------------------------------------
- -, ] - } - 0[REV END] -
----------------------------------------------------------------------------------------------
MPE/iX 5.0 Documentation