Previous Page | Next Page

Common Messaging Interface Call Routines

ACCEPTATTACHMENT



Accepts an attachment by recreating it on the local machine.
Transports supported: MQSeries, MQSeries-C, MSMQ, Rendezvous, Rendezvous-CM

Syntax
Arguments
Details
Example

Syntax

CALL ACCEPTATTACHMENT(qid, attachid, qual1, qual2, rc);

Arguments

qid

Numeric, input

Specifies the handle of an open queue that is obtained from a previous OPENQUEUE function call.

attachid

Numeric, input

Specifies an attachment identifier that is obtained from a previous GETATTACHMENT function call.

qual1

Character, input

Specifies the first attachment qualifier. If this is an external file attachment, then this qualifier designates the file specification that is used to receive it (either FILENAME or FILEREF). Otherwise, this qualifier designates the receiving library name.

qual2

Character, input

Specifies the second attachment qualifier. If this is an external file attachment, then this qualifier designates the receiving filename or fileref. Otherwise, this qualifier designates the receiving member name.

rc

Numeric, output

Provides the return code from the CALL routine. If an error occurs, then the return code is nonzero. You can use the SAS function SYSMSG() in order to obtain a textual description of the return code.


Details

For information about exception processing when you use attachments, see Attachment Error Handling.


Example

This example accepts attachments from a message and stores them in the file d:\myexternalfile.tmp.

length msg $ 200;
length qid lastflag attachid rc 8;
length type $ 13;
length qual1 qual2 $ 80;
length desc $ 80;
length minor major 8;

next:
   rc=0;
   lastflag=0;
   attachid=0;
   type='';
   qual1='';
   qual2='';
   desc='';
   minor=0;
   major=0;
   call getattachment(qid, lastflag, attachid, type,
      qual1, qual2, rc, desc, minor, major);
   if rc ^= 0 then do;
      put 'GETATTACHMENT: failed';
      msg = sysmsg();
      put msg;
   end;
   else do;
      put 'GETATTACHMENT: succeeded';
      put 'Attachment type is ' type;
      if type eq 'EXTERNAL_TEXT' OR type eq
	     'EXTERNAL_BIN' then do;
         put "Sender's " qual1 " was " qual2;

      /* accept/receive the external attachment */
      call acceptattachment(qid, attachid, 'filename',
         'd:\myexternalfile.tmp', rc);
      if rc ^= 0 then do;
         put 'ACCEPTATTACHMENT: failed';
         msg = sysmsg();
         put msg;
      end;
      else
         put 'ACCEPTATTACHMENT: succeeded';
      end;
      else do;
         put "Sender's library name was ' qual1;
         put "Sender's member name was ' qual2;

      /* accept/receive the library/member */
         libname tmp 'd:\tmp';
         call acceptattachment(qid, attachid,
            'tmp', 'test', rc);
      end;

      if lastflag eq 0 then goto next;

Previous Page | Next Page | Top of Page