CL Command Reference - CHGCURDIR

CL Command List > CHGCURDIR Reference

Description:

The Change Current Directory (CHGCURDIR) command changes a specified directory to the current working directory. The current directory can be a directory, library, folder, or database file. The current directory is used to locate objects used by the commands.

This command can also be issued using the following alternative file system command names:
. CD
. CHDIR

Restrictions:

1. This command works on only one object. If a pattern is specified on the Directory (DIR) parameter and more than one object matches the pattern, the user can select the object from a list in an interactive job. If this is a batch job, the command fails with error message CPFA08E, ¡åMore than one name matches pattern.¡å.

2. The current directory and current library are separate and distinct entities. The current library and current directory can be set to the same library, but a change to either the current library or current directory does not affect the other. The current directory, set with this command, affects the integrated file system commands and APIs. The current library, set with the Change Current Library (CHGCURLIB) command, affects commands such as the Create Display File (CRTDSPF) command, that uses the value *CURLIB as a library qualifier. 3. The user must have read (*R) authority to the directory. 4. The user must have execute (*X) authority to each directory in the path.


Examples:

Example 1: Changing a Current Directory

CHGCURDIR DIR(/DIRECTORY2)
This command changes the current directory to the directory named DIRECTORY2.



Example 2: Changing a Current Directory to the Parent of the Current Directory

CHGCURDIR DIR(¡¯..¡¯)

This command changes the current directory to the parent directory of the directory that contains the current directory before this command is run.