Page 1 of 1

'Improper Data Type ' Error in Server Routine

Posted: Tue Nov 27, 2007 6:15 pm
by ds_my_job
We have written sever routine which does some multiplications based on certain conditions . The returning value from routine will be assigned to varchar2 field. We are getting ' Improper Data Type ' error when we run the job. The log mentions the line number of the routine and Datastgae Fantom aborting with with @ABORT.CODE = 3. Although not sure if it mentioning the correct line number ? Do we need to any type conversion here ?

Re: 'Improper Data Type ' Error in Server Routine

Posted: Tue Nov 27, 2007 6:22 pm
by jseclen
Can you show the routine code to evaluate???

Re: 'Improper Data Type ' Error in Server Routine

Posted: Tue Nov 27, 2007 6:23 pm
by jseclen
Can you show the routine code to evaluate???

Posted: Tue Nov 27, 2007 6:33 pm
by ray.wurlod
Without the code it's going to be difficult to determine. Improper data type usually arises from an attempt to use a file variable or subroutine variable that have not been properly assigned or which have subsequently been overwritten. However, there are other possible causes. Please post the routine code and the exact error message (complete).

Sample code

Posted: Tue Nov 27, 2007 6:50 pm
by ds_my_job
Sample code

***Initialization section
Ans=""
v_cents_yen=""
v_cents=""
v_cycledate = CYCLE_DT


**If CRNCY OR QUOTED_CRNCY IS IN MINOR CURNCY SET FLAG =2
IF (FLAG = 2) THEN

v_yen=Index(UpCase(FUT_QTE_UNITS),"100 YEN",1)

if(v_yen > 0) then
if(num(PX_SETTLE) and TRIMB(PX_SETTLE_LAST_DT) = v_cycledate) then
Ans = PX_SETTLE * FACTOR * 0.01
end
else
return (-1)
end
end
else
if(num(PX_SETTLE) and TRIMB(PX_SETTLE_LAST_DT) = v_cycledate) then
Ans = PX_SETTLE * FACTOR
end
else
return (-1)
end
END
END

Re: Sample code

Posted: Tue Nov 27, 2007 9:13 pm
by chulett
Your sample code when wrapped in 'code' tags:
ds_my_job wrote:Sample code

Code: Select all

***Initialization section
      Ans=""
      v_cents_yen=""
      v_cents=""
      v_cycledate = CYCLE_DT


**If CRNCY OR QUOTED_CRNCY IS IN MINOR CURNCY SET FLAG =2
      IF (FLAG = 2) THEN

         v_yen=Index(UpCase(FUT_QTE_UNITS),"100 YEN",1)

         if(v_yen > 0) then
            if(num(PX_SETTLE) and TRIMB(PX_SETTLE_LAST_DT) = v_cycledate) then
               Ans = PX_SETTLE * FACTOR * 0.01
            end
            else
               return (-1)
            end
         end
         else
            if(num(PX_SETTLE) and TRIMB(PX_SETTLE_LAST_DT) = v_cycledate) then
               Ans = PX_SETTLE * FACTOR
            end
            else
               return (-1)
            end
         END
      END
First suggestion would be to replace the return statements with Ans assignments that denote an error condition. Pass the "-1" as the Answer if that's what you are going to check for to determine something has gone wrong in the routine.