Contents Common Messaging Interface Previous Next

Using the SAS Registry with the Common Messaging Interface

The SAS registry can be used to store information about objects used for application messaging. This document provides information on 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, from the SAS pull-down menu:

  1. Select Solutions ®
  2. Select Accessories ®
  3. Select Registry Editor ®

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

Products
   Base
      Messaging
         Transports
            transport1         transportname     MQSeries(trantab=SAS_trantab_override)
            transport2         transportname     MQSeries-C(trantab=SAS_trantab_override)
            transport3         transportname     MSMQ
         Queues
            queue1             transportname     MQSeries(trantab=SAS_trantab_override)
                               queuename         QMgr:queue
            queue2             transportname     MSMQ
                               queuename         pathname
         Maps
            map1               descriptor        type,offset,length;type,offset,length;...
            map2               descriptor        type,offset,length;type,offset,length;...
         Models
            MSMQ
               model1          authenticate      none,always
                               basepriority      short
                               journal           none,always
                               journalquota      unsigned long
                               label             queue description
                               privlevel         none,body,optional
                               quota             unsigned long
                               transaction       none,always
                               type              binary GUID

Writing Applications to Access the SAS Registry

A typical program would configure information such as:

  1. Map data descriptor
  2. Queue and transport aliases
  3. Dynamic model for transport processing.

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;

Contents Common Messaging Interface Previous Next

Copyright © 2025 SAS Institute Inc. All Rights Reserved.