Of course, SQL will not accept your statement, because it can not relate to your CL defined variable. You have to pass a completely setup SQL expression. Example:
dcl &rec *char 10
dcl &sql *char 128
chgvar &rec value(‘TEST’)
chgvar &sql value(‘Insert into qtemp/rrtemp values(‘ *CAT &rec *CAT ‘)’)
Then hand over the string contained in &sql to be processed by RUNSQLSTM. Note that in RPG/RPGLE you can work with parameter markers to pass program-defined variables to SQL!