Chapter Contents

Previous

Next
SAS/CONNECT User's Guide

Example 2 - Retrieve an Agent Information

This example uses the notification queue to retrieve the agent name and runkey values. The runkey can then be used to retrieve the actual log and output from the agent run.

init:

station_c = 
   loadclass('sashelp.connect.station.class');
station_i = instance(station_c);

collection = 'acollection';
domain = 'tcp//mynode.xyz.com/domsvr';
call send(station_i, '_open', collection, rc, 
          domain);

   /* open the notification queue          */
queue_c = loadclass('sashelp.connect.queue');
queue_i = instance(queue_c);
call send(queue_i, '_open', station_i, 
          "checkq", "FETCH", rc);

eventtype = '';
runkey=0;
hdrlist = makelist();
call send(queue_i, '_query', eventtype, 
          msgtype, hdrlist, 0, rc);

if (rc eq 0) and (msgtype eq 65539) then do;
   agentname = getnitemc(hdrlist, 'AGENT_NAME');
   runkey = getnitemn(hdrlist, 'AGENT_RUN_KEY');
   description = getnitemc(hdrlist, 
      'DESCRIPTOR');
   put agentname;
   put runkey;
   put description;
end;

rc = dellist(hdrlist);

   /* close queue */
call send(queue_i, '_close', rc);

agent_c = loadclass('sashelp.connect.agent');
agent_i = instance(agent_c);
 call send(agent_i, '_setDomainInfo', domain, 
           collection, rc, "", station_i);

   /* retrieve agent log and output spool     */
   /* using agent name and runkey retrieved   */
   /* from queue header information           */
model_c = 
   loadclass('sashelp.connect.runspool.class');
model_i = instance(model_c);
call send(agent_i, '_retrieveAgentRunInfo', 
          agentname, runkey, rundt, runcc, rc, 
          model_i, model_i);

   /* now model_i can be used to display log  */
   /* and output from agent run by attaching  */
   /* to text viewer object                   */
return;


Chapter Contents

Previous

Next

Top of Page

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