You can use SQL context files with SQL module language just as
you can use them with precompiled SQL. A context file is an SQL
command procedure containing DECLARE statements that you want to
apply when your program compiles and executes. Context files help
improve the portability of compiled source files.
The format of a context file used with SQL module language is the
same as the one used for precompiled SQL, with one exception. It
is not necessary to end the DECLARE statements with a semicolon
(;) when you use a context file with SQL module language.
However, if you include the semicolon, you can use the context
file with both module and precompiled SQL. When you use a context
file, enter it as the second parameter on the command line.
Suppose an application contains a module that must be compiled
using different SQL dialects. Rather than having two copies
of the module and the problem of maintaining them in parallel,
you can have one module and two context files. The module
contains all the code, and each context file contains the dialect
declaration statement. For example, assume that you need to
compile the module TEST using two different dialects: SQL92 and
MIA. You might create two context files:
o The context file TEST-SQL92 contains the following DECLARE
MODULE statements:
DECLARE MODULE
DIALECT SQL92
o The context file TEST-MIA contains the following DECLARE
MODULE statements:
DECLARE MODULE
DIALECT MIA
You can control the dialect you want to use by compiling the
module with the appropriate context file:
o For TEST to use the SQL92 semantics, compile TEST using the
TEST-SQL92 context file. The following example shows how to
compile the module on OpenVMS:
$ SQL$MOD
SQL$MOD> TEST TEST-SQL92
o For TEST to use the MIA semantics, compile the module TEST
using the TEST-MIA context file. The following example shows
how to compile the module on OpenVMS:
$ SQL$MOD
SQL$MOD> TEST TEST-MIA