Static Conversion Mode [ ALLBASE/SQL Advanced Application Programming Guide ] MPE/iX 5.0 Documentation
ALLBASE/SQL Advanced Application Programming Guide
Static Conversion Mode
The DYNAMIC preprocessor command line option provides a means of
converting static SQL statements to dynamic statements with little or no
change to existing source code.
This is termed static conversion processing and provides the flexibility
of running an application with either static processing or dynamic
processing. In addition, an already dynamic application can be
preprocessed without having to specify a DBEnvironment name in the
command line.
This functionality is available for C and Pascal applications.
The following sections describe how to implement this feature. Note that
additional information and examples regarding static and dynamic
processing are found in the language specific ALLBASE/SQL application
programming guides and in later sections in this chapter.
Static Conversion Mode Syntax Specification
Use one of the following statements to both check SQL syntax and create
output files that can be processed by the compiler. All static SQL
statements are converted to dynamic statements. Dynamic SQL statements
remain dynamic. No module is created, and no DBEnvironment is connected
to during preprocessing.
Static Conversion Mode for C Applications.
[FLAGGER (FlaggerName)]
RUN PSQLC.PUB.SYS;INFO= "(DYNAMIC [ANSI ])"
[THREAD ]
Static Conversion Mode for Pascal Applications.
RUN PSQLPAS.PUB.SYS;INFO= "(DYNAMIC [FLAGGER (FlaggerName)])"
[ANSI ]
Parameters
DYNAMIC indicates that all static SQL statements are to
be converted to dynamic statements, dynamic
statements remain dynamic, and a module is not
created. DYNAMIC can be specified in upper
and/or lower case.
FlaggerName is the name of the flagger being invoked. At
this release FIPS127.1 is the only valid
FlaggerName. FlaggerName is not case sensitive.
Refer to the "Flagging Non-Standard SQL with the
FIPS Flagger" chapter in this manual.
ANSI preprocesses the application in ANSI mode. The
preprocessor generates an SQLCA declaration
automatically and implicit updatability is in
effect. Refer to the sections "Understanding
Implicit Updatability" and "Declaring the SQLCA"
in this manual.
THREAD For C applications only; used to support threaded
applications. When specified, the C preprocessor
will not generate the #include "SQLVAR" line at
the beginning of SQLOUT. The user must insert a
#include "SQLVAR" wherever local variables are
required to compile and utilize application
threads successfully.
Description
* The complete set of ALLBASE/SQL syntax can be preprocessed in
static conversion mode with the following execeptions:
* Any DECLARE CURSOR statements must be located in an
executable portion of the code. In the C language, for
example, you would declare the cursor within curly brackets
following any data declaration statements within a given
block. For Pascal, position the statement within a
BEGIN/END block.
* Static host variables in the source code (except for those
used in a BULK FETCH or BULK SELECT statement) are
converted to dynamic parameters. Therefore, such static
host variables must adhere to the specifications for
dynamic parameters. For further information, refer to the
"Using Parameter Substitution in Dynamic Statements"
chapter in this document.
* When you invoke the preprocessor with the FLAGGER option, your
application must contain an ANSI mode compiler directive in order
for the compiler to detect non-standard statements. The following
table lists the appropriate directive for each language:
---------------------------------------------------------------------------------------------
| | |
| Language | Directive |
| | |
---------------------------------------------------------------------------------------------
| | |
| C | ccxl ... ;info='-Aa' |
| | |
---------------------------------------------------------------------------------------------
| | |
| COBOL | $CONTROL STDWARN |
| | |
---------------------------------------------------------------------------------------------
| | |
| FORTRAN | $OPTION ANSI ON$ |
| | |
---------------------------------------------------------------------------------------------
| | |
| Pascal | $standard_level 'ANSI'$ |
| | |
---------------------------------------------------------------------------------------------
Authorization
At run time, the owner of any unqualified object defaults to the user who
is running the application.
Example of Static Conversion Processing of a C Application
RUN PSQLC.PUB.SYS;INFO=" (DYNAMIC)"
Example of Static Conversion Processing of a Pascal Application
RUN PSQLPAS.PUB.SYS;INFO=" (DYNAMIC)"
Before running the preprocessor, remember to equate SQLIN to the name of
the file containing the application you want to preprocess. After
running the preprocessor, save and rename any output files you do not
want overwritten.
MPE/iX 5.0 Documentation