HPlogo ALLBASE/NET User's Guide: HP 9000 Computer Systems > Chapter 3 Using ALLBASE/SQL Through ALLBASE/NET

Using the ALLBASE/SQL Preprocessors

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

To use the ALLBASE/SQL preprocessors, do the following steps:

  1. In the source code, define the alias name of the DBEnvironment to be accessed on the server.

      begin
    
      .
    
      .
    
      .
    
      EXEC SQL CONNECT TO 'AliasName';
    
      .
    
      .
    
      .
    
      EXEC SQL RELEASE;
    
      end
    

    You can specify an alias name dynamically by using a host variable. For example:

      EXEC SQL BEGIN DECLARE SECTION;
    
    
    
      AliasName: packed array [1..128] of char;
    
    
    
          .
    
          .
    
          .
    
      EXEC SQL END DECLARE SECTION;
    
      EXEC SQL CONNECT TO :AliasName;
    
  2. Invoke the preprocessor on the client and use the AliasName for the DBEnvironment. In the following example, the preprocessor for Pascal is used on the Series 800.

      $ psqlpas AliasName -i mysource.sql -p mysource.p -o serverlogin -m mymodule
    

    where:

    1. AliasName is the name of the alias profile described in the AliasDB file.

    2. mysource.sql is the name of the source file.

    3. mysource.p is the name of the modified source code file.

    4. owner is the server login name on the server that is specified in the NETUsers file. The owner has implicit RUN authority on the module created.

    5. mymodule is the name of the module to be stored.

    A module is created and stored in the system catalog of the DBEnvironment on the server. The modified source code file and the include files created by the preprocesor remain on the client.

  3. Compile and link the modified source file with the necessary libraries on the client.

      $ pc mysource.p -lsql -lportnls -o someprog.r
    

    where:

    1. mysource.p is the modified source code file.

    2. the -lsql option tells the compiler to link with the runtime library /usr/lib/libsql.a.

    3. the -lportnls option tells the compiler to link with the native language routines.

    4. the -o option causes the creation of the executable output file someprog.r.

    The executable program resides on the client. The program someprog.r is now ready to run from the client to access the DBEnvironment on the server.

For more information on preprocessors, refer to the ALLBASE/SQL application programming guide for the language you are using.

Feedback to webmaster