The chdir 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 that do not begin with a slash.
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state, any PSW key |
Dispatchable unit mode: | Task |
Cross memory mode: | PASN = HASN |
AMODE (BPX1CHD): | 31-bit |
AMODE (BPX4CHD): | 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 BPX4CHD with the same parameters.
The name of a fullword that contains the length of the pathname of the directory that is to become your new working directory.
The name of a field that contains the pathname of the new directory. This field has the length specified in Pathname_length.
The name of a fullword in which the chdir 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 permission to search one of the components of Pathname. |
EINVAL | The Pathname parameter is not valid; it contains nulls. |
ELOOP | A loop exists in symbolic links that were encountered during resolution of the Pathname argument. This error is issued if more than 24 symbolic links are detected in the resolution of Pathname. |
ENAMETOOLONG | Pathname is longer than 1023 characters, or a component of Pathname is longer than 255 characters. Name truncation is not supported. |
ENOENT | No directory named Pathname was found, or no Pathname was specified. The following reason codes can accompany the return code: JRChdNoEnt and JRQuiescing. |
ENOTDIR | Some component of Pathname is not a directory. The following reason code can accompany the return code: JRChdNotDir. |
The name of a fullword in which the chdir service stores the reason code. The chdir 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 chdir service.
For an example using this callable service, see BPX1CHD (chdir) example.