Page 1 of 1

phanthom error

Posted: Fri May 20, 2011 8:57 am
by rsunny
Hi ,

I created a small routine to convert string values to decimal

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H
vLen=len(Arg1)
For Arg2 = vLen To 1 Step -1
If Arg1[Arg2,1]="" or Arg1[Arg2,1]=" "
then
end
else 
abc=Seq(Arg1[Arg2,1]):abc
end  
Next Arg2
Ans=abc
and when i try to run the job i am getting the following error
Program "DSU.StringToDecimal": Line 9, Variable "abc" previously undefined. Empty string used.
Program "DSU.StringToDecimal": Line 9, Variable "abc" previously undefined. Empty string used.
Program "DSU.StringToDecimal": Line 9, Variable "abc" previously undefined. Empty string used.
Program "DSU.StringToDecimal": Line 9, Variable "abc" previously undefined. Empty string used.
Program "DSU.StringToDecimal": Line 9, Variable "abc" previously undefined. Empty string used.


can you please let me know what is the error causing .

Any help is really appreciated

Thanks in advance

Posted: Fri May 20, 2011 9:00 am
by chulett
The error is pretty self-explanatory. You are referencing a variable that has yet to be defined. Solution? Initialize it properly.

Posted: Fri May 20, 2011 9:30 am
by rsunny
Hi craig ,

can you please elaborate to me as to how to initialize it. So do i need to intialize variable "abc" but how should i initailize it?

Any help is really appreciated

Thanks in advance

Posted: Fri May 20, 2011 9:33 am
by rsunny
Hi ,

I have initialized it and its working fine .

Thanks again

Posted: Fri May 20, 2011 9:39 am
by pandeesh
Can you please post the corrected routine?

Posted: Fri May 20, 2011 9:47 am
by chulett
Here, let me take a wild stab at that. :wink:

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H 
vLen=len(Arg1) 
abc=''
For Arg2 = vLen To 1 Step -1 
If Arg1[Arg2,1]="" or Arg1[Arg2,1]=" " 
then 
end 
else 
abc=Seq(Arg1[Arg2,1]):abc 
end  
Next Arg2 
Ans=abc

Posted: Fri May 20, 2011 9:49 am
by pandeesh
thanks craig!!