Using cozsftp to set env variables (v1.10.1)

Discussion of the COZBATCH utility for z/OS
Post Reply
gngrossi
Posts: 36
Joined: Sat Mar 06, 2010 6:10 pm

Using cozsftp to set env variables (v1.10.1)

Post by gngrossi »

We have users using COZBATCH to run the ping command. They need to use export _BPX_SHAREAS=YES to make it work.
Is including the export command in the cozsftp script a good way to do it? (I see export LC_ALL="C" in the script :-)
Thanks.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: Using cozsftp to set env variables (v1.10.1)

Post by dovetail »

When you run COZBATCH, it executes the z/OS Unix shell with _BPX_SHAREAS=MUST. This is because the z/OS Unix shell will not run in the same address space unless _BPX_SHARES is set to MUST.

After the shell is running, you can export _BPX_SHAREAS=YES in the script. You could also set this in /etc/profile or $HOME/.profile, which is a common and reasonable thing to do. This is because "YES" is a pretty good default once you are executing under the shell.

The reason that you are finding that _BPX_SHAREAS must be set to YES (rather than MUST) in order to run the ping command is that ping is apf authorized, and it won't run in the same address space and therefore gets an error if _BPX_SHAREAS=MUST.

RE: "including the export command in the cozsftp script" - The input to the COZBATCH utility is a z/OS Unix shell script, where you could use the export command. You might be running the "cozsftp" command under COZBATCH, and cozsftp has input commands as well.

So, you could have:

Code: Select all

// EXEC PGM=COZBATCH
export _BPX_SHAREAS=YES
ping ...
...
cozsftp -b- user@host <<EOB
put foo bar
EOB
//
Post Reply