HPlogo ALLBASE/ISQL Reference Manual: HP 9000 Computer Systems > Chapter 3 Using ISQL for Database Tasks

Using Modules

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

A module is a set of one or more preprocessed statements that are stored in the DBEnvironment. Each stored statement is known as a section. ALLBASE/SQL application programs usually access modules that are stored by the preprocessor. You can also create modules interactively with the PREPARE statement in ISQL.

Installing a Module

An installable module, which is created by the ALLBASE/SQL preprocessor before source code is compiled, contains information that ALLBASE/SQL uses to execute the application program's SQL statements at run time. The program can only access the DBEnvironment in which its corresponding module is stored.

Sometimes you need to transfer a user-written application from one DBEnvironment to another. For instance, an application created on a development machine may need to be transferred to a production system. You would need to unload the data from one DBEnvironment and then load it into the new one.

Additionally, to use an application program in a DBEnvironment different from that in which it was developed, you must move the executable application program file and the file containing the installable module to the machine containing the target DBEnvironment.

To store the installable module in the new DBEnvironment, use the ISQL INSTALL command:

   isql=> INSTALL;



   File name> someprog.sqlm;

   Name of module in this file:  Pgmr1.someprog

   Number of sections installed:  6

   COMMIT WORK to save to DBEnvironment.



   isql=>

You can use the ISQL LIST INSTALL command to identify the names of the modules contained in an installable module file. For example:

   isql=> LIST INSTALL;



   File name> someprog.sqlm;

   Name of module in this file:  Pgmr1.someproga

   Name of module in this file:  Pgmr1.someprogb



   isql=>

To copy a module in a DBEnvironment to an installable module file, use the ISQL EXTRACT command:

   isql=> EXTRACT MODULE CEX9 INTO cex9.sqlm;



   Extract     6 sections from module CEX9.



   Number of modules extracted: 1.



   isql=>
NOTE: A module stored in a DBEnvironment by a preprocessor, or a module installed using the ISQL INSTALL command, should never be executed directly from ISQL by typing the name of the module. The module should be executed by running the executable program file.

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

Modules can be created by the preprocessor or the PREPARE statement. The preprocessor inserts a single module into the module installation files. Several module installation files may be joined into a single installation file with the cat command. The PREPARE statement has an interactive option which allows creation of a module through ISQL. The EXECUTE statement can then be used to cause ALLBASE/SQL to execute the statement that was stored with the PREPARE statement. A module created by using the PREPARE statement with ISQL cannot be executed by an application with the preprocessor. For more information on the PREPARE and EXECUTE statements, refer to the ALLBASE/SQL Reference Manual.

Feedback to webmaster