if else statement

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
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Create a stage variable called "DaysDiff" with your date subtraction
In your derivation for column C use

Code: Select all

IF DaysDiff < 365 THEN DSLink3.ColC ELSE (DSLink3.ColC*365)/(DaysDiff)
. Note that the answer for a difference of 1096 is the same formula as for => 365.
datastgnewbie
Participant
Posts: 4
Joined: Tue Mar 28, 2006 11:06 am

Post by datastgnewbie »

Thanks for the response, but i'm getting an error of Fractional truncation
the field is defined as numeric (18) the number is 852.377 is there a way to fix this?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use Int() function to get the largest integer less than or equal to a particular number.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
datastgnewbie
Participant
Posts: 4
Joined: Tue Mar 28, 2006 11:06 am

Post by datastgnewbie »

thank-you for the response, i tried that but its not giving me the decimal, I'm going to change the format from numeric to decimal hopefully that will help. thank-you have a good night
Post Reply