HP 3000 Manuals

VPUTBUFFER [ HP Data Entry and Forms Management System (VPLUS/V) ] MPE/iX 5.0 Documentation


HP Data Entry and Forms Management System (VPLUS/V)

VPUTBUFFER 

Copies data from an application to the data buffer in memory.

Syntax 

             VPUTBUFFER {comarea,buffer,buflen}

Parameters 

comarea          Must be comarea name specified when the forms file was
                 opened with VOPENFORMF. If not already set, the
                 following comarea items must be set before calling
                 VPUTBUFFER:

                 cstatus          Set to zero.

                 language         Set to the code identifying the
                                  programming language of the calling
                                  program.

                 comarealen       Set to total number of two-byte words
                                  in comarea.  Must be at least 70 words
                                  in length if the ARB feature is used.

                 buffercontrol    Set bit 15 to 1 to indicate that data
                                  is to be transformed according to the
                                  ARB specifications.

                 VPUTBUFFER may set the following comarea items:

                 cstatus          Set to nonzero value if call
                                  unsuccessful.

                 numerrs          May be decremented as a result of new
                                  data replacing data in field with
                                  error.

                 bufferstatus     Bit 15 set to 1 if data conversion is
                                  successful.

buffer           Character string in a application containing the data to
                 be copied to the data buffer in memory.

buflen           Two-byte integer variable that specifies the number of
                 bytes to be copied to the data buffer in memory.  The
                 comarea item dbuflen, which contains the size of the
                 data buffer in memory, may be used as this parameter.

Discussion 

This intrinsic transfers data from a buffer in an application to the data
buffer in memory.  The length of the data moved is based on the number of
bytes specified in the buflen parameter and the number of bytes in the
largest data buffer in the forms file, whichever is less.  The length of
the buffer assigned to the current form is not considered since the user
may intend the data for another form with a longer buffer length.  For
example, assume there are three forms in the forms file:

  Form A dbuflen = 100 bytes
  Form B dbuflen = 200 bytes
  Form C dbuflen = 75 bytes

In this case, the maximum data buffer length is 200 bytes.  If the
current form is form A and the user calls VPUTBUFFER with a user buffer
length (buflen parameter) of 200, he may intend to call VGETNEXTFORM to
get form B and then VSHOWFORM to display form B with the 200 bytes of
data moved to the data buffer with VPUTBUFFER.

Fewer bytes than the data buffer can hold may be transferred; the
remaining space in the data buffer is not changed.

The data moved to the data buffer is exactly as it appears in the
application buffer.  (If you want the data converted to USASCII in the
data buffer, you must use VPUTtype, where type is the data type of the
field in an application.)  When the data is displayed, it is moved to
each field in the form in sequence from left to right, top to bottom.  If
any field being replaced by user data contained an error, VPUTBUFFER
clears the error flag for the field and decrements numerrs.

Special Considerations 

Designers using the ARB feature in VPUTBUFFER should be aware that
damaging run-time errors could occur if the application is inadvertently
run on a system that has a VPLUS/V version earlier than B.05.00.

To prevent this, the designer should do three things:

   1.  Document the product with a clear warning that VPLUS/V version
       B.05.00 or later MUST be used.

   2.  Use the VPLUS/V intrinsic HP32209 in the code.  This intrinsic
       checks to make sure you are using the proper VPLUS/V version.  If
       not, the application should terminate with an appropriate message.

   3.  Check offset 65 (bufferstatus) in the comarea on return from
       VPUTBUFFER. Bit 15 will be set to 1 if VPUTBUFFER performed the
       conversion successfully.  In other words, the application must
       check both status and bufferstatus to be sure that the data was
       correctly converted.

Example 

COBOL

            01 DAT1.
                 03 FIRSTNAME PIC X(6).
                 03 LASTNAME PIC X(18).
                    .
                    .
                    .
            ACCEPT DAT1.
            CALL "VPUTBUFFER" USING COMAREA, DAT1, DBUFLEN.

BASIC

            235 L1=24
            240 CALL VPUTBUFFER(C(*),D1$,L1)

FORTRAN

            CALL VPUTBUFFER(COMAREA,DAT1,DBLEN)

SPL/PASCAL

            BYTE ARRAY DAT1(0:23);
                  :
            VPUTBUFFER(COM1,DAT1,LEN);

The following calls transfer 24 bytes from an application area, DAT 1 to
the data buffer.  In this example, the longest dbuflen is assumed to be
80 bytes.



MPE/iX 5.0 Documentation