How to run several dssh scripts in one batch

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
hailun
Participant
Posts: 40
Joined: Fri Nov 07, 2008 9:07 am

How to run several dssh scripts in one batch

Post by hailun »

Hi,
I would like to realize one function retrieving the hash_num for one job using shellscript,the server is of AIX

What I do now in the script file is
'hellp' is project name and 'Test' is the job name

dssh<<eof
logto hellp
select JOBNO FROM DS_JOBS WHERE NAME ='Test'
quit
eof

But it will take long time to run and return no record,
BTW I type the command as following
dssh<<eof
>logto hellp
>SELECT JOBNO FROM DS_JOBS WHERE NAME = 'Test'
>QUIT
It is OK

Can any one of you post kindly advice here... :)
Let's Progress Together....
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

try

Code: Select all

dssh<<eof
pterm case noinvert
SELECT JOBNO FROM DS_JOBS WHERE NAME = 'Test';
QUIT;
eof
Note the switching off of case inversion and the semicolon on the SQL
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

... but lose the semi-colon after QUIT
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
hailun
Participant
Posts: 40
Joined: Fri Nov 07, 2008 9:07 am

Post by hailun »

dssh<<eof
pterm case noinvert
SELECT JOBNO FROM DS_JOBS WHERE NAME = 'Test';
QUIT
eof

Hi ArndW&ray,
Thank you for your kindly inputs,and the script as above works,I have another question here,is there any way so as I have transfer the output of the Select query to one Unix variable or plain file. I have tried adding redirection symbol '>'
following <<eof and eof and SELECT JOBNO FROM DS_JOBS WHERE NAME = 'Test'; but none of them works,,,

:)
Let's Progress Together....
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

How about just using SH scripting
(from UNIX)
cd {project directory}
dssh "SELECT JOBNO FROM DS_JOBS WHERE NAME = 'Test';" > textfile.txt
hailun
Participant
Posts: 40
Joined: Fri Nov 07, 2008 9:07 am

Post by hailun »

Hi ArndW,
Thank you for input, the method mentioned does work,bu it is said it is not a good habit to run dssh/uvsh under other paths than $DSHOME,
And I have achieved this by function calling,detailed as following:
。。。。。。。。。。。。。。。。
run_dssh()
{ a=$1
b=$2
cd $a
dssh<<eof
LOGTO $2
SELECT * FROM DS_JOBS;
QUIT
eof
}

run_dssh $DSHOME $pro_name > ./filename
。。。。。。。。。。。。。。。。
Hence the record returned by the SELECT query will be returned to file filename under present path

However,I have another question now,is there any way to run "dssh SELECT * FROM RT_LOG$HASH_NUM" under path $DSHOME,however the RT_LOG$HASH_NUM" is under some project path
ArndW wrote:How about just using SH scripting
(from UNIX)
cd {project directory}
dssh "SELECT JOBNO FROM DS_JOBS WHERE NAME = 'Test';" > textfile.txt ...
Last edited by hailun on Fri Sep 11, 2009 8:39 pm, edited 1 time in total.
Let's Progress Together....
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I don't know why you think it is bad to call up dssh outside of the $DSHOME directory - I think it is better and safer, as the "UV" account, if inadvertantly modified, can affect all projects on the system.

The question regardnig accessing the RT_LOGnnn file(s) in a different project from within the UV project is answered with a definitive "NO", as you do not want to add remote file pointers to the main UV account.
hailun
Participant
Posts: 40
Joined: Fri Nov 07, 2008 9:07 am

Post by hailun »

Yeah,although I could not read the fulltext of comments posted by you,I can know you are supporting running dssh under project path other thant $DSHOME :)

And in fact,few persons I know care under which folder the dssh is executed.

I believe we can resolve my last question someday in future...

As you have support resolving two queries factly,I would like to mark this topic resolved here..

Thank you both....

ArndW wrote:I don't know why you think it is bad to call up dssh outside of the $DSHOME directory - I think it is better and safer, as the "UV" account, if inadvertantly modified, can affect all projects on the s ...
Let's Progress Together....
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

dssh can be run satisfactorily in any project directory, as well as in $DSHOME - each project directory is an "account" for dssh. But it is vital that the dsenv script has been executed first - that's why (I believe) advice is usually given to execute in $DSHOME, the location of the dsenv script.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply