/**********************************************************************/

/******** Example for Windows 3.1 or Windows 3.11 with Novell *********/
/*
  Use the following code on a Windows 3.1 or Windows 3.11 client running
  on a NOVELL network to update the DOS environment variable, VQPNAME
  with the userid of the current user logged onto a particuliar NOVELL
  server. This code uses the modulen function to reference
  three DOS/WINDOWS/Novell API's.

*1*   
  Data step creates the text file novell.txt referenced by the fileref 
  SASCBTBL.  SASCBTBL will be read by the modulen function.

*2* 
   Data step to execute the NOVELL api external modules
   'NWGetDefaultConnectionID','NWGetConnectionNumber', and
   'NWGetConnectionInformation'.  The NWGetConnectionInformation api
   actually returns the name information. Connectionid and connection
   number are needed to call NWGetConnectionInformation.  The macro
   variable vqpname is updated with the value of the name returned.
   Note that NWGetConnectionInformation returns a other valuable
   informatio that might be used in other applications.  

*3* 
   Now set the environment variable vqpname with the value stored 
   in the macro variable vqpname.
*/
/****** Start of Code for NOVELL/DOS/WIN32S example******************/
  
/* *1* */  

data _null_;
   filename sascbtbl 'novell.txt';
   file sascbtbl;
   input  line $char80.;
   put line $char80.;
   cards4;
routine NWGetDefaultConnectionID
minarg=1
maxarg=1
arch=bit16
stackorder=l2r
stackpop=called
module=NWCALLS
returns=short;
arg 1 num update byaddr format=ib2.;

routine NWGetConnectionNumber
minarg=2
maxarg=2
arch=bit16
stackorder=l2r
stackpop=called
module=NWCALLS
returns=short;
arg 1 num input byvalue format=ib2.;
arg 2 num update byaddr format=ib2.;

routine NWGetConnectionInformation
minarg=6
maxarg=6
arch=bit16
stackorder=l2r
stackpop=called
module=NWCALLS
returns=short;
arg 1 num input byvalue format=ib2.;
arg 2 num input byvalue format=ib2.;
arg 3 char update byaddr format=$cstr48.;
arg 4 num update byaddr format=ib2.;
arg 5 num update byaddr format=ib4.;
arg 6 char update byaddr format=$cstr7.;
;;;;

/* *2* */

filename sascbtbl 'novell.txt';
data _null_;
  length Name $48 logtime $7;
  rc=modulen('NWGetDefaultConnectionID',ID);
  rc=modulen('NWGetConnectionNumber',ID,Handle);
  rc=modulen('NWGetConnectionInformation',ID,Handle,Name,Type,UserID,
              logtime);
  put ID= Handle= Name= Type= UserID= logtime=;
  call symput('vqpname',name);
run;

/* *3* */

options set=vqpname &vqpname;

/****** End of example for NOVELL/DOS/WINDOS **************************/