KBADifferent does not work Fractional part of Dec is 10 dig

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

kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Please use code tags so that formatting is preserved. I think I see the issue with your changes, but please re-paste with tags.
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
DS4DRIVER
Premium Member
Premium Member
Posts: 39
Joined: Thu Oct 30, 2003 1:37 pm

Post by DS4DRIVER »

Code: Select all

      PRECISION 14
      DataIn1 = TRIM(Arg1)
      DataIn2 = TRIM(Arg2)


      If (IsNull(DataIn1) and Not(IsNull(DataIn2))) or (IsNull(DataIn2) and Not(IsNull(DataIn1))) Then
         Ans = @TRUE
      End Else
         If IsNull(DataIn1) and IsNull(DataIn2) Then
            Ans = @FALSE
         End Else
            If (Not(NUM(DataIn1)) and NUM(DataIn2)) Or (Not(NUM(DataIn2)) and NUM(DataIn1)) Or (Not(NUM(DataIn1)) and Not(NUM(DataIn2))) Then
               If DataIn1 = DataIn2 Then
                  Ans = @FALSE
               End Else
                  Ans = @TRUE
               End
            End Else
               If SCMP(DataIn1,DataIn2) = 0 Then
                  Ans = @FALSE
               End Else
                  Ans = @TRUE
               End
            End

         End

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

Post by ray.wurlod »

Did you try

Code: Select all

Compare(DataIn1, DataIn2, "R") 
?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DS4DRIVER
Premium Member
Premium Member
Posts: 39
Joined: Thu Oct 30, 2003 1:37 pm

Post by DS4DRIVER »

Compare does not work in a situation where the args compared are numbers like 2335567.7700000000 and 2335567.77
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

This may be a cleaner way of expressing the logic:

Code: Select all

      PRECISION 14 

      DataIn1 = TRIM(Arg1) 
      DataIn2 = TRIM(Arg2) 

      Begin Case
      Case (IsNull(DataIn1) and Not(IsNull(DataIn2))) or (IsNull(DataIn2) and Not(IsNull(DataIn1)))
         Ans = @TRUE 
      Case IsNull(DataIn1) and IsNull(DataIn2)
         Ans = @FALSE 
      Case NOT(NUM(DataIn1) and NUM(DataIn2))
         If DataIn1 = DataIn2 Then Ans = @FALSE Else Ans = @TRUE 
      Case NUM(DataIn1) and NUM(DataIn2)
         If SCMP(DataIn1,DataIn2) = 0 Then Ans = @FALSE Else Ans = @TRUE 
      Case @TRUE
         Ans = @FALSE
      End Case
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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

PRECISION 14 

      DataIn1 = TRIM(Arg1) 
      DataIn2 = TRIM(Arg2) 
      IsNull1 = IsNull(DataIn1)
      IsNull2 = IsNull(DataIn2)

      Begin Case 
      Case IsNull1 + IsNull2 = 1  ; * either is null but not both
         Ans = @TRUE 
      Case IsNull1 + IsNull2 = 2  ; * both are null
         Ans = @FALSE 
      Case NOT(NUM(DataIn1) and NUM(DataIn2)) 
         Ans =  (DataIn1 <> DataIn2 )
      Case NUM(DataIn1) and NUM(DataIn2) 
         Ans = (SCMP(DataIn1,DataIn2) <> 0)
      Case @TRUE 
         Ans = @FALSE 
      End Case
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DS4DRIVER
Premium Member
Premium Member
Posts: 39
Joined: Thu Oct 30, 2003 1:37 pm

Post by DS4DRIVER »

I am not able to see the full contents of the reply that Ken and Ray posted.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Premium membership is only a few cents per day, and is totally devoted towards paying for the bandwidth charges for DSXchange. With premium membership you WILL be able to see all of the premium posters' posts.
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