
Procedure Vrecv(var nam: ch6; var msg: message_packet_type;
                var stat: VI_status_type);
   EXTERNAL;
{*USER*
 
VRECV is used to
process a message MSG received from a form NAM.  The processing status
code is returned in STAT.
 
VRECV is the one of four commonly used VIEWPORT interface calls (VINIT,
VSEND, VRECV and VDISC).  It will use the other VIEWPORT interface calls
for its work, making it uneccesary for the normal user to call any other
VIEWPORT interface calls.
 
After receiving a message from a form program (whether connected or not),
of the type PK_RESOURCE or PK_FIELD_VALUE, the user should call VRECV
supplying the message and form program name.  VRECV will then handle
the message as needed.
 
The form name (NAM) will remain unchanged.
The message (MSG) variable will normally remain unchanged upon
return from VRECV.  The only change that can happen, is that the
message length (in MSG.FIELD_VALUE) will be adjusted to reflect the
length of the field value already in cache.  If needed the value
will be padded with blanks.  This is done, since the first VSEND,
which resulted in the field value being placed in cache, also determines
the "official" field length that will be use in subsequent sends.
After the call, the user may
then do any additional processing desired based on the returned status
in STAT.  In some cases, no further processing will be needed.
 
 
*ERROR CODES*
 
VI_SUCCESS - (PK_FIELD_VALUE/PS_GET)
             The requested field value was retrieved from
             cache and sent to the form job named in NAM.
             Normally, no further processing by the
             user is needed.
 
             (PK_RESOURCE/PS_CLOSE)
             The form job named in NAM has been removed
             from the connected form list.  If form job
             as not on the list, nothing is done.  Normally,
             no further processing is needed by the user
             unless the user wishes to monitor connection
             activity.
 
VI_CONNECTED - (PK_RESOURCE/PS_OPEN)
               The job named in NAM has been sent all
               current field values from cache, and a
               confirmation that the "connect request"
               has been "granted".  The form job is now
               on the "connected job list".  Normally,
               no further processing is needed by the user
               unless the user wishes to monitor connection
               activity.
 
              (PK_RESOURCE/PS_GRANT)
               The job named in NAM has sent all current field values
               from cache, and this is now the confirmation that the
               "connect request" has been "granted".  The form job is
               now on the "connected job list".  Normally,
               no further processing is needed by the user
               unless the user wishes to monitor connection
               activity.  Note that the connection is granted
               unconditionally.  It is up to the caller to determine
               if it wants the connection.  If the caller does not
               want the connection, this message should be ignored
               and a disconnect request (PK_RESOURCE/PS_CLOSE) should
               be sent in reply.
 
VI_CONNECT_DENIED - (PK_RESOURCE/PS_OPEN)
                    Connection request was rejected, and
                    form job named in NAM notified of the
                    fact.  There was no more space available
                    for another form in "connected form list".
                    Normally, no further processing is needed
                    by the user unless the user wishes to
                    monitor connection activity.
 
                    (PK_RESOURCE/PS_GRANT)
                    Connection grant from the job name in NAM could
                    not be honored because there was no more space
                    available for another job in "connected job list".
                    Normally, no further processing is needed
                    by the user unless the user wishes to
                    monitor connection activity.  A PK_RESOURCE/PS_CLOSE
                    was automatically sent to inform the attempting connector
                    that we cannot connect.
 
VI_CONNECT_LOST - (PK_RESOURCE/PS_OPEN)
                  Connection request was in the process of
                  being done when an error occurred that
                  indicated the form job was no longer
                  receiving messages.  The processing was
                  aborted, and the form job WAS NOT added
                  to the connected form list.
                  Normally, no further processing is needed
                  by the user unless the user wishes to
                  monitor connection activity.
 
VI_CHANGED - (PK_FIELD_VALUE/PS_PUT)
             Field value was updated in cache, and the
             supplied value was different than the value
             already in cache.
 
VI_NO_CHANGE - (PK_FIELD_VALUE/PS_PUT)
               Field value was updated in cache, and the
               supplied value was the same as the value
               already in cache.
 
VI_NOT_FOUND - (PK_FIELD_VALUE/PS_PUT)
               Field value was not in cache, and there was
               no value to compare or update.  Field value
               was ignored.  This normally means that this
               field is not controlled (initialized) by
               the user, but by some other user.  The user
               often is not interested in this field and
               can just discard it.  However, it does allow
               the user a means to see what other users are
               doing, and can montior those values of
               interest.
 
               (PK_FIELD_VALUE/PS_GET)
               Field value requested by form program was
               not found in cache.  Must be some other
               user's responsibility.  Message ignored.
               Normally, the user will discard this message.
 
VI_NO_MEMORY - (PK_FIELD_VALUE/PS_PUT)
               Field value was not already in cache, and
               furthermore, we were unable to place the
               supplied field value in cache as there was
               no more memory available in cache.
 
VI_NOT_CONNECTED - The form job name (NAM) is not in the list
                   of connected forms.  This message has been
                   ignored, and a disconnect command sent to
                   the form job name.  The user will normally
                   ignore and discard this message.  The only
                   message that can be accepted from a form
                   job that is not connected is a "connect
                   request" message.
 
VI_MSG_UNKNOWN - The message supplied in MSG was not recognized
                 (handled) by VRECV.  The sending form job
                 is on the connected form list.  VRECV did
                 nothing with the message.  The user may
                 ignore or process the message as desired.
 
*WIZARD*
 
The user can choose to route all received message through VRECV, or
route only the PK_RESOURCE and PK_FIELD_VALUE messages thorugh VRECV.
There is some extra overhead for routing all messages through VRECV,
so it is recommended that a fliter be applied, and only PK_RESOURCE
and PK_FIELD_VALUE messages be given to VRECV for processing.
 
If all messages are routed through, the VI_MSG_UNKNOWN and VI_NOT_CONNECTED
return statii should be interpreted as "not handled here, ignored".
 
}

