CHDIR



CHDIR

Changes the process's current working directory (CWD).

Syntax

      CHDIR [ [DIR=]dir_name] [;SHOW | NOSHOW]



PARAMETERS

dir_name            The name of the new current directory (optional).
                    The dir_name is assumed to be an MPE name.
                    HFS-named directories may be changed to if
                    dir_name starts with a dot (.) or a slash (/).
                    The dir_name may not end in a slash and wild
                    carding is not allowed.  If dir_name is omitted,
                    your logon directory is used.  Your logon
                    directory is your logon group, in the form:
                    /LOGON_ACCOUNT/LOGON_GROUP.


OPERATION

    The CHDIR command changes the process' current working directory
    to dir_name or to the logon group, if you omit dir_name.  You can
    change the CWD to any HFS directory if you precede dir_name with
    a dot (.) or a slash (/) or to an MPE account or group to
    which you have the appropriate permission.

    Issuing the CHDIR command does not give users access to files in
    a directory (or group and account) that they would not otherwise
    have.  That is, it has no affect on file access permissions.

    The CWD is a process-local attribute, which means that CHDIR
    changes the CI's CWD for the life of that CI process or until
    another CHDIR command is issued.  When CHDIR is executed
    programmatically from a child process of the CI (e.g., HPEDIT),
    only that process' CWD is changed; the CWD of the parent process
    (in this example, the CI) remains the same.

    CHDIR does not post any accounting information: Connect and CPU
    time are still accounted to the user's logon account and group.

    HPCWD is a read-only, CI string variable that contains the name
of the current working directory in HFS syntax. At logon, HPCWD contains /account_name/logon_group_name. The CHGROUP command causes the HPCWD variable to be set to /account/group_changed_to.

The table below summarizes the differences and similarities
between the CHDIR and CHGROUP commands.

--------------------------------------------------------------
|Affects | CHGROUP | CHDIR |
--------------------------------------------------------------
|Accumulation of CPU and Connect time | yes | no |
--------------------------------------------------------------
|Set of accessible files | yes | no |
---------------------------------------------------------------
|CWD of process | yes | yes |
---------------------------------------------------------------
|HPCWD variable | yes | yes |
---------------------------------------------------------------
|Disk space accumulation limits | yes | no |
---------------------------------------------------------------

The CHDIR command may be invoked from a job, session, program,
or in break mode. It is not breakable. You must have Traverse
Directory entries (TD) permission to each directory component in
dir_name (refer to the ALTSEC command for more information on
directory permissions). The CWD is not changed if the CHDIR
command fails.

EXAMPLE(S)

     The following example shows the command entry to change to
     the directory "dir1" in the "MYGRP" group in the "MYACCT"
     account.

         CHDIR /MYACCT/MYGRP/dir1


     The following example shows the command entry to change to
     the MPE group level (AGROUP) in the MYACCT account.

         CHDIR /MYACCT/AGROUP


     The following example shows the command entry to change to a
     directory named spook_dir.  In this example, spook_dir
     is a relative pathname; that is, relative to the current
     working directory (CWD).

         CHDIR spook_dir

     You must use HFS syntax to change groups with the CHDIR command.
     For example, if the CWD is PUB.SYS and you want to change to the
     group ARPA, you would enter:

     CHDIR /SYS/ARPA

     or

     CHDIR ../ARPA

     The following example shows the command entry to change to a
     directory named spook, in the group jones, in the account
     users, by specifying the full pathname.

         CHDIR /MYACCT/JONES/spook

     In the following example, a change is made to a directory
     named final by specifying the relative pathname.  The variable
     HPCWD displays the current working directory after the change
is made.

CHDIR ./es/final
SHOWVAR HPCWD HPCWD = /MYACCT/JONES/spook/es/final

ADDITIONAL INFORMATION

Commands:     CHGROUP and the HPCWD variable