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

288 Chapter6
USING VPLUS INTRINSICS
INTRINSIC DESCRIPTIONS
Error Determination
To enable applications to determine which fields are in error for a given form at run-time,
VGETFORMINFO optionally returns a 32-byte bit map containing these error flags to show
which fields failed the edit checks.
Each field in a form is represented by a bit in the bit map according to its field creation
number. The bit map is a 32-byte logical array to accommodate the maximum of 255 field
numbers. The most significant (left most) bit of the first byte in the bit map array
represents the field with the field number equal to 1 as assigned by FORMSPEC. For
example, the field assigned a field number of 17 would be represented by the most
significant bit of the third byte in the array. If a field is in error, the corresponding bit
representing that field will be set to a one. Otherwise, the value will be zero.
The bit map is valid for the current form only; information for the current form must be
requested by form name key. If the bit map is requested for any other form, it will contain
all zeros. Therefore, a value of zero should not be interpreted to mean the field is not in
error for the current form, (i.e., the last form retrieved by VGETNEXTFORM). Furthermore,
bit positions representing nonexistent field numbers for a given form will contain a value
of zero.
To retrieve the bit map, the user-supplied parameter
entrylength
in
infobuf
should
contain a value of 36. This is to inform VPLUS to supply 36 two-byte words of information
pertaining to the form requested. The last 16 two-byte words will contain the bit map
indicating which fields are in error.
The
infobuflen
parameter normally passed to VGETFORMINFO is calculated using the
entrylength
of 36. To request the bit map for the current form, the calculation is as
follows:
2+(
entrylength
*
numofentries
)
where
entrylength
is equal to 36 and
numofentries
is equal to 1. Thus, the
infobuflen
parameter should contain a value of 38 when calling VGETFORMINFO.
For languages which provide bit manipulation capability, the bits can be shifted left or
right to determine which bits are on. For other languages, a mask may be used with the bit
map to determine whether a bit is on or off. An intrinsic called BITMAPCNV is available to
help decode and set bits in the bit map. Refer to Appendix I for more information.
Example
COBOL
DATA DIVISION.
:
WORKING-STORAGE SECTION.
01 INFOBUF.
05 NUMBER-OF-ENTRIES PIC S9(4) COMP.
05 ENTRY-LENGTH PIC S9 (4) COMP.
05 ENTRY-TABLE OCCURS 9 TIMES.
10 FORM-NAME PIC X15.
10 FILLER PIC X.
10 FORM-NUMBER PIC S9(4) COMP.
10 NUMBER-OF-FIELDS PIC S9(4) COMP.
10 BUF-LENGTH PIC S9(4) COMP.