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

658 AppendixL
A Programmer’s Guide to VPLUS
VPLUS Intrinsic Calls
Returning Data to the Program
After the data is verified by VFIELDEDITS, optional programmatic edits, and VFINISHFORM,
it is returned to the program’s form buffer with a call to VGETBUFFER. There are other
intrinsics to return from VPLUS’s data buffer to the program buffer such as VGETtype and
VGETFIELD. These two intrinsics can be used to retrieve one field’s worth of data to a
program buffer. Refer to the VPLUS/V Reference Manual on their use.
This section covers the VGETBUFFER intrinsic.
VGETBUFFER
Purpose: to return values from VPLUS data buffer to the user’s program buffer.
When VREADFIELDS is performed, it returns user input data to the VPLUS data buffer.
When VFIELDEDITS and VFINISHFORM are performed, the editing and formatting is
performed on VPLUS’s copy of the data buffer. In order to return the data to the program
buffer, a call to VGETBUFFER is necessary.
The call to VGETBUFFER in pseudocode looks like:
VGETBUFFER (COMAREA, BUFFER, BUFLEN)
The number of bytes that VGETBUFFER returns into the program form buffer is determined
by BUFLEN (the third parameter of the call) and DBUFLEN (word in comarea array which
contains the buffer length in bytes of the current form). DBUFLEN is set by the call to
VGETNEXTFORM which retrieved the current form. VGETBUFFER transfers the lesser number
of bytes between BUFLEN and DBUFLEN into the program buffer. VGETBUFFER returns all the
data from the screen in a left-to-right and top-to-bottom order. Display-only fields are also
returned into the program buffer and therefore you will need to ensure that the program
buffer is set up to accommodate this data.
There are also two other routines that transfer data from the VPLUS data buffer into the
program buffer.
VGETFIELD - transfers one field from the VPLUS data buffer to a character buffer.
VGET{type} - transfers one field from the VPLUS data buffer to a numeric defined field,
such as an integer, double integer, real, or long.
VGETFIELD and VGETtype are useful to you if you want to return one field at a time to your
program buffer. If the form design is changed so that fields are moved around within the
form, VGETBUFFER’s call requires that your program buffer matches the changes you have
made to the screen. With VGETFIELD and VGETtype calls, the program buffer’s definition is
independent of the order in which fields are organized on the screen.
Once the data resides in the program buffer, the program may write the data to a
database, KSAM or MPE file.
Closing Files
Once data collection has finished, the terminal and formsfile may be closed. Signaling the
end of data collection can be accomplished several ways and is application dependent.
Some programmers use 8 to signal an exit. When VREADFIELDS has finished and LASTKEY
is equal to 8, the program performs the closing routines.