How to run SELECT from command line

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
rajendharreddy
Participant
Posts: 46
Joined: Tue Aug 21, 2007 5:39 am
Location: Bangalore, India

How to run SELECT from command line

Post by rajendharreddy »

Hi,

Can anybody tell me how to run SELECT statement from command line?

SELECT NAME FROM DS_JOBS WHERE JOBTYPEIND='2'

I want to execute above query from command line and get all the sequence names list to a file.

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

Post by ray.wurlod »

Code: Select all

DSHOME=`cat /.dshome` ; export DSHOME
. ${DSHOME}/dsenv
cd ProjectDirPath
${DSHOME}/bin/dssh "SELECT NAME FMT '40T' FROM DS_JOBS WHERE JOBTYPEIND = '2';"
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rajendharreddy
Participant
Posts: 46
Joined: Tue Aug 21, 2007 5:39 am
Location: Bangalore, India

Post by rajendharreddy »

Hi Ray,

Thanks for the reply. Code that you have given can be run in UNIX server. But my server is WINDOWS.

Could you please tell me the command that can be executed from WINDOWS.

Thanks.
rajendharreddy
Participant
Posts: 46
Joined: Tue Aug 21, 2007 5:39 am
Location: Bangalore, India

Post by rajendharreddy »

Thanks Ray, i tried it is working in windows server.
rajendharreddy
Participant
Posts: 46
Joined: Tue Aug 21, 2007 5:39 am
Location: Bangalore, India

Post by rajendharreddy »

Hi,

When I fire any query in DS Administrator I am getting some header in my output. Please see output below.

Query:

SELECT DISTINCT EVAL DS_JOBOBJECTS."INDEX(@RECORD,'\:vTableName:\',1) > 0", DS_JOBS.NAME AS JOB_NAME FMT '40L' FROM DS_JOBS,DS_JOBOBJECTS WHERE DS_JOBS.JOBNO = DS_JOBOBJECTS.OBJIDNO ORDER BY 1,2;

Output:

TRANS ( DS_JOBOBJECTS , J\ : @RECORD < 5 > : \ROOT , 31 , X )
if TRANS ( DS_JOBOBJECTS , J\ : @RECORD < 5 > : \ROOT , 40 , X ) = 2 then Y else N
DEPEND_JOBS........................ SEQ.......

product_load Y
product_staging

1 records listed.


From the above result I would like to filter unwanted lines like (TRANS, DEPEND_JOBS and 1 records listed.).

Since I am running it in a automated fashion DSDesign.exe is not able to report the jobs.

Could anybody tell me how to get this done?

Thanks.
AmeyJoshi14
Participant
Posts: 334
Joined: Fri Dec 01, 2006 5:17 am
Location: Texas

Post by AmeyJoshi14 »

Hey! What is the output when you run your Select query"SELECT NAME FROM DS_JOBS WHERE JOBTYPEIND='2' ;" in Datastage Administrator? :?
rajendharreddy
Participant
Posts: 46
Joined: Tue Aug 21, 2007 5:39 am
Location: Bangalore, India

Post by rajendharreddy »

Output is as follows

Job name.............

product_seq
time_seq


Job name............


geography_seq
personicx_seq


Job name...........
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Search for 'suppress', it has been mentioned several times. Freebie:

viewtopic.php?t=111199
-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 »

You can not, if you are using EVAL, suppress the EVAL message. EVAL expressions must be compiled, and the compiler reports its output. There is no way to disable this.

However, you're trying to cheat on us. The output you give is not from the query you give; the query you give does not have any EVAL in it.

The TRANS functions you have in EVAL expressions can more easily be done with joins, that do not need to be compiled. On the down side, however, you would need field definitions for records 31 and 40 in the file dictionary of DS_JOBOBJECTS for an approach using joins to work.

The "1 records listed." message can be suppressed by using COUNT.SUP in the query immediately before the semi-colon. Column headings and report headings can also be suppressed with the SUPPRESS COLUMN HEADING clause before the ";" query terminator.
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