HP 3000 Manuals

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


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

VSETERROR 

Sets the error flag of a specified field and increments numerrs.  If this
is the first field (in screen order) with an error, it copies a message
to the window area of memory for later display.

Syntax 

             VSETERROR {comarea,fieldnum,message,msglen}

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
                 VSETERROR:

                 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.

                 VSETERROR may set the following comarea items:

                 numerrs          Contains number of fields in form with
                                  errors; incremented by VSETERROR.

                 cstatus          Set to nonzero value if call
                                  unsuccessful.

fieldnum         Two-byte integer variable containing the field number or
                 screen order number of the data field to be flagged for
                 error.  If it is the screen order number, it must be a
                 negative number representing the position of the field
                 on the form.

message          Character string containing an error message to be
                 copied to the window area of memory for subsequent
                 display by VSHOWFORM.

length           Two-byte integer containing the length in bytes of the
                 message parameter.  If length is set to -1, the current
                 content of the window is not changed.  If length is set
                 to zero, the current content of the window is cleared to
                 blanks.

Discussion 

This intrinsic can be called by any program that wants to perform its own
edits, either in addition to, or instead of VFIELDEDITS. VSETERROR sets
the error flag associated with the specified field.  If this is the first
time this field has been diagnosed as having an error, VSETERROR
increments numerrs; otherwise, it does not change numerrs.  Thus, if a
field has an error detected by a prior call to VFIELDEDITS, a call to
VSETERROR for that field does not increment numerrs.  However, if the
touch feature is enabled, VSETERROR toggles the error flag for a
specified field to clear, if it was already set, and decrements numerrs.
Refer to "Coding the Touch Feature" in Appendix E.

If this is the first field in the form (in screen order) that has an
error, the specified message is copied to the window area of memory for
later display.  If you do not want to change the current contents of the
window, set the length parameter to -1.  To clear a message, set length
to zero.

Note that the field number identifies a field regardless of its position
in the form.  Thus, field "1" could be the third field in screen order
counting from left to right, top to bottom.  Using the screen order
number is preferable because if the fields in a form are rearranged, no
modification to an application is necessary.

Example 

COBOL

           DATA DIVISION.
               77 FLDNUM         PIC 9(4) COMP.
               77 MESSAGE        PIC X(80).
               77 MLENGTH        PIC S9(4) COMP.
                    :
           PROCEDURE DIVISION.
               MOVE 3 TO FIELDNUM.
               MOVE 22 TO MLENGTH.
               MOVE "THIS FIELD IS REQUIRED" TO MESSAGE.
               CALL "VSETERROR" USING COMAREA, FLDNUM, MESSAGE, MLENGTH.

BASIC

               220 F1=3
               225 L1=22
               230 M$="THIS FIELD IS REQUIRED"
               250 CALL VSETERROR(C(*),F1,M$,L1)

FORTRAN

               FF=3
               ML=22
               MSG="THIS FIELD IS REQUIRED"
               CALL VSETERROR(COMAREA,FF,MSG,ML)

SPL/PASCAL

               INTEGER FF,ML;
               BYTE ARRAY MESSAGE(0:21);="THIS FIELD IS REQUIRED";
                 :
               FF:=3;
               ML:=22;
               VSETERROR(COMAREA,FF,MESSAGE,ML);

The examples above set error flags for field number "3" in the currently
open form, and set up the message "THIS FIELD IS REQUIRED" to be
displayed if no value is entered in the field and this is the first field
(in screen order) in which an error is detected.

The following examples show how VSETERROR can be used to set error flags
for a field in error without writing a message to the window.

COBOL

        MOVE 3 TO FIELDNUM.
        MOVE -1 TO MLENGTH.
        CALL "VSETERROR" USING COM1, FIELDNUM, MESSAGE, MLENGTH.

BASIC

        220 F1=3
        230 L1=-1
        CALL VSETERROR(C(*),F1,M$,L1)

FORTRAN

        FF=3
        ML=-1
        CALL VSETERROR(COM1,FF,MSG,ML)

SPL/PASCAL

        FIELD:=3;
        LEN:=-1;
        VSETERROR(COM1,FIELD,MESSAGE,LEN);



MPE/iX 5.0 Documentation