HP Data Entry and Forms Management System (VPLUS) Reference Manual (32209-90024)
248 Chapter6
USING VPLUS INTRINSICS
ERROR HANDLING
ERROR HANDLING
There are basically two types of errors that can occur as a result of calling VPLUS
intrinsics. The first type consists of errors in the intrinsic call itself or in an attempt to
access a file used by the called intrinsic. The second type are errors detected by editing
data entered into FORMSPEC forms. These two error types are handled differently by
VPLUS.
Intrinsic Call or File Errors
If a call to a VPLUS intrinsic causes an error so that the intrinsic cannot be executed
correctly, or if an MPE file error occurs as a result of an attempt to access a file with a
VPLUS intrinsic, the
comarea
word
cstatus
is set to a nonzero value. In addition, the
number associated with an MPE file error is stored in the
comarea
word,
filerrnum
.
When
cstatus
is not zero, any subsequent VPLUS intrinsics called by the application
return to the application without executing. As part of good programming practice, check
cstatus
after each call, report the error, and then reset
cstatus
. There is one exception —
VERRMSG uses
cstatus
to determine the error number. If
cstatus
is set to zero (indicating
no error) prior to the call to VERRMSG, then no message is returned.
Editing Errors
Field processing may be specified in the forms description with FORMSPEC and checked
by VFIELDEDITS, VINITFORM, or VFINISHFORM; or editing may be provided by user
routines in an application.
Each field in a FORMSPEC form has an error flag associated with it. When one of the
VPLUS intrinsics that performs field processing (VFIELDEDITS, VINITFORM or
VFINISHFORM) detects a field error, it sets the error flag for that field. It also increments
numerrs
, the word in
comarea
that contains the total number of fields with errors in each
form. If a user-provided editing routine detects a field error, the program must call the
VPLUS intrinsic VSETERROR in order to set the field error flag and increment
numerrs
. The
cstatus
item is not set when an editing error is detected and subsequent intrinsics may be
executed without resetting this
comarea
item.
If new data is written to a field in the data buffer that had an error, the error flag for the
field is cleared and
nurnerrs
is decremented. VPUTBUFFER, VPUTFIELD, or VPUTtype are
the intrinsics that can correct field errors and decrement
numerrs
. The intrinsic
VREADFIELDS resets
numerrs
to zero when it reads new data into the buffer from the
terminal. If
numerrs
has been set to a nonzero value by one of the VPLUS edit intrinsics,
then VREADFIELDS with reset it to zero. Also, when VGETNEXTFORM is called,
nurnerrs
is
reset to zero.
Error Messages
Messages associated with all VPLUS-detected errors can be retrieved by a call to VERRMSG.
This intrinsic uses the error message file whose MPE file number is kept in the
comarea
word,
errfilenum
The error message file contains internal error numbers linked to