Passing parameters from Db2 to external procedures

Db2 provides storage for all parameters that are passed to a procedure. Therefore, parameters are passed to an external procedure by address.

This is the normal parameter passing method for programs. For service programs, ensure that the parameters are defined correctly in the procedure code.

When defining and using the parameters in the external procedure, care should be taken to ensure that no more storage is referenced for a given parameter than is defined for that parameter. The parameters are all stored in the same space and exceeding a given parameter's storage space can overwrite another parameter's value. This, in turn, can cause the procedure to see invalid input data or cause the value returned to the database to be invalid.

There are several supported parameter styles available to external procedures. For the most part, the styles differ in how many parameters are passed to the external program or service program.