VWRITEBATCH [ HP Data Entry and Forms Management System (VPLUS/V) ] MPE/iX 5.0 Documentation
HP Data Entry and Forms Management System (VPLUS/V)
VWRITEBATCH
Writes a record to the batch file from the data buffer in memory, or
deletes a record from the batch file.
Syntax
VWRITEBATCH {comarea}
Parameters
comarea Must be comarea name specified when the batch file was
opened with VOPENBATCH. If not already set, the
following comarea items must be set before calling
VWRITEBATCH:
cstatus Set to zero.
comarealen Set to total number of two-byte words
in comarea.
recnum Set to record number in batch file to
which data is to be written (record
numbers start with zero). The recnum
is initialized to zero by VOPENBATCH
(or to the next sequential record
number if the file is an existing
file).
deleteflag Set to TRUE (all ones) if record is to
be deleted.
(The cfname and dbuflen should be set by a prior call to
VGETNEXTFORM.)
VWRITEBATCH may set the following comarea values:
cstatus Set to nonzero value if call
unsuccessful.
filerrnum Set to file error code if MPE file
error.
numrecs Incremented each time a new record is
written; decremented if record is
deleted.
Discussion
VWRITEBATCH writes the contents of the data buffer to the record
specified by recnum in an open batch file. (The recnum must be
maintained by the calling program.) VWRITEBATCH writes the following
information to the batch record:
* Contents of the data buffer
* Batch record control information (from comarea):
deleteflag TRUE if record is deleted.
cfname Name of the form associated with this data.
dbuflen Length (in characters) of the data buffer.
(Refer to "Record Format" in the VOPENBATCH description for a diagram of
the batch record.)
VWRITEBATCH may be used in both the data collection and modify modes.
Data Collection Mode
The data in the data buffer is entered on a particular form displayed at
a terminal and then read into the data buffer by VREADFIELDS.
VWRITEBATCH can then be called to write the data buffer and the record
control information to the batch record specified by recnum.
Modify Mode
When data is modified, an existing batch file record is rewritten. The
calling program must set recnum to the record number of this record.
To mark a batch record as deleted, the deleteflag must be set to TRUE
(all ones) by an application. Then a call to VWRITEBATCH sets a
corresponding flag in the batch record to mark the record as deleted.
Since a deleted record still exists in the batch file, it can be viewed
through FCOPY or a user-written intrinsic.
In ENTRY, a function key pressed by the user not only determines which
record is to be viewed, but also specifies which record is to be deleted.
Example
COBOL
CALL "VWRITEBATCH" USING COMAREA.
BASIC
165 CALL VWRITEBATCH(C(*))
FORTRAN
CALL VWRITEBATCH(COMAREA)
SPL/PASCAL
VWRITEBATCH(COMAREA);
The calls shown above write the contents of the data buffer to the batch
record identified by recnum. Assume the following data is in the data
buffer and that it was entered on form ORDENT. (Note that the data
entered on separate fields of a form is concatenated in the data buffer,
with no separators.)
Assume the comarea is set as follows:
recnum = 5
cfname = ORDENT
dbuflen = 37
In addition, assume the batch file opened by VOPENBATCH has fixed-length
records, 80 bytes long. The call to VWRITEBATCH writes the following
record as the sixth record in the batch file:
MPE/iX 5.0 Documentation