Job Aborts with improper data type

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
shiva459
Premium Member
Premium Member
Posts: 100
Joined: Wed Jun 11, 2003 1:49 am
Location: Bangalore

Job Aborts with improper data type

Post by shiva459 »

Hi All

I am trying to call the below mentioned function in transformer and when I start the job it aborts with reason "Improper data type".When I tested this code in routine it satisfies all the conditions and gives proper results.I understand its very lengthy code and take lot of time to go through to debug it.I assure you that it works as it is supposed to.If any one can guide me from their experience regarding the error or the chances where it can occur would be of immense help.

Thanks in advance.

BUY_RATE1 = BUY_RATE
SELL_RATE1 = SELL_RATE

If TOS = "C" Then
BUY_RATE1 = @NULL
GoTo FrogJump
End
If (BUY_RATE1[1,1] = " " Or (BUY_RATE1[1,1] >=0 And BUY_RATE1[1,1] <= 9)) Then
If Num(Trim(BUY_RATE1)) = 0 Then
BUY_RATE1 = @NULL
GoTo ToadJump
End
If BUY_RATE1[1,1] = "0" And BUY_RATE1[2,1] = " " Then
BUY_RATE1 = "0.00"
GoTo ToadJump
End
If BUY_RATE1[1,2] = "00" Then
BUY_RATE1 = BUY_RATE1 * 2400
GoTo ToadJump
End
If BUY_RATE1[1,2] <> "00" And SELL_RATE1<0.01 Then
If BUY_RATE1 > 0 And BUY_RATE1 < 10 Then
BUY_RATE1 = BUY_RATE1 * 0.24
GoTo ToadJump
End
Else
If BUY_RATE1 >= 10 And BUY_RATE1 < 100 Then
BUY_RATE1 = BUY_RATE1 * 0.024
GoTo ToadJump
End
Else
If BUY_RATE1 >= 100 And BUY_RATE1 < 1000 Then
BUY_RATE1 = BUY_RATE1 * 0.0024
GoTo ToadJump
End
Else
If BUY_RATE1 >= 1000 And BUY_RATE1 < 10000 Then
BUY_RATE1 = BUY_RATE1 * 0.00024
GoTo ToadJump
End
Else
If BUY_RATE1 >= 10000 And BUY_RATE1 < 100000 Then
BUY_RATE1 = BUY_RATE1 * 0.000024
GoTo ToadJump
End
Else
If BUY_RATE1 >= 100000 Then
BUY_RATE1 = BUY_RATE1 * 0.0000024
GoTo ToadJump
End
End
End
End
End
End
End
If BUY_RATE1[1,2] <> "00" And SELL_RATE1 >= 0.01 And SELL_RATE1 < 1 Then
If BUY_RATE1 > 0 And BUY_RATE1 < 10 Then
BUY_RATE1 = BUY_RATE1 * 0.1
GoTo ToadJump
End
Else
If BUY_RATE1 >= 10 And BUY_RATE1 < 100 Then
BUY_RATE1 = BUY_RATE1 * 0.01
GoTo ToadJump
End
Else
If BUY_RATE1 >= 100 And BUY_RATE1 < 1000 Then
BUY_RATE1 = BUY_RATE1 * 0.001
GoTo ToadJump
End
Else
If BUY_RATE1 >= 1000 And BUY_RATE1 < 10000 Then
BUY_RATE1 = BUY_RATE1 * 0.0001
GoTo ToadJump
End
Else
If BUY_RATE1 >= 10000 And BUY_RATE1 < 100000 Then
BUY_RATE1 = BUY_RATE1 * 0.00001
GoTo ToadJump
End
Else
If BUY_RATE1 >= 100000 Then
BUY_RATE1 = BUY_RATE1 * 0.000001
GoTo ToadJump
End
End
End
End
End
End
End
If BUY_RATE1[1,2] <> "00" And SELL_RATE1 >= 1 Then
If BUY_RATE1 > 0 And BUY_RATE1 < 10 Then
BUY_RATE1 = BUY_RATE1
GoTo ToadJump
End
Else
If BUY_RATE1 >= 10 And BUY_RATE1 < 100 Then
BUY_RATE1 = BUY_RATE1 * 0.1
GoTo ToadJump
End
Else
If BUY_RATE1 >= 100 And BUY_RATE1 < 1000 Then
BUY_RATE1 = BUY_RATE1 * 0.01
GoTo ToadJump
End
Else
If BUY_RATE1 >= 1000 And BUY_RATE1 < 10000 Then
BUY_RATE1 = BUY_RATE1 * 0.001
GoTo ToadJump
End
Else
If BUY_RATE1 >= 10000 And BUY_RATE1 < 100000 Then
BUY_RATE1 = BUY_RATE1 * 0.0001
GoTo ToadJump
End
Else
If BUY_RATE1 >= 100000 Then
BUY_RATE1 = BUY_RATE1 * 0.00001
GoTo ToadJump
End
End
End
End
End
End
End
ToadJump:
If (SELL_RATE1 >= 10 And SELL_RATE1 < 20) And BUY_RATE1 < 1 Then
BUY_RATE1 = BUY_RATE1 * 10
GoTo FrogJump
End
If (SELL_RATE1 >= 20 And BUY_RATE1 < 10) Then
BUY_RATE1 = BUY_RATE1 * 10
GoTo FrogJump
End
If BUY_RATE1 < 1 And ((SELL_RATE1 - BUY_RATE1) > 3) Then
BUY_RATE1 = BUY_RATE1 * 10
GoTo FrogJump
End
If (SELL_RATE1 - BUY_RATE1 ) > 10 Then
BUY_RATE1 = BUY_RATE1 * 10
GoTo FrogJump
End
End
If BUY_RATE1[1,3] = "APR" Then
BUY_RATE1 = BUY_RATE1[5,4] * 0.01
If SELL_RATE1 - BUY_RATE1 < -3 Then
BUY_RATE1 = BUY_RATE1 * 0.1
GoTo FrogJump
End
GoTo FrogJump
End
If BUY_RATE1[1,3] = "LMF" Then
BUY_RATE1 = BUY_RATE1[5,4] * 0.024
GoTo FrogJump
End
If BUY_RATE1[1,2] = "AO" Then
If SELL_RATE1 >= 0.01 Then
BUY_RATE1 = SELL_RATE1 - (BUY_RATE1[4,5] * 0.01)
GoTo FrogJump
End
If SELL_RATE1 < 0.01 Then
BUY_RATE1 = SELL_RATE1 - (BUY_RATE1[4,5] * 0.024)
GoTo FrogJump
End
End
FrogJump:
If ((SELL_RATE1 - BUY_RATE1) / BUY_RATE1) > 7 Then
BUY_RATE1 = BUY_RATE1 * 10
GoTo LastJump
End
Else
If BUY_RATE1 >= 30 And BUY_RATE1 < 100 Then
BUY_RATE1 = BUY_RATE1 * 0.1
GoTo LastJump
End
Else
If BUY_RATE1 >= 100 And BUY_RATE1 < 1000 Then
BUY_RATE1 = BUY_RATE1 * 0.01
GoTo LastJump
End
Else
If BUY_RATE1 >= 1000 And BUY_RATE1 <10000 Then
BUY_RATE1 = BUY_RATE1 * 0.001
GoTo LastJump
End
Else
If BUY_RATE1 >= 10000 And BUY_RATE1 < 100000 Then
BUY_RATE1 = BUY_RATE1 * 0.0001
GoTo LastJump
End
End
End
End
End
LastJump:
Ans = BUY_RATE1
Return(Ans)
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Please format your code and the do alt-c before and after pasting it. This will save the indentation. This is unreadable.
Mamu Kim
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

You have a couple issues which it maybe erroring out on. If you use it as a number and it is @NULL. You maybe doing substrings [] on @NULL.

I would also change this into a case statement.

Code: Select all

Begin Case
   Case Num(Arg1)
      Begin Case
         Case Arg1 < 100
             some code...
         Case @TRUE
             default code...
      End Case
    Case @TRUE
      Ans = 0
End Case
Mamu Kim
Post Reply