HP Data Entry and Forms Management System (VPLUS) Reference Manual (32209-90024)

656 AppendixL
A Programmer’s Guide to VPLUS
VPLUS Intrinsic Calls
and the numbers are right justified.
This section on “Editing” will cover the three phases of editing: VFIELDEDITS, optional
programmatic edits, and VFINISHFORM.
VFIELDEDITS
Purpose: to verify the data entered.
This intrinsic is called to verify the data entered. If the field is defined as OPTIONAL and is
left blank, no further processing is performed. To perform processing on a blank field (for
instance, to set it to a value), the field type should be defined as PROCESS. VFIELDEDITS
performs the following checks if the field is a REQUIRED field type or a PROCESS field type
and the field contains data.
Field type - If the field type is REQUIRED and no data is present, the field is flagged in
error.
Data type - If the data type is invalid, the field is flagged in error. The data input by the
user must match the data type defined for the field.
Field processing specification statements - The user may define processing specification
statements within each field menu. If the data does not meet the specifications set up by
the user, the field is flagged in error.
If VFIELDEDITS detects any errors on the checks listed above, the field is set in error and
the NUMERRS word of the user’s COMAREA is incremented by one. The only parameter passed
to VFIELDEDITS is COMAREA. When the intrinsic completes, it may set the NUMERRS word
within the comarea array. NUMERRS contains a count of the number of fields on the form
detected in error. Note that a CSTATUS of 0 only indicates that the intrinsic executed
properly, not that no errors were found; this information is contained in NUMERRS.
In looking at Illustration 1, if there are any errors (NUMERRS > 0) the program calls an error
processing routine. The error processing routine calls VERRMSG to retrieve the appropriate
error message of the first field in error. The error processing routine then calls VPUTWINDOW
which puts the error message to a window buffer maintained by VPLUS. It next calls
VSHOWFORM which highlights all fields in error and displays the error message in the
terminal window. VREADFIELDS is called to prompt the user to input the correct data. Then
VFIELDEDITS is called once again. This loop is performed until there are no errors flagged
by VFIELDEDITS.
Optional Programmatic Edits against Data
After passing the first phase of editing, additional checks may be desired. For example, a
programmatic check could be made to verify that the employee number entered exists in
the company’s data base. Since this type of check cannot be done in FORMSPEC, it needs to
be implemented by the program with a call to a data base, KSAM or MPE file.
Before any user editing is performed, the program needs to retrieve VPLUS’s data buffer
into its own program buffer. A call to VGETBUFFER or VGETFIELD or VGETtype returns the
data to the program’s buffer. At this point, the data can be verified against a database or
KSAM file or MPE file. If the programmatic edits detect an error, VSETERROR is called to set
the field in error.
VSETERROR is another VPLUS intrinsic available to the programmer so that when