>>-getment--length--variable-----------------------------------><
Function
getment invokes the w_getmntent callable service to get
information about the mounted file systems and return the information
in the format used by the z/OS UNIX callable services. Alternatively,
you can use the getmntent syscall command to format the mount entries
in a stem.
Parameters
- length
- The size of the specified variable. If the length is 0,
RETVAL contains the total number of mounted file systems; otherwise,
RETVAL contains the number of entries returned.
- variable
- The name of the buffer where the information about the mount
entries is to be stored. Clear the buffer on the first call and do
not alter it between calls.
Usage notes
- Before a program calls getment for the first time, the
variable should be dropped, set to blanks, or set to nulls.
- If more than one call is made to getment, use the same
variable on each call, because part of the information returned in
the variable tells the file system where to continue retrieving its
information.
- getment normally returns information about as many file
systems as are mounted, or as many as fit in the passed variable.
The number of entries contained in the variable is returned. The caller
must have a variable large enough to receive information about at
least a single mount entry with each call. If a zero-length variable
is passed, no information is returned, but the return value contains
the total number of mounted file systems. This value could then be
used to get enough storage to retrieve information on all these file
systems in one additional call.
- You could also retrieve all mount entries by setting up a loop
that continues to call getment until a return value of either
-1 (in an error) or 0 (no more entries
found) is returned.
Example
In the following example, assume that
buf was assigned
a value earlier in the exec. This example returns the number of mounted
file systems in RETVAL:
"getment 0 buf"