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.
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:
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).
Code:
$DSHOME/bin/uvsh "select * from DS_JOBS" > /tmp/deletemeplease.txt
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.
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):
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