HP 3000 Manuals

Ap C. MPE XL Run-Time Trap Handling [ HP COBOL II/XL Quick Reference Guide ] MPE/iX 5.0 Documentation


HP COBOL II/XL Quick Reference Guide

Appendix C  MPE XL Run-Time Trap Handling 

The HP COBOL II/XL compiler handles run-time traps for cases of bounds
checking, divide by zero, invalid GOTO statements, and alignment errors.

The run-time environment is set using the MPE XL SETVAR command with the
variable COBRUNTIME. The syntax for this command is:

     SETVAR COBRUNTIME "string"
[REV BEG]

where string is a string of nine uppercase or lowercase[REV END]
characters representing run-time options A, C, D, I, M, N, or blank as
shown in the following table.

          Table C-1.  Run-Time Error Handling Options 

----------------------------------------------------------------------------------------
|              |                                                                       |
|    Option    |                                Meaning                                |
|              |                                                                       |
|  A or blank  | Print the error message and abort (the default).                      |
|              |                                                                       |
|      C       | Print the error message and continue.                                 |
|              |                                                                       |
|      D       | Print the error message and enter debug mode.                         |
|              |                                                                       |
|      I       | Ignore the error (continue without printing an error message).        |
|              |                                                                       |
|      M       | Print the error message, change the illegal digit to some legal       |
|              | digit, and continue.  This option is only valid for illegal decimal   |
|              | or ASCII digit errors.  (See character position 1 in the next table.) |
|              | When used for other errors, M is treated as a blank.                  |
|              |                                                                       |
|      N       | Change the illegal digit to a legal digit and continue without        |
|              | printing an error message.[REV BEG] This option is only valid for     |
|              | illegal decimal or ASCII digit errors in positions 1, 7, and 8.  See  |
|              | the description of character positions 1, 7, and 8 in the next table  |
|              | for details.  When used in other positions,[REV END] N is treated as  |
|              | a blank.                                                              |
|              |                                                                       |
----------------------------------------------------------------------------------------

Each character position in the above COBRUNTIME string represents a
specific trap that you can request, as shown in the following table:

          Table C-2.  Character Position in Specific Traps 

-------------------------------------------------------------------------------
|              |                                                              |
|  Character   |                                                              |
|   Position   |                          Trap Type                           |
|              |                                                              |
-------------------------------------------------------------------------------
|              |                                                              |
|      1       | Illegal ASCII or decimal digit.                              |
|              |                                                              |
-------------------------------------------------------------------------------
|              |                                                              |
|      2       | Range error (OCCURS DEPENDING ON identifier, subscript,      |
|              | index, or reference modification out of bounds).             |
|              |                                                              |
-------------------------------------------------------------------------------
|              |                                                              |
|      3       | No SIZE ERROR phrase.                                        |
|              |                                                              |
-------------------------------------------------------------------------------
|              |                                                              |
|      4       | Invalid GO TO.                                               |
|              |                                                              |
-------------------------------------------------------------------------------
|              |                                                              |
|      5       | Address Alignment.                                           |
|              |                                                              |
-------------------------------------------------------------------------------
|              |                                                              |
|      6       | Paragraph stack overflow (recursive PERFORMs or too many     |
|              | PERFORMs with a common exit point).[REV BEG]                 |
|              |                                                              |
-------------------------------------------------------------------------------
|              |                                                              |
|      7       | Leading blanks in a numeric field.  If this position         |
|              | contains I, leading blanks in a numeric field are ignored.   |
|              | If this position contains N, leading blanks are changed to   |
|              | zeros.  If this position contains a value other than N or I, |
|              | the action entered in character position 1 is used.          |
|              |                                                              |
-------------------------------------------------------------------------------
|              |                                                              |
|      8       | Unsigned number in signed numeric field or signed number in  |
|              | unsigned numeric field.  If this position contains I, the    |
|              | invalid sign is ignored.  If this position contains N, the   |
|              | invalid sign is corrected.  If this position contains a      |
|              | value other than N or I, the action entered in character     |
|              | position 1 is used.[REV END]                                 |
|              |                                                              |
-------------------------------------------------------------------------------

          Table C-2.  Character Position in Specific Traps (cont.) 

----------------------------------------------------------------------------------------
|                       |                                                              |
|           Character   |                                                              |
|            Position   |                          Trap Type                           |
|                       |                                                              |
----------------------------------------------------------------------------------------
| [REV BEG]             |                                                              |
|                       |                                                              |
|               9       | Only affects a NUMERIC class condition with a PACKED-DECIMAL |
|                       | identifier.  If this field contains the character I, then    |
|                       | the following conditions do not make a NUMERIC test false:   |
|                       |                                                              |
|                       |    *   A signed value in an unsigned PACKED-DECIMAL field.   |
|                       |    *   An unsigned value in a signed PACKED-DECIMAL field.   |
|                       |    *   Any invalid sign nibble (half-byte).                  |
|                       |                                                              |
|                       | If this field contains anything other than I, the above      |
|                       | conditions make the NUMERIC class condition false.[REV END]  |
|                       |                                                              |
----------------------------------------------------------------------------------------



MPE/iX 5.0 Documentation