Page 1 of 1

Storing the output of Coomands in TCL prompt to a file

Posted: Thu Apr 10, 2008 9:19 pm
by nkln@you
Hi ,

I want to store the output of the following command at TCL prompt to a file
(bascially an excel)

SELECT DS_JOBS.NAME AS JOB_NAME, DS_JOBS.CATEGORY, DS_JOBOBJECTS.NAME AS OBJECT_NAME, DS_JOBOBJECTS.OLETYPE, EVAL DS_JOBOBJECTS."if index(upcase(@RECORD),'TERRITORY_AMOUNT_FACTOR',1) > 0 then 'FOUND' else ''" AS FOUND FMT '5L' FROM DS_JOBS, DS_JOBOBJECTS WHERE DS_JOBS.JOBNO = DS_JOBOBJECTS.OBJIDNO and FOUND = 'FOUND' GROUP BY JOB_NAME, DS_JOBS.CATEGORY, OBJECT_NAME, DS_JOBOBJECTS.OLETYPE, FOUND ;

Is there any way to achieve this?

Posted: Fri Apr 11, 2008 12:14 am
by ray.wurlod
Yes, but first are the column widths adequate? You may need additional FMT specifiers.

Research the commands COMO and DIVERT.OUT in your UniVerse documentation.

Another way is to redirect stdout of your DataStage shell. For example

Code: Select all

cd $ProjectDir

. $DSHOME/dsenv

$DSHOME/bin/dssh "SELECT NAME FMT '30L', CATEGORY FMT '30L' FROM DS_JOBS WHERE NAME = '<<Job Name>>';" > /tmp/job_category.rpt

Posted: Sat Apr 12, 2008 7:05 pm
by kduke
The is a job included with EtlStats which will take a SQL statement like this and turn it into a web page and mail it as an attachement to any list of users you want. SQL can be run against uvlocal or any DSN you like.

Posted: Sat Apr 12, 2008 7:08 pm
by ray.wurlod
This won't help; I include it for interest only.

UniVerse version 10 (the first after the split from DataStage) introduced a TO.XML keyword that dumps the result of the query as an XML document. Further options allow this to be attribute-centric or element-centric, and to include DTD or to exclude it. It's a pretty neat interface. It's also available in UniData version 7.