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

Appendix L 655
A Programmer’s Guide to VPLUS
VPLUS Intrinsic Calls
example, if an order processing clerk is entering order information on a screen, then
presses a function key labeled “MODIFY”, the program needs to read the data on the
screen. Without the AUTOREAD option set, the program would not read the screen. The
program needs to interrogate the LASTKEY word of the COMAREA for an i value. If a non-zero
value is found, it needs to proceed with enabling AUTOREAD.
AUTOREAD is enabled by setting bit 14 of the TERMOPTIONS word to 1. For COBOL
programmers, ADD and SUBTRACT may be used to set bit 14. For example, in pseudocode:
VREADFIELDS (COMAREA)
IF LASTKEY = 1 THEN
TERMOPTIONS(14:1)=1
[COBOL programmers must add 2 to TERMOPTIONS]
VREADFIELDS(COMAREA)
TERMOPTIONS(14:1)=0
[COBOL programmers must subtract 2 from TERMOPTIONS]
ENDIF
Another feature which is enabled through the TERMOPTIONS word of the comarea array is
setting a timed read. The TERMOPTIONS word bit (10:1) enables a times read. Another word
in the comarea array, USER’TIME, defines the time limit in seconds. Again, COBOL
programmers must use the ADD and SUBTRACT to set bit 10. For example, to enable a timed
read for 60 seconds in pseudocode:
USER’TIME = 60
TERMOPTIONS(10:1)=1
[COBOL programmers must add 32 to TERMOPTIONS].
VREADFIELDS(COMAREA)
IF COM’STATUS = 160 THEN
PERFORM TIME-OUT-PROCEDURE
ENDIF
TERMOPTIONS(10:1)=0
[COBOL programmers must subtract 32 from TERMOPTIONS].
Editing
Once the data is read from the screen into VPLUS’s data buffer, edits may be performed.
The edits may be performed in as many as three passes. On the first pass, the editing
process checks that all required fields are present, the data input by the user is consistent
with the data type defined for the field, and the data meets rules set out by the user (for
example, matching a pattern or being within range of values). Optionally, a second editing
pass may be performed by the program. Edits can be designed into the program. An
example of a programmatic edit is verifying that an employee number exists in the
personnel data base before allowing a modify of an employee record. Optionally, a third
pass of editing may be performed. The third pass of editing performs any totaling or
formatting functions. For example, if a form contains hours worked for each day of the
week, a first level editing pass would verify that the hours input for each day is less than
24 hours. In this example, we will assume that there are no programmatic edits in the
second pass of editing. However, in the third pass of editing, a weekly total is accumulated