Setting sections or paragraph breakpoints while editing the source of your program with IBM Developer for ZOS
I was surprised early this year when after a presentation in Europe where I described a new feature in the IBM Developer for zOS, setting paragraph breakpoints from the source, I was approached by a developer that told me that using paragraphs in a COBOL program is not considered a good coding practice. I was very surprised by that statement, so I did some research in the topic (ok, I â€śgoogledâ€ť) and found interesting discussions on this topic. In any case while there isnâ€™t a precise rule for the preference to use sections instead of paragraph, I did find in my little research that in general Europeans ban the use of paragraphs in COBOL programs, while the opposite is seen in the United States where the ban is against the use of section in COBOL programs. Given that new perspective on this matter, IBM Developer for zOS 14.2 (IDz) debugger is now enhanced to provide similar support for Paragraphs and Sections. We donâ€™t want to hurt feelings by taking a side between those two important development communities. There are other features in this new version of the debugger. You can read about them if you follow this link https://developer.ibm.com/mainframe/2019/09/06/whats-new-in-ibm-z-os-debugger-v14-2/
What do I mean by setting a paragraph or section breakpoint from the source?
What I mean is that while making modification to your program using IBM Developer for zOS you can set a breakpoint directly from the editor. This breakpoint is saved so when you do start the debug session to verify the correctness of the new code you can stop directly there. You donâ€™t have to start the debugger first, and then set the breakpoint. Your might be editing a large program so getting to the new code faster is a good thing.
Next, I am going to describe how to set a breakpoint from the source for sections and paragraphs using IDz 14.2.
Letâ€™s start IDz 14.2., I already have a connection to my zOS System and have a filter to a group of datasets that I am using to demonstrate this functionality.
I expand the PDS that contains the source for the program SECPAR2
Next, I am going to edit SECPAR2.cbl
On the bottom left is the source view for SECPAR2 and on the bottom right is the Outline view for SECPAR2.
There are two ways to set a section or paragraph section breakpoint. You can use the Outline view or directly from the source view. Let me show you using the Outline View. First I am going to expand that PROCEDURE DIVISION tab in the Outline view. You can now see the program layout with its sections and paragraphs.
Doing a Right Mouse Click on a Section brings a popup selection pane:
Selecting â€śToggle Section Breakpointâ€ť brings the Breakpoint Properties popup. There you provide the load module and the compile unit. You can use wild cards * or be specific and provide the names. Using wild cards instead of a Compile Unit name impact performance, since the debugger is tasked with having to retrieve the debug information as load modules are loaded by the application in order to find whether a section or paragraph with that name exist.
The editor does populate the selection tabs with possible options, but you can override them if needed. After selecting the Module and Compile Unit I can now press OK to set the breakpoint.
Notice that the breakpoint view is now updated with this breakpoint. Keep in mind that the debugger is not active at this point. The breakpoint is deferred until the debug session starts.
Similar process can be used to set a paragraphs section. The smart editor recognizes whether the entry is a section or a paragraph.
After setting the paragraph breakpoint, the breakpoint view is updated with the new entry, see above.
Next, I am going to show you how to set the breakpoint from the source view. I scroll down in the source until I see the Section where I want to set the breakpoint. You need to use the prefix area of the line where the section is defined. In the figure below you can see the little hand where my cursor is. After selecting you can do a right mouse click which brings the list of actions that apply to that line.Â I am going to select the â€śToggle Section Breakpointâ€ť.
This brings the Breakpoint properties dialogue which I populate as I explained before. After providing the module and compile unit I press OK and the breakpoint is set. The breakpoint view is now updated with three breakpoints.
Now I can start the debug session by submitting the JCL I have prepared for this blog.
After starting the debug session, you can see the deferred breakpoint in the breakpoint view, now you can resume to reach the first breakpoint. The one for SEC-1.
A second resume should take to the next breakpoint and so on.
I hope you enjoy this new feature, whether your preference is to use SECTIONS, PARAGRAPHS, or a combination.
Francisco M. Anaya
IBM Application Delivery Foundation Senior Architect