Previous Topic: Database Procedure BlocksNext Topic: Specifying When to Call Database Procedures


Establishing Communication Between Programs and Procedures

Program/Procedure Communication

Some database procedures may require specific information from the calling application program (for example, a password for a security routine). Use the application program information block to pass this information. Using the BIND PROCEDURE DML command, the programmer binds space in program variable storage for the information to be passed. At program runtime, whenever the procedure is called, the information in the program space bound to the procedure is placed in the procedure's application program information block.

Executing Under the Central Version in a Different Address Space

If the application program is executing under the central version and in a different address space, the program must bind a 256-byte space in variable storage. Programs running in the same address space as the central version or in local mode can bind a variable amount of space, but 256 bytes is recommended in case of future changes in the operating configuration.

In the central version environment, the BIND procedure DML has the function of passing the information in the application program information block to the database procedure. To get information back from the database procedure, the application program should issue an ACCEPT...FROM...PROCEDURE DML statement. If the application program wishes to send new information to the database procedure, the application program should alter the data in the application program information block and then issue another BIND procedure DML statement, which will cause the central version's copy of the application program information block to be refreshed.

No Information Passed

Usually, no information is passed between the program and the database procedure, since database procedures are normally transparent to application programs. When no information is passed, the database procedure must define the application program information block as a 4-byte alphanumeric item.