Running a SQL from dos command

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
sunil_acc
Participant
Posts: 28
Joined: Thu Oct 20, 2005 5:49 am

Running a SQL from dos command

Post by sunil_acc »

Here goes one more stuff.
We can write various sql's and run them in routine using "EXECUTE", but is there a way to run the same command (TCL) at dos prompt by any means?

I gave a thought to this and can think of following options:
1. Write a routine and execute it from DOS Prompt (cant find and way out yet).
2. Write a basic program and then compile it and use the exe (can we produce a exe here) to run the desired sql.

Like to have some suggestions (and if somebody has done anything like this, then his implementation technique) for this problem!

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

Post by ray.wurlod »

1. No.
2. No.

Any SQL to be run from the DOS command line would have to be run from a BAT file - DataStage BASIC does not create an "executable" in the operating system sense - all DataStage BASIC code executes within dssh. You can regard dssh as a virtual machine if you like. However, routines can not be executed directly - just as in C they need a "main" program that invokes them. You do not have the tools/skills to construct one of these in the DataStage BASIC environment.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Do a search for Dwn_ExecTCL.exe.
Mamu Kim
sunil_acc
Participant
Posts: 28
Joined: Thu Oct 20, 2005 5:49 am

Post by sunil_acc »

kduke wrote:Do a search for Dwn_ExecTCL.exe.
KIM,
Is this a utility coded by you or its a datastage product utility and comes with a standaed package?

thanks!
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

sunil_acc wrote:
KIM,
Is this a utility coded by you or its a datastage product utility and comes with a standaed package?

thanks!
Does not come inbuilt with Datastage, It's one of Kim's creation.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

It is a little program written by me in VB. They may post source code for something like this in a members only area. If that would be something you might want then ask Dennis the Editor.
Mamu Kim
sunil_acc
Participant
Posts: 28
Joined: Thu Oct 20, 2005 5:49 am

Post by sunil_acc »

kduke wrote:It is a little program written by me in VB. They may post source code for something like this in a members only area. If that would be something you might want then ask Dennis the Editor.
Thanks for help KIM!
i need that code, to understand how that works!if you can provide a way out then it will be a great help!

thanks again!
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I give a lot of code and jobs away now. Dennis wants to hold back on some of this as an incentive to become a member. Depends on the demand. We may give away all my tools if you become a member. Need to make this site at least break even.
Mamu Kim
CharlesNagy
Premium Member
Premium Member
Posts: 66
Joined: Mon Feb 21, 2005 10:40 am
Location: Paris

Post by CharlesNagy »

Just curious as to why you need to run the sql query from the Dos prompt. If you can describe why you need to do it that way, there may be another solution.
sunil_acc wrote:
kduke wrote:It is a little program written by me in VB. They may post source code for something like this in a members only area. If that would be something you might want then ask Dennis the Editor.
Thanks for help KIM!
i need that code, to understand how that works!if you can provide a way out then it will be a great help!

thanks again!
sunil_acc
Participant
Posts: 28
Joined: Thu Oct 20, 2005 5:49 am

Post by sunil_acc »

CharlesNagy wrote:Just curious as to why you need to run the sql query from the Dos prompt. If you can describe why you need to do it that way, there may be another solution.
sunil_acc wrote:
kduke wrote:It is a little program written by me in VB. They may post source code for something like this in a members only area. If that would be something you might want then ask Dennis the Editor.
Thanks for help KIM!
i need that code, to understand how that works!if you can provide a way out then it will be a great help!

thanks again!


I want to query DS_JOBS abd DS_ROUTINES to make a list of the jobs and routines in a particular category/project. We have a lot of ways to get the jobs name (dsjob, dssearch) but i am still not aware os any command that can list all the routines (besides querying DS_ROUTINES).

Hop i make my point clear :)
CharlesNagy
Premium Member
Premium Member
Posts: 66
Joined: Mon Feb 21, 2005 10:40 am
Location: Paris

Post by CharlesNagy »

Yes, I see what you mean. Bit tricky that. Obtainable readily enough within the Datastage environment, but from outside...
sunil_acc wrote:
CharlesNagy wrote:Just curious as to why you need to run the sql query from the Dos prompt. If you can describe why you need to do it that way, there may be another solution.
sunil_acc wrote: Thanks for help KIM!
i need that code, to understand how that works!if you can provide a way out then it will be a great help!

thanks again!


I want to query DS_JOBS abd DS_ROUTINES to make a list of the jobs and routines in a particular category/project. We have a lot of ways to get the jobs name (dsjob, dssearch) but i am still not aware os any command that can list all the routines (besides querying DS_ROUTINES).

Hop i make my point clear :)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Attach to project directory and use dssh command to execute DataStage/SQL query (which must be surrounded by double quotes).

Code: Select all

CD C:\Ascential\DataStage\Projects\MyProject
C:\Ascential\DataStage\Engine\bin\dssh "SELECT JOBNO FROM DS_JOBS WHERE NAME = 'MyJob';"
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