To use the ALLBASE/SQL preprocessors, do the following steps:
In the source code, define the alias name of the DBEnvironment to be
accessed on the server.
begin
.
.
.
EXEC SQL CONNECT TO 'AliasName';
.
.
.
EXEC SQL RELEASE;
end
|
You can specify an alias name dynamically by using a host variable. For example:
EXEC SQL BEGIN DECLARE SECTION;
AliasName: packed array [1..128] of char;
.
.
.
EXEC SQL END DECLARE SECTION;
EXEC SQL CONNECT TO :AliasName;
|
Invoke the preprocessor on the client and use the AliasName for
the DBEnvironment. In the following example, the preprocessor for
Pascal is used on the Series 800.
$ psqlpas AliasName -i mysource.sql -p mysource.p -o serverlogin -m mymodule
|
where:
AliasName is the name of the alias profile described in the AliasDB file.
mysource.sql is the name of the source file.
mysource.p is the name of the modified source code file.
owner is the server login name on the server that is specified in the NETUsers file. The owner has implicit RUN authority on the module created.
mymodule is the name of the module to be stored.
A module is created and stored in the system catalog of the
DBEnvironment on the server. The modified source code file and
the include files created by the preprocesor remain on the
client.
Compile and link the modified source file with the necessary libraries on the client.
$ pc mysource.p -lsql -lportnls -o someprog.r
|
where:
mysource.p is the modified source code file.
the -lsql option tells the compiler to link with the runtime library /usr/lib/libsql.a.
the -lportnls option tells the compiler to link with the native language routines.
the -o option causes the creation of the executable output file someprog.r.
The executable program resides on the client. The program
someprog.r is now ready to run from the client to access the
DBEnvironment on the server.
For more information on preprocessors, refer to the ALLBASE/SQL application
programming guide for the language you are using.