how to get the output of the unix command:'echo "obase=

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
lynnliu
Premium Member
Premium Member
Posts: 40
Joined: Tue Oct 28, 2003 7:13 pm

how to get the output of the unix command:'echo "obase=

Post by lynnliu »

hi,

i want to get the 36 base decimal through the unix shell like bellows,

Code: Select all

$echo "obase=36;99999999999"|bc
in DataStage routine using

Code: Select all

InputArg = 'echo "obase=36;'
InputArg = InputArg : LongNum: '"|bc'
Call DSExecute("UNIX",InputArg,Output,SystemReturnCode)
But i can not catch the output of the shell.
How to catch the output of this kind of shell?

Regards
Thanks!!
ogmios
Participant
Posts: 659
Joined: Tue Mar 11, 2003 3:40 pm

Re: how to get the output of the unix command:'echo "ob

Post by ogmios »

It's your output argument.

Put a DSLogInfo using output after executing the instruction.

Also watch out that anything you run with DSExecute runs using a very minimal UNIX environment unless you make changes to your DataStage installation.

Ogmios
In theory there's no difference between theory and practice. In practice there is.
Amos.Rosmarin
Premium Member
Premium Member
Posts: 385
Joined: Tue Oct 07, 2003 4:55 am

Post by Amos.Rosmarin »

meaning

Code: Select all

Call DSLogInfo ("output is - " : Output , '')
and you'll see it in the log




HTH
lynnliu
Premium Member
Premium Member
Posts: 40
Joined: Tue Oct 28, 2003 7:13 pm

Post by lynnliu »

sorry, i didn't explain clearly.

i know that the output in the Output argument.
i using DSLogInfo in my routine

Code: Select all

call DSLogInfo("*** Output from the command was: ":Output, RoutineName)
i got only one blank space in Output.

if the command like this :

Code: Select all

'echo 9999'
,the Output return "9999". I don't know how to get the result of this command

Code: Select all

 $echo "obase=36;9999"|bc
Thanks!!
magma
Premium Member
Premium Member
Posts: 10
Joined: Wed Apr 14, 2004 11:35 pm
Location: Australia
Contact:

Post by magma »

works for me if I try...

echo "obase=36 \n 9999" | bc
Last edited by magma on Mon Nov 01, 2004 8:26 pm, edited 2 times in total.
Michael
Magma Computing Solutions
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

$echo is a reference to a shell variable. Perhaps that shell variable is not defined, or has "" assigned to it? This would be a "do nothing" command with no output.

Try it without the $ character at the beginning.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
lynnliu
Premium Member
Premium Member
Posts: 40
Joined: Tue Oct 28, 2003 7:13 pm

Post by lynnliu »

Michael, you mean you can get the same output in DSExecute as in terminal? My problem is it works well in terminal but not in DSExecute.
Ray, i didn't use "$" in my routine. i used it to explain the shell command in last post . Is the problem of double quotation marks or pipe operator?
lynnliu
Premium Member
Premium Member
Posts: 40
Joined: Tue Oct 28, 2003 7:13 pm

Post by lynnliu »

The Problem solved!! Thanks All!!

i change the command to

Code: Select all

echo 'obase=36;9999'|bc
In DSExecute:

Code: Select all

call DSExecute("UNIX","echo 'obase=36;9999'|bc",Output,SystemReturnCode)
it works!!
Post Reply