1

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?

capacitive
  • 17
  • 6

1 Answers1

0

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.

cardmagik
  • 1,698
  • 19
  • 17
  • You gave me an idea on it! Although I made some tweaks on other part of the code to jive in, but later then I realized about the confusing apostrophe on that particular code. – capacitive Jul 06 '20 at 18:13