Chapter Contents

Previous

Next
_recv

_recv



Receive message into SCL variables.


Syntax
Example 1
Example 2

Syntax

CALL SEND(cnctionInst, '_recv', rc <, parm1...parmn>);

Where... Is type... And represents...
rc N return code
parm1...parmn N or C parameters in which to receive the message surfaced by the query; consists of 0 or more numerics or characters

When a message is surfaced by a query, it needs to be received into SCL parameters. The _recv method supports the receipt of numerics and characters. SCL lists are not supported by _recv; _recvlist should be called to receive SCL lists. The _recv method must be called with the correct parameter types. For example, if a character and a numeric variable were sent, _recv must be called with a character and a numeric variable in the correct order.

If an error or warning condition is encountered during the receive, a non-zero return code is returned in the rc parameter. The return codes that follow are a defined set of warning and error conditions that can be checked by using the SYSRC macro, which is provided in the autocall library that is supplied by SAS Institute.

If the rc is not one of the messages shown here, use SYSMSG() to determine the exact error message.

_SWTRUNC
is a WARNING that indicates that the message has been truncated because too few parameters were passed into the _recv method. All parameters that were passed into the method will be updated, but the remainder of the message is truncated.

_SENOBUF
indicates that the receive failed because there is no message to receive.

_SEMORE
indicates that the receive failed because more receive parameters (parm1...parmn) were passed into _recv than were actually received. Parameters will NOT be updated and _recv must be called again to receive the message.

If an unexpected message is received, _recv can be called by using 0 receive parameters in order to throw away the message. A truncation warning is returned, but the message will have successfully been received and truncated.


Example 1

This example queries on a specific connection, and based on the msgtype that is returned, receives the message into the appropriate SCL variables.

attachlist = makelist();
header = makelist();

call send(cnctionInst, '_query', etype, 
          msgtype, header, attachlist, 
          rc);

if (etype eq "MESSAGE") then do;
   if (msgtype eq 1) then do;
      name = '';
      age = 0;
      race = '';
         /*******************************/
         /* receive 3 parameters.       */
         /*******************************/
      call send(cnctionInst, '_recv', 
                rc, name, age, race);
   end;

   else if (msgtype eq 2) then do;
      company = ''; address='';
         /*******************************/
         /* receive 2 character         */
         /* parameters.                 */
         /*******************************/
      call send(cnctionInst, '_recv', 
              rc, company, address);
   end;

   else do;
         /*******************************/
         /* unknown message type; throw */
         /* away message by forcing     */
         /* truncation.                 */
         /*******************************/
      call send(cnctionInst, '_recv', rc);
   end;
end;


Example 2

This example throws the message away by forcing truncation.

call send(cnctionInst, '_recv', rc);


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.