Writing dssh scripts

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Writing dssh scripts

Post by zulfi123786 »

Hi,

I would like to know if dssh supports a batch mode, the intention is to write a scripts which would perform below activities:

1. Add VOC entry for a hashed file
2. Delete VOC entry for hashed file
3. Create and build secondary indexes for hashed files
4. Delete secondary indexes for hashed files
5. Fetch a particular record from hashed file from Unix script.

We can perform 1-4 in interactive mode but would like to have scripts with parameters that can be executed rather than having every developer meddling with VOC file.


Thanks
- Zulfi
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Not sure about the 'batch mode' you mentioned but you can certainly execute dssh queries from the command line and bundle those into scripts.

But then it seems you already know that. :wink:
Last edited by chulett on Wed Aug 27, 2014 8:02 am, edited 1 time in total.
-craig

"You can never have too many knives" -- Logan Nine Fingers
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

To bundle the commands in a script and run them, is there any flag of dssh which accepts the script file as input and runs it ?

From inside the dssh script, is it posible to run a query and let the result dumped into a flat file using standard redirection.

Thanks
- Zulfi
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

See edited reply.

I meant your shell script could 'bundle' as in make multiple calls to dssh, one for each command / function you needed to run. Did not mean to imply there is any kind of 'script' capability within dssh itself, although there very well could be. Never had a need to investigate any such thing so others will need to clarify that for you.

There's always COMO ON and COMO OFF for that 'redirection' but me, I'd stick with using standard stuff from the command line and leave COMO for the interactive client sessions.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

1.  UVwrite hashedfile keyvalue field1 field2 ...  
     (warning: this is a destructive overwrite).
2.  UVdelete hashedfile keyvalue
3.  dssh "CREATE.INDEX hashedfile columnname" && dssh "BUILD.INDEX hashedfile columnname"
4.  dssh "DELETE.INDEX hashedfile columnname"
5.  UVread hashedfile keyvalue
Make sure that your command search path (PATH environment variable) includes $DSHOME/bin for these commands.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

chulett wrote:But then it seems you already know that. :wink:
Wow :) you spotted an appropriate post of mine. Looks like your version of DSXchange supplies appropriate links like those found in social networking sites ;)

Yup, I was wondering if at all there was any flag in dssh that takes a file with queries with the intention to avoid the to and fro calls to dssh. Anyhow I will go ahead with bundling them into shell script.


Thanks
- Zulfi
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

ray.wurlod wrote:

Code: Select all

5.  UVread hashedfile keyvalue
Thanks for the reply Ray, Is there a way to fetch all records of select query from dssh by getting rid of "Press any key to continue..."


Thanks
- Zulfi
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Add the NO.PAGE keyword to the query.

Or redirect stdin from /dev/null.

Code: Select all

dssh "SELECT * FROM VOC;" < /dev/null
This provides the responses to "Press any key to continue . . ."
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