DB2 10.5 for Linux, UNIX, and Windows

Uses of modules

Modules are used primarily to group object definitions together that have a common business purpose or use.

For example a module might contain all the data types and routines related to inventory management. Such a module might contain all the routines for adding products and product count data to an inventory table, renaming products, removing products from the inventory table, issuing a reorder notice. Another module within the database might contain all the routines for human resources.

Modules provide support for adding routine prototypes and later adding the full routine definition. This is particularly useful when you might have to define a set of routines that contain references to other routines within the set. Since you cannot define a routine with references to another routine that is not yet defined or that might circularly reference the first routine, this can present a problem. Prototypes allow you to define the name and parameters for a routine which once defined can be referenced by other routines. The implementation for the routine can be added in full later.

Once created, the module definition can be deployed for use in other schemas or other databases.