Chapter Contents

Previous

Next
QUEUE_GETAGENT

QUEUE_GETAGENT



Retreives agent header information.


Syntax
QUEUE_GETAGENT Example

Syntax

CALL QUEUE_GETAGENT(queueId, agentName, runKey, dateTime, completionCode, rc);

Where... Is type... And represents...
queueId N queue identifier
agentName C name of defined agent
runKey N run instance key
dateTime N date and time agent was run
completionCode N agent run completion code
rc N return code

The QUEUE_GETAGENT routine retrieves the agent header information from the specified queue. When the agent runs, you have the ability to define a notification queue. If a notification queue is defined, a completion message is sent to this queue with a message type of 65539.

The agentName parameter is the name of an agent that has already been defined using the SCL _defineAgent.

The header information that is returned includes runkey, dateTime, and completionCode.

The runKey parameter is used in the SCL interface to retrieve the agent run information.

The dateTime parameter indicates the date and time that the agent was run.

The completionCode parameter indicates whether the agent was successfully invoked. A value of zero indicates the agent was invoked successfully.

If an error or a warning condition is encountered, a non-zero return code is returned in the rc parameter. Use the SYSMSG() function to print the message that is associated with the non-zero rc.


QUEUE_GETAGENT Example

This example queries for a message and displays agent information if agent completed successfully.

msgtype = 0;
aflag = 0;
put ' ';
call queue_query(qid, etype, msgtype, aflag, rc);

if rc = 0 and (etype = DELIVERY) then do;
   put 'Query successful';
   put 'Etype is ' etype;
   put 'Msgtype is ' msgtype;

      /* agent completion message received, */
      /* get agent info                     */ 
   if (msgtype = 65539) then do;
      retrieved = retrieved + 1;
      agentName = '';
      dt = 0;
      cc = 0;
      runkey = 0;
      put ' ';
      call queue_getagent(qid, agentName, runkey, 
                          dt, cc, rc); 

      if rc = 0 then do;
         put ' ';
         put ' ';
         put 'GetAgent successful';
         put 'Agent name is ' agentName;
         put 'Runkey is ' runkey;
         put 'Datetime is ' dt;
         put 'Completion code is ' cc;
      end;
   else do;
      msg = sysmsg();
      put msg;
   end;
   corr = 0;
   put ' ';
   put 'Calling queue_gethdr';
   call queue_gethdr(qid, desc, respQ, dt, 
      origin, security, corr, rc); 

   if rc = 0 then do;
      put 'Gethdr successful';
      put 'Desc is ' desc;
      end;
   else do;
      msg = sysmsg();
      put msg;
   end;
end;  /* if msgtype is 65539 */


Chapter Contents

Previous

Next

Top of Page

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