DSExecute and cd on unix

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
koojo
Premium Member
Premium Member
Posts: 43
Joined: Sun Jul 11, 2004 1:30 pm
Location: USA

DSExecute and cd on unix

Post by koojo »

The cd commond does not seem to be effective when I use it.

When i do a pwd it shows the projects directory.

Is there any way I can cd to a given directory and then use unix commands (by using DSExecute) on files in a different path.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Hello Koojo,

the DSExecute() command will open up a command shell in the current working directory (the project in which your DataStage job is running). Once the command returns back to the DataStage job this shell is closed; so doing a DSExecute() to cd to another directory and then using another DSExecute() will give you the current project directory as the attach point. If you need to execute a series of commands then call up a script from DataStage which then does your other commands.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You can string a series of commands together using a semi-colon as a separator. This is normal UNIX stuff.

Code: Select all

cd /x/y/z; cat dddd
Etc, etc. Works just fine like this in DSExecute or ExecSH.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

or just fully qualify everything
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
koojo
Premium Member
Premium Member
Posts: 43
Joined: Sun Jul 11, 2004 1:30 pm
Location: USA

Post by koojo »

Thank you guys.

kcbland,
I am quiet comfortable with basic and not quiet comfortable working with unix.

I was wondering what you mean by fully qualify everything.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Instead of:

Code: Select all

cd /here/there/everywhere/scripts
./runmyscript.ksh
You should just do

Code: Select all

/here/there/everywhere/scripts/runmyscript.ksh
You should write scripts that can be executed from anywhere and have enough logic to handle not requiring a directory change. Beginner programmers do this, rather than fully qualify all paths. It's rather elegant to set variables to hold directory paths within your script and then just use that variable when constructing a filename.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
koojo
Premium Member
Premium Member
Posts: 43
Joined: Sun Jul 11, 2004 1:30 pm
Location: USA

Post by koojo »

Thank you,

You guys are faster than other support available.
:lol:

koojo
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

And free, too.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Don't forget about "more accurate", either 8)
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

And most of our answers don't end with:
You need to wait for the next version...
Or
You need to upgrade to PX...
Or
You need to get some help from Professional Services...
We help get it done now, rather than later, if ever. 8)
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Post Reply