Page 1 of 1

LIST UV.ACCOUNT

Posted: Thu Apr 08, 2004 9:57 am
by trobinson
I would like to use this:
echo `${dshome}/bin/dssh "LIST UV.ACCOUNT ${Projectname}FACR1DEV UNIQUE.PATH FMT '256L' HDR.SU
P COUNT.SUP ID.SUP COL.SUP NOPAGE"`
in a shell script and assign its output to a env variable. In English, I want to manipulate the directory path for a passed Project name.
The output of the above command is this:
^[[?1h^[[2J^[[H /opt/ascential/Ascential/DataStage/Projects/<Projectname>

While I can "appreciate" the lovely formatting of this command, I don't want it.

What can be done, Oh rich and powerful UNIX/DataStage Guroos?

Posted: Thu Apr 08, 2004 2:11 pm
by kcbland
Didn't mean for you to have dead air all day. I tried some options, but couldn't figure out a way to purely output the specific result from the command. Everything involved ksh commands to strip off the excess characters. The only other option would be a DS BASIC program that specifically does what you want and outputs it to either stdout or writes a sequential file of content.

Maybe someone should wakeup Ray. 8)

Posted: Thu Apr 08, 2004 4:26 pm
by kduke
It is adding clear screen to the output. Add:

export TERM=dummy
uvsh "LIST UV.ACCOUNT 'DGI' UNIQUE.PATH FMT \"256L\" HDR.SUP COUNT.SUP ID.SUP CO
L.SUP NOPAGE"

You will need a head and a tail to get the third line. Like:

export TERM=dummy
mypath=`uvsh "LIST UV.ACCOUNT 'DGI' UNIQUE.PATH FMT \"256L\" HDR.SUP COUNT.SUP ID.SUP CO
L.SUP NOPAGE" | head -3 | tail -1`

Posted: Thu Apr 08, 2004 4:28 pm
by kduke
It still has a space on the front of the path that you need to strip off. Let me know if you can't finish it.

Posted: Thu Apr 08, 2004 5:28 pm
by ray.wurlod
Prefer SQL to RetrieVe. By default, SQL doesn't generate headers, initial form feeds, and the like.

Code: Select all

SELECT UNIQUE.PATH FMT '256L' FROM UV.ACCOUNT WHERE @ID = 'DGI';
To execute this from a UNIX shell you must be in a directory in which a pointer to UV.ACCOUNT exists. This happens when DS.TOOLS is used in a project (the pointer is not automatically in the account). Or you could cd to the $DSHOME account. For example:

Code: Select all

cd $DSHOME && . ./dsenv && bin/uv "SELECT UNIQUE.PATH FMT '256L' FROM UV.ACCOUNT WHERE @ID = 'DGI';" > ~/tempprojpath
Anyone running a version earlier than 7.x should replace cd $DSHOME with cd `cat /.dshome` or, if it's earlier than version 5.2, with cd `cat /.uvhome` (note the use of backquotes in this command).

Posted: Fri Apr 09, 2004 5:36 am
by trobinson
We got it with this;
plogpath=`${dshome}/bin/dssh "LIST UV.ACCOUNT <Projectname> UNIQUE.PATH FMT '256L' HDR.SUP COUNT.SUP ID.SUP COL.SUP NOPAGE" | sed -e 's/^[^/]*//' | tr -d "\012"`

The sed eliminates everything but two line feeds. The tr does the rest.
I think I like the head tail better but will stick with what I've got cause it is more mysterious, obsure and difficult to understand ... but it does work.

Thanks for the three solutions. It is very appreciated.

Re: LIST UV.ACCOUNT

Posted: Tue Apr 13, 2004 1:32 pm
by gherbert
While I can "appreciate" the lovely formatting of this command, I don't want it.

What can be done, Oh rich and powerful UNIX/DataStage Guroos?
You could also just grab the project path via a unix utility included with the DSEngine, i.e:

Code: Select all

$DSHOME/bin/UVread -f11 $DSHOME/UV.ACCOUNT {PROJECTNAME}
In a shell script you could:

Code: Select all

projPath=`$DSHOME/bin/UVread -f11 ${DSHOME}/UV.ACCOUNT ${PROJECTNAME}`
The '-f11' is the field to be extracted, which happens to contain the project path. Hope this helps, and sorry it's kinda late.

Posted: Tue Apr 13, 2004 5:00 pm
by kduke
Still nice idea. I did not know UVread could get a single field. I have used UVread for years. You must of used UV before DataStage.

Posted: Tue Apr 13, 2004 7:05 pm
by ray.wurlod
He sure did! :lol:

Posted: Wed Apr 14, 2004 8:13 am
by gherbert
:P Uh yep. I wrote and maintained a significant portion of the server engine over the past 13 yrs and have worked with it since it's "Vmark" days....

Posted: Wed Apr 14, 2004 4:28 pm
by ray.wurlod
Still wasting apostrophes, I see! :roll:

Posted: Thu Apr 15, 2004 5:28 am
by chulett
Ill forgo the use of them in some of my posts to even things out. We wouldnt want to run out! :P