Currency Format

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Currency Format

Post by arunkumarmm »

Hi All,

Is there a way/Function to change the format of the amount. E.g., Input value is 123456.78 and output should be $123,456.78

Whatever I'm asking is the equivalent of the below server function in parallel:

Server Fn: Oconv(Arg1,"$MD,2")
Arun
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

I don't think there is an equivalent for Oconv function

You can try this awk or you can write your own C++ function

Code: Select all

$ echo 1123456.78 | awk -F'.' ' { y=$1;while ($1/1000 != 0) { x=int($1 /1000); sub("^"x,"&,",y); $1=x } print "$"y"."$2 } '
$1,123,456.78
$ echo 123456.78 | awk -F'.' ' { y=$1;while ($1/1000 != 0) { x=int($1 /1000); sub("^"x,"&,",y); $1=x } print "$"y"."$2 } '
$123,456.78
You are the creator of your destiny - Swami Vivekananda
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

Thanks Anbu.

One more question before I go for one of your suggestions.

BASIC_TRANSFOMER accepts the oconv function in a parallel job. But when I run the job it doesnt provide any proper output for this command. Is there comething we need to do to make it work or It will never work in a parallel job?

If none of the server function will work in a parallel job via Basic_transformer, what is the use of having it?
Arun
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Oconv function should work in BASIC transformer. Check whether you are passing the right arguments to Oconv function
You are the creator of your destiny - Swami Vivekananda
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

I'm using the function in one of the server job which is working fine. I just copied the same into a parallel job and hard coded the value but that doesnt work :cry:

And thanks for your quick replies Anbu, I really appreciate it! I will mark this topic as resolved as all I wanted to know was, whether there is a equivalent function in parallel or not.
Arun
Post Reply