When using
Enterprise Developer, SQL CLR stored procedures are comprised of at least two projects:
- One or more Visual Studio COBOL Library Project(s) that contain your COBOL code.
- One SQL CLR .Publish project from which to deploy your COBOL code for execution as a SQL Server stored procedure.
To successfully issue a COBOL call to a routine from within a SQL CLR stored procedure, do either of the following:
- Include and compile the called routines in the same Visual Studio COBOL Library Project as the stored procedure, which automatically
includes it as part of the stored procedure's assembly. We highly recommend this approach as all CALLs by literal are resolved
at compile time, and because all routines are contained in one assembly, all CALLs by data-name are executed properly.
- Include and compile the called routines in a Visual Studio COBOL Library Project or Projects distinct from the project that
contains the stored procedure.
If you decide to use distinct projects for your stored procedure and called COBOL routines, please be aware of the following:
- To ensure successful deployment, you must also update the SQL CLR .Publish project with references to all Visual Studio COBOL
Library Projects that contain called routines.
- In addition, we recommend that you create references from the project that contains the stored procedure to the projects that
contain called routines. This ensures that all CALLs by literal become static, and can be successfully resolved at run time.
CALLs by data-name and CALLs by literal (without project references) can only execute properly if the assembly that contains
the called routine has been loaded. Use one of these methods to load the assembly:
- In the stored procedure code, before issuing the call, pre-load the called routine's project assembly by setting a corresponding
PROCEDURE-POINTER. Do not include a
.dll extension in the name.
- Be sure that the name of the called routine's project assembly matches the name of the called routine.