Many of the deployment considerations and techniques for DB2 on LUW also apply to DB2 on zSeries. The skills and tools you have learned for DB2 LUW can be leveraged for zSeries.
Deploying SQL Procedures
In order to build an SQL stored procedure on zSeries, you can use JCL or the DB2 Development Center. Issuing the CREATE PROCEDURE statement only registers the procedure to the DB2 catalog; however, it does perform the compilation and bind steps required for the procedure to be ready to be executed. If you store your CREATE PROCEDURE statements in a script file and execute this script from the CLP at the DB2 client machine while connected to a DB2 for zSeries subsystem, you will receive an error and the procedures will not build. Therefore, in order to deploy SQL procedures on zSeries, we recommend you use the DB2 Development Center. The methodology for using the Development Center to deploy a stored procedure is similar to LUW:
Deploying Functions and Triggers
In order to build functions on zSeries, you can use CREATE FUNCTION. Unlike stored procedures, this statement is enough to register and build the function. Therefore, in order to deploy functions on zSeries, you can include in a script file all the CREATE FUNCTION statements and execute them from the command line, either using SPUFI or from a DB2 LUW client connected to the DB2 for series zSeries subsystem. Moreover, there is no support in the Development Center to work with functions on zSeries.
Similar to functions, a CREATE TRIGGER statement is enough to register and build a trigger on zSeries. Triggers can only be deployed from the command line; the Development Center cannot be used because there is no support to develop triggers from this tool.
As with LUW, we recommend you create separate scripts for functions and triggers. SQL stored procedures cannot be deployed with scripts.
Deployment Considerations Based on Your C Compiler Requirements
A DB2 for zSeries SQL stored procedure is converted into a C language program as part of the build process. To deploy a procedure from a source DB2 for zSeries subsystem to a target DB2 for zSeries subsystem, you need to consider if the target system has a C/C++ compiler enabled or not. If the target system does not have a C/C++ compiler enabled, a methodology similar to deploying other programs on the mainframe can be followed:
If you were developing your procedures using the Development Center, the Export option can be used to extract the CREATE PROCEDURE statements. If the Development Center was not used, these statements are stored in the source DB2 subsystem catalog table SYSIBM.SYSROUTINES_SRC.
This method will not work for zSeries UDFs and triggers where CREATE FUNCTION and CREATE TRIGGER not only register these objects but also create the corresponding packages using a C compiler; therefore, they cannot be deployed if the target system does not have this compiler.
If the target system does have a C/C++ compiler enabled, in addition to the method already mentioned, the methods described in earlier sections of this chapter can be followed.