One solution could be to define the SQL statements within a copy file.
Copy file ‘SQLVarTabName.cpy’:
EXEC SQL
select * from TabName
where x = z
END-EXEC
Cobol source:
If recNumber = 2000
copy SQLVarTabName replacing TabName by ==A==.
end-if
If recNumber = 2100
copy SQLVarTabName replacing TabName by ==B==.
end-if
Freundliche Grüsse
Werner Lanter