Equalient DataStage function for oracle ceil

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
raj158347
Participant
Posts: 26
Joined: Thu Apr 19, 2007 5:15 am
Location: Chennai

Equalient DataStage function for oracle ceil

Post by raj158347 »

Dear All,
I want to check the below condition...
Like the value
$0 to $100000 output 01
$10001 to $20000 output 02
$20001 to $30000 output 03
$30001 to $4000 output 04 etc....


So i need the equalient dataStage function for oracle ceil

Thanks in advance for your help..

Regards
Raj
Last edited by raj158347 on Wed Jan 02, 2008 4:34 am, edited 1 time in total.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

How would you do that with ceil ?!!

Try

Code: Select all

Mod(InLink.TheColumn,10000) - 1
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
raj158347
Participant
Posts: 26
Joined: Thu Apr 19, 2007 5:15 am
Location: Chennai

Post by raj158347 »

ray.wurlod wrote:How would you do that with ceil ?!!

Try

Code: Select all

Mod(InLink.TheColumn,10000) - 1
...
thanks for your kind reply..Sorry actualy i need if the value like below
$0 to 100000 output 01
$100001 to 200000 output 02
$20001 to 300000 output 03 so if i use ceil function i can get the nearest greatest for the value like ceil (100001/10000) output will be 2 as you know.Excatly i want to do the same.

Thanks & Regards
Raj
Mayur Dongaonkar
Participant
Posts: 20
Joined: Mon Dec 11, 2006 10:57 am
Location: Pune

Post by Mayur Dongaonkar »

This can be achieved by using Switch stage.
Mayur Dongaonkar.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You changed your specification. My solution changes only by losing its "- 1". You can use the Fmt() function to enforce leading zero.

I remain curious to learn how you would generate these values using ceil without any other arithmetic (since you did not mention any).

Switch stage is not available in server jobs and, in any case, would not generate the value that the OP seeks.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
raj158347
Participant
Posts: 26
Joined: Thu Apr 19, 2007 5:15 am
Location: Chennai

Post by raj158347 »

Dear All ..
Thanks for your kind reply...
By using the following code + FMT function it is solved

IF WKLIABUSD = 0 THEN
DIV = 0
QUAS = 1
END
ELSE
DIV = DIV(WKLIABUSD,WKDIVI)
QUAS = WKLIABUSD/WKDIVI
END

IF QUAS > DIV THEN
Ans = DIV+1
END
ELSE
Ans = DIV
END

WKLIABUSD is the value
WKDIVI is divser value

Eg :
WKLIABUSD 98000001
WKDIVI 1000000
Ans is 99


Regards
Raj
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You might like to mark the thread as Resolved, then.
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