Guides you through the steps required to create a debug configuration for the COBOL console client application, and use the
Eclipse debugger to run the client and access the MakeCheckAppt Web service.
Set Breakpoints
You want to be able to see when the client program hands off control to the service running in
Enterprise Server.
The code that calls the service is contained in the
MakeCheckAppt-proxy.cbl file. Because the program hands off control at two points in its execution – first to run the MakeAppt operation, and second
to run the CheckAppt operation – set a breakpoint at each hand-off point in the code so you can step through the program from
there.
- From the
Application Explorer view, expand
ProgramRESTClient > client.
- Double-click
MakeCheckAppt-proxy.cbl. This places the source code into the COBOL editor.
- Press
Ctrl+F to search for the following code:
call "InvokeService04"
This is the call that hands execution off to the Web service. You want to set a breakpoint on the code that executes just
before it, which is:
move 256 to wsc-srvc-faultstring-len
- Place your mouse pointer in the left-most column at that line of code, and double-click to set a breakpoint.
Note: When the breakpoint has been set, a dot appears in the left-most column.
- Search for the next instance of:
call "InvokeService04"
and set another breakpoint on the line of code that precedes it.
- Back on the
Application Explorer view, double-click
MakeCheckAppt-app.cbl to open it in the COBOL editor.
- Press
Ctrl+F to search for the following code:
CBL_CANCEL
This line of code cancels
MakeCheckAppt-proxy.cbl
- Set a breakpoint on this line.
Create a debug configuration
- In the
Application Explorer view, click the
ProgramREST project.
- From the main menu, click
Run > Debug Configurations.
- In the left pane, right-click
COBOL Enterprise Server; then select
New Configuration from the context menu.
- At the very top of the right pane, type
ProgramREST into the
Name field.
- On the
General tab click the
Browse button that corresponds to the
Connection and
Server fields.
- Select
ESREST; then click
OK.
Note: If the ESREST
enterprise server instance is the only instance defined in
Enterprise Server, these fields are completed for you.
- In the
Debugging type section, click
to the right of
Type and select
Web Service.
This shows that all debug Web services are invoked by a request from the client.
- Click
Apply; then click
Debug.
- Answer
Yes to any prompts to open views or perspectives.
- In the
Debug view, you should now see an entry for debugging
ProgramREST [COBOL Enterprise Server].
Run the COBOL console client
- From the
Application Explorer view, expand
ProgramRESTClient > COBOL Programs > client.
- Right-click
MakeCheckAppt-app.cbl, and then select
Debug As > COBOL Application from the context menu.
Note: If a
Confirm Perspective Switch message appears, click
Switch.
This places an entry into the
Debug view for the client application.
- In the
Debug view, right-click the bottom-most entry; then select
Resume.
The client invokes a console, and waits for input.
- In the client console, complete the fields as follows to set an appointment slot:
Service Address
|
leave blank
|
Supplemental Query String
|
leave blank
|
Username
|
leave blank
|
Password
|
leave blank
|
Operation
|
1
|
lnk_customer_name
|
Benton Riley
|
lnk_consultant_id
|
8706
|
lnk_time_slot
|
5
|
lnk_date.lnk_yyyy
|
2525
|
lnk_date.lnk_mm
|
1
|
lnk_date.lnk_dd
|
1
|
The client application then resumes execution, and pauses on the breakpoint set on the
move 256 to wsc-srvc-faultstring-len statement.
- Click
Step Into
twice to step just past the
call "InvokeService04" statement and into
schedule.cbl, which opens in an Eclipse window.
- From the Eclipse menu bar, click
Resume
until the debugger breaks on the
call "CBL_CANCEL" statement on line 181 in
MakeCheckAppt-app.cbl.
- Click
Terminate
to terminate
MakeCheckAppt-app.dll execution.
Rerun the COBOL console client
Here you rerun the client, selecting the other operation to see that the appointment has been made.
- In the
Debug view, right-click the
MakeCheckAppt-app.dll entry marked as <terminated>; then select
Relaunch from the context menu.
- In the
Debug view, right-click the bottom-most entry; then select
Resume.
- Complete the fields as follows:
Service Address
|
leave blank
|
Supplemental Query String
|
leave blank
|
Username
|
leave blank
|
Password
|
leave blank
|
Operation
|
2
|
lnk_customer_name
|
Benton Riley
|
lnk_consultant_id
|
8706
|
lnk_date.lnk_yyyy
|
2525
|
lnk_date.lnk_mm
|
1
|
lnk_date.lnk_dd
|
1
|
The client application then resumes execution, and pauses on the
move 256 to wsc-srvc-faultstring-len statement.
- Click
Step Over
repeatedly to step into
schedule.cbl.
- Click
Step Over
a few more times to observe how the debugger moves through the code.
- Click
Resume to return to
MakeCheckAppt-proxy.cbl.
- Click
Resume one more time to position the Debugger on your last breakpoint, which is line 181 in
MakeCheckAppt-app.cbl.
The appointment you set appears on the list in the console on line
[00005] because it is the fifth appointment set for that day.
- Click
Terminate
to terminate execution and stop debugging.
This concludes the tutorial.