HP 3000 Manuals

Illegal ASCII Digit Error Handling [ COMMUNICATOR 3000/XL ] MPE/iX Communicators


COMMUNICATOR 3000/XL

Illegal ASCII Digit Error Handling 

by Julia Rodriguez--Information Technology Group 

COBOL II/XL A.00.14 has two new options to allow greater compatibility
with the COBOL II/V handling of illegal data.  Leading blanks and wrong
signs are two special cases of the Illegal ASCII/Decimal Digit Trap.
COBOL II/XL has been enhanced to allow correction of these two cases
without issuing a message, while continuing to allow the programmer to
get a message for other instances of illegal digits.

The run-time variable, COBRUNTIME, now has eight positions.  The two new
positions specify special cases of the illegal ASCII/Decimal Trap.  These
positions are provided to suppress any messages for these special cases
of the traps.  The only valid values for these two new positions are
blank or "N" .  Blank indicates that the value in the first position
specifies the action to be taken.  "N" specifies fix the illegality and
continue.

These options allow the user to obtain the MPE/V functionality while also
retaining the new functionality offered by COBRUNTIME.

The eight positions of COBRUNTIME are associated with the following
traps:

position 1       Illegal ASCII Digit or Illegal Decimal Digit

position 2       Range Error

position 3       No SIZE ERROR clause

position 4       Invalid GO TO

position 5       Address Alignment

position 6       Paragraph Stack Overflow

position 7       Leading blanks in numeric field

position 8       Signed value in unsigned field/Unsigned value in signed
                 field

For example, the programmer wants to have leading blanks changed to
zeroes without any messages printed.  First the program should be
compiled with the $CONTROL VALIDATE. Second, before the program is
executed the SETVAR command must be issued to set COBRUNTIME to "CbbbbbN"
, where b is used to indicate a space.  If the program encounters a
numeric field that contains illegal digits the following actions would
occur:

 *  If the only illegal digits are leading blanks, fix leading blanks and
    continue.

 *  If it has a wrong sign, print message and continue.

 *  If it has any other illegal digits, print message and continue.

It should be noted that there is a small impact on program size and
possibly a large impact on performance by using traps to correct illegal
data.  When $CONTROL VALIDATE is specified, the program size grows by
four instruction for each arithmetic statement and 10 instructions for
each move.  If a trap is executed then thousands of operating system
instructions are executed.

This overhead should be taken into account when considering use of the
Illegal ASCII Digit Trap to correct leading blanks and wrong signs.  The
programmer should consider changing the source code of the program when
it is likely that this trap will occur every time a particular field is
referenced, and the number of references is a large percentage of the
statements of the program.  The source code changes would check numeric
fields for illegal data and correct them.  This would eliminate the need
for $CONTROL VALIDATE.


MPE/iX Communicators