Preparing Programs for Static Execution

If you want to prepare a program for static execution with NDZ, the program must be prepared for static execution with NDB beforehand. Please refer to Dynamic and Static SQL Support for more information.

NDZ uses the temporary assembler program created in the Generation Procedure (CMD CREATE) (Step 1 in the following diagram) and relies on the information added to the Natural object during the the Modification Procedure (CMD MODIFY) (Step 3). In addition, the temporary assembler program must be converted into a temporary SQLJ program (Step Z1). Then, the Db2 SQLJ translator generates the SQLJ Profile using the temporary SQLJ program as input (Step Z2). During the final step, the Db2 bind is executed using the SQLJ Profile.

Currently it is not possible to prepare programs for static execution only for NDB or only for NDZ. Both preparations must be executed. Nevertheless, you do not need to complete steps 2, 3 and 4 for programs that are already prepared for static execution with NDB. In this case, for step 1, you must ensure that you use the same list of programs that was used when the program was prepared for static execution with NDB. In addition, you must also make sure that the same DBRM name is used in step Z3. Having a different list of programs and/or a different DBRM name will lead to errors when executing the programs, because the information about the static execution located in the Natural objects will not be accurate. The following chart represents an overview of the necessary steps to prepare a program for static execution with NDZ.

overview of the necessary steps to prepare a program for static execution with NDZ

Here is detailed information about the steps:

This section covers the following topics:


Step 1 - Generation Procedure

This step is described in the Generation Procedure: CMD Create Command section.

Step 2 - Db2 Pre-compiler

This step is described in the Precompilation of the Generated Assembler Program section.

Step 3 - Modification Procedure

This step is described in the Precompilation of the Generated Assembler Program section.

Step 4 - Bind

This step is described in the Bind the Precompiled DBRM section.

Step Z1 - Generate Temporary SQLJ

The temporary assembler program generated in "Step 1 - Generation Procedure" is converted to a SQLJ program.

The Java program com.softwareag.ndz.sqljgen.SQLJGenerator is provided to perform this conversion.

Input Parameters

DBRM name - the name of the generated SQLJ program. This name has to be the same name that was used in Step 1.

DD Names

INPUT - The temporary assembler program that was generated in Step 1.

OUTPUT - The temporary SQLJ program.

Step Z2 - Generate SQLJ Profile

The Db2 SQLJ Translator (sqlj) generates a SQLJ profile using the SQLJ program generated in the previous step as input. The provided shell script genprof.sh executes this task.

Step Z3 - Bind

The Db2 SQLJ Profile binder (db2sqljbind) binds packages for the SQLJ Profile generated in the previous step. The provided shell script bind.sh executes this task.

Shell Scripts for static preparation

setenv.sh - Set the environment variables for Java, Db2 and NDZ.The variables are required by other scripts.

genprof.sh - Generate profile for static execution. Syntax:

genprof ndz_path program
Where ndz_path is the NDZ installation path and program is the SQLJ program that is used to generate the profile.

bind.sh - Bind a static profile to Db2. Syntax:

bind NDZ_PATH url user password program bind_opts

Where ...

  • NDZ_PATH is the installation path of NDZ.

  • url is the URL for Db2 access.

  • user is the username for Db2 access.

  • password is the password for the selected username for Db2 access.

  • program is the Natural program that is accessing Db2.

  • bind_opts is a list of bind options. Every option has to be seperated by a space and carries the same function as Db2 precompile and bind options. For more information, see the BIND PACKAGE command section in the IBM Db2 documentation.