Get the List of Jobs in a text file
Moderators: chulett, rschirm, roy
-
- Charter Member
- Posts: 130
- Joined: Mon Sep 06, 2004 3:05 am
- Location: Dubai,UAE
Get the List of Jobs in a text file
Hi Friends,
I would like to get the list of jobs belonging to a category in a text file.
I am aware of SELECT * FROM DS_JOBS where CATEGORY=''
I tried executing the command in uv and got an error saying DS_JOBS table does not exist.
Can I execute this command in uv?
1) If yes then what am I doing wrong?
2) Also after executing how can I get the result in a text file?
I do not want to execute the command window in the Administrator.
Thanks in Advance,
Sunshine
I would like to get the list of jobs belonging to a category in a text file.
I am aware of SELECT * FROM DS_JOBS where CATEGORY=''
I tried executing the command in uv and got an error saying DS_JOBS table does not exist.
Can I execute this command in uv?
1) If yes then what am I doing wrong?
2) Also after executing how can I get the result in a text file?
I do not want to execute the command window in the Administrator.
Thanks in Advance,
Sunshine
Warm Regards,
Amruta Bandekar
<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
Amruta Bandekar
<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
-
- Participant
- Posts: 57
- Joined: Wed Jan 26, 2005 10:22 pm
- Location: India
Code: Select all
DSHOME=<Your DataStage home directory>
. $DSHOME/dsenv
DSBIN=$DSHOME/bin
PROJDIR=<Your project dir>
cd $PROJDIR
$DSBIN/uv "select * from DS_JOBS where CATEGORY='<your category name>'; > <your txt file>"
Note: You will have to give
Code: Select all
<category name>/<sub category name>
Ashwin
-
- Charter Member
- Posts: 130
- Joined: Mon Sep 06, 2004 3:05 am
- Location: Dubai,UAE
Hi Ashwin,
Thanks for the reply.
I am able to execute the command and see the list of jobs but I am still not able to capture the list in a text file.
It executes the command but does not write to the text file
Thanks,
Sunshine
Thanks for the reply.
I am able to execute the command and see the list of jobs but I am still not able to capture the list in a text file.
It executes the command but does not write to the text file
Thanks,
Sunshine
Warm Regards,
Amruta Bandekar
<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
Amruta Bandekar
<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
Ashwin's line looks correct. If the redirect to the text file is working correctly then you should get no output to your terminal, just to the file. If you are having problems with this you need to post your exact command here or talk to someone savvy in UNIX locally.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Charter Member
- Posts: 130
- Joined: Mon Sep 06, 2004 3:05 am
- Location: Dubai,UAE
Hi,
select * from ds_jobs where category='ELDM\DIMENSIONS'; >/HOME/USER6/TRIAL.TXT
It lists down 8 records.
It does not write to the txt file.
Thanks,
Sunshine
select * from ds_jobs where category='ELDM\DIMENSIONS'; >/HOME/USER6/TRIAL.TXT
It lists down 8 records.
It does not write to the txt file.
Thanks,
Sunshine
Warm Regards,
Amruta Bandekar
<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
Amruta Bandekar
<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
In my environment (UNIX) I used
successfully.
That should give you enough to get it working.
Code: Select all
$DSHOME/bin/uvsh "select * from DS_JOBS" > /tmp/deletemeplease.txt
That should give you enough to get it working.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Charter Member
- Posts: 130
- Joined: Mon Sep 06, 2004 3:05 am
- Location: Dubai,UAE
Hi,
This what I amm trying to do but not able to write to text file.
cd ../DSEngine/bin
$ uv
>Logto LETS_A
>SELECT * FROM DS_JOBS > /home/dsadm/trial1.txt;
DataStage/SQL: syntax error. Unexpected symbol. Token was ">".
Scanned command was FROM DS_JOBS >
Please tell me what am I doing wrong?
Thank You,
Sunshine
This what I amm trying to do but not able to write to text file.
cd ../DSEngine/bin
$ uv
>Logto LETS_A
>SELECT * FROM DS_JOBS > /home/dsadm/trial1.txt;
DataStage/SQL: syntax error. Unexpected symbol. Token was ">".
Scanned command was FROM DS_JOBS >
Please tell me what am I doing wrong?
Thank You,
Sunshine
Warm Regards,
Amruta Bandekar
<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
Amruta Bandekar
<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
Sunshine,
the advice you got so far will work as listed; you have changed this (from an external call into a TCL one) so it won't work and the message clearly states the syntax error.
The concept in UNIX and DOS of using a ">" to redirect output does not work in the TCL environment.
If you really wish to do this you can execute 3 commands:
This will create the text output file in &COMO&/SELECTOUTPUT.TXT
the advice you got so far will work as listed; you have changed this (from an external call into a TCL one) so it won't work and the message clearly states the syntax error.
The concept in UNIX and DOS of using a ">" to redirect output does not work in the TCL environment.
If you really wish to do this you can execute 3 commands:
Code: Select all
COMO ON SELECTOUTPUT.TXT
SELECT * FROM DS_JOBS > /home/dsadm/trial1.txt;
COMO OFF
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Hi ArndW,
Can you please tell me where the above command has been executed?ArndW wrote:In my environment (UNIX) I used
successfully.Code: Select all
$DSHOME/bin/uvsh "select * from DS_JOBS" > /tmp/deletemeplease.txt
That should give you enough to get it working.
Hi,
Seems this was run under the OS command line, after dsenv was loaded.
Seems this was run under the OS command line, after dsenv was loaded.
Roy R.
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
-
- Participant
- Posts: 232
- Joined: Sat May 07, 2005 2:49 pm
- Location: USA
Hi,
Take off the ; at the end of the select and tryselect * from ds_jobs where category='ELDM\DIMENSIONS'; >/HOME/USER6/TRIAL.TXT
Code: Select all
select * from ds_jobs where category='ELDM\DIMENSIONS' > /HOME/USER6/TRIAL.TXT
Thanks,
Naveen
Naveen
There are 2 things going on here. You can run these commands under the control of the Universe shell (uvsh) or Korn (ksh) or Bourne shell (sh).
Has to be under the control of ksh. Once you run uv as a separate command then you cannot redirect because you are under control of the Universe shell and it does not understand > or >>. That is why Arnd suggested using COMO commands. COMO is the Universe way of saving the output of the commands into a file. Where using less than and greater than is the Korn shell way of saving the output by redirecting it. COMO actually duplicates the output.Code:
$DSHOME/bin/uvsh "select * from DS_JOBS" > /tmp/deletemeplease.txt
Mamu Kim
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
DS_JOBS not found
You must be in a project for the DS_JOBS table to exist. If you're in the UV account, there is no DS_JOBS table, which might indicate why you got the "DS_JOBS not found" message.
Redirection using redirection operators does not work at the TCL prompt; instead you can use COMO (as already suggested) or DIVERT.OUT. For example (in a project at TCL):
This will capture the output into a file called capture.txt in your project directory.
Redirection using redirection operators does not work at the TCL prompt; instead you can use COMO (as already suggested) or DIVERT.OUT. For example (in a project at TCL):
Code: Select all
DIVERT.OUT ON &UFD& capture.txt
SELECT * FROM DS_JOBS;
DIVERT.OUT OFF
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.
Hi,
Try this in after subroutine.
Input argument is fully qualified path of the text file
Hope this will work
Try this in after subroutine.
Input argument is fully qualified path of the text file
Code: Select all
ErrorCode = 0 ;* set this to non-zero to stop the stage/job
FilePath = InputArg
Cmd = "select * from DS_JOBS where CATEGORY='Your Category';"
Call DSExecute("UV", Cmd, Output, SystemReturnCode)
NoOfMessage = DCount(Output,@FM)
OPENSEQ FilePath TO fv Then WEOFSEQ fv ; *Try to open the sequential file ,if it exists it will clear the file
Else
CREATE fv Then Ans = "File Created" ; * If file not exists it will create the file
End
for i=1 to NoOfMessage Step 1
Msg = Field(Output,@FM,i)
WriteSeqF Msg To fv Else Exit
Next i
Ans = NoOfMessage