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

Appendix L 657
A Programmer’s Guide to VPLUS
VPLUS Intrinsic Calls
programmatic edits detect invalid data, the field may be highlighted and set in error. The
pseudocode for VSETERROR looks like:
VSETERROR (COMAREA, FIELDNUM, MESSAGE, MSGLEN)
VSETERROR sets the field in error if it is not already in error and increments the NUMERRS
word of the user’s COMAREA by one. After the call to VSETERROR, NUMERRS reflects the
number of fields detected in error on the form. The second parameter of VSETERROR is the
field number to be set in error. The third and fourth parameters of VSETERROR are the
customized error message and the error message length, respectively. If this is the first
field in error, the customized error message appears in the terminal window on a call to
VSHOWFORM.
In looking at Illustration 1, if the optional programmatic edits detect an error, the field is
set in error by VSETERROR. The subsequent VSHOWFORM displays the programmer’s custom
error message and highlights the fields in error. VREADFIELDS is then called after
VSHOWFORM to allow the user to input the corrected data. The data is next taken through all
the passes of editing once again - beginning with VFIELDEDITS, next with the
programmatic edits, and finally with VFINISHFORM.
VFINISHFORM
Purpose: to perform final editing.
Once the validity of data has been established with VFIELDEDITS and it has passed
optional programmatic editing, VFINISHFORM can be called to perform the final totaling
and editing processes. VFINISHFORM executes any processing statements defined in the
FINISH phase. If there are no FINISH phase statements in the form, it is not necessary to
call VFINISHFORM.
FINISH phase statements are input through FORMSPEC in the field menu at the field
processing specification section. Formatting and totaling are typical functions performed
in this phase. An example of the formatting at FINISH phase is right justifying a number,
or stripping out a decimal point or filling a numeric field with leading zeros.
The only parameter passed to VFIELDEDITS is COMAREA. Within the comarea array,
VEDITFIELDS may set the NUMERRS word. If there are any field type, data type or editing
errors, the field is set in error and NUMERRS is incremented.
In looking at the flowchart, if there are any errors (NUMERRS>0), VERRMSG retrieves the
appropriate error message. VPUTWINDOW puts the error message in VPLUS’s window buffer.
When VSHOWFORM is called, all fields in error are highlighted and the window displays the
error message retrieved by VERRMSG. VREADFIELDS allows the user to input corrected data.
Again, the flowchart passes through all levels of error checking from VFIELDEDITS through
VFINISHFORM. Once the data passes all levels, the program proceeds to the next step.