IBM z/OS Debugger v14.2.3 introduces debugging or collecting code coverage on multiple steps for existing JCL. Lets take a step-by-step tour of this new feature.
Creating the launch configuration
There are several ways to create a z/OS Batch Application with existing JCL launch configuration:
- To create a launch from scratch, there are two options:
- From the toolbar, select the Debug Configurations menu from the Debug button pull-down menu:

- From the main menu, select Run>Debug Configurations:

From there you will need to right-click on the launch type, and click on the New button: 
And then fill out all the required fields,
- Another, simpler way, is to access the Debug As context menu for the JCL. This can be done by right-clicking in the JCL Editor, or (and this is the way I prefer to do it), by right-clicking in the Remote Systems view:

Selecting the steps
Once I have selected the launch from the Debug As context menu, I am prompted to select one or more steps to debug. Here I will choose to debug STEPA and STEPC, then click OK:
New JCL is generated and then automatically submitted to the z/OS system.
Debug View
As the debug session initializes, I see the Debug view being populated with several items.
- The top level item is the launch configuration that was automatically created when I clicked on the Debug As menu action. Its children are debug targets (always listed first) followed by processes.
- The first debug target, represents the JCL that was submitted to z/OS. It provides some general status on how the job is running.
- The next debug target is for the first step I requested to debug. I can see the step name (STEPA) as part of the debug target name, and that we are already suspended from execution along with the threads and the call stack for my program TBND009.
- The final debug target is the second step I requested to debug. The step name is again visible (STEPC) and since this step has not started executing, it remains in pending state.
- The last item is the process for the step currently executing. The step name is visible so that when additional steps begin their execution, and the processes for those steps are added, I can differentiate between them.
Show in Remote Systems
If I want to know more about the JCL that was generated and submitted, I can right-click on the JCL debug target, and select the Show in Remote Systems from the context menu:
This takes me to the Remote Systems view - where I can do interesting things like Show JCL:
And see exactly what was generated (highlighted text generated to trigger z/OS Debugger):
Debugging the first step
Closing the JCL and returning to the Debug view, I can now debug my first step, looking through the variables, setting breakpoints, etc.
When I am done, I can either click on the Resume button to run to completion, or click Terminate to stop the application.
Terminating the STEPA debug target will not cancel the JCL. If I want cancel the JCL, I need to select the JCL debug target before clicking the terminate button.
Debugging the next step
Once the first step (STEPA) completes execution, I can see the next step (STEPC) start up in the debug view:
The first step (STEPA) debug target and process are now marked terminated, and now that the next step I asked to debug (STEPC) is running, a process has been added for that step.
I can now continue to debug as before, performing any needed debug operations. When all the steps have run to completion, the Debug view shows all the targets and processes as terminated, and I can also see the final status of the batch job:
Running the same launch in Code Coverage mode
Running code coverage for the same JCL is as easy as debug. I could bring up the Compiled Code Coverage Configurations dialog using one of the following two methods
- From the toolbar, select the Compiled Code Configurations menu from the Code Coverage button pull-down menu:

- From the main menu, select Run>Compiled Code Coverage Configurations.
I would then select the launch that was created when I used the Debug As context menu and click the Coverage button. This method is also useful if I want to change the steps I want to use to collect code coverage. I prefer to go back to the Remote Systems view and used the Code Coverage As context menu (the action is also available in the JCL Editor):
Since I previously selected my desired steps, I am not prompted to pick them again (the previously generated launch configuration is reused), and two code coverage results are produced, one for each step I previously selected: