3

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?

Oh Come On
  • 153
  • 8
  • Look at the REXX syscalls environment. What you are doing is temporary, as by default each one of these commands is essentially a separate ADDRESS statement with the command string argument. – zarchasmpgmr Apr 05 '17 at 03:16
  • @zarchasmpgmr That was exactly the prompting I needed. Thanks. – Oh Come On Apr 05 '17 at 12:39

1 Answers1

6

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.

Oh Come On
  • 153
  • 8