I am trying to set the default version for a thread in a cobol program running on a Unisys 2200.

The default version will be decided at runtime by the use of a parameter card and passed to a cobol variable.

The program uses static ESQL for all calls to the database. If i hardcode the version name to use into the program it uses the correct version, however as soon as i try to use dynamic ESQL the default version is ignored.

The code i have used is

EXEC SQL
EXECUTE IMMEDIATE :RDMS-DEFAULT-VERSION
END-EXEC

where rdms-default-version is a string made up to hold 'USE DEFAULT VERSION TUESDAY'

Any help to set the default version at run time would be appreciated.