LIST UV.ACCOUNT

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
trobinson
Participant
Posts: 208
Joined: Thu Apr 11, 2002 6:02 am
Location: Saint Louis
Contact:

LIST UV.ACCOUNT

Post 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?
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post 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)
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post 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`
Mamu Kim
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

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

Post 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).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
trobinson
Participant
Posts: 208
Joined: Thu Apr 11, 2002 6:02 am
Location: Saint Louis
Contact:

Post 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.
gherbert
Participant
Posts: 9
Joined: Mon Mar 29, 2004 7:58 am
Location: Westboro, MA

Re: LIST UV.ACCOUNT

Post 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.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

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

Post by ray.wurlod »

He sure did! :lol:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
gherbert
Participant
Posts: 9
Joined: Mon Mar 29, 2004 7:58 am
Location: Westboro, MA

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

Post by ray.wurlod »

Still wasting apostrophes, I see! :roll:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ill forgo the use of them in some of my posts to even things out. We wouldnt want to run out! :P
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply