phanthom error

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
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

phanthom error

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The error is pretty self-explanatory. You are referencing a variable that has yet to be defined. Solution? Initialize it properly.
-craig

"You can never have too many knives" -- Logan Nine Fingers
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

Post 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
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

Post by rsunny »

Hi ,

I have initialized it and its working fine .

Thanks again
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Can you please post the corrected routine?
pandeeswaran
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

thanks craig!!
pandeeswaran
Post Reply