In my TACL, I'm trying to create a variable used as input to an SQLCI command. I want to use a LIKE clause with a % as a wildcard. Every time it replaces the % with a ? causing the SQL statement to not return the desired results.
Code snippitz:
?TACL macro
#Frame
#Set #informat plain
#Set #outformat pretty
#Push stoprun DC fidata var1 mailmast sqlvol sqlsvol IsOpen EMLFile ans emlline
#Push mailfile mfile likeit charaddr sqlin sqlout test
[#Def True text |body|-1]
[#Def False text |body|0]
Intervening code cut out to reduce length - the cutout code works
== select <program name> from <full mailmast filename> where mm_file_prefix
== like "<likename>%" for browse access;
[#If Not [StopRun]
|then|
#Setv test "~%"
#Set #trace -1
#Set SqlIn select mm_program_name from [mailmast] where mm_file_prefix
#appendv sqlin "like ""[LikeIt]~%"" for browse access;"
SQLCI/Inv Sqlin,outv sqlout/
] == end of if
When I run the code, I display the variables, and it has replaced the % with ?
-TRACE- -19-st 1 v Invoking variable :MAILMAST.1 #Set SqlIn select mm_program_name from $DATA5.SQL2510.MAILMAST where mm_file_p refix -TRACE- -20- #appendv sqlin "like ""[LikeIt] ^ -TRACE- -20- Invoking variable :LIKEIT.1 #appendv sqlin "like ""ED?"" for browse access;" -TRACE- -20-d test ? -22-st 1 v SQLCI/Inv Sqlin,outv sqlout/ -TRACE- -23-d sqlin select mm_program_name from $DATA5.SQL2510.MAILMAST where mm_file_prefix like "ED?" for browse access; -24-
Since the % is not there as a wildcard, this SQL statement fails to bring up the proper record.
The question is, how do I put a % into a TACL variable and not get it changed to a ?
Edited to replace duplicate code with the start of the TACL Macro - MEH