The Generate SPD File tool enables you to generate stored procedure definition (SPD) files from an extracted DB2 schema. You can use a generated SPD file to generate a COBOL wrapper.
The Generate SPD File tool provides the following functionality:
- Enables you to select one or more stored procedures from a Schema Extract file.
- Generates selected stored procedures into a stored procedure definition file.
- If HCOSS is opened from within the IDE and a SQL Server Database project is open in
Visual Studio, the Generate SPD File tool can also generate a COBOL wrapper program that executes the stored procedures in the SPD file, and include both the SPD file and the generated program in the current project.
Before using the SPD Generator tool, review the following scenarios to help you determine how to best use the tool for any given application or project:
- If any selected stored procedure contains a TIMESTAMP or DATE parameter, the Generate SPD File tool enables its
Publish Post Deployment Script group of options. If
Generate changes is checked for the post deployment script specified, the tool changes TIMESTAMP and DATE DB2 data types to SQL Server DATETIME2 and SMALLDATETIME respectively in the published stored procedure via the post-deployment script ALTER PROCEDURE statement. This ensures compatibility between Java and other .Net languages, such as C# and SQL Server, by generating native .Net date/time data types instead of character string data types in the wrapper code, and correctly setting the published stored procedure data type.
- If your application interfaces exclusively with other COBOL applications, you have the option to edit the generated SPD file and change DATETIME2 back to TIMESTAMP and SMALLDATETIME back to DATE. In this case, do not include a POSTDEPLOY line in the SPD file. This change automatically sets the data type to the COBOL character string type, which is valid only for COBOL callers.
- If your project was created using the SQL Server Database Project template, and one or more of your selected stored procedures contains a DATETIME2 or SMALLDATETIME parameter, you must add the post-deployment script to the project manually before running the Generate SPD File tool. The post-deployment ALTER PROCEDURE statement generated is needed to ensure the SQL Server stored procedure data type is defined correctly.