How to run SELECT from command line
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 46
- Joined: Tue Aug 21, 2007 5:39 am
- Location: Bangalore, India
How to run SELECT from command line
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.
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.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 46
- Joined: Tue Aug 21, 2007 5:39 am
- Location: Bangalore, India
-
- Participant
- Posts: 46
- Joined: Tue Aug 21, 2007 5:39 am
- Location: Bangalore, India
-
- Participant
- Posts: 46
- Joined: Tue Aug 21, 2007 5:39 am
- Location: Bangalore, India
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.
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.
-
- Participant
- Posts: 334
- Joined: Fri Dec 01, 2006 5:17 am
- Location: Texas
-
- Participant
- Posts: 46
- Joined: Tue Aug 21, 2007 5:39 am
- Location: Bangalore, India
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.