0.9b (c) 1995 Peter Childs
The function adds a use to a resource using either a UNC name or an alias.
Syntax
MyRc = NetAdd(NETUSE, 'useInfo', ComputerName) MyRc = NetAdd(NETUSE, DcName, aliasName, LocalName, ComputerName)
Parameters
The parameters required are:
'useInfo' The REXX variable holding the use information. The variable is divided into:
o useInfo.local
The local device name being redirected to the shared resource. The variable can either be a device name connection or a UNC connection. The following format can be used:
Connection type Format --------------- ------ Device Name D: to Z: LPT1: to LPT9: COM1: to COM9: UNC ''
For UNC connections the remote parameter will be used to specify the resource to be used
o useInfo.remote
The UNC name of the remote resource being accessed.
The following UNC syntax must be used:
\\servername\sharename
The sharename is identical to the netname
o useInfo.password
This password if required. A value of 'N/A' or '' will be used as no password required. If the variable does not exist the default default value is no password required
o useInfo.asg_type
The resource type. The following values must be used:
Device type Value ----------- ------ Disk Device 'Disk device' 'DISKDEV' Spooled device 'Spooled printer' 'SPOOLDEV' Serial device 'Serial device' 'CHARDEV' Interprocess communication (IPC) 'Interprocess communication (IPC)' 'IPC' UNC where local is '' 'UNC'
ComputerName The name of the computer that performs the net use operation. For a local workstation the value can be ''.
The second form requires that the resource specified by the alias already is shared, otherwise a return code 67 will be returned. 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
LocalName The local device name being redirected to the shared resource. The variable can either be a device name connection or a UNC connection. The following format can be used:
Connection type Format --------------- ------ Device Name D: to Z: LPT1: to LPT9: COM1: to COM9: UNC ''
For UNC connections the remote resource name will be created from the alias
ComputerName The name of the computer that performs the net use operation. For a local workstation the value can be ''.
Note
The ComputerName and DcName can be specified as '' for a local server
A example using the useInfo structure
/* Net use add using a net use info structure */ call RxFuncAdd 'LoadLsRxutFuncs', 'LSRXUT', 'LoadLsRxutFuncs' call LoadLsRxutFuncs NETUSE = 270 ComputerName = '\\ILIDC' useInfo.local = 'W:' useInfo.remote = '\\ILIDC\BOOKS' useInfo.password = '' useInfo.asg_type = 'Disk device' myRc = NetAdd(NETUSE, 'useInfo', ComputerName) if myRc <> '0' then do say 'Got error from NetAdd() ' myRc call DropLsRxutFuncs exit 9 end else do say say "Successfully using resource" end call DropLsRxutFuncs call RxFuncDrop 'LoadLsRxutFuncs' exit 0
Example Output
Successfully using resource
A example using an alias as parameter
/* Net use add using an alias */ call RxFuncAdd 'LoadLsRxutFuncs', 'LSRXUT', 'LoadLsRxutFuncs' call LoadLsRxutFuncs NETUSE = 270 DcName = '\\ILIDC' aliasName = 'BOOKMGR' LocalName = 'X:' ComputerName = '\\ILIDC' myRc = NetAdd(NETUSE, DcName, aliasName, LocalName, ComputerName) if myRc <> '0' then do say 'Got error from NetAdd() ' myRc call DropLsRxutFuncs exit 9 end else do say say "Successfully using resource" end call DropLsRxutFuncs call RxFuncDrop 'LoadLsRxutFuncs' exit 0
Example Output
Successfully using resource
Inf-HTML End Run - Successful