The fchdir service changes your working directory from the current one to a new one. The working directory is the starting point for path searches of pathnames not beginning with a slash.
For corresponding service using a pathname, see chdir (BPX1CHD, BPX4CHD) — Change the working directory.
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state, any PSW key |
Dispatchable unit mode: | Task |
Cross memory mode: | PASN = HASN |
AMODE (BPX1FCD): | 31-bit |
AMODE (BPX4FCD): | 64-bit |
ASC mode: | Primary mode |
Interrupt status: | Enabled for interrupts |
Locks: | Unlocked |
Control parameters: | All parameters must be addressable by the caller and in the primary address space. |
|
AMODE 64 callers use BPX4FCD with the same parameters.
The name of a fullword containing the directory file descriptor that was returned when the directory was opened (see opendir (BPX1OPD, BPX4OPD) — Open a directory), which is to become the new working directory. It may also be specified as the name of a fullword containing the file descriptor of an open directory (see open (BPX1OPN, BPX4OPN) — Open a file).
The name of a fullword where the fchdir service returns 0 if the request is successful, or -1 if it is not successful.
Return_code | Explanation |
---|---|
EACCES | The calling process does not have search permission for the directory referenced by the file descriptor. |
EBADF | The file descriptor parameter is not a valid file descriptor. |
ENOTDIR | The open file descriptor does not refer to a directory. The following reason code can accompany the return code: JRChdNotDir. |
EINTR | A signal was caught during the execution of fchdir(). |
EIO | An I/O error occurred while reading from or writing to the file system. The following reason codes can accompany the return code: JRQuiescing. |
The name of a fullword where the fchdir service stores the reason code. The fchdir service returns a Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. See z/OS UNIX System Services Messages and Codes for the reason codes.
There are no restrictions on the use of the fchdir service.
For an example using this callable service, see BPX1FCD (fchdir) example.