Previous Page | Next Page

Using the SAS Common Messaging Interface

Using the SAS Registry with the Common Messaging Interface


Overview of Using the SAS Registry

The SAS registry can be used to store information about objects used for application messaging. This document provides information about using the SAS registry editor to view registry entries. It also provides a sample program for managing registry objects under program control.


Using the SAS Registry Editor

The SAS Registry Editor can be used to verify that values set programmatically for application messaging objects were set properly. To invoke the Registry Editor, select Solutions [arrow] Accessories [arrow] Registry Editor in the Base SAS menu.

The SAS registry has the following hierarchy for application messaging objects:

Products
   Base
      SAS Messaging
         Maps
         Models
         Queues
         Transports


Writing Applications to Access the SAS Registry

A typical program would configure information such as the following:

The following code illustrates how to set and retrieve information within the SAS Registry.

   data _null_;

   length rc 8 msg $ 200;
   length descriptor transport queue label $ 80;
   length type $ 32;
   length auth journal priv trans $ 10;
   length basep journalq quota 8;

   put 'Registry Map creation...';
   call setmap('mymap', 'registry', rc, 
      'char,0,80;double;');
   if rc ne 0 then do;
      put 'Setmap failed';
      msg = sysmsg();
      put msg;
   end;
   else put 'Setmap was successful';

   put 'Registry Map retrieval...';
   call getmap('mymap', 'registry', rc, descriptor);
   if rc ne 0 then do;
      put 'Getmap failed';
      msg = sysmsg();
      put msg;
   end;
   else do;
      put 'Getmap was successful';
      put 'descriptor = ' descriptor;
   end;

   put 'Registry Map deletion...';
   call deletemap('mymap', 'registry', rc);
   if rc ne 0 then do;
      put 'Deletemap failed';
      msg = sysmsg();
      put msg;
   end;
   else put 'Deletemap was successful';

   put '-------------------------------';

   put 'Registry Queue creation...';
   call setalias('queue', 'myqueue', 'registry', 
      rc, 'msmq', 'machine_name\queue_name');
   if rc ne 0 then do;
      put 'Setalias failed';
      msg = sysmsg();
      put msg;
   end;
   else put 'Setalias succeeded';

   put 'Registry Queue retrieval...';
   call getalias('queue', 'myqueue', 'registry', 
      rc, transport, queue);
   if rc ne 0 then do;
      put 'Getalias failed';
      msg = sysmsg();
      put msg;
   end;
   else do;
      put 'Getalias succeeded';
      put 'transport = ' transport;
      put 'queue = ' queue;
   end;

   put '-------------------------------';

   put 'Registry Transport creation...';
   call setalias('transport', 'mytransport', 
      'registry', rc, 'MSMQ');
   if rc ne 0 then do;
      put 'Setalias failed';
      msg = sysmsg();
      put msg;
   end;
   else put 'Setalias succeeded';

   put 'Registry Transport retrieval...';
   call getalias('transport', 'mytransport', 
      'registry', rc, transport);
   if rc ne 0 then do;
      put 'Getalias failed';
      msg = sysmsg();
      put msg;
   end;
   else do;
      put 'Getalias succeeded';
      put 'transport = ' transport;
      put 'queue = ' queue;
   end;

   put '-------------------------------';

   put 'Registry Model creation...';
   call setmodel('msmq', 'mymodel', 'registry', rc,
      'authenticate, label',
      'always', 'Test Queue of MyModel');
   if rc ne 0 then do;
      put 'Setmodel failed';
      msg = sysmsg();
      put msg;
   end;
   else put 'Setmodel succeeded';

   put 'Registry Model retrieval...';
   call getmodel('msmq', 'mymodel', 'registry', rc,
      'authenticate,basepriority,journal,
      journalquota,label,privlevel,quota,
      transaction,type',
      auth, basep, journal, journalq,
      label, priv, quota, trans, type);
   if rc ne 0 then do;
      put 'Getmodel failed';
      msg = sysmsg();
      put msg;
   end;
   else do;
      put 'Getmodel succeeded';
      put 'authenticate = ' auth;
      put 'base priority = ' basep;
      put 'journal = ' journal;
      put 'journal quota = ' journalq;
      put 'label = ' label;
      put 'privacy level = ' priv;
      put 'quota = ' quota;
      put 'transaction = ' trans;
      put 'type = ' type;
   end;

   run;
   quit;

Previous Page | Next Page | Top of Page