═══ 1. Introduction ═══ NETUTIL.DLL is a REXX function package which includes REXX functions that simulate and enhance NET commands of IBM OS/2 LAN Server products. It also includes functions which can perform things that NET commands do not offer. It is designed to provide REXX programmers with ease-of-use interface and more capabilities than NET commands. Note: IBM offers an applet WSLSRXUT("LAN Server/Warp Server REXX API extension") as a free AS-IS software from a Web site; http://www.software.ibm.com/warp/pspinfo/wsapplets.html NetUtil has less functions than WSLSRXUT, but I think it will be more friendly to use than WSLSRXUT because NetUtil is is an implementation of NET commands as REXX functions but WSLSRXUT is an implementation of LAN Server APIs as REXX functions. Advantage of NetUtil functions:  It sets information directly into REXX variables. (See an example.)  It offers more simple interface than NET commands. (See the example.)  It provides non-ADMIN users with limited information that cannot be obtained by NET commands. (See an example.)  There are also useful functions of non-NET command type. (See an example.)  It returns an exact return code from NET APIs. (c) Copyright IBM Corporation 1995, 1997 ═══ Ease-of-use: Example of NetGroup ═══ To list all the group names of a logon domain and the user ids within the groups by a REXX program, it would be complicated when it uses NET GROUP command. (NET ADMIN command will be also required when it is run from a requester machine.) By use of NetGroup function in NetUtil package, the REXX program is very simple: /* Example. */ if NetGroup('Query','out','.')=0 then do do i=1 to out.0 say out.i.0gid /* group id*/ say out.i.0remark /* comment for this group */ do j=1 to out.i.0 /* number of users */ say out.i.j /* user id within the group*/ end end end ═══ More capability for Non-ADMIN users: Example of NetUser ═══ An user of NetUtil who has not ADMIN privilege can list all the user ids in a logon domain: /* Example. */ if NetUser('Query','out','.')=0 then do do i=1 to out.0 say out.i.0uid /* group id*/ say out.i.0remark /* comment for this group */ say out.i.0fullname /* fill name */ say out.i.0UserComment /* user comment */ end end ═══ Functions of Non-NET command type ═══ NetUtil includes also useful functions of non-NET command type. Here are examples: /* Examples */ parse value LsDCname() with rc domsrv say 'Domain Controller of your logon domain is' domsrv srv = 'LS40SRV' parse value LsServer('Disk',srv) with rc drive_list say 'Server' srv 'has local drives of' drive_list /* Lists all the servers in a logon domain and put such information on the servers as LS version, and so on, in REXX compound variables with the stem OUT. */ rc = LsServer('Query','out','.') ═══ 1.1. How to install and use ═══  To install NETUTIL.DLL, copy it under a directory specified in the LIBPATH statement of your CONFIG.SYS file. Note: If you are using OS/2 v2.x, NETUTIL.DL2 should be used instead of NETUTIL.DLL. Rename NETUTIL.DL2 to NETUTIL.DLL when you use on OS/2 v2.x. NETUTIL.DL2 can also work under OS/2 v3.x or upper, but NETUTIL.DLL is only for OS/2 v3.x or upper.  To use a function of NETUTIL.DLL in your REXX program, the function must have been registered in REXX. To register it, use REXX's build-in function RxFuncAdd. Example To register NetAlias function, issue the following instruction in a REXX program: call RxFuncAdd 'NetAlias', 'NETUTIL', 'NetAlias'  To register all the functions of NETUTIL.DLL, issue the following instruction in a REXX program: call RxFuncAdd 'LsLoadFuncs', 'NETUTIL', 'LsLoadFuncs' call LsLoadFuncs  To drop all the registered functions of NETUTIL.DLL, issue the following instruction in a REXX program: call LsDropFuncs Note: If you often use NetUtil functions, it is better to call LsLoadFuncs from your STARTUP.CMD. ═══ 1.2. Restrictions ═══ 1. NETUTIL.DLL uses 32-bit API of IBM OS/2 LAN Server version 4.0, so the functions do not run on a machine where IBM OS/2 LAN Server products of versions less than 4.0 is running. Note: The functions can operate with servers of the earlier versions. 2. The current version of NETUTIL.DLL does not implement all the NET commands. 3. The current version of NETUTIL.DLL supports mainly for 'Query' verb. ═══ 1.3. Change History ═══ 1.23 1996 12/25 Output stem variable name that NetGroup function returns for user ids of a group id is changed from "stem.i.0uid.j" to "stem.i.j". Though old name is obsolete, it will remain on NETUTIL in some future releases for compativilities. 1.22 1996 02/19 Fixed a bug of NetAlias function that returned only DISK aliases when alias argument is not specified or specified as an asterisk. 1.21 1996 02/11 NETUTIL.DL2 file was added for OS/2 v2.x users. It should be renamed to NETUTIL.DLL when it is used on OS/2 v2.x. Some typo in INF file were fixed. 1.20 1995 12/29 New function and some enhancement added, and a bug is fixed.  NetApp function with 'Query' verb was added.  'Connect' and 'Disconnect' verbs were added to NetUse function.  NetUser function with 'Query' verb added following REXX variables to be set: - stem.i.0LOGONALWAYS? - stem.i.0LOGONHOURS.0 (=7) - stem.i.0LOGONHOURS.t (t=1 to 7) - stem.i.0PWREQ? - stem.i.0PWCHG? - stem.i.0ACCOUNTACT? - stem.i.0ACCOUNTDEL?  NetUser function with 'Query' verb added detail of 2 to set information on group membership, assignment of network application, and logon assignment.  SYS3175 error for NetUser function with no detail given was fixed. 1.10 1995 12/07 New function added and some bugs fixed:  NetAccess function with 'Query' and 'Delete' verbs was implemented.  Fixed a bug of NetAdmin function when a command displays no outputs.  Fixed a bug of NetAlias function. (Value in stem.i.0server was prefixed by extra two back slashes(\\) if the server is LS v4.0.) 1.00 1995 11/17 Initial release. ═══ 2. Convention on NetUtil functions. ═══ NetUtil functions are grouped in two groups: 1. Netxxxx functions Their names start with Net. They are implementation of NET commands, though not the exact one. Note: Syntax of a Netxxxx function is not the same as that of the corresponding NET command. 2. Lsxxxx functions Their names start with Ls. They offers capabilities that are not provided by NET commands of IBM OS/2 LAN Server products. The first parameter of most Netxxxx functions is a verb such as 'Query'. The verb parameter is case-insensitive. Only the first character of a verb is checked by a function unless described otherwise. So you can use both 'query' and 'QUARK' as a 'Query' verb. Netxxxx function returns a REXX whole number. It is an return code. "0" means successful completion of the function. If it is a negative, it means a syntax and/or semantics error to invoke the function. Positive value is a return code from NET API or OS/2 API. See Return codes from NetUtil functions. Parameters in syntax diagrams of NetUtil functions uses terms defined in Syntactic Variables. In examples of how to use functions, the functions are assumed to have already been registered in REXX. ═══ 2.1. Stem variables set by Query verb ═══ When a function is called with Query verb, stem is specified. After successful completion, the function sets values for some items in REXX compound variables with the stem. For example, the function call: rc = NetAlias('Q','out','*') lists all the aliases defined in a logon domain, and sets REXX variables for the items related to the aliases. Some of them are as follows. out.0 Number of aliases. out.i.0ALIAS Alias name (i=1 to out.0) out.i.0SERVER Server name that defines the alias out.i.0NETNAME Netname for the alias out.i.0PATH Path for the Netname Note that zero("0") is prefixed to each item name. (Such as 0ALIAS) This is an intentional design for usage of stem in NetUtil functions. Suppose if an alias name were designed to be set in out.i.ALIAS, then following REXX SAY statement would not displays a correct alias name if alias variable has been set to a value other than 'ALIAS' explicitly: alias ='*' if NetAlias('Q','out',alias)=0 then /* list all the aliases */ do i=1 to out.0 say out.i.alias /* would say "OUT.1.*" ... */ end The reason is that REXX thinks a symbol alias as a variable , retrieves a value of the variable, and constructs a compound variable for the stem(out.). By prefixing a number such as 0 to alias, REXX thinks that the symbol 0alias is not a variable but a constant 0ALIAS. (Any lowercase letters in a symbol is always uppercased by REXX.) Thus the way makes REXX coding simple and error-free. That's why a zero is prefixed to an item. ═══ 2.2. Flag variable ═══ Among REXX varaibles that are set by NetUtil functions, flag variables name always ends with a question mark(?). Values of the flag variables are set to either "1" or "0". An example is stem.i.0PWREQ? that is set by NetUser function with Query verb. ═══ 2.3. Values returned in stem variable ═══ Values set in REXX compound varialbles of a stem for a function with Query verb may be different from those returned by the NET command which the function simulates. For example, stem.i.0TYPE variable set by NetAlias with Query verb will have 'DISK', 'PRINT', or 'COMM'. Whereas, NET ALIAS command will return 'Files', 'Printer', or 'Comm'. Values of 'DISK', 'PRINT', and 'COMM' are commonly used for type field in other NetUtil functions such as NetUse, NetShare, and NetSess. That's why they are different from those of NET ALIAS command. Computer name, that is, a requester or a server is always prefixed by double back slashes(\\) when it is returned in a REXX variable. ═══ 2.4. Syntax Notation ═══ Syntax diagram for NetUtil functions is the same as what is described in a document "IBM OS/2 Commands and Utilities", and terms in the document is also used. In the syntax diagram for NetUtil functions, some special terms Syntactic Variables are also used. ═══ 2.5. Syntactic Variables ═══ The following variables are used in syntax diagrams for NetUtil functions. ┌─────────┬────────────┬─────────────────────────────────────────────┐ │Variable │Example │Description │ ├─────────┼────────────┼─────────────────────────────────────────────┤ │stem │OUT. │It is a REXX stem. It may be │ │ │Data │case-insensitive. A period is not required, │ │ │data. │but may be specified. │ ├─────────┼────────────┼─────────────────────────────────────────────┤ │dom │LS40DOM │Domain name. See documents of IBM OS/2 LAN │ │ │ │Server as for a valid domain name. │ ├─────────┼────────────┼─────────────────────────────────────────────┤ │req │LS40REQ │Computer name of a Requester. See documents │ │ │ │of IBM OS/2 LAN Server as for a valid │ │ │ │computer name. │ ├─────────┼────────────┼─────────────────────────────────────────────┤ │locReq │MYMACH │Computer name of a local machine where │ │ │ │NetUtil function is executed. │ ├─────────┼────────────┼─────────────────────────────────────────────┤ │srv │LS40SRV │Computer name of the machine where LAN Server│ │ │ │or OS/2 Peer is running. │ ├─────────┼────────────┼─────────────────────────────────────────────┤ │locSrv │LS40SRV │Local server. It is the server where NetUtil │ │ │MY_SRV │function is executed. │ ├─────────┼────────────┼─────────────────────────────────────────────┤ │DC │LS40DCSRV │It is a computer name of a Domain │ │ │ │Controller(DC) in a domain. │ ├─────────┼────────────┼─────────────────────────────────────────────┤ │uid │USERID │An user id. It is username defined in │ │ │ │documents of LAN Server. │ ├─────────┼────────────┼─────────────────────────────────────────────┤ │gid │ADMINS │A group id. It is groupname defined in │ │ │ │documents of LAN Server. │ ├─────────┼────────────┼─────────────────────────────────────────────┤ │detail │ │It specifies a level of information that is │ │ │ │extracted by NetUtil functions with 'Query' │ │ │ │verb. It is an integer. │ ├─────────┼────────────┼─────────────────────────────────────────────┤ │xDom │LS40DOM │It specifies a domain name. If it is a │ │ │ . │dot(.), then a logon domain is used. │ │ │ │ │ │ │ │xDom: │ │ │ │ ├──┬──dom──┬──┤ │ │ │ │ └───.───┘ │ ├─────────┼────────────┼─────────────────────────────────────────────┤ │xReq │\\LS40REQ │It specifies a requester that starts with a │ │ │ . │double back slashes(\\). If it is a dot(.), │ │ │\\MYMACH │then it indicates a local requester. │ │ │ │ │ │ │ │xReq: │ │ │ │ ├──┬──\\req─┬──┤ │ │ │ │ └───.────┘ │ ├─────────┼────────────┼─────────────────────────────────────────────┤ │xSrv │\\LS40SRV │It specifies a server that starts with a │ │ │\\LS40DCSRV │double back slashes(\\). When it does not │ │ │LS40DOM │start with a back slash(\), it should be xDom│ │ │ . │. In this context, xDom actually represents a│ │ │ │DC of the domain xDom. │ │ │ │ │ │ │ │ xSrv: │ │ │ │ ├──┬──\\srv──┬──┤ │ │ │ │ └───xDom──┘ │ ├─────────┼────────────┼─────────────────────────────────────────────┤ │UNC │\\SRV\TOOLS │Shared resource name in such a format as \\ │ │ │ │srv\netname. │ │ │ │ │ │ │ │ UNC: │ │ │ │ ├──\\srv\netname──┤ │ ├─────────┼────────────┼─────────────────────────────────────────────┤ │res │D: │Resource name for drive, directory, filename,│ │ │D:\IBMLAN │pipe, printer, or serial device. │ │ │\PIPE │ │ │ │ │ res: │ │ │ │ ├─┬─drive:──────────────────┬─┤ │ │ │ │ ├─drive:pathname──────────┤ │ │ │ │ ├─drive:pathname\filename─┤ │ │ │ │ ├─\PIPE\pipename──────────┤ │ │ │ │ ├─\PRINT\queuename────────┤ │ │ │ │ └─\COMM\chardevqueuename──┘ │ └─────────┴────────────┴─────────────────────────────────────────────┘ ═══ locReq ═══ Computer name of a local machine where NetUtil function is executed. ═══ locSrv ═══ Local server. It is the server where NetUtil function is executed. ═══ uid ═══ An user id. It is username defined in documents of LAN Server. ═══ gid ═══ A group id. It is groupname defined in documents of LAN Server. ═══ xDom ═══ It specifies a domain name. If it is a dot(.), then a logon domain is used. xDom: ├──┬──dom──┬──┤ └───.───┘ ═══ xReq ═══ It specifies a requester that starts with a double back slashes(\\). If it is a dot(.), then it indicates a local requester. xReq: ├──┬──\\req─┬──┤ └───.────┘ ═══ xSrv ═══ It specifies a server that starts with a double back slashes(\\). When it does not start with a back slash(\), it should be xDom. In this context, xDom actually represents a DC of the domain xDom. xSrv: ├──┬──\\srv──┬──┤ └───xDom──┘ ═══ UNC ═══ Shared resource name in such a format as \\srv\netname. UNC: ├──\\srv\netname──┤ ═══ res ═══ Resource name for drive, directory, filename, pipe, printer, or serial device. res: ├─┬─drive:──────────────────┬─┤ ├─drive:pathname──────────┤ ├─drive:pathname\filename─┤ ├─\PIPE\pipename──────────┤ ├─\PRINT\queuename────────┤ └─\COMM\chardevqueuename──┘ ═══ 3. LsLoadFuncs ═══ Syntax: ┌─────────────────────────────────┐ │ │ │ ──LsLoadFuncs()── │ │ │ └─────────────────────────────────┘ Syntax Description: No parameters are required. Operation: This function registers all the functions in NetUtil.DLL to REXX. Variables to be set: None. Returned string: None. ═══ 4. LsDropFuncs ═══ Syntax: ┌─────────────────────────────────┐ │ │ │ ──LsDropFuncs()── │ │ │ └─────────────────────────────────┘ Operation: This function registers all the functions in NetUtil.DLL to REXX. Variables to be set: None. Returned string: None. ═══ 5. LsUtilVer ═══ Syntax: ┌─────────────────────────────────┐ │ │ │ ──LsUtilVer()──── │ │ │ └─────────────────────────────────┘ Operation: This function returns version number of NetUtil.DLL. Variables to be set: None. Returned string: Version number in such format as "1.02". ═══ 6. LsMyInfo ═══ Syntax: ┌─────────────────────────────────┐ │ │ │ ──LsMyInfo()──── │ │ │ └─────────────────────────────────┘ Operation: This function queries information of the caller, and returns a return code, an user id, a flag to indicate ADMIN user id or not, a computer name, a logon domain name, and the DC of the domain. If some of the values is unknown, a question mark(?) is assigned to the values as a place holder. Returned string: rc uid admin? \\locReq domain \\DCserver Note: If uid is an ADMIN user id, admin? is '1'. Otherwise, it is '0'. Required Privilege: GUEST, USER or ADMIN Examples: Here are examples. ═══ Examples of LsMyInfo function ═══ Example: /* Example */ parse value LsMyInfo() with rc uid admin? mach dom dc . if rc=0 then do say 'My user id is' uid if admin? then say 'It is an ADMIN user id.' say 'My machine with back slashes(\\) is' mach say 'Logon domain name is' dom say 'DC name with back slashes(\\) is' dc end Exit ═══ 7. LsDCname ═══ Syntax: ┌────────────────────────────────────┐ │ │ │ ┌───.────┐ │ │ ─LsDCname(──┼────────┼────)─ │ │ └──xDom──┘ │ │ │ └────────────────────────────────────┘ Operation: This function queries DC of a domain specified by xDom Default is a logon domain. It returns a return code and DC with double back slashes(\\) prefixed. Returned string: rc \\DCsrv Required Privilege: GUEST, USER or ADMIN ═══ 8. LsLogonUser ═══ Syntax: ┌───────────────────────────────────────────────────────────┐ │ │ │ ┌─\\locSrv─┐ │ │ ─LsLogonUser(─stem─,─┼──────────┼─,─┬────────┬─)─ │ │ ├───xDom───┤ └─detail─┘ │ │ └──\\srv───┘ │ │ │ └───────────────────────────────────────────────────────────┘ Operation: This function queries users who logged on to a domain which is specified by xDom or to a domain which a server srv belongs to. If xDom or \\srv is omitted, the default is a local server. The information is set in REXX compound variables with the stem stem. Detail information is obtained when detail is set to 1. Note: This function is similar to NET WHO command, but not the same. NET WHO also lists users who have logged on to other domains but have session(s) with servers in xDom or with srv. (The session may have been established by NET USE command or others.) Variables to be set: stem.0 Number of indexes for stem (i=1 to stem.0 for variables below) stem.i.0UID An user id stem.i.0USERCOMMENT User comment stem.i.0FULLNAME Full name stem.i.0COMPUTER (*1) Computer name of the user stem.i.0LOGONTIME (*1) Date when the user logged on (*2) Note: (*1) These variables are only set when detail is set to 1. (*2) Date format is YYYY MM/DD hh:mm:ss. Returned string: rc Required Privilege: GUEST, USER or ADMIN Examples: Here are examples. ═══ Examples of LsLogonUser function ═══ In the examples below, example of returned value is enclosed in left and right parentheses in a comment area for a variable. Example 1: List all the users who logged on to the domain that the caller logged on to. /* Example 1 */ retc = LsLogonUser('Q','out','.') if retc = 0 then do i=1 to out.0 say out.i.0uid /* ('MYADMIN') */ say out.i.0Computer /* ('\\MYAPTIVA') */ say out.i.0UserComment /* ('The Admin uid') */ say out.i.0Fullname end Exit Example 2: List all the users who logged on to the domain LS40DOM. /* Example 2 */ retc = LsLogonUser('Q','out','ls40dom',1) if retc = 0 then do i=1 to out.0 say out.i.0uid 'logged on to LS40DOM from the machine', out.i.0computer 'on' out.i.0logontime'.' end Exit ═══ 9. LsConnection ═══ Syntax: ┌───────────────────────────────────────────────────────────┐ │ │ │ ┌─\\locSrv─┐ ┌─\\locReq─┐ │ │ ─LsConnection(─stem─,─┼──────────┼─,─┼──────────┼─)── │ │ └───xSrv───┘ ├───xReq───┤ │ │ └─netname──┘ │ │ │ └───────────────────────────────────────────────────────────┘ Operation: When a requester xReq is specified, this function lists all connections between a server xSrv and the requester xReq. If xReq is not specified, the default is the caller's machine. When a shared resource netname is specified, this function lists all connections between a server xSrv and the shared resource xReq of the server. If xSrv is not specified, default is a local server. The connection information is set in compound variables with the stem stem. Variables to be set: stem.0 Number of indexes for stem (i=1 to stem.0 for variables below) stem.i.0UID An user id who has connection with the server. stem.i.0COMPUTER Computer name of the user (*1) stem.i.0NETNAME Network name of the server's shared resource. (*2) stem.i.0CONNTYPE Connection type (*3) stem.i.0CONNTIME Connection time (in sec) stem.i.0CONNOPENS Number of open files on the connection stem.i.0CONNUSERS Number of users on the connection (= 0 or 1) Note: (*1) Value is the same as xReq including case of letters when xReq is specified in the function. (*2) Value is the same as netname including case of letters when netname is specified in the function. (*3) Value is 'DISK', 'PRINT', 'COMM', or 'IPC'. Returned string: rc Required Privilege: ADMIN Examples: Here are examples. ═══ Examples for LsConnection ═══ In the examples below, we assume that: 1. Server LS40SRV has shared resource \\LS40SRV\OS2TOOLS. 2. The caller has issued NET USE for \\LS40SRV\OS2TOOLS. 3. The caller's machine and user id is \\LS40REQ and MYADM, respectively. Note: Example of returned value is enclosed in left and right parentheses in a comment area for a variable. Example 1: Lists all connections with shared resource \\LS40SRV\OS2TOOLS. /* Example 1 */ retc = LsConnection('out','\\LS40SRV','os2Tools') if retc = 0 then do do i=1 to out.0 /* here is i-th user that has connection with \\LS40SRV\OS2TOOLS. */ say out.i.0uid /* ('MYADM') */ say out.i.0computer /* ('\\LS40REQ') */ say out.i.0netname /* ('os2Tools') */ say out.i.0conntype /* ('DISK') */ end end Exit retc Example 2: Lists all connections between LS40SRV and the caller. /* Example 2 */ retc = LsConnection('out','\\LS40SRV','\\Ls40Req') if retc = 0 then do do i=1 to out.0 /* here is i-th shared resource of LS40SRV. */ say out.i.0uid /* ='MYADM' */ say out.i.0computer /* ='\\Ls40Req' */ say out.i.0netname /* ('OS2TOOLS') */ say out.i.0conntype /* ('DISK') */ end end Exit retc ═══ 10. LsServer ═══ LsServer function supports for two verbs:  Disk  Query ═══ 10.1. LsServer with Disk verb ═══ Syntax: ┌────────────────────────────────────────┐ │ │ │ ┌─\\locReq─┐ │ │ ─LsServer('D',─┼──────────┼───)─── │ │ └───xSrv───┘ │ │ │ └────────────────────────────────────────┘ Operation: This function gets a list of local drives of a specified server xSrv. If there is no xSrv specified, it is a local machine. A return code followed by the list is returned from this function. Variables to be set: None. Returned string: rc drive_list Required Privilege: GUEST, USER or ADMIN Examples: Here are examples. ═══ Examples for LsServer with Disk verb ═══ In the examples below, example of returned value is enclosed in left and right parentheses in a comment area for a variable. Example 1: Get a list of local drives of the caller's machine. /* Example 1 */ parse value LsServer('D') with retc drvlist if retc = 0 then do say drvlist /* ('C: D:') */ end Exit Example 2: Get a list of local drives of DC of a logon domain. /* Example 2 */ parse value LsServer('D','.') with retc drvlist if retc = 0 then do say drvlist /* ('C: D: E:') */ end Exit Example 3: Get a list of local drives of DC of domain LS40DOM. /* Example 3 */ parse value LsServer('D','ls40dom') with retc drvlist if retc = 0 then do say drvlist /* ('C: D: E: F: G:') */ end Exit Example 4: Get a list of local drives of a server \\LS40SRV. /* Example 4 */ parse value LsServer('D','ls40srv') with retc drvlist if retc = 0 then do say drvlist /* ('C: D: E: F: G: H: I:') */ end Exit ═══ 10.2. LsServer with Query verb ═══ Syntax: ┌─────────────────────────────────────────────────────────────────┐ │ (1) │ │ ┌──.───┐ ┌────*─────┐ ┌─defM─┐ │ │ ─LsServer('Q',─stem─,─┼──────┼─,─┼──────────┼─,─┼──────┼─)─ │ │ ├─xDom─┤ ├─srvtypes─┤ └─xReq─┘ │ │ └──*───┘ └────*─────┘ │ │ │ │ ┌───────┐ │ │ srvtypes:  │ │ │ ├───┬─────┬┴──┤ │ │ ├──D──┤ │ │ ├──B──┤ │ │ ├──S──┤ │ │ ├──Q──┤ │ │ └──T──┘ │ │ │ │ Note: (1) defM depends on xDom. See Operation for detail. │ └─────────────────────────────────────────────────────────────────┘ Operation: This function lists and gets information on active servers of given types in a domain xDom or in domains that a requester xReq is monitoring. Note: In general, a requester machine monitors a default domain, logon domain, and domains that are specified by OTHDOMAINS line in IBMLAN.INI or by /OTHDOMAINS parameter on NET START REQUESTER command. When xDom is a dot(.), the caller's logon domain is used. When it is an asterisk(*), servers in all the domains that the requester xReq is monitoring are listed. When xReq is a dot(.), it indicates the local machine. If xReq starts with double back slashes(\\), it must be the local machine, or a server which the caller can access to. If xReq is not specified, defM is decided by xDom as follows;  If xDom is either an asterisk(*) or a dot(.), or is not specified, defM is a local machine.  Otherwise, defM is a DC of the domain xDom. Note that OS/2 Peer machines will be included on the list if the OS/2 Peer machines are logged on to the domain. Information on alias(es) is set in compound variables with the stem stem. Variables to be set: stem.0 Number of indexes for stem (i=1 to stem.0 for variables below) stem.i.0SERVER Server name stem.i.0REMARK Comment stem.i.0VERMAJOR Major version of LAN Server on the server stem.i.0VERMINOR Minor version of LAN Server on the server stem.i.0PEER? Peer server flag ("1" or "0") stem.i.0HEXTYPE Server type in HEX representation (*1) stem.i.0TYPELIST A list of server types. (*2) Note: (*1) Value is a hexadecimal string of sv1_type field of server_info_1 data structure of NetServerEnum2 API. See a document of NET API for detail. (*2) Value would be 'REQUESTER', 'SERVER', 'DC', 'BACKUP', 'SQL', 'TIMESRV', or a list of some of them. This value is an human-readable representation of the one in (*1). Returned string: rc Required Privilege: GUEST, USER or ADMIN Examples: Here are examples. ═══ Examples for LsServer with Query verb ═══ In the examples below, example of returned value is enclosed in left and right parentheses in a comment area for a variable. Example 1: List all the active servers in a logon domain. /* Example 1 */ retc = LsServer('Q','out') if retc = 0 then do i=1 to out.0 say out.i.0server /* server name: (\\LS40DCSRV) */ say out.i.0remark /* comments */ say out.i.0VerMajor /* major version: ('4') */ say out.i.0VerMinor /* major version: ('0') */ say out.i.0peer? /* peer server? : ('0') */ say out.i.0TypeList /* Types: ('REQUESTER SERVER DC') */ end Exit Note: Even if you have not yet logged on to a domain, this example works. In that case, all the active servers in the primary domain and other domains that you might have specified are listed. Example 2: List all the active Backup servers or DC in the domain LS40DOM. /* Example 2 */ retc = LsServer('Q','out','LS40DOM','DB') if retc = 0 then do i=1 to out.0 say out.i.0server /* server name: ('\\LS40SRV') */ say out.i.0remark /* comments */ say out.i.0VerMajor /* major version: ('4') */ say out.i.0VerMinor /* major version: ('0') */ say out.i.0peer? /* peer server? : ('0') */ say out.i.0TypeList /* Types: ('REQUESTER SERVER BACKUP') */ end Exit ═══ 11. NetAccess ═══ NetAccess function simulates NET ACCESS command. Note: The current version of NetUtil.DLL supports for 'Query' verb and 'Delete' verb. ═══ 11.1. NetAccess with Query verb ═══ Syntax: ┌─────────────────────────────────────────────────────────────────┐ │ │ │ ┌─\\locSrv─┐ ┌───*───┐ │ │ ─NetAccess('Q',─stem─,─┼──────────┼─,─┼───────┼─,─┬────┬─)─ │ │ └───xSrv───┘ ├─xRes──┤ └tree┘ │ │ ├─alias─┤ │ │ └───*───┘ │ │ xRes: │ │ ├───res──┬───┬──┤ │ │ └─*─┘ │ │ │ │ tree = 1 │ │ │ └─────────────────────────────────────────────────────────────────┘ Operation: This function gets access control profiles(ACP) with associated permissions of resource xRes of a server xSrv. If xSrv is omitted, it is a local server. If xRes is not specified, but an alias name alias is specified, it gets ACPs with associated permissions of resource for the alias defined in a domain that the server xSrv belongs to. If res is followed by an asterisk(*), it specifies all the resources that starts with res. For example, if there are C:\IBMCOM and C:\IBMLAN directories, 'C:\IBM*' specifies both C:\IBMCOM and C:\IBMLAN directories. If xRes or alias is omitted, or an asterisk(*) is specified, the function gets ACPs with associated permissions for all the resources of drives, pipes, printers, and serial devices of the server xSrv. If tree of 1 is specified, then the function gets ACPs with associated permissions for the specified resource and all its subdirectories. Information of the ACPs with associated permissions is set in compound variables with the stem stem. This function returns a return code(rc) of "0", even if there is no ACPs for the specified resource. If the function returns rc of "234", it means that LAN Server API could not return all of ACPs so that the compound variables hold only part of them. Variables to be set: stem.0 Number of indexes for stem (i=1 to stem.0 for variables below) stem.0 Number of indexes for stem. stem.i.0PATH Path of the resource stem.i.0SUCCESS Audit Success (*1) stem.i.0FAILURE Audit Failure (*1) (j=1 to stem.i.0 for variables below) stem.i.0 Number of indexes for stem.i. stem.i.j.0UGNAME User ID or Group ID stem.i.j.0GRP? A flag to indicate Group ID. stem.i.j.0ACCESS Access permissions (*2) Note: (*1) Value is 'ALL', 'NONE', or any combinations of 'OPEN', 'WRITE', 'DELETE', or 'ACL' with separated each other by a blank. (*2) Value is 'N' or any combinations of 'R', 'W', 'C', 'X', 'D', 'A', or 'P' without blanks between them. Returned string: rc Required Privilege: GUEST, USER, or ADMIN If the caller has not ADMIN privilege, the function only gets ACPs with Permission access right given to the caller or groups that the caller belongs to. Examples: Here are examples. ═══ Examples for NetAccess with Query verb ═══ In the examples below, example of returned value is enclosed in left and right parentheses in a comment area for a variable. Example 1: List ACPs of directory resource d:\TOOLS and its subdirectories of a server LS40SRV. (It is assumed that the caller has ADMIN privilege.) /* Example 1 */ retc = NetAccess('Q','out','\\ls40srv','d:\tools',1) if retc = 0 | retc = 234 then do i=1 to out.0 say out.i.0path /* ('D:\TOOLS\OS2') */ say out.i.0success /* ('NONE') */ say out.i.0failure /* ('OPEN WRITE') */ do j=1 to out.i.0 say out.i.0ugname /* ('USERS') */ say out.i.0grp? /* ('1') */ say out.i.0access /* ('RX') */ end end Exit Example 2: List ACPs of directory resources that start with 'd:\IBM' of a DC of a domain LS40DOM. (It is assumed that the caller has ADMIN privilege.) /* Example 2 */ retc = NetAccess('Q','out','ls40dom','d:\ibm*',1) if retc = 0 | retc = 234 then do i=1 to out.0 say out.i.0path /* ('D:\IBMAV2') */ say out.i.0success /* ('OPEN WRITE DELETE') */ say out.i.0failure /* ('ALL') */ do j=1 to out.i.0 say out.i.0ugname /* ('HACKER') */ say out.i.0grp? /* ('0') */ say out.i.0access /* ('N') */ end end Exit ═══ 11.2. NetAccess with Delete verb ═══ Syntax: ┌───────────────────────────────────────────────────────────────────┐ │ │ │ ┌─\\locSrv─┐ │ │ ─NetAccess('D',─┬────┬─,─┼──────────┼─,─┬─xRes──┬─,─┬────┬─)─ │ │ └stem┘ └───xSrv───┘ ├─alias─┤ └tree┘ │ │ └───*───┘ │ │ │ │ xRes: │ │ ├──res─┬───┬──┤ │ │ └─*─┘ │ │ │ │ tree = 1 │ │ │ └───────────────────────────────────────────────────────────────────┘ Operation: This function deletes access control profiles(ACP) with associated permissions of resource xRes of a server xSrv. If xSrv is omitted, it is a local server. If xRes is not specified, but an alias name alias is specified, it deletes ACPs with associated permissions of resource for the alias defined in a domain that the server xSrv belongs to. If res is followed by an asterisk(*), it specifies all the resources that starts with res. For example, if there are C:\IBMCOM and C:\IBMLAN directories, 'C:\IBM*' specifies both C:\IBMCOM and C:\IBMLAN directories. If an asterisk(*) is specified instead of xRes or alias, the function deletes ACPs with associated permissions for all the resources of drives, pipes, printers, and serial devices of the server xSrv. If tree of 1 is specified, then the function deletes ACPs with associated permissions for the specified resource and all its subdirectories. Information of deleted ACPs with associated permissions is set in compound variables with the stem stem if it is specified. When stem is omitted, performance of the function increases because there is no overhead to set REXX variables. This function returns a return code(rc) of "0", even if there is no ACPs for the specified resource. Variables to be set: (The same as in 'Query' verb if stem is specified.) Returned string: rc Required Privilege: ADMIN Examples: Here are examples. ═══ Examples for NetAccess with Delete verb ═══ In the examples below, example of returned value is enclosed in left and right parentheses in a comment area for a variable. Example 1: Delete ACPs of directory resource E:\ and its subdirectories of a server LS40SRV. /* Example 1 */ retc = NetAccess('Delete','out','\\ls40srv','E:\',1) if retc = 0 then do i=1 to out.0 say 'ACP of' out.i.0path 'deleted.' end Exit Example 2: Delete ACPs of all the resources that are defined in a DC of a domain LS40DOM. (This example is too dangerous!!) /* Example 2 */ dom = 'ls40dom' retc = NetAccess('D',,dom','*',1) /* no stem */ if retc = 0 then say 'Deleted ACPs of all the resources defined in DC of' dom Exit ═══ 12. NetAccounts ═══ NetAccounts function simulates NET ACCOUNTS command. Note: The current version of NetUtil.DLL only supports for 'Query' verb. ═══ 12.1. NetAccounts with Query verb ═══ Syntax: ┌───────────────────────────────────────────────────────────┐ │ │ │ ┌─\\locReq─┐ │ │ ─NetAccounts('Q',─stem─,─┼──────────┼─,─┬────────┬─)─ │ │ └───xSrv───┘ └─detail─┘ │ │ │ │ │ │ detail = 1 │ │ │ └───────────────────────────────────────────────────────────┘ Operation: This function gets global information on an User Account Database that is maintained in a server xSrv. If xSrv is omitted, it is a local machine. Note that the local machine may be a Requester or Peer machine. In this case the information is retrieved from a local User Account Database. The information is set in compound variables with the stem stem. Detail information is obtained when detail is set to 1. In this case the caller should have ADMIN privilege for a server xSrv. Variables to be set: stem.0PWHISTLEN Length of password history stem.0MINPWLEN Minimum password length stem.0MINPWDAYS Minimum password age (days) stem.0MAXPWDAYS Maximum password age (days) (*2) stem.0FORCEOFFTIME Time(in sec) after which an user is forced off (*2) stem.0SRVROLE (*1) Role of the server xSrv stem.0DCSRV (*1) DC of a domain that the server xSrv belongs to (*3) Note: (*1) These variables are only set when detail is set to 1 and the caller has an ADMIN privilege. (*2) An asterisk(*) will be returned if there is no limitation. (*3) If xSrv is not specified, the value is a null string. Returned string: rc Required Privilege: GUEST, USER, or ADMIN Examples: Here are examples. ═══ Examples for NetAccounts with Query verb ═══ Example of returned value is enclosed in left and right parentheses in a comment area. Example 1: List global account information of the logon domain. /* Example 1 */ /* The caller's privilege may be USER or GUEST */ retc = NetAccounts('Q','out','.') if retc = 0 then say out.0MinPwLen /* ('4') */ say out.0MaxPwDays /* ('*') */ say out.0MinPwDays /* ('0') */ say out.0ForceOffTime /* ('*') */ say out.0PwHistLen /* ('8') */ Exit In the example below, it is assumed that the caller has ADMIN privilege. Example 2: List global account information of the server LS40SRV. /* Example 2 */ retc = NetAccounts('Q','out','\\ls40srv',1) if retc = 0 then say out.0MinPwLen /* ('4') */ say out.0MaxPwDays /* ('*') */ say out.0MinPwDays /* ('0') */ say out.0ForceOffTime /* ('*') */ say out.0PwHistLen /* ('8') */ say out.0SrvRole /* ('MEMBER') */ say out.0DCsrv /* ('\\LS40DCSRV') */ Exit ═══ 13. NetAdmin ═══ NetAdmin function simulates NET ADMIN command. ═══ 13.1. NetAdmin function ═══ Syntax: ┌───────────────────────────────────────────────────┐ │ │ │ ┌──.───┐ │ │ ─NetAdmin(──stem──,─┼──────┼─,──command──)── │ │ └─xSrv─┘ │ │ │ └───────────────────────────────────────────────────┘ Operation: This function executes a command command on a server xSrv. If xSrv is omitted or a dot(.), it is DC of a logon domain. Outputs from command are set in array variables for stem stem. Return code from command is set in REXX's reserved variable RC. NetAdmin function returns a return code from a NET API function itself or the one set by NetAdmin function's internal logic. Variables to be set: RC Return code from command. stem.0 Number of indexes for stem (i=1 to stem.0 for variables below) stem.i i-th outputs from executed command command. Returned string: rc Required Privilege: ADMIN Examples: Here are examples. ═══ Examples for NetAdmin ═══ Example 1: Execute TYPE command on a DC of logon domain /* Example 1 */ retc = NetAdmin('out',,'TYPE c:\config.sys') if rc=0 & retc = 0 then do i=1 to out.0 say out.i /* contents of CONFIG.SYS file */ end Exit Example 2: Execute NET USE command on a DC of LS40DOM /* Example 2 */ retc = NetAdmin('out','LS40DOM,'net use') if rc=0 & retc = 0 then do i=1 to out.0 say out.i /* outputs from NET USE */ end Exit ═══ 14. NetAlias ═══ NetAlias function simulates NET ALIAS command. Note: The current version of NetUtil.DLL only supports for 'Query' verb. ═══ 14.1. NetAlias with Query verb ═══ Syntax: ┌───────────────────────────────────────────────────────────┐ │ │ │ ┌──.───┐ │ │ ─NetAlias('Q',─stem─,─xAlias─,─┼──────┼─,─┬──────┬─)─ │ │ ├─xDom─┤ └detail┘ │ │ └\\srv─┘ │ │ │ │ ┌───────┐ │ │ xAlias: ┌───────*────────┐ alitypes:  │ │ │ ├─┼────────────────┼─┤ ├───┬───┬─┴─┤ │ │ ├─────alias──────┤ ├─D─┤ │ │ └─*─┬──────────┬─┘ ├─P─┤ │ │ └─alitypes─┘ └─C─┘ │ │ │ │ detail = 1 │ │ │ └───────────────────────────────────────────────────────────┘ Operation: This function gets information on an alias xAlias that is defined in a domain xDom or in a domain that a server srv belongs to. If \\srv is specified, the server srv must be a DC or a Backup DC. Otherwise, this function will return "2795". If there is no xDom or \\srv specified, the default is a logon domain. If xAlias is an asterisk(*), then information on all the aliases defined in the domain is retrieved. If valid alitypes follows the asterisk, then information on the aliases which types meet alitypes is retrieved. Valid alitypes is 'D' for directory alias, 'P' or printer alias, 'C' for serial device alias, or any combinations of the three characters. Invalid character is treated as if an asterisk is given. Information on alias(es) is set in compound variables with the stem stem. Detail information is obtained when detail is set to 1. Variables to be set: stem.0 Number of indexes for stem (i=1 to stem.0 for variables below) stem.i.0ALIAS Alias name stem.i.0REMARK Remark stem.i.0TYPE Type. (= DISK, PRINT, or COMM) (*2) stem.i.0SERVER (*1) Server name that defines the alias stem.i.0NETNAME (*1) Netname of the alias stem.i.0PATH (*1) Path spec of the alias stem.i.0WHEN (*1) When Shared. (= STARTUP, ADMIN, or REQUESTED) (*2) stem.i.0MAXUSERS(*1) Max number of users (*3) stem.i.0QUEUE (*1) Print/serial queue stem.i.0PRIORITY(*1) Serial only: priority stem.i.0DEVPOOL (*1) Serial only: device pool stem.i.0LOCATION(*1) Location Note: (*1) These variables are only set when detail is set to 1. (*2) Values of alias type are different from what are returned by NET ALIAS command. (*3) An asterisk(*) is set for 'No limit' of NET ALIAS command. Returned string: rc Required Privilege: GUEST, USER, or ADMIN Examples: Here are examples. ═══ Examples for NetAlias with Query verb ═══ Example 1: List all aliases defined in a logon domain. /* Example 1 */ retc = NetAlias('Q','out') if retc = 0 then do i=1 to out.0 say out.i.0alias /* alias name */ say out.i.0type /* alias type */ say out.i.0remark /* comments */ end Exit Example 2: List all printer aliases defined in a domain LS40DOM. /* Example 2 */ /* Example of returned value is enclosed in left and right parentheses in a comment area. */ retc = NetAlias('Q','out','*p','LS40DOM',1) if retc = 0 then do i=1 to out.0 say out.i.0alias /* alias name */ say out.i.0type /* alias type: 'PRINT' */ say out.i.0remark /* comments */ say out.i.0server /* server: ('\\LS40DCSRV') */ say out.i.0netname /* netname: ('4216-510') */ say out.i.0when /* When Shared: ('STARTUP') */ say out.i.0maxusers /* Max Users: ('*') */ say out.i.0queue /* Queue: ('4216-510') */ end Exit ═══ 15. NetApp ═══ NetApp function simulates NET APP command. Note: The current version of NetUtil.DLL only supports for 'Query' verb. ═══ 15.1. NetApp with Query verb ═══ Syntax: ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ ┌───.───┐ │ │ ──NetApp('Q',─stem─,─xApp─,─┬─────┬─,─┼───────┼─,─┬────────┬─)─ │ │ ├─uid─┤ ├─xDom──┤ └─detail─┘ │ │ └──.──┘ └─\\srv─┘ │ │ │ │ xApp: apptypes: ┌───────┐ │ │ ┌───────*────────┐  │ │ │ ├──┼────────────────┼──┤ ├───┬───┬─┴─┤ │ │ ├───────app──────┤ ├─O─┤ │ │ └─*─┬──────────┬─┘ └─D─┘ │ │ └─apptypes─┘ │ │ │ │ detail = 1 │ │ │ └─────────────────────────────────────────────────────────────────────┘ Operation: This function gets information on a public or a private application xApp defined in a domain xDom or in a domain that a server srv belongs to. If \\srv is specified, the server srv must be a DC or a Backup DC. Otherwise, this function will return "2795". If there is no xDom or \\srv specified, the default is a logon domain. If uid is given, the application is a private application to the user uid. Otherwise, it is a public application. If xApp is not specified or an asterisk(*) is specified, the function gets information on all the applications. (The applications are either public or private.) If xApp is an asterisk(*) followed by 'O' or 'D', information on OS/2 applications or DOS applications is obtained, respectively. Information on the application(s) is set in REXX compound variables with the stem stem. Detail information is obtained when detail is set to 1. Variables to be set: stem.0 Number of indexes for stem (i=1 to stem.0 for variables below) stem.i.0APP Application id stem.i.0REMARK Remark stem.i.0TYPE Application type (Either "OS/2" or "DOS") stem.i.0PUBLIC? Indicates the application is public. stem.i.0COMMAND (*1) Command and its parameter to invoke the application stem.i.0APPDIR (*1) Application directory (*2) stem.i.0APPDRIVE (*1) Local drive used for the application (*3) stem.i.0WRKDIR (*1) Application work directory (*2) stem.i.0WRKDRIVE (*1) Local drive used as work area for the application. (*3) stem.i.0PROMPT? (*1) Indicates a prompt at start up of the application stem.i.0INTERFACE (*1) Interface that the application uses. (*4) stem.i.0 (*1) Number of resources required by the application. (j=1 to stem.i.0 for variables below) stem.i.j.0ALIAS (*1) Alias of the resource stem.i.j.0LOCAL (*1) Local drive assigned to the alias (*3) Note: (*1) These variables are only set when detail is set to 1. (*2) Format of value is the same as what is used for /APPDIR and /WRKDIR options of NET APP command. (*3) Format of value is the same as what is used for /APPDRIVE and /WRKDRIVE options of NET APP command. (*4) Value is the same as what is used for /INTERFACE options of NET APP command. Returned string: rc Required Privilege: GUEST, USER, or ADMIN Users without ADMIN privilege can access information on all the public applications and all the private applications of their own, but cannot access to the one on private applications of others. Examples: Here are examples. ═══ Examples for NetApp with Query verb ═══ In the examples below, example of returned value is enclosed in left and right parentheses in a comment area for a variable. Example 1: List all the public applications defined in a logon domain. /* Example 1 */ dom ='.' retc = NetApp('Q','out',,dom) if retc = 0 then do i=1 to out.0 say out.i.0app /* application id ('CMVCINST') */ say out.i.0type /* alias type ('CMVCINST') */ say out.i.0remark /* comments */ say out.i.0public? /* Public App? ('0') */ say out.i.0command /* command string ('instlall /r:cmvcos2.rsp') */ say out.i.0AppDir /* Appl Dir ('CMVC\INSTALL') */ say out.i.0AppDrive /* Appl Drive ('*') */ say out.i.0WrkDir /* Appl work Dir ('CMVC\INSTALL') */ say out.i.0WrkDrive /* Appl work Drive ('*') */ say out.i.0prompt? /* prompt? ('0') */ say out.i.0interface? /* I/F ('PM') */ end Exit Example 2: List all the private applications defined in a logon domain. /* Example 2 */ myuid = 'HORI' retc = NetApp('Q','out',myuid) if retc = 0 then do i=1 to out.0 say out.i.0app /* application id ('KLONDIKE') */ say out.i.0type /* alias type ('OS/2') */ say out.i.0remark /* comments */ say out.i.0public? /* Public App? ('1') */ say out.i.0command /* command string ('klondike') */ say out.i.0AppDir /* Appl Dir ('OS2APPS') */ say out.i.0AppDrive /* Appl Drive ('Z:') */ say out.i.0WrkDir /* Appl work Dir ('C:\OS2\APPS') */ say out.i.0WrkDrive /* Appl work Drive ('') */ say out.i.0prompt? /* prompt? ('0') */ say out.i.0interface? /* I/F ('PM') */ end Exit ═══ 16. NetGroup ═══ NetGroup function simulates NET GROUP command. Note: The current version of NetUtil.DLL only supports for 'Query' verb. ═══ 16.1. NetGroup with Query verb ═══ Syntax: ┌───────────────────────────────────────────────────────────────┐ │ │ │ ┌\\locReq─┐ ┌──*──┐ │ │ ─NetGroup('Q',─stem─,─┼─────────┼─,─┼─────┼─,─┬──────┬─)─ │ │ └──xSrv───┘ ├─gid─┤ └detail┘ │ │ └──*──┘ │ │ │ │ detail = 1 │ │ │ └───────────────────────────────────────────────────────────────┘ Operation: This function gets information on a group gid that is defined in a server xSrv. If xSrv is omitted, it is a local machine. Note that the local machine may be a Requester or Peer machine. In this case the information is retrieved from a local User Account Database. If gid is an asterisk(*) or is not specified, then information on all the groups defined in the domain is retrieved. To get information on special groups(USERS, ADMINS, and GUESTS), the caller needs to have ADMIN privilege. Information on group(s) is set in compound variables with the stem stem. Detail information is obtained when detail is set to 1. Variables to be set: stem.0 Number of indexes for stem (i=1 to stem.0 for variables below) stem.i.0GID Group ID (Group name) (*3) stem.i.0REMARK (*1) Comment stem.i.0 (*2) Number of indexes for stem.i.j (*4) (j=1 to stem.i.0 for variables below) stem.i.j (*2) An user id that belongs to the group. Note: (*1) This variable is only set if the caller's privilege is ADMIN. (*2) These variables are only set when detail is set to 1. (*3) Value is the same as gid including case of letters when gid other than an asterisk(*) is specified in the function. (*4) If the caller's privilege is ADMIN, or the caller belongs to the group except special groups(USERS, LOCAL, ADMINS, and so on), number of users in the group is set in this variable. Otherwise, the error code that is set by NET API internally is negated and set in this variable. For example, if stem.i.0 is "-5", it means "Access Denied". Returned string: rc Required Privilege: GUEST, USER, or ADMIN Examples: Here are examples. ═══ Examples for NetGroup with Query verb ═══ Example 1: List group ids defined in a logon domain. /* Example 1 */ /* The caller's privilege may be USER or GUEST */ retc = NetGroup('Q','out','.') if retc = 0 then do i=1 to out.0 say out.i.0gid /* group id */ end Exit In examples below, it is assumed that the caller has ADMIN privilege. Example 2: List group ids defined in a server \\LS40SRV. /* Example 2 */ retc = NetGroup('Q','out','\\LS40SRV','*',1) if retc = 0 then do i=1 to out.0 say out.i.0gid /* group id */ say out.i.0remark /* comment */ do j=1 to out.i.0 say out.i.j /* user id in this group */ end end Exit Example 3: List user ids in ADMINS group in a logon domain. /* Example 3 */ retc = NetGroup('Q','out','.','admins',1) if retc = 0 then do say out.1.0gid /* group id: ADMINS */ say out.1.0remark /* comment */ do j=1 to out.1.0 say out.1.j /* user id of ADMIN privilege */ end end Exit ═══ 17. NetSess ═══ NetSess function simulates NET SESSION command. Note: The current version of NetUtil.DLL only supports for 'Query' verb. ═══ 17.1. NetSess with Query verb ═══ Syntax: ┌───────────────────────────────────────────────────────────────────┐ │ │ │ ┌─\\locSrv─┐ ┌──*───┐ │ │ ─NetSess('Q',─stem─,─┼──────────┼─,─┼──────┼─,─┬────────┬─)── │ │ └───xSrv───┘ ├─xReq─┤ └─detail─┘ │ │ └──*───┘ │ │ │ │ detail = 1 or 2 │ │ │ └───────────────────────────────────────────────────────────────────┘ Operation: This function gets information on sessions between a server xSrv and a requester xReq. If xSrv is omitted, it is a local server. If xReq is omitted or an asterisk(*) is specified, then session information for all the machines who have sessions with the server is obtained. Information on sessions is set in compound variables with the stem stem. If you have ADMIN privilege, you can specify detail to 1 or 2 to get more detail information. Variables to be set: stem.0 Number of indexes for stem (i=1 to stem.0 for variables below) stem.i.0UID An user id stem.i.0COMPUTER Computer name of a user stem.i.0SESSTIME Session time (in sec) stem.i.0IDLETIME Idle time (in sec) stem.i.0CLIENT", (*1) Type of client. (*3) stem.i.0CONNS", (*1) Number of connections in the sesseon stem.i.0OPENS", (*1) Number of open files/devices/pipes stem.i.0USERS", (*1) Number of users in the session.(=0 or 1) stem.i.0GUEST?", (*1) Guest account used? (=0 or 1) stem.i.0ENCRYPT?" (*1) Password encrypted? (=0 or 1) stem.i.0 (*2) Number of connections. (*4) (j=1 to stem.i.0 for variables below) stem.i.j.0NETNAME (*2) Network name that the server provides. stem.i.j.0CONNTYPE (*2) Connection type. stem.i.j.0CONNTIME (*2) Connection time (in sec) stem.i.j.0CONNOPENS (*2) Number of open files on the connection stem.i.j.0CONNUSERS (*2) Number of users on the connection Note: (*1) These variables are only set when detail is set to 1 or 2. (*2) These variables are only set when detail is set to 2. As for these variables, refer to LsConnection function. (*3) The value is something like 'OS/2 LS 4.0'. It seems to indicate the LAN Server version of the server actually. (*4) The value should be equal to stem.0CONNS. Returned string: rc Required Privilege: GUEST, USER, or ADMIN Examples: Here are examples. ═══ Examples for NetSess with Query verb ═══ Example 1: List session information with DC of a logon domain and my machine. /* Example 1 */ retc = NetSess('Q','out','.','.') if retc = 0 then do i=1 to out.0 say out.i.0uid /* user id */ say out.i.0computer /* machine name */ say out.i.0sesstime /* session time */ say out.i.0idletime /* idle time */ end Exit In the example below, it is assumed that the caller has ADMIN privilege. Example 2: List information on all the sessions with a server LS40SRV. /* Example 2 */ retc = NetSess('Q','out','\\ls40srv',,2) if retc = 0 then do i=1 to out.0 say out.i.0uid /* user id */ say out.i.0computer /* machine name */ say out.i.0sesstime /* session time */ say out.i.0idletime /* idle time */ say out.i.0client say out.i.0conns say out.i.0opens say out.i.0users say out.i.0guest? say out.i.0encrypt? /* List all connections in this session */ do j=1 to out.i.0 say out.i.j.0netname say out.i.j.0conntype say out.i.j.0conntime say out.i.j.0connopens say out.i.j.0connusers end end Exit ═══ 18. NetShare ═══ NetShare function simulates NET SHARE command. Note: The current version of NetUtil.DLL only supports for 'Query' verb. ═══ 18.1. NetShare with Query verb ═══ Syntax: ┌──────────────────────────────────────────────────────────────────────┐ │ │ │ ┌─\\locSrv─┐ ┌────*────┐ │ │ ─NetShare('Q',─stem─,─┼──────────┼─,─┼─────────┼─,─┬────────┬─)─ │ │ └───xSrv───┘ ├─netname─┤ └─detail─┘ │ │ └────*────┘ │ │ │ │ detail = 1 │ │ │ └──────────────────────────────────────────────────────────────────────┘ Operation: This function gets information on a shared resource netname of a server xSrv. If xSrv is omitted, it is a local server. If netname is omitted or an asterisk(*) is specified, the function gets information on all the shared resources of the server. The information is set in compound variables with the stem stem. If detail is 1, then information on the users who have connection with the shared resource is also set in the stem variables. Variables to be set: stem.0 Number of indexes for stem (i=1 to stem.0 for variables below) stem.i.0NETNAME Netname of a shared resource stem.i.0TYPE Resource type. (*2) stem.i.0REMARK Remark stem.i.0PATH Path stem.i.0MAXUSES Max concurrent connections (*3) stem.i.0CONNS Number of current connections stem.i.0 (*1) Number of indexes for stem.i. (j=1 to stem.i.0 for variables below) stem.i.j.0UID (*1) An user id with connection to netname stem.i.j.0COMPUTER (*1) Computer name of the user stem.i.j.0NETNAME (*1) Netname of a shared resource stem.i.j.0CONNTYPE (*1) Connection type stem.i.j.0CONNTIME (*1) Connection time (in sec) stem.i.j.0CONNOPENS (*1) Number of open files on the connection stem.i.j.0CONNUSERS (*1) Number of users on the connection (= 0 or 1) Note: (*1) These variables are only set when detail is set to 1. As for these variables, refer to LsConnection function. (*2) Value is 'DISK', 'PRINT', 'COMM', or 'IPC'. (*3) If is is an asterisk(*), it indicates 'No Limit'. Returned string: rc Required Privilege: ADMIN Examples: Here are examples. ═══ Examples for NetShare with Query verb ═══ In the examples below, we assume that: 1. DC LS40DCSRV has shared resource \\LS40DCSRV\IBMPC. 2. Server LS40SRV has shared resource \\LS40SRV\OS2TOOLS. 3. The caller's machine and user id is \\LS40REQ and MYADM, respectively. 4. The caller has logged on to LSDCSRV. Note: Example of returned value is enclosed in left and right parentheses in a comment area for a variable. Example 1: List information on all the shared resources of the DC of logon domain. /* Example 1 */ retc = NetShare('Q','out') if retc = 0 then do i=1 to out.0 say out.i.0NetName /* ('IBMPC') */ say out.i.0type /* ('DISK') */ say out.i.0remark /* ('Forums on IBMPC disk') */ say out.i.0path /* ('F:\IBMPC') */ say out.i.0MaxUses /* ('*') */ say out.i.0Conns /* ('1') */ end Exit Example 2: List information on all the shared resources of server LS40SRV. /* Example 2 */ retc = NetShare('Q','out','\\ls40srv') if retc = 0 then do i=1 to out.0 say out.i.0NetName /* ('OS2TOOLS') */ say out.i.0type /* ('DISK') */ say out.i.0remark /* ('Repository of OS2TOOLS disk') */ say out.i.0path /* ('G:\TOOLS\OS2TOOLS') */ say out.i.0MaxUses /* ('*') */ say out.i.0Conns /* ('2') */ end Exit Example 3: List information on shared resource \ls40srv\os2tools and those who have connection with it. /* Example 3 */ retc = NetShare('Q','out','\\ls40srv','\os2tools',1) if retc = 0 then do i=1 to out.0 say out.i.0NetName /* 'OS2TOOLS' */ say out.i.0type /* 'DISK' */ say out.i.0remark /* 'Repository of OS2TOOLS disk' */ say out.i.0path /* 'G:\TOOLS\OS2TOOLS' */ say out.i.0MaxUses /* '*' */ say out.i.0Conns /* ('2') */ do j=1 to out.i.0 say out.i.j.0uid /* user id */ say out.i.j.0computer /* machine */ end end Exit ═══ 19. NetUse ═══ NetUse function simulates NET USE command and supports for two verbs:  Query  Connect(or Add)  Disconnect ═══ 19.1. NetUse with Query verb ═══ Syntax: ┌──────────────────────────────────────────────────┐ │ │ │ ┌──────*───────┐ │ │ ─NetUse('Q',──stem──,─┼──────────────┼──)── │ │ ├───DevOrUNC───┤ │ │ └──────*───────┘ │ │ │ │ DevOrUNC: │ │ ├─┬──device──┬─┤ │ │ └───UNC────┘ │ │ │ └──────────────────────────────────────────────────┘ Operation: This function gets information on an explicit connection of the local machine to a shared resource by device or the one on an implicit connection by UNC. Note: An an explicit connection is established by such a command like: NET USE X: OS2TOOLS An an implicit connection is established by such a command like: DIR \\LS40SRV\OS2TOOLS\*.*. If DevOrUNC is omitted, or an asterisk(*) is specified, the function gets information on all the connections of the local machine to shared resources. The connection information is set in compound variables with the stem stem. Variables to be set: stem.0 Number of indexes for stem (i=1 to stem.0 for variables below) stem.i.0LOCAL Device that established a connection. (*1) stem.i.0REMOTE Shared resource name in UNC format. stem.i.0STATUS Connection status. (*2) stem.i.0RESTYPE Resource type. (*3) stem.i.0OPENCNT Number of open files and/or other resources. stem.i.0USECNT Number of explicit and implicit connections. Note: (*1) Value is null string when the connection is established implicitly. (*2) Value is 'OK', 'DISC', 'RECONN', 'CONN', 'ERROR', or 'PAUSED'. (Some of them are different from those returned by NET USE command.) (*3) Value is 'DISK', 'PRINT', 'COMM', or 'IPC'. Returned string: rc Required Privilege: GUEST, USER, or ADMIN Examples: Here are examples. ═══ Examples for NetUse with Query verb ═══ In the examples below, example of returned value is enclosed in left and right parentheses in a comment area for a variable. Example 1: List information on an implicit connection with \\LS40SRV\OS2TOOLS. /* Example 1 */ retc = NetUse('Q','out','\\ls40srv\os2tools') if retc = 0 then do i=1 to out.0 /* out.0 = 1 */ say out.i.0local /* (Null string) */ say out.i.0remote /* \\LS40SRV\OS2TOOLS */ say out.i.0status /* ('OK') */ say out.i.0ResType /* 'DISK' */ say out.i.0opencnt say out.i.0usecnt end Exit Example 2: List connection information of a redirected device LPT1:. /* Example 2 */ retc = NetUse('Q','out','LPT1:') if retc = 0 then do i=1 to out.0 say out.i.0local /* ('LPT1:') */ say out.i.0remote /* ('\\LS40SRV\4216') */ say out.i.0status /* ('OK') */ say out.i.0ResType /* ('PRINT') */ say out.i.0opencnt say out.i.0usecnt end Exit Example 3: List information on all the connections with a local machine. /* Example 3 */ retc = NetUse('Q','out') if retc = 0 then do i=1 to out.0 say out.i.0local /* ('X:') */ say out.i.0remote /* ('\\LS40SRV\OS2TOOLS') */ say out.i.0status /* ('OK') */ say out.i.0ResType /* ('DISK') */ say out.i.0opencnt say out.i.0usecnt end Exit ═══ 19.2. NetUse with Connect(or Add) verb ═══ Syntax: ┌───────────────────────────────────────────────────────────────────┐ │ │ │ (2) │ │ ─NetUse('C',─┬────────┬─,─┬─alias──┬─────┬┬─,─┬──────────┬─)─ │ │ (1) ├─device─┤ │ └─dom─┘│ └─password─┘ │ │ └─anydrv─┘ └───UNC─────────┘ │ │ │ │ │ │ anydrv: │ │ ├──*───┬─────┬───┬──────┬───┬─────┬──┤ │ │ (3)└─drv─┘(3)└─sign─┘(2)└─var─┘ │ │ │ │ sign: '+' or '-' │ │ │ │ Note: (1) 'A' can be specified instead of 'C'. │ │ (2) there should be one or more spaces between two words. │ │ (3) there should be no space. │ └───────────────────────────────────────────────────────────────────┘ Operation: This function connects a local device device to shared resource alias or UNC. alias is an alias defined in a logon domain or in dom if it is specified. If device is not explicitly specified but anydrv is specified, the function searches for the first free local drive from a drive drv in ascending or descending order to connect with disk resource. The order is given by sign. If drv is omitted, the default is 'D:' for ascending search and 'Z:' for descending search. Note that drv is inclusive for the search. The first available drive is set in a REXX variable var if it is specified. If device or anydrv is not given, an implicit connection is established. If password is omitted, logon password is used. If it is specified and it is one or more blanks, no password is used. Variables to be set: REXX variable var is set if it is specified. Returned string: rc Required Privilege: GUEST, USER, or ADMIN Examples: Here are examples. ═══ Examples for NetUse with Connect verb ═══ Example 1: Connect j: drive to \\LS40SRV\OS2TOOLS. /* Example 1 */ retc = NetUse('C','j:','\\ls40srv\os2tools') if retc \=0 then say 'Failed.' Exit Example 2: Connect the last free drive before Z: to an alias CMVC that is defined in another domain TOOLDOM. /* Example 2 */ retc = NetUse('C','*z- drv','CMVC TOOLDOM') if retc =0 then say 'Drive' drv 'was connected.' Exit ═══ 19.3. NetUse with Disconnect verb ═══ Syntax: ┌──────────────────────────────────────────────────────────────┐ │ │ │ ┌──────*───────┐ ┌───1───┐ │ │ ─NetUse('D',─┬──────┬─,─┼──────────────┼─,─┼───────┼─)─ │ │ └─stem─┘ ├───DevOrUNC───┤ └─force─┘ │ │ └──────*───────┘ │ │ │ │ DevOrUNC: │ │ ├─┬──device──┬─┤ │ │ └───UNC────┘ │ │ │ │ force = 1, 2 │ │ │ └──────────────────────────────────────────────────────────────┘ Operation: This function disconnects from a resource that has been connected by by local device device or UNC. If DevOrUNC is omitted, or an asterisk(*) is specified, the function disconnects from all the resources. To indicate whether each resource is disconnected successfully or not, stem.i.0RC variable is set if stem is specified for i-th resource. force specifies a way to disconnect. If force is 1, it disconnects resource when a file, a directory, or a drive for the resource is not open. If force is 2, it is forced to be disconnected. Information on resource(s) before disconnection is set in compound variables with the stem stem if it is specified. Variables to be set: stem.0 Number of resources to be disconnected (i=1 to stem.0) stem.i.0RC Return code for disconnection of this resource. (others are same as in 'Query' verb.) Returned string: rc Required Privilege: GUEST, USER, or ADMIN Examples: Here are examples. ═══ Examples for NetUse with Disconnect verb ═══ In the examples below, example of returned value is enclosed in left and right parentheses in a comment area for a variable. Example 1: Terminate an implicit connection with \\LS40SRV\OS2TOOLS. /* Example 1 */ retc = NetUse('D',,'\\ls40srv\os2tools') /* no stem */ if retc \= 0 then say 'Failed to disconnect with error code:' retc Exit Example 2: Disconnect all the resources without care for open resource. /* Example 2 */ retc = NetUse('D','out','*',1) if retc = 0 then do i=1 to out.0 say out.i.0RC /* ('0' for success) */ say out.i.0local /* ('LPT1:') */ say out.i.0remote /* ('\\LS40SRV\4216') */ say out.i.0status /* ('OK') */ say out.i.0ResType /* ('PRINT') */ say out.i.0opencnt say out.i.0usecnt end Exit ═══ 20. NetUser ═══ NetUser function simulates NET USER command. Note: The current version of NetUtil.DLL only supports for 'Query' verb. ═══ 20.1. NetUser with Query verb ═══ Syntax: ┌──────────────────────────────────────────────────────────────┐ │ │ │ ┌\\locReq─┐ ┌──*──┐ │ │ ─NetUser('Q',─stem─,─┼─────────┼─,─┼─────┼─,─┬──────┬─)─ │ │ └──xSrv───┘ ├─uid─┤ └detail┘ │ │ ├──.──┤ │ │ └──*──┘ │ │ │ │ detail = 1 or 2 │ │ │ └──────────────────────────────────────────────────────────────┘ Operation: This function gets information on an user id uid that is maintained in an User Account Database of a server xSrv. If xSrv is omitted, it is a local machine. Note that the local machine may be a Requester or Peer machine. In this case the information is retrieved from a local User Account Database. If uid is an asterisk(*) or is not specified, then information on all the user accounts on the database is retrieved. Information on user(s) is set in compound variables with the stem stem. Detail information is obtained when detail is set to 1. In this case the caller should have ADMIN privilege. If uid is a dot(.), the caller who does not have ADMIN privilege can specify detail of 1 successfully. Variables to be set: stem.0 Number of indexes for stem (i=1 to stem.0 for variables below) stem.i.0UID User ID (User name) stem.i.0REMARK Comment stem.i.0USERCOMMENT User Comment stem.i.0FULLNAME Full name stem.i.0PARMS (*1) Parameters stem.i.0HOMEDIR (*1) Home directory stem.i.0REQUESTERS (*1) Requesters where logon is allowed (*4) stem.i.0LOGONSRV (*1) Preferred Logon Server (*5) stem.i.0PWAGE (*1) Time after password is last set. (in sec) stem.i.0PWSETDATE (*1) Date when password is last set. (*6) stem.i.0PWEXPDATE (*1) Date when password is expired. (*4,6) stem.i.0PWCHGDATE (*1) Date when password can be changed. (*4,6) stem.i.0LASTLOGON (*1) Date when an user logged on last. (*6,7) stem.i.0LASTLOGOFF (*1) Date when an user logged on last. (*6,7) stem.i.0COUNTRYCODE (*1) Country code stem.i.0CODEPAGE (*1) Code page stem.i.0LOGONCNT (*1) Logon count (*7) stem.i.0BADPWCNT (*1) Bad password count (*7) stem.i.0MAXSTORAGE (*1) Maximum disk space (*4) stem.i.0PRIV (*1) Privilege level stem.i.0PRIVPRT? (*1) Operator privilege - PRINT (*8) stem.i.0PRIVCOM? (*1) Operator privilege - COMM (*8) stem.i.0PRIVSRV? (*1) Operator privilege - SERVER (*8) stem.i.0PRIVACC? (*1) Operator privilege - ACCOUNTS (*8) stem.i.0LOGONALWAYS? (*1) Can the user logon always ? (*9) stem.i.0LOGONHOURS.0 (*1) (='7') stem.i.0LOGONHOURS.t (*1) Hour flags in hex style to indicate allowed hours of a day when the user can logon on a domain. (*9) stem.i.0SCRIPTPATH (*1,2) Logon script stem.i.0ACCOUNTEXP (*1,2) Date when Account expires (*4,6) stem.i.0PWREQ? (*1,2) Password required? stem.i.0PWCHG? (*1,2) Password is changeable? stem.i.0ACCOUNTACT? (*1,2) Account is active? stem.i.0ACCOUNTDEL? (*1,2) Account can be deleted? stem.i.0GRP.0 (*3) Number of groups (*10) stem.i.0GRP.j (*3) Group that the user belongs to. stem.i.0APP.0 (*3) Number of Network Applications. (*10) stem.i.0APP.k (*3) Application assigned to the user. stem.i.0APP.k.0TYPE (*3) Application type ('OS/2' or 'DOS') stem.i.0APP.k.0PUBLIC? (*3) Public Application? stem.i.0LA.0 (*3) Number of Logon assignments (*10) stem.i.0LA.m (*3) Alias name stem.i.0LA.m.0TYPE (*3) Alias type stem.i.0LA.m.0LOCAL (*3) Local device name Note: (*1) These variables are set when detail is set to 1 or 2 and the caller has an ADMIN privilege. If uid is a dit(.), the ADMIN privilege is not required. (*2) These variables are not set if a dot(.) is specified for uid. (*3) These variables are set when detail is set to 2 and the caller has an ADMIN privilege. (*4) An asterisk(*) will be returned if there is no restriction. (*5) Double back slashes(\\) precedes a server name. If there is no restriction, '\\*' is returned. (*6) Date format is YYYY MM/DD hh:mm:ss. (*7) If it is unknown, an question mark(?) is returned. (*8) The value is either '0' or '1'. (*9) t is 1 for Sunday, 2 for Monday, and so on. Value of stem.i.0LOGONHOURS.t is a string of 6 hexadecimal characters where 24 bits are assigned to time ranges of the day t. Least significant bit of the 24 bits is 00:00 thru 00:59, the next is 01:00 thru 01:59, and so on. Bit of '1' indicates that the user can logon for the time range. For example, stem.0.0LogonHours.1='000000' show the user cannnot logon on Sunday. stem.0.0LogonHours.2='0FFF00' show the user can logon on from 08:00 until 20:00 on Monday. stem.i.0LogonAlways? is set to '1' if there is no restriction on the time when the user can logon. Otherwise, it is '0'. (*10) One of following conditions should be met so that these values are correctly set.  the caller has an ADMIN privilege,  the caller has an Account Operator privilege, or  the caller queries information on his/her own. If an error is raised from NET API internally to set these variables, the error code is negated and set to the variables. For example, if stem.i.0GRP.0 is "-5", it means "Access Denied". Returned string: rc Required Privilege: GUEST, USER, or ADMIN Examples: Here are examples. ═══ Examples for NetUser with Query verb ═══ Example 1: List all th user ids defined in a logon domain. /* Example 1 */ /* The caller's privilege may be USER or GUEST.*/ retc = NetUser('Q','out','.') if retc = 0 then do i=1 to out.0 say out.i.0uid /* user id */ say out.i.0Remark /* comment */ say out.i.0UserComment /* user comment */ say out.i.0Fullname /* full name */ end Exit Example 2: List detail information on my own in a domain LS40DOM. /* Example 2 */ /* The caller's privilege may be USER or GUEST.*/ retc = NetUser('Q','out','ls40dom','.',2) if retc = 0 then do i=1 to out.0 /* out.0 = 1 */ say out.i.0uid /* user id */ say out.i.0Remark /* comment */ say out.i.0UserComment /* user comment */ say out.i.0Fullname /* full name */ say out.i.0Parms say out.i.0HomeDir say out.i.0Requesters say out.i.0LogonSrv say out.i.0PwAge say out.i.0LastLogon say out.i.0LastLogoff say out.i.0CountryCode say out.i.0CodePage say out.i.0LogonCnt say out.i.0BadPwCnt say out.i.0MaxStorage say out.i.0Priv say out.i.0PrivPrt? say out.i.0PrivCom? say out.i.0PrivSrv? say out.i.0PrivAcc? say out.i.0PwSetDate say out.i.0PwExpDate say out.i.0PwChgDate if out.i.0LogonAlways?=0 then /* show detail */ do t=1 to out.i.0LogonHours.0 say out.i.0LogonHours.t end /* say out.i.0AccountExp (This variable is not set.) */ /* say out.i.0ScriptPath (This variable is not set.) */ /* say out.i.0PwReq? (This variable is not set.) */ /* say out.i.0PwChg? (This variable is not set.) */ /* say out.i.0AccountAct? (This variable is not set.) */ /* say out.i.0AccountDel? (This variable is not set.) */ do j=1 to out.i.0grp.0 say out.i.0grp.j end do j=1 to out.i.0App.0 say out.i.0App.j end do j=1 to out.i.0LA.0 say out.i.0LA.j end end Exit In examples below, it is assumed that the caller has ADMIN privilege. Example 3: List all the user ids defined in a server \\LS40SRV. /* Example 3 */ retc = NetUser('Q','out','\\LS40SRV','*',1) if retc = 0 then do i=1 to out.0 say out.i.0uid /* user id */ say out.i.0Remark /* comment */ say out.i.0UserComment /* user comment */ say out.i.0Fullname /* full name */ say out.i.0Parms say out.i.0HomeDir say out.i.0Requesters say out.i.0LogonSrv say out.i.0PwAge say out.i.0LastLogon say out.i.0LastLogoff say out.i.0CountryCode say out.i.0CodePage say out.i.0LogonCnt say out.i.0BadPwCnt say out.i.0MaxStorage say out.i.0Priv say out.i.0PrivPrt? say out.i.0PrivCom? say out.i.0PrivSrv? say out.i.0PrivAcc? say out.i.0PwSetDate say out.i.0PwExpDate say out.i.0PwChgDate say out.i.0AccountExp say out.i.0ScriptPath say out.i.0PwReq? say out.i.0PwChg? say out.i.0AccountAct? say out.i.0AccountDel? end Exit ═══ 21. NetView ═══ NetView function simulates NET VIEW command. Note: The current version of NetUtil.DLL only supports for 'Query' verb. ═══ 21.1. NetView with Query verb ═══ Syntax: ┌─────────────────────────────────────────────────────────┐ │ │ │ ┌───*────┐ │ │ ─NetView('Q',──stem──,─┼────────┼─,─┬────────┬──)── │ │ ├──xSrv──┤ └─detail─┘ │ │ └───*────┘ │ │ │ │ detail = 1 │ │ │ └─────────────────────────────────────────────────────────┘ Operation: This function gets information on the server xSrv. If xSrv is omitted or an asterisk(*) is specified, it gets information on all the servers in the domain(s) that the caller's machine monitors. Note: In general, a requester machine monitors a default domain, logon domain, and domains that are specified by OTHDOMAINS line in IBMLAN.INI or by /OTHDOMAINS parameter on NET START REQUESTER command. The information is set in compound variables with the stem stem. If detail of 1 is specified, then information on shared resources of the server(s) is also retrieved. Variables to be set: stem.0 Number of indexes for stem (i=1 to stem.0 for variables below) stem.i.0SERVER Server name stem.i.0REMARK Comment stem.i.0VERMAJOR Major version of LAN Server on the server stem.i.0VERMINOR Minor version of LAN Server on the server stem.i.0PEER? Peer server flag ("1" or "0") stem.i.0HEXTYPE Server type in HEX representation (*2) stem.i.0TYPELIST A list of server types. (*2) stem.i.0 (*1) Number of shared resources of the server. (j=1 to stem.i.0 for variables below) stem.i.j.0NETNAME (*1) Netname of a shared resource stem.i.j.0TYPE (*1) Resource type. (*3) stem.i.j.0REMARK (*1) Remark stem.i.j.0LOCAL (*1) Local device which the resource is attached to. Note: (*1) These variables are only set when detail is set to 1. (*2) For detail on values, see LsServer with Query verb. (*3) If is is an asterisk(*), it indicates 'No Limit'. Returned string: rc Required Privilege: GUEST, USER, or ADMIN Examples: Here are examples. ═══ Examples for NetView with Query verb ═══ In the examples below, example of returned value is enclosed in left and right parentheses in a comment area for a variable. Example 1: List all the active servers that the local machine monitors. /* Example 1 */ retc = NetView('Q','out') if retc = 0 then do i=1 to out.0 say out.i.0server /* server name: (\\LS40DCSRV) */ say out.i.0remark /* comments */ say out.i.0VerMajor /* major version: ('4') */ say out.i.0VerMinor /* major version: ('0') */ say out.i.0peer? /* peer server? : ('0') */ say out.i.0TypeList /* Types: ('REQUESTER SERVER DC') */ end Exit Example 2: Get information on the server LS40SRV and lists all the shared resources of the server. /* Example 2 */ retc = NetView('Q','out','\\ls40srv',1) if retc = 0 then do i=1 to out.0 say out.i.0server /* server name: (\\LS40DCSRV) */ say out.i.0remark /* comments */ say out.i.0VerMajor /* major version: ('4') */ say out.i.0VerMinor /* major version: ('0') */ say out.i.0peer? /* peer server? : ('0') */ say out.i.0TypeList /* Types: ('REQUESTER SERVER DC') */ do j=1 to out.i.0 say out.i.j.0NetName /* ('IBMPC') */ say out.i.j.0type /* ('DISK') */ say out.i.j.0remark /* ('Forums on IBMPC disk') */ end end Exit ═══ 22. Return codes from NetUtil functions. ═══ Here is a table of return code(rc) returned from NetUtil functions. 1. rc = 0 Successful completion 2. rc < 0 Syntax error or invalid parameter -1 No verb specified. -2 Invalid verb specified. -3 Parameter is missing. -4 Parameter is invalid. -5 REXX variable name is invalid. -6 Failed to set REXX variables. -8 No free local drive available. 3. rc > 0 Error code returned from NET API or OS/2 system. As for rc of pisitive nnnn, see documents of IBM OS/2 LAN Server or you can see on-line help by either: HELP NETnnnn or HELP SYSnnnn