Chapter Contents |
Previous |
Next |
SAS/CONNECT User's Guide |
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:
Note: The following code is a portion of an SCL program
that is used for illustration purposes only. It is not a complete program.
/******************************************/ /* */ /* 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;
Open a station for the client. | |
Connect to the ADM server. | |
Send the ADM server a check-out request and include the userid and the desired entryname. | |
Wait for a response from the ADM server. | |
A message type of 39 means that the entry is already checked out. | |
A message type of 35 means that the entry is available. | |
Prepare to receive the requested entry. | |
The OUTLIB and OUT named items are used by the _acceptAttachment method to determine where to write the checked-out entry. | |
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.