在 z/OS USS 中更改 REXX exec 运行 中的目录?

Change directory in REXX exec running in z/OS USS?

我在 TSO 下的 USS shell,我有这个 exec(名为 tryit):

/* rexx */
"cd /differentdir"
"pwd"

结果如下:

> pwd
/origdir
> tryit
/origdir

换句话说,cd 命令的效果似乎只持续到命令本身的持续时间。 REXX exec 是否可以通过以下命令识别的方式更改工作目录?

对于 USS shell 下的 REXX execs 运行,默认寻址环境是 SH。来自 Using REXX and z/OS UNIX System Services 手册:

Note that built-in shell commands run in the shell process, not your REXX process and cannot alter the REXX environment. For example, address sh 'cd /' will not change the current directory of your REXX process.

要对当前工作目录进行持久更改,请发出 address syscall chdir 命令。来自同一手册:

If you use chdir to change a directory in a REXX program that is running in a TSO/E session, the directory is typically reset to your home directory when the REXX program ends.