Batch Interactive Debugging Scenario


This tutorial will introduce you BMC AMI DevX Code Debug for TSO & IMS within BMC AMI DevX Workbench for Eclipse. You will use a couple of time-saving functions including 'right-click" access to Code Debug commands and the ability to record and playback code executions to help resolve difficult abends.



You will use the Code Debug Monitor command to help us solve a problem with a COBOL Program. This command allows you to record the execution of a program and play it back in review mode. While in Review Mode you can leverage all the DevX Code Debug commands as you simulate reverse execution.

In this scenario, we have a small payroll application that has an employee file as input. This employee file includes multiple record types, including hourly, salary, and management-type employees. The program processes each of these record types as it executes.

Instructions

  • This guide contains many screenshots to provide a visual reference
  • Every action is in blue
  • Please note each place that you must enter your own specific ID or number
  • You must complete each step before proceeding to the next to follow the test drive script successfully

This script requires that you first complete the "Getting Started " script.


Open Workbench for Eclipse.
Open the Host Explorer perspective.
You should have already created a z/OS dataset filter for CWEZxxx.WBSAMP.*
Expand the filtered dataset list to locate and highlight CWEZxxx.WBSAMP.JCL


In this part of the test-drive, you will set up and open a debugging session with Code Debug interactive debugger.

To run an Code Debug test for a batch program, you need two things:

  1. A program that has been compiled with the DevX Enterprise Common Components Language Processor to capture the compile listing in a DDIO member.
  2. The JCL to run the program.

We will go through an example of how to obtain both items and then start an Code Debug test.

Setting Up

Prepare the program for Code Debug

Click the BMC drop-down menu and click Host Explorer.


image-2024-3-14_12-13-38.png

First, you need to compile and link the program that you want to test using the BMC AMI Devx ECC Language Processor to store the compile listing in a DDIO file.


We will use sample JCL file member LPCOBCL.


Do This

In the Host Explorer view, navigate to yourid.WBSAMP.JCL and expand the dataset by clicking on the expand button – ">."

image-2023-4-17_13-20-29.png


Do This

Right-click on member LPCOBCL and click Submit.

image-2023-4-17_13-23-28.png

This job will compile the programs with the DevX Enterprise Common Components Language Processor to capture the compile listing in a DDIO


Do This

Click OK.

worddav9dc85929aa1f76ed74af0b98c97846c5.png

worddavf600353f4b2f8540e5c6991131797c94.png

Verify that the compile was successful, a CC of 4 step for CWXTCOB is acceptable.

Execute JCL

We are going to verify that the program now executes successfully.

Do This

Right-Click CWXTJCLC and Submit.

image-2023-4-17_13-35-4.png


worddavec3c799751900fad9eb66711cae7d574.png


Verify that the JCL completed with a CC of 0.

Configure Launch Configuration

Do This

Right-click on CWXTJCLC again, click 'Debug As' then select Code Debug Batch Debug Session.

image-2023-4-17_13-37-22.png

This will open the Debug Configuration dialog completed with the details extracted from the JCL.

Do This

Click Debug.

image-2023-4-17_13-52-31.png

Code Debug requires login credentials to submit your job and attach to it.

Do This

Click OK.

worddav492b7cbd7c345e95917f1869b1ae4e5d.png

You will be prompted to switch perspective.

Do This

Click Switch.

image-2023-4-17_13-54-29.png


Do This

Close the Cheat Sheets* as indicated in the screenshot.

image-2023-4-17_14-24-35.png

*Cheat Sheets can be a very helpful tutorial tool, but for our test drive we do not need them, so closing them gives us more screen real estate to work with.


If you need to bring up cheat sheets again, click Help then select Cheat Sheets.

image-2023-4-17_14-25-48.png

Code Debug Eclipse

The Code Debug perspective has several views that are helpful during the debug session.


Do This

Add Tool bar to the Debug View.


image-2023-10-9_9-39-42.png

Lets start by adding the Debug Toolbar. This will give you debugging controls in the Debug view

The Debug View

image-2023-4-17_14-29-41.png

The Debug view provides details about the configuration as well as why you are stopped in the program. In this case it is because we encountered the default breakpoint.

The Breakpoints View

worddav41cc87e1c41d650ceca24654214e976f.png

Any breakpoints or conditional commands issued will be displayed. The tool bar in this view allows you to delete one or all breakpoints. You also have the option to uncheck a condition or breakpoint, which will disable it. You can re-enable any breakpoints/conditions by checking the box.

The Variables View

worddav676166c6cbf5a63fb01eeff0521e858c.png

In the Variables view the variables associated with the currently executing statement will automatically be displayed (displayed with a blue diamond). You can add variables to this view, right-click to 'Add to Watch Variables' to keep variables in this view (displayed with glasses) throughout the program execution.

Data values can be viewed and/or modified during program execution.


The Source Listing (Edit View)

image-2023-4-17_14-30-52.png

What is shown is the DDIO listing that was generated during the compile. This is how you see source when we are executing your program. Code Debug places a default breakpoint on the first executable statement in the program. Code Debug commands are displayed when you right-click in this view.

The Outline View

worddav57ff5842b9f4b0f1f707adff0e726759.png

The Outline view displays an outline of a structured file that is currently open and can be used to navigate into the program during the debug session.

Debug Scenario


In this script we will use the Monitor command to help understand what is happening in this program when it executes when "PARM-DATA" variable contains a value of '00002'.

Do This

Expand the 'PARMINFO' variable in the Variables View. Change value from '00003' to '00002'

worddav3a9379048f98fe29db97f78405d80cec.png

With Code Debug you can display and modify variable, register, and storage contents.

When variable contains a value of 0002 in it causes a S0C7 abend that is difficult to diagnose.

image-2023-4-17_14-36-17.png


Do This

Right Click within the Editor View to see list of available Code Debug commands.

image-2023-4-17_14-52-36.png

Do this

Select 'Monitor'.

image-2023-4-17_14-53-15.png


Do this

Select the Resume Icon in the Toolbar to resume execution.

image-2023-4-17_14-54-46.png

Monitor and Review functionality lets you monitor(record) and review the execution path of a program. It enables you to step backward through your program to view the actual sequence of instructions.
Notice the message in the Console and the icon in the Debug view, show that Monitor is enabled.


Do this

Click the BMC AMI DevX Abend-AID Icon.

image-2023-4-17_14-57-11.png

Notice that we are getting a S0C7, this is the issue we've been encountering when processing parm data with a value of '00002'. From this view we can access the Abend-AID report to get more details of the abend.

Do this

Double click the Abend-AID Tab to maximize.

image-2023-4-17_14-58-30.png

As you can see from an active debug session you can access and analyze the AA report.

Do this

Double click Abend-AID tab to minimize.

image-2023-4-17_14-59-56.png

With this integration you can diagnose the issue while still actively debugging the program.

image-2023-4-17_15-2-59.png

The abend indicated that GRAND-TOTAL-EMP contains invalid packed data. However, this program initializes this fields at the start. It should not contain invalid values. It should contain zeroes.

One option during this session is to Toggle Breakpoint on all statements that reference the field name of GRAND-TOTAL-EMP. However, it is possible that the statement that changes the values of GRAND-TOTAL-EMP may not actually reference it.
Our best bet is to use the WHEN command.

Do this

Right-click in the Edit view to show Code Debug commands and Select 'Set When Condition'.

image-2023-4-17_15-5-37.png

The 'When' command is not associated with a particular source line. The When command will suspend execution when the data value changes by default or when specified condition occurs.


Do this

Enter 'GRAND-TOTAL-EMP'  in the dialog box, press "OK".

worddav768cecc3fb3ecae9c50644eb99caca90.png

'Changes' is the default for the When condition, so we only need to enter the Variable name.

Do This

Right-click in the Edit view to show Code Debug commands and Select 'Add Watch Variables'.

image-2023-4-17_15-7-58.png

Since this variable is associated with the currently executing statement, let's add it to the variables view. Notice that the variables associated with the currently executing statement are listed. However, you can always add any variable from your program to the list by clicking the 'By Name'.


Do This

Check the box for GRAND-TOTAL-EMP, press "OK".

image-2023-4-17_15-8-49.png

This will retain 'GRAND-TOTAL-EMP' in the variables view.

worddav136c6892116e646087793bfa01dfc171.png

This allows you to retain variables in the Variables view throughout the execution.


Do This

Click Review Resume Backward.

image-2023-4-17_15-10-25.png

Also notice that once we began execution with Monitor on the Review toolbar is now active.

This time instead of Resume, we will use the Review Toolbar.
The When condition is shown in the Breakpoints view. Code Debug will retain any breakpoints or conditions for use in subsequent debugging sessions.

Do this

Expand Region-Comment in the Variables view.

image-2023-4-17_15-12-17.png




image-2023-4-17_15-14-34.png

The statement that altered Grand-Total-Emp is referencing a table array. However, the table only occurs 4 times, but the index contains a value 5. It should be any value between 1-4.

This time let's set the When condition to find how the index 'WA-EMP-REGION' is getting populated with a value of '5' instead of 1-4. First let's add the variable to the Variables View.

Do this

Right-click in the Edit view to show Code Debug commands and Select 'Add Watch Variables'.

image-2023-4-17_15-16-41.png




Do this

Check the box for WA-EMP-REGION, press "OK"

image-2023-4-17_15-17-9.png




Do this

Right-click in the Edit view to show Code Debug commands and Select 'Set When Condition'.

image-2023-4-17_15-18-7.png


Do this

Enter 'WA-EMP-REGION' in the dialog box, click ok and Review Resume Backward.

worddava5bd76d10f39904c0804235e3142b2f5.png




image-2023-4-17_15-30-13.png

Notice that the field is being populated by an external file. Now that we have the details, we can bring this information to the application team that supports the program that created this file


Do this

Uncheck the When conditions in the Breakpoint View and click the Resume.

image-2023-4-17_15-31-3.png

Now that we know what the problem is, we can toggle off Monitor.

Unchecking the condition/breakpoint allows you to disable for reuse later or subsequent debug sessions.
Resume will bring us back to the point where the abend occurred.

Do this

Change the value of 'GRAND-TOTAL-EMP' to '0'.

image-2023-4-17_15-32-48.png

This highlights how we have full control of the variables within our program in a debug session.


Congratulations! You have completed the Batch Interactive Debugging Test Drive Script.
In this script, you learned what it is like to use a modern Integrated Development Environment to debug your applications.

Restarting This Script

At any point should you need to restart this Test Drive script, follow the instructions below:
You can reuse the same Launch configuration to start the debug session.

Next Steps


Click on the link below to return to the BMC Test Drive main page and choose your next road trip!
BMC AMI TEST DRIVE

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*