Deploying a native SQL procedure to another Db2 for z/OS server

When deploying a native SQL procedure to another Db2 for z/OS® server, you can change the bind options to better match the deploying environment. The procedure logic remains the same.

Before you begin

Deprecated function: The DEPLOY bind option is deprecated. For best results, deploy compiled SQL functions and native SQL procedures to multiple environments by issuing the same CREATE or ALTER statements separately in each Db2 environment.
Requirements:
  • The remote server must be properly defined in the communications database of the Db2 subsystem from which you deploy the native SQL procedure.
  • The target Db2 subsystem must be operating at a PTF level that is compatible with the PTF level of the local Db2 subsystem.

Procedure

To deploy a native SQL procedure to another Db2 for z/OS server:

Issue the BIND PACKAGE command with the following options:
DEPLOY
Specify the name of the procedure whose logic you want to use on the target server.
Tip: When specifying the parameters for the DEPLOY option, consider the following naming rules for native SQL procedures:
  • The collection ID is the same as the schema name in the original CREATE PROCEDURE statement.
  • The package ID is the same as the procedure name in the original CREATE PROCEDURE statement.
COPYVER
Specify the version of the procedure whose logic you want to use on the target server.
ACTION(ADD) or ACTION(REPLACE)
Specify whether you want Db2 to create a new version of the native SQL procedure and its associated package or to replace the specified version.
Optionally, you can also specify the bind options QUALIFIER or OWNER if want to change them.

Examples

Deploying the same version of a procedure at another location
The following BIND command creates a native SQL procedure with the name PRODUCTION.MYPROC at the CHICAGO location. This procedure is created from the procedure TEST.MYPROC at the current site. Both native SQL procedures have the same content and version, ABC. However, the package for the procedure CHICAGO.PRODUCTION.MYPROC has XYZ as its qualifier.
CREATE PROCEDURE TEST.MYPROC VERSION ABC LANGUAGE SQL ...
BEGIN
 ...
END

BIND PACKAGE(CHICAGO.PRODUCTION) DEPLOY(TEST.MYPROC) COPYVER(ABC)
                                 ACTION(ADD) QUALIFIER(XYZ)
Replacing a version of a procedure at another location
The following BIND command replaces version ABC of the procedure PRODUCTION.MYPROC at the CHICAGO location with version ABC of the procedure TEST.MYPROC at the current site.
BIND PACKAGE(CHICAGO.PRODUCTION) DEPLOY(TEST.MYPROC) COPYVER(ABC)
                                 ACTION(REPLACE) REPLVER(ABC)