Example for Compiling a File 

The user has written a precompiler program (test.cpc).

Use the command cpc –d DB –u Armstrong,Secret test

to generate the file test.o. In this example, the database instance would be DB, the user Armstrong, and the password Secret.

Use the command cpclnk test

to link the file with the runtime library and to generate an executable program.

If you want a precompiler trace to be written when the test program is executed, you must accordingly set the environment variable SQLOPT to the value -X. In a bash shell, the command would be as follows:

export SQLOPT=-X

When the test program is executed, the precompiler trace is written to the file test.pct. This file is situated in the same directory as the test program.

To test the precompiler you have installed, you can use the SAP DB demo database at http://www.sapdb.org/ ® Software with Sample Database ® Linux ® Create and Test a Sample Database .

Once you have installed the relevant package (5kb), use TST as the database name, TEST as the user and TEST as the user password.

An example of a call you might use to compile the file test.cpc:

cpc -d TST -u TEST,TEST test