Pascal ALLBASE/SQL application programs originate as Pascal
source files that are subsequently compiled with the Pascal
compiler and linked by the linker to create an executable
program file. The development of ALLBASE/SQL programs, however,
requires that you preprocess those portions of the program that
contain SQL commands before compilation.
In the case illustrated in Figure 2-1 “Developing a Pascal ALLBASE/SQL Program”, the ALLBASE/SQL Pascal
program consists of one source file and, optionally, one or more
include files. The preprocessor merges any user include file
into the source program, and preprocesses it. The result is a
modified source code file and several preprocessor-generated
include files. These preprocessor include files contain all of
the definitions of variables used by any Pascal statements in
the modified source code file. These two files are then
compiled to produce an object code file, and linked to produce
an executable program file, in the same manner as any other
Pascal program.
In other cases, the ALLBASE/SQL application program might
consist of a main program and one or more subprograms in
separate files. In these cases, only source files containing
SQL commands need to be preprocessed, as illustrated in Figure 2-2 “Developing a Pascal ALLBASE/SQL Program with Subprograms”.
You invoke the Pascal compiler as many times as necessary
to create the desired number of object code files. The files
output by the Pascal preprocessor are treated just as any other
compiler input files at compile time.
During preprocessing, the Pascal preprocessor actually accesses
one of the DBEnvironments to be used by your program at run
time. It can be the same DBEnvironment your program uses at run
time, or a DBEnvironment into which your program is installed.
The preprocessor stores a module in the DBEnvironment which is
executed at run time. The module is used at run time to
optimize and validate DBEnvironment operations.
During any invocation, the Pascal preprocessor can access only
one DBEnvironment. You can create separate subprograms that
all access the same DBEnvironment. Each program is
separately preprocessed and compiled. In this case, the
preprocessor stores multiple modules in one
DBEnvironment.
The criteria governing the division of an application program
into subprograms is very application-dependent. As in the
development of any application program, factors such as program
size, program complexity, expected recompilation frequency, and
number of programmers affect how a program is subdivided. In
the case of ALLBASE/SQL Pascal application programs, the only
additional factors are as follows:
All code containing embedded SQL commands must be preprocessed.
The preprocessor can access only one DBEnvironment at a time.
Each program or subprogram (preprocessed unit) that accesses the
same DBEnvironment must have a unique OwnerName.ModuleName.
The preprocessor can process only one program or subprogram per
invocation.