batch debugging

Hi all,

I need to debug a Natural batch program. I have noticed methods like SYSRDC being mentioned at various places for the same, but since i am new to Natural i am not very sure how to use it or another method. Kindly let me know how this can be done, or If you could direct me to any document or site that has more detail on how to debugg natrual batch programs that would also help.


Hi Raj;

Since you are somewhat new to Natural, I will be careful to explain what this posting is all about. I typically use the term “batch index” (no. this is not a standard Software AG term), to indicate to what extent a program is “batch”. The index runs from 0 to 10. Zero is an online program. One is a program that could be online except for the existance of a single work file that contains some transaction records, of a single report that is being routed to a work file. Ten is a program that involves a bunch of input work files, and a bunch of output reports and perhaps many of these are used conditionally, etc. No, this is not a strict quantitative index, it is very much qualitative.

Suppose I have a one or a two. It is not difficult to transform such a program into an online program. For example, Suppose I have a single input workfile. I can define data such as:

1 #wf1-record (a300/1:5) init <'datadatadata '>
1 #wf1-index (i4)
1 #real-wf-record (a300)

Now, in my program, instead of a READ WORK FILE loop, I have something like

     for #wf1-index = 1 to 5
     move #wf1-record (#wf1-index) to #real-wf-record

and now you have the code that would have existed in the READ WORK FILE loop.

Ideally, all you have to do to restore this to a batch program is change the above two statements to a READ WORK FILE statement and change the end-for to an end-work.

Clearly, beyond a couple of work files, this starts to get unwieldy. But, if you are new to Natural, and are working with a low batch index, and want to get some practice using Natural’s debugger, this is a viable solution.


The conclusion:

It is not possible to debug a program in batch mode (on mainframe).

The effort to change the batch program into an online program for debugging purposes is determined by the “batch index” Steve mentioned.

BTW. The debugger is a very very poor one (e.g. you can not set break points in the editor and save these with the program. The debugging environment is created and saved separately from the program in the debugger. So inserting/deleting lines can make your debugging environment unusable). But: It is still better than nothing!

We use a 3rd party product named Profiler for Natural by Treehouse Software, which is not exactly a debugger, but is can be used to monitor the actual flow of a program and give all kinds of statistics on line number base or program/library base. It is designed to also work for batch jobs.

Another option could be SPoD. You can use the Natural GUI debugger of the Natural Studio to debug your batch programs.
Under z/OS a NDV session is similar to batch. Except CMSYNIN and CMPRINT you can assign any batch resources. But keep in mind that these resources are shared between all clients of a NDV server. So you probably might launch a server exclusively for one client.

You also have the option of running Natural using a CLIST / REXX if you have the module available. You’ll have to convert your job step to CLIST. You can now use the debugger.

Hi Arnold,

How can we convert the batch job to clist/rexx. I have some knowledge of rexx but dont know how to do this. Also even if it was converted to a rexx program, how will we be able to debug it?.


Have a look at

The homepage for the tip directory is: