change directory prior to executing the class

General discussion on the JZOS batch launcher and toolkit
Post Reply
Ulrich Schmidt
Posts: 37
Joined: Fri Jan 09, 2009 1:25 pm
Location: Germany

change directory prior to executing the class

Post by Ulrich Schmidt »

Hello,

is there a opportunity to change directory prior to executing the classes? We use a foreign class which reads the name of the config-pathes from a file. The pathes need to be specified as relative pathes. The homedir of the user cannot be the root for those relative pathes.
Without jzos we can deal with this easily by issuing a cd to the base of the config-pathes and then issuing "java .."-command to invoke the class. But how I can do this with jzos.
I tried with the STDENV but this doesn't help much. Do you have any hint for me?

brgds,
Ulrich
coz
Posts: 391
Joined: Fri Jul 30, 2004 5:29 pm

Post by coz »

Sure - in your STDENV DD, just issue a cd command to the directory you want as your base:

Code: Select all

cd /my/new/base
This will be adopted by the JVM as user.dir
Ulrich Schmidt
Posts: 37
Joined: Fri Jan 09, 2009 1:25 pm
Location: Germany

Post by Ulrich Schmidt »

Oh, you're right - I had tried it had a wring typing in it. I checked it now by displaying "user.dir". It's ok. Thank you.

But may I ask another question about this:
We are running several classes with different basic pathnames - but the relative pathnames are all the same. By invoking JZOS I would like to "cd" to the basic path. I know now, I can do this with STDENV.
Bur I would like to have the same STDENV for all this classes as they are very similiar. I'd like to introduce a environment-variable and do a "cd" within the STDENV to this variable.

At least I would like to have the STDENV all the same in it's content. So if I could grep from within the script where it's located I could do a cd to this location. This is a unix question - but maybe you know this.

I'd prefer the first solution (if there is one) but can also do with the second one.

brgds,
Ulrich
Post Reply