# Using Natural Debugger in Batch ?

**URL:** <https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-Utilities\
**Created:** [March 2, 2006, 3:38pm UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623 "2006-03-02T15:38:44Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deeps](https://avatars.discourse-cdn.com/v4/letter/d/ccd318/32.png) [@Deeps](https://techcommunity.softwareag.com/u/Deeps)\
**Post date:** [March 2, 2006, 3:38pm UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/1 "2006-03-02T15:38:44Z")

</div>

Hi All,

Can we use Natural Debugger for Batch programs?

I guess we can not take the control of the program from batch by setting up spies but if we will be able to get the logs of “call statstics” and “statement execution summary” then that would be sufficient.

Is their any way to do this?

Many Thanks,  
Deeps

---

<div class="post-metadata">

**Author:** ![Darrell](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@Darrell](https://techcommunity.softwareag.com/u/Darrell)\
**Post date:** [March 7, 2006, 9:46pm UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/2 "2006-03-07T21:46:41Z")

</div>

It is possible, by setting the debugging environment from an online session then saving it. You can then load that debug environment in batch before running your program. However it would be much easier and better to use the RDC facility instead. Look at the examples in library SYSRDC for more information.

---

<div class="post-metadata">

**Author:** ![Deeps](https://avatars.discourse-cdn.com/v4/letter/d/ccd318/32.png) [@Deeps](https://techcommunity.softwareag.com/u/Deeps)\
**Post date:** [March 8, 2006, 9:36am UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/3 "2006-03-08T09:36:30Z")

</div>

Hi Darrell,

Thanks for replying. I have never used SYSRDC before, could you just brief me about this? Is this a utility?

Also for setting up debugging environment for batch.Do you mean to say load that environment and then run the job. If this is the case I’m not sure how the control will go from a job to natural debugger. Could you add a little more words to your explanation?

Thanks a lot, Deeps

---

<div class="post-metadata">

**Author:** ![Darrell](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@Darrell](https://techcommunity.softwareag.com/u/Darrell)\
**Post date:** [March 31, 2006, 10:28pm UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/4 "2006-03-31T22:28:18Z")

</div>

Deeps, Sorry for taking so long to reply. I don’t logon to this forum as often as I should. For the RDC information, you can look in library SYSRDC. It contains example programs. It is all very simple stuff. You can execute the modules there without worry. Be sure your session has RDCBUFF set greater than 2, or RDC cannot work. Estimate about 1K buffer for every 10 or 12 traced activities. More information on RDC is in the Utilities manual. For batch Debugger, set up the traces you want while you are in an online session, then save the settings with a unique name (use the "E Debug environment maintenance " option on the top-level menu). If my memory is working… When running the batch environment, put the following into your CMSYNIN stream before you EXECUTE your program:

TEST ON  
TEST E  
L your-debug-environment-name

Then run your program. When it is done you can invoke TEST (similar to the above method) to print the call statistics. But I would still recommend the SYSRDC method, because it is sometimes difficult to feed the debugger screens in batch.

---

<div class="post-metadata">

**Author:** ![Deeps](https://avatars.discourse-cdn.com/v4/letter/d/ccd318/32.png) [@Deeps](https://techcommunity.softwareag.com/u/Deeps)\
**Post date:** [April 13, 2006, 7:41pm UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/5 "2006-04-13T19:41:01Z")

</div>

This was great !!  
Thanks a lot Darrell 😃

---

<div class="post-metadata">

**Author:** ![Fred\_Horn](https://avatars.discourse-cdn.com/v4/letter/f/90ced4/32.png) [@Fred\_Horn](https://techcommunity.softwareag.com/u/Fred_Horn)\
**Post date:** [October 25, 2006, 4:57am UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/6 "2006-10-25T04:57:39Z")

</div>

Darrell or Deeps,

Are you still around?

I have tried using your technique for batch debugging but I can’t seem to get it to work. I am trying to get the Statement execution statistics from a batch program. So far no luck:

DATA FWH,FWH,FWH  
Logon accepted to library FWH.  
NEXT TEST ON  
Test mode started.  
NEXT TEST E  
NEXT L FWHDB  
Source FWHDB not found in current library.  
NEXT EX CALLBITS  
Page 1 06-10-24 14:01:42  
0START CALLBITS CALLING BITSUB 14:01:42  
RESULTS: d 7 N  
NEXT FIN  
0NAT9995 NATURAL SESSION TERMINATED NORMALLY

---

<div class="post-metadata">

**Author:** ![Fred\_Horn](https://avatars.discourse-cdn.com/v4/letter/f/90ced4/32.png) [@Fred\_Horn](https://techcommunity.softwareag.com/u/Fred_Horn)\
**Post date:** [October 26, 2006, 1:52am UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/7 "2006-10-26T01:52:03Z")

</div>

Ok, I have gotten this far:

DATA FWH,FWH,FWH  
Logon accepted to library FWH.  
NEXT TEST ON  
Test mode started.  
NEXT TEST E  
NEXT TEST LOAD ENVIRONMENT FWHDB  
Debug environment FWHDB loaded.  
NEXT EX CALLBITS  
Page 1 06-10-25 12:46:54  
0START CALLBITS CALLING BITSUB 12:46:54  
END CALLBITS : 12:48:49 FOR 9000001 TIMES  
NEXT FIN  
0NAT9995 NATURAL SESSION TERMINATED NORMALLY

Now, can I print the results in batch?

---

<div class="post-metadata">

**Author:** ![Lukas\_Hundemer](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/lukas_hundemer/32/113_2.png) [@Lukas\_Hundemer](https://techcommunity.softwareag.com/u/Lukas_Hundemer)\
**Post date:** [October 26, 2006, 1:48pm UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/8 "2006-10-26T13:48:21Z")

</div>

> [@Darrell](#):
>
> … Be sure your session has RDCBUFF set greater than 2, or RDC cannot work. …

The RDC buffer is allocated with the RDCSIZE parameter.

---

<div class="post-metadata">

**Author:** ![Fred\_Horn](https://avatars.discourse-cdn.com/v4/letter/f/90ced4/32.png) [@Fred\_Horn](https://techcommunity.softwareag.com/u/Fred_Horn)\
**Post date:** [October 27, 2006, 12:19pm UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/9 "2006-10-27T12:19:52Z")

</div>

Well, I threw out the idea of loading a debug environment. I got a bit further with this:

## DATA FWH,FWH,FWH Logon accepted to library FWH. NEXT TEST ON Test mode started. NEXT TEST SE XSTAT COUNT FWH,CALLBITS Statement execution counting started for library/object FWH/CALLBITS. NEXT EX CALLBITS Page 1 06-10-26 18:37:28 0START CALLBITS CALLING BITSUB 18:37:28 RESULTS: A 1 Y END CALLBITS : 18:37:28 FOR 2 TIMES NEXT TEST PR XSTAT FWH,CALLBITS PRINT file HARDCOPY not available.

- 

```
    *************NATURAL Debug Utility Error**************
    * NATURAL error 1520 occurred in NATURAL TEST utility. *
    * PRINT file HARDCOPY not available. *
    * *
    * Error occurred on level 2 in line 1590 in *
    * subprogram DBGXSL in library SYSLIB. *
    * DBGXSL has been loaded from FNAT=(1,303). *
    * DBGXSL has been cataloged on 1999-04-21 16:55:21. *
    ********************************************************

```

NEXT FIN  
0NAT9995 NATURAL SESSION TERMINATED NORMALLY

Anyone know how to set the debug profile output device in batch? It seems to default to HARDCOPY. When I change my output device online to something other than HARDCOPY, save it then log off, log back on and the output device has been set back to HARDCOPY. ARRRGGGG!!!

---

<div class="post-metadata">

**Author:** ![Helmut\_Spichtinger](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@Helmut\_Spichtinger](https://techcommunity.softwareag.com/u/Helmut_Spichtinger)\
**Post date:** [October 27, 2006, 5:57pm UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/10 "2006-10-27T17:57:42Z")

</div>

> [@Fred Horn](#):
>
> Anyone know how to set the debug profile output device in batch? It seems to default to HARDCOPY. When I change my output device online to something other than HARDCOPY, save it then log off, log back on and the output device has been set back to HARDCOPY. ARRRGGGG!!!

The standard debug environment is named “Noname”. It is loaded if you don’t specify any other debug environment. If you change this it is valid only for the current Natural session.  
All options that can be set with the direct command PROFILE (except the file for loading or saving debug environments) are part of a debug environment. So I think you have to create your own debug environment for to store your output device and proceed as Darrel suggests.

---

<div class="post-metadata">

**Author:** ![Mishra](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Mishra](https://techcommunity.softwareag.com/u/Mishra)\
**Post date:** [June 3, 2008, 9:03pm UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/11 "2008-06-03T21:03:02Z")

</div>

Hi Darrell,

Could you please tell me how can I use the SYSRDC. In fact in my Natural system I do not have a SYSRDC library and also I tried if this is a system command. But there is no system command with SYSRDC.

How can I explore the batch debugging with out the SYSRDC?

Thanks,  
Mishra

---

<div class="post-metadata">

**Author:** ![Hezi](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@Hezi](https://techcommunity.softwareag.com/u/Hezi)\
**Post date:** [March 12, 2009, 12:32pm UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/12 "2009-03-12T12:32:17Z")

</div>

Hi,

Well i have tried to use the debugger in Batch, but I always get the error: “Reinput can not be executed in batch”, what is true.  
Why this feature can not be use in our system?

Thank you  
Hezi

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [March 12, 2009, 5:54pm UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/13 "2009-03-12T17:54:06Z")

</div>

Hezi;

Is this message regarding a REINPUT statement in your code? If so, please see my comment to your other posting (other thread); namely, why do you have a REINPUT in batch? What are you trying to do?

Or, is the message coming from the debugger? That is, is the REINPUT something the debugger is trying to do?

steve

---

<div class="post-metadata">

**Author:** ![Hezi](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@Hezi](https://techcommunity.softwareag.com/u/Hezi)\
**Post date:** [March 15, 2009, 6:04pm UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/14 "2009-03-15T18:04:56Z")

</div>

HI,

I want to run debugger in batch as shown above.  
I follow the instructions but, I get an error regarding “reinput”.  
How can I run debugger in batch?

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [March 16, 2009, 8:03am UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/15 "2009-03-16T08:03:20Z")

</div>

Hezi - the reinput message likely the debugger trying to give you an error regarding your input - something in your input to the test/debugger is incorrect.

Try putting similar commands into a program that STACKs the input and run it online to see the error. Once you have the STACKing program working, you can just run it in batch.

---

<div class="post-metadata">

**Author:** ![Hezi](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@Hezi](https://techcommunity.softwareag.com/u/Hezi)\
**Post date:** [March 16, 2009, 12:14pm UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/16 "2009-03-16T12:14:03Z")

</div>

Hi Douglas,

I did not fully undersatnd your suggestion.  
Is there a problem running debbuger in batch and also passing parameters to the program calling?  
How should my jcl look like (with data input)?

Thanks  
Hezi

---

<div class="post-metadata">

**Author:** ![Hezi](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@Hezi](https://techcommunity.softwareag.com/u/Hezi)\
**Post date:** [March 16, 2009, 12:37pm UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/17 "2009-03-16T12:37:53Z")

</div>

Hi,

Is it interactive? should I put debbuger command in my jcl or save it in my terst env?

Hezi

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [March 18, 2009, 10:43am UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/18 "2009-03-18T10:43:22Z")

</div>

The debugger is intended for interactive use. I’m guessing that there is something wrong with the batch input to the debugger, causing it to execute a REINPUT.

If your batch job has something like:  
TEST ON  
TEST SE XSTAT COUNT FWH,CALLBITS  
EX CALLBITS

you can put these strings into STACK COMMAND statements in a small Natural program and run this program online (which will execute the online REINPUT and hopefully tell you what is missing or wrong). Once you have the program with the STACK COMMANDs in it working, you can then just run the program in batch to invoke the program and debugger.

---

<div class="post-metadata">

**Author:** ![Hezi](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@Hezi](https://techcommunity.softwareag.com/u/Hezi)\
**Post date:** [March 18, 2009, 1:28pm UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/19 "2009-03-18T13:28:22Z")

</div>

HI Douglas,

Well it works fine.  
Actually, I need to debug in batch the variables in a program without involving the objects only the jcl.  
So, I need to set tp a watchpoints & to load it under jcl.  
Can I do it (without sending commands to debugger) only display the variables data?

ex: jcl  
logon slik  
test on  
test load enviroment prog  
prog

Thanks  
Hezi

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [March 18, 2009, 4:26pm UTC](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623/20 "2009-03-18T16:26:29Z")

</div>

Hi Hezi;

There is a VERY important sentence in Douglas’s last post:

“The debugger is intended for interactive use.”

The idea behind watchpoints and breakpoints is to STOP the execution of an object, look at variable values, think about what is happening and why it happened. Reading a series of printouts doesn’t come close to being as useful for debugging.

Many long time Natural programmers, myself included, debug batch programs by running them online. How? Easy.

If there is only one workfile involved, I typically STACK a bunch of records. Then, instead of a READ WORK FILE, I use an INPUT. If there are more work files involved, I use a subprogram. Instead of a READ WORK FILE, I use a CALLNAT which returns the next “record”. Instead of a WRITE WORK FILE, write to an array, and at the end of what would be a job step, write out the array.

This gives you the benefits of working with the debugger as it was designed to work, interactively. It also gives you the ability to reliably simulate the operation of work files.

Try it. You will never want to go back to using the debugger in batch.

steve

[Next page](https://techcommunity.softwareag.com/t/using-natural-debugger-in-batch/60623.md?page=2)
