Storing the output of Coomands in TCL prompt to a file

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
nkln@you
Premium Member
Premium Member
Posts: 271
Joined: Wed Nov 17, 2004 5:15 am
Location: US

Storing the output of Coomands in TCL prompt to a file

Post 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?
Aim high
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post 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.
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
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