Embedded SQL program version for use with the -x option

/* Program name: ocs_test.cp 
 **
 ** Description  : This program declares a cursor which retireves rows
 **  from the 'titles' table based on condition checking for NULLS
 **  in the NON-ANSI style.
 **  The program will be compiled using the -x option which will
 **  use an external configuration file (ocs.cfg) based on the
 **  name of the application. The name of the application is
 **  defined at the time of INITIALIZING the application. Note that
 **  this is a new 11.x feature too.
 */
 
 #include <stdio.h>
 
 /* Declare the SQLCA */
 EXEC SQL INCLUDE sqlca;
  
 EXEC SQL BEGIN DECLARE SECTION;
         /* storage for login name and password */
         CS_CHARusername[30], password[30];
         CS_CHARtitle_id[7], price[30]; 
 EXEC SQL END DECLARE SECTION;
 
  
 /*
 ** Forward declarations of the error and message handlers and
 ** other subroutines called from main().
 */
 void    error_handler();
 void    warning_handler();
 
 int main()
 {
         int i=0 ;
 
         EXEC SQL WHENEVER SQLERROR CALL error_handler();
         EXEC SQL WHENEVER SQLWARNING CALL warning_handler();
         EXEC SQL WHENEVER NOT FOUND CONTINUE ;
 
         /*
         ** Copy the user name and password defined in sybsqlex.h to
         ** the variables declared for them in the declare section.
         */
 
         strcpy(username, "sa");
         strcpy(password, "");
 
         EXEC SQL INITIALIZE_APPLICATION APPLICATION_NAME = "TEST1";
 
         EXEC SQL CONNECT :username IDENTIFIED BY :password ;
         EXEC SQL USE pubs2 ;
    
         EXEC SQL DECLARE title_list CURSOR FOR 
         SELECT title_id, price FROM titles 
                 WHERE price != NULL;
 
         EXEC SQL OPEN title_list ;
         for ( ;; )
         {
                 EXEC SQL FETCH title_list INTO
                           :title_id, :price;
                 if ( sqlca.sqlcode == 100 )
                 {
                           printf("End of fetch! \n");
                           break;
                 }
                 printf("Title ID : %s\n", title_id );
                 printf("Price    : %s\n", price) ;
                 printf("Please press RETURN to continue .. ");
                 getchar();
                 printf("\n\n");
        }
        EXEC SQL CLOSE title_list;
        exit(0);
 
 }
 
 void error_handler()
 {
        . . .}
  
 void warning_handler()
 {
       . . .}

NotePrecompiler option to set in the makefile: cpre -x.

The following is a sample configuration file for the preceding program:

[DEFAULT]
 ;
 
 [TEST1]
 ;This is name of the application set by INITIALIZE_APPLICATION. ;Therefore this
is the section that will be referred to a runtime.
 
 CS_OPT_ANSINULL=CS_FALSE
 
 ;The above option will enable comparisons of nulls in the NON-ANSI
 ;style.