0.9b (c) 1995 Peter Childs
The function adds a server share using either a alias or a shareInfo structure.
Syntax
MyRc = NetAdd(NETSHARE, 'shareInfo', SrvName) MyRc = NetAdd(NETSHARE, DcName, aliasName, NetName)
Parameters
The parameters required are:
'shareInfo' The REXX variable holding the share information. The variable is divided into:
o shareInfo.netname
The netname of a resource. It is recommended that the shareInfo.netname and the shareInfo.path be the same for a Spooler Queue; otherwise, the result is unpredictable
o shareInfo.type
The share type. The following values are used:
Share type Value ---------- ----- Disk drive 'Disk Drive' 'DISKTREE' Spooler queue 'Spooler Queue' 'PRINTQ' Serial device 'Serial Device' 'DEVICE' Interprocess Communications 'Interprocess communication (IPC)' 'IPC'
o shareInfo.remark
The share remark
o shareInfo.max_uses
The maximum number of concurrent connections that the shared resource can accommodate. The default value is 65535
o shareInfo.path
The string containing the local path name of the shared resource. For disks, shareInfo.path is the path being shared. For spooler queues, shareInfo.path is the name of the spooler queue being shared. For serial device queues, shareInfo.path is a string of one or more communication device names separated by spaces (for example, COM1 COM2 COM6).
It is recommended that the shareInfo.netname and the shareInfo.path be the same for a Spooler Queue; otherwise, the result is unpredictable
SrvName The computer name of the server that has the resource to be shared
The second form of the function call is divided into:
DcName The domain controller computer name, which holds the alias information
aliasName The alias name
NetName The share network name. For a spooler queue the Queue name will be identical with the netname. It the value is empty, the default Alias netname will be used.
It is recommended to use the same netname as the alias name
Note
The server and DcName computer names can be specified as '' for a local server.
Example using shareInfo structure
/* Net share add using a net share info structure */ call RxFuncAdd 'LoadLsRxutFuncs', 'LSRXUT', 'LoadLsRxutFuncs' call LoadLsRxutFuncs NETSHARE = 190 SrvName = '\\ILIDC' shareInfo.netname = 'TEMP' shareInfo.type = 'Disk Drive' shareInfo.remark = 'Temporary files share' shareInfo.max_uses = 10 shareInfo.path = 'D:\TEMP\FILES' myRc = NetAdd(NETSHARE, 'shareInfo', SrvName) if myRc <> '0' then do say 'Got error from NetAdd() ' myRc call DropLsRxutFuncs exit 9 end else do say say "Resource shared successfully" end call DropLsRxutFuncs call RxFuncDrop 'LoadLsRxutFuncs' exit 0
Example Output
Resource shared successfully
Example using an alias
/* Net share add using an alias */ call RxFuncAdd 'LoadLsRxutFuncs', 'LSRXUT', 'LoadLsRxutFuncs' call LoadLsRxutFuncs NETSHARE = 190 DcName = '\\ILIDC' aliasName = 'THEBOOK' NetName = 'THEBOOK' myRc = NetAdd(NETSHARE, DcName, aliasName, NetName) if myRc <> '0' then do say 'Got error from NetAdd() ' myRc call DropLsRxutFuncs exit 9 end else do say say "Resource shared successfully" end call DropLsRxutFuncs call RxFuncDrop 'LoadLsRxutFuncs' exit 0
Example Output
Resource shared successfully
Inf-HTML End Run - Successful