Precompiler Syntax

You can use either a slash (/) or a hyphen (-) to designate a sqlprep precompiler option. For example, /DB server_name.database_name and -DB server_name.database_name are equivalent.

The sqlprep syntax is as follows:

sqlprep program_filename [/SQLACCESS | /NOSQLACCESS]
[/FLAGGER {ENTRY | NONE}] [/DB [server_name.]database_name
/PASS login[.password]] [/BIND filename] [/MSG filename] [/NOLOGO] [/PLAN name] [/NOLINES] [/user_defined_option]

where

program_filename

Is the filename (without the extension) of the Embedded SQL program for precompiling. The precompiler searches for the file name and the file extension .SQC. For example, if you run sqlprep myprogrm, sqlprep searches for MYPROGRM.SQC and precompiles it if it is found.

/SQLACCESS

Specifies that sqlprep will automatically create stored procedures for static embedded SQL sections of the program. You must also include /DB and /PASS to specify a direct connection to SQL Server for creating the stored procedures, or /BIND to create a bind file for later loading of the stored procedures. Note that for standard cursors, the original SELECT statement is used directly, and the stored procedures that were created by the /SQLACCESS option are not used.

/NOSQLACCESS

Specifies that sqlprep will not automatically create stored procedures for static embedded SQL sections of the program. If you also include /DB and /PASS to specify a direct connection to SQL Server, sqlprep responds as follows:

/FLAGGER

Specifies sending static SQL statements to the server at compile time for syntax checking. Syntax or compilation error messages that are generated from the server are displayed on the screen. If you specify the /FLAGGER option, you must also specify the /DB and /PASS options. You cannot use the /PLAN or /SQLACCESS options with the /FLAGGER option.

ENTRY

Specifies that the static SQL sections are also checked for FIPS 127-2 SQL compliance. If the precompiler encounters SQL statements that do not conform to the specified FIPS level of support, an error message is displayed on the screen or stored in the file specified by the /MSG option. Program output is generated the same as when you use the /NOSQLACCESS option (that is, stored procedures are not created).

NONE

Specifies that the static SQL sections are not checked for FIPS 127-2 SQL compliance but are checked for correct syntax. The existence of database objects that the sections refer to is also verified.

/DB

Specifies a database, and optionally a SQL Server, in which to put stored procedures for the access plan. If SQL Server is running on your local computer, you need to supply only the database_name. Whenever you use the /DB option, you must also use the /PASS option. For more information about using /DB see "Access Plan and Bind File Options," later in this chapter.

[server_name.]database_name

Is the same server name and/or database name that is in the Embedded SQL CONNECT TO statement in the program.

/PASS

Specifies $INTEGRATED support for the login[.password] parameter, so that the precompiler can use integrated security regardless of the server's security mode. The compile-time connection is force integrated. Any implicit run-time connection is also force integrated. Whenever you use the /PASS option, you must also use the /DB option. For more information about using /PASS, see "Access Plan and Bind File Options," later in this chapter.

login[.password]

Is a user's login ID and password, or a user's login ID only.

/BIND

Specifies that the extension .BND be automatically appended to the filename. The bind file is an isql script that can be used to create the desired stored procedures (it includes CREATE PROCEDURE statements). For more information about using /BIND, see "Access Plan and Bind File Options," later in this chapter.

When you create a bind file, you must use the Embedded SQL CONNECT TO statement to connect to the server. If you use this option and no stored procedure is created, the bind file is deleted.

filename

Is the name of a bind file (without an extension) to create in place of access plans.

/MSG

Specifies that the extension .MSG be automatically appended to the filename. If the file has a length of 0 after precompile, it is deleted.

filename

Is the name of a file (without an extension) to create to store error messages that are sent by the sqlprep precompiler.

/NOLOGO

Specifies suppression of the sqlprep banner and the compiler banner (sqlprep invokes the compiler).

/PLAN name

Specifies a non-default name for an access plan. (The default name is the program_filename without an SQL extension.)

/NOLINES

Specifies that the generated .C file be displayed for debugging instead of the .SQC file. You must use the /NOLINES option if the .SQC source code contains C language code that appears on the same line after an EXEC SQL statement.

/user_defined_option

Is a user-defined option to be passed to the C compiler.