The SQL statement is normally a host variable. The CCSID of the host variable is used as the CCSID of the statement text. In PL/I, it also can be a string expression. In this case, the job CCSID is used as the CCSID of the statement text.
Dynamic SQL statements are processed using the CCSID of the statement text. This affects variant characters. For example, the not sign (¬) is located at 'BA'X in CCSID 500. This means that if the CCSID of your statement text is 500, SQL expects the not sign (¬) to be represented by the value 'BA'X.
If the statement text CCSID is 65535, SQL processes variant characters as if they had a CCSID of 37. This means that SQL looks for the not sign (¬) at '5F'X.