HPlogo ALLBASE/SQL Advanced Application Programming Guide: HP 9000 Computer Systems > Chapter 1 Using the Preprocessor

Static Conversion Mode

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

The -D 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

psqlc -D [-i SourceFileName ] [-p ModifiedSourceFileName.c ] [-f FlaggerName ] [-a ] |...|

Static Conversion Mode for Pascal Applications

psqlpas -D [-i SourceFileName ] [-p ModifiedSourceFileName.p ] [-f FlaggerName ] [-a ] |...|

Parameters

-D

indicates that all static SQL statements are to be converted to dynamic statements, dynamic statements remain dynamic, and a module is not created.

-i SourceFileName

identifies the name of the input file containing the source code to be preprocessed. If a SourceFileName is not specified, a file by the name of sqlin is assumed.

-p ModifiedSourceFileName

identifies the name for the modified source code file. If a name is not specified, the preprocessor generated code is written to a file with the same name as SourceFileName but with the file extension .c for a C application and .p for a Pascal application.

-f 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.

-a

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.

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 -f 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:

    LanguageDirective
    Ccc -Aa
    COBOLcob -C ANS85
    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

   psqlc -D -i ProgramName.sql 

Example of Static Conversion Processing of a Pascal Application

   psqlpas -D -i ProgramName.sql 
Feedback to webmaster