Ensuring that DB2 correctly interprets character input data in REXX programs
DB2® REXX Language Support might incorrectly interpret character literals as graphic or numeric literals unless you mark them correctly.
Procedure
To ensure that DB2 correctly interprets character input data in REXX programs:
Precede and follow character literals with a double quotation
mark, followed by a single quotation mark, followed by another double
quotation mark ("'").
Example: Specify the string the string 100
as "'"100"'".
Enclosing
the string in apostrophes is not adequate, because REXX removes the apostrophes when
it assigns a literal to a variable. For example, suppose that you
want to pass the value in a host variable called stringvar to DB2. The value that you want to
pass is the string '100'. First, you assign the string to the host
variable by issuing the following REXX command:
stringvar = '100'
After
the command executes, stringvar contains the characters 100 (without
the apostrophes). DB2
REXX Language Support then
passes the numeric value 100 to DB2,
which is not what you intended.However, suppose that you write
the following command:
stringvar = "'"100"'"
In this case, REXX assigns
the string '100' to stringvar, including the single quotation marks. DB2
REXX Language Support then
passes the string '100' to DB2,
which is the result that you want.