error-handlingspecial-characterspeoplesoftsqr

(SQR 4008) Unknown function or variable in expression


I have an SQR code like this:

begin-procedure SPL-REMOVE($Vndr_Name_Shrt_Usr, :$outputshrt)

Let $valid_chars_shrt = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -.:/'@0123456789@()=+%*"£$'

Let $invalid_chars_shrt = translate($Vndr_Name_Shrt_Usr, $valid_chars_shrt, '')

Let #invalid_shrt = length($invalid_chars_shrt)

If #invalid_shrt

Let $outputshrt = translate($Vndr_Name_Shrt_Usr, $invalid_chars_shrt, '')

Else

Let $outputshrt = $Vndr_Name_Shrt_Usr

End-if

end-procedure

And upon running the SQR, I am getting this error:

(SQR 4008) Unknown function or variable in expression: @0123456789@ Let $valid_chars_shrt = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -.:/'@0123456789@()=+%*"£$'

May I know why is that so? How can I avoid such error from coming up?


Solution

  • If this is truly the code: Let $valid_chars_shrt = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -.:/'@0123456789@()=+%*"£$'

    The problem lies with the single quote before the @012345678. It unbalances the quoted string. Change it to TWO single quotes '' (not a double-quote). That should work but unless I test it, no guarantees.