简体   繁体   中英

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

I'm in the USS shell under TSO, and I have this exec (named tryit ):

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

Here's the result:

> pwd
/origdir
> tryit
/origdir

In other words, the effects of the cd command appear to last only for the duration of the command itself. Is there a way for the REXX exec to change the working directory in a way that will be recognized in following commands?

For REXX execs running under the USS shell, the default addressing environment is SH. From the Using REXX and z/OS UNIX System Services manual:

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.

To make a persistent change to the current working directory, issue the address syscall chdir command. From the same manual:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM