# Debugging a dynamic NATURAL program

**URL:** <https://techcommunity.softwareag.com/t/debugging-a-dynamic-natural-program/311374>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [August 19, 2025, 6:46am UTC](https://techcommunity.softwareag.com/t/debugging-a-dynamic-natural-program/311374 "2025-08-19T06:46:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clint\_R](https://avatars.discourse-cdn.com/v4/letter/c/e5b9ba/32.png) [@Clint\_R](https://techcommunity.softwareag.com/u/Clint_R)\
**Post date:** [August 19, 2025, 6:46am UTC](https://techcommunity.softwareag.com/t/debugging-a-dynamic-natural-program/311374/1 "2025-08-19T06:46:30Z")

</div>

Hi

I have an old dynamic batch program (with ampersand variables) that is called by a RUN command and has recently started producing a 1316 error (Index not within array structure).  
My initial thought was to add a WRITE to the program to see what is causing the problem but that just causes syntax errors within the code as it obviously messes with the compile at RUN time.  
Is there a way to debug this dynamic program?  
Here is an excerpt of the code:

 ![image](https://global.discourse-cdn.com/techcommunity/original/3X/b/2/b221cfeeb8719b1c76f15a2167c1dd2fc5edd139.png)

The error is in line 1560 so I tried adding an ampersand variable containing the WRITE statement but that didn’t do anything.

COMPRESS FULL ‘WRITE’ ‘“=”’ ‘#LEVEL’ ‘“=”’ #LEVEL-A INTO +WRITE

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [August 19, 2025, 4:30pm UTC](https://techcommunity.softwareag.com/t/debugging-a-dynamic-natural-program/311374/2 "2025-08-19T16:30:22Z")

</div>

There is no need for the COMPRESS. Just use a standard WRITE statement in the dynamic program.  
`WRITE '=' #LEVEL '=' #LEVEL-A`  
If you insist on generating the WRITE, the COMPRESS must be in the driver, not the dynamic program.

---

<div class="post-metadata">

**Author:** ![suman001](https://avatars.discourse-cdn.com/v4/letter/s/ed8c4c/32.png) [@suman001](https://techcommunity.softwareag.com/u/suman001)\
**Post date:** [August 29, 2025, 5:33pm UTC](https://techcommunity.softwareag.com/t/debugging-a-dynamic-natural-program/311374/3 "2025-08-29T17:33:02Z")

</div>

This post was flagged by the community and is temporarily hidden.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [February 25, 2026, 5:33pm UTC](https://techcommunity.softwareag.com/t/debugging-a-dynamic-natural-program/311374/4 "2026-02-25T17:33:57Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
