Walks you through the tasks of associating the SPCall project with the JCLSP
enterprise server region, starting the region, configuring debug properties, and running the debugger.
Associate the JCLSP Region with the SPCall Project
- In
Server Explorer, expand
Micro Focus Servers > localhost.
- Right-click
JCLSP; then select
Associate With Project > SPCall from the context menu.
Start the JCLSP Region
- On the
Server Explorer list, right-click
JCLSP; then select
Start from the context menu.
- If you are using SQL Server authentication, check
Server is secured; then provide your
Username and
Password. (If you are using Windows authentication, skip this step.)
- Click
OK.
Configure SQL Server Debug Properties
- In Visual Studio, click
View > SQL Server Object Explorer.
- Expand
SQL Server.
- In the list of SQL Server instances, expand your SQL Server instance.
Note: If your SQL Server instance is not listed:
- On the
SQL Server Object Explorer, right-click
SQL Server; then select
Add SQL Server from the context menu.
- On the
Connect to Server dialog box, type
. (dot) into the
Server name field; then click
Connect.
- Repeat this step.
- Expand
Databases; then check the resulting list to ensure that
SQLCLR_Test is listed.
- Right-click your SQL Server instance; then select
Application Debugging to turn it on. When Application Debugging is on, a check mark
appears to its left.
- Right-click your SQL Server instance again; then select
Allow SQL/CLR Debugging to turn it on.
- If prompted, click
Yes.
Set Breakpoints
- In the
Solution Explorer, double-click
SPCall.cbl to open in the COBOL editor.
- In the
COBOL Editor, scroll to:
exec sql
call "GETHIRE" (:EMPID INOUT, :FIRSTNAME OUT,
:LASTNAME OUT, :HIREDATE OUT,
:SQLXCODE OUT)
end-exec
- In the leftmost column on the
exec sql line, click to set a breakpoint.
- From the
Solution Explorer, open
GETHIRE.cbl.
- Scroll to:
MOVE EMPNO TO EMP-EMPNO
and set a breakpoint.
Debug the Program and Stored Procedure
In this section, you use
Enterprise Developer to debug the native COBOL program and the SQL CLR stored procedure.
- Click
. This builds the project and puts the debugger in a wait state.
- In
Solution Explorer, right-click the
SPCall.jcl file; then select
Submit JCL from the context menu.
The JCL script calls the SPCall program and stops at the beginning of the program. Press
F5 to continue execution up to the breakpoint you set in the
SPCall.cbl file.
- Click
.
- On the
Attach to Process dialog box, click
Select.
- On the
Select Code Type dialog box, click
Debug these code types; then check the following boxes:
- Click
OK.
- On the
Attach to Process dialog box, check
Show processes from all users.
- On the
Available Processes list, select the
sqlservr.exe entry that has the
NT Service\MSSQLServer User Name. If you are using a SQL Server named instance, the User Name to select will have the format
NT Service\MSSQL$<instanceName>.
- Click
Attach.
Note: If a prompt appears, click
Attach to clear it.
- Click
.
The debugger steps into the .NET SQL CLR stored procedure code. This demonstrates debugging in a mixed native/.NET environment.
- To continue debugging, press
F10; when the debugger reaches another breakpoint, press
F10 again.
- Press
F5 to run the program to its completion.
- Click
Stop Debugging
to stop the Debugger.