Chapter Contents

Previous

Next
SAS/CONNECT User's Guide

Check Out a Catalog Entry

The check-out action involves a user making a request for a specific entry and receiving an immediate response. The response is either the requested entry or a message indicating why the entry cannot be returned. Direct-messaging was chosen for this portion of the application because the user needs an immediate response to the check-out request in order to continue working.

The following code, which was taken from the client portion of the ADM application, allows a user to check out a specified catalog entry. The application was written to send a message type of 30 to the ADM server in order to request that a specific catalog entry be checked out by the user. The ADM server will respond with one of two message types. A message type of 35 has been defined to mean that the requested catalog entry is available. In this case, the entry is received and written to the location specified by the user. A message type of 39 has been defined to mean that the requested catalog entry is locked to another user in the work group. In this case, the client application prints a message and control returns to the main menu.

The following variables would be initialized prior to the code fragment:

srvname
supplied to the _open method when opening a client station. This variable contains the service name of the server portion of the ADM application.

uname
supplied to the _send method. This variable contains the userid of the client and will be sent as the first parameter in the message.

incat
supplied to the _send method. This variable contains the four-level entryname in the central catalogs that are controlled by the server portion of the ADM application. It is the second parameter in the message.

outcat
used to build the TLIST parameter that is supplied to the _acceptAttachment method. This variable contains the four-level entryname of the location to which the received entry will be written.

Note:   The following code is a portion of an SCL program that is used for illustration purposes only. It is not a complete program.  [cautionend]

   /******************************************/
   /*                                        */
   /* CHECK-OUT A CATALOG ENTRY              */
   /*                                        */
   /******************************************/

[1]
stationid = loadclass('sashelp.connect.station');
station = instance(stationid);
call send(station, '_open', "TESTPTP", rc);

[2]
cnctionid = loadclass('sashelp.connect.cnction');
cobj = instance(cnctionid);
call send(cobj, '_open', station, srvname, rc);

[3]
call send(cobj, '_send', 30, 0, alist, rc,
   uname, incat);      

[4]
call send(cobj, '_query', eventtype, 
   msgtype, 0, alist, rc); 

[5]
if msgtype = 39 then do;
   call send(cobj, '_recv', rc, str);
   put 'NOTE: ' str;
end;

[6]
else if msgtype = 35 then do;
   call send(cobj, '_recv', rc, str );

[7]
   catlist = makelist();
   catlist = getiteml(alist,1);
   outlib = scan(outcat,1,'.');
   outcat = scan(outcat,2,'.');

[8]
   rc = setnitemc(catlist, outlib, "OUTLIB");
   rc = setnitemc(catlist, outcat, "OUT");
   tlist= makelist();
   catlist = insertl(tlist,catlist,-1);
   call send(cobj, '_acceptAttachment', 
      tlist, rc, "COMPLETE");
   put 'NOTE: Requested entry has been received.';
end;

[9]
else do;
   put 'ERROR:  Received unknown msgtype--'msgtype;
   call send(cobj, '_recv', rc);
end;
[1] Open a station for the client.
[2] Connect to the ADM server.
[3] Send the ADM server a check-out request and include the userid and the desired entryname.
[4] Wait for a response from the ADM server.
[5] A message type of 39 means that the entry is already checked out.
[6] A message type of 35 means that the entry is available.
[7] Prepare to receive the requested entry.
[8] The OUTLIB and OUT named items are used by the _acceptAttachment method to determine where to write the checked-out entry.
[9] Should only receive msgtype 39 (fail) or 35 (success). All other msgtypes are unknown.


Chapter Contents

Previous

Next

Top of Page

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