# Issue writing to Natural Work Area

**URL:** <https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural\
**Created:** [June 8, 2025, 3:40pm UTC](https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564 "2025-06-08T15:40:45Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![albertdaniel2002](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@albertdaniel2002](https://techcommunity.softwareag.com/u/albertdaniel2002)\
**Post date:** [June 8, 2025, 3:40pm UTC](https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564/1 "2025-06-08T15:40:45Z")

</div>

I am using Natural Version 6.3.12 and am trying to manipulate Natural source code within the Natural Source Work Area.

I am using user exit USR1057N within a Natural program to read an existing Natural program into an array.

Scan replace is then being used to update the contents of the returned program array.

The updated source code is then being written to the Source Work Area using a write(1) which has been defined as DEFINE PRINTER(1) OUTPUT ‘SOURCE’.

The code within the Source Work Area is then attempted to be run but is returning Natural error NAT0399.

The object has an include code line which seems to not have a line break and is merging with the following line;

INCLUDE COPY1  
RESET #FIELD1

In the above example the ‘RESET’ line returns the NAT0399 error.

If I manually edit the Natural Source Area to comment out the ‘INCLUDE’ code line I am able to ‘cat’ the source. If I then reinstate the commented ‘INCLUDE’ code line, I am now able to ‘cat’ the source code.

This seems to be a line break issue which is resolved on manual edit.

Additionally the source code I am writing to the Source Work Area has multiple ‘INCLUDE’ codes within. If I comment out the first ‘INCLUDE’ code instance on generation the error moves to the next ‘INCLUDE’ code within the generated source code.

Any advice would be gratefully appreciated.

---

<div class="post-metadata">

**Author:** ![William\_Scollard](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/william_scollard/32/27633_2.png) [@William\_Scollard](https://techcommunity.softwareag.com/u/William_Scollard)\
**Post date:** [June 8, 2025, 4:13pm UTC](https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564/2 "2025-06-08T16:13:24Z")

</div>

Hello Albert  
I once crafted a subsystem similar to what you are doing but it did not contain any INCLUDE commands as my faint memory suggests.  
Without knowing the complete text of error 0399 I can suggest you try the following:

1. determine the end of line character(s) for your system and insert those hex character(s) after each of your INCLUDE statements when you write to the source output.
2. insert at least one comment line after each INCLUDE

and let us know  
Thanks  
Bill

---

<div class="post-metadata">

**Author:** ![Eugene.Miklovich](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@Eugene.Miklovich](https://techcommunity.softwareag.com/u/Eugene.Miklovich)\
**Post date:** [June 8, 2025, 4:16pm UTC](https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564/3 "2025-06-08T16:16:02Z")

</div>

Try putting a semi-colon after the word COPY1.

Little known fact that you can use a semi-colon to mark the end of a statement.

If you still get the error, check that COPY1 is available as copy-code.

😊

Eugene (Gene) Miklovich

ADABAS/NATURAL Systems Support and DBA

Cell: 916-202-7047

Normal Hours: 8am-4pm E.T.

Please call or text if assistance needed outside these hours.

Out of Office Notice:

Fri May 2nd thru Tues May 6th.

---

<div class="post-metadata">

**Author:** ![albertdaniel2002](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@albertdaniel2002](https://techcommunity.softwareag.com/u/albertdaniel2002)\
**Post date:** [June 8, 2025, 4:44pm UTC](https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564/4 "2025-06-08T16:44:51Z")

</div>

Hi Bill,

Thanks for your reply.

I have previously tried inserting a h’00’ at character 72 of each ‘INCLUDE’ lines and ensuring that there is a comment line prior to and after each ‘INCLUDE’ line without success.

---

<div class="post-metadata">

**Author:** ![albertdaniel2002](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@albertdaniel2002](https://techcommunity.softwareag.com/u/albertdaniel2002)\
**Post date:** [June 8, 2025, 4:50pm UTC](https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564/5 "2025-06-08T16:50:41Z")

</div>

Hi Eugene,

Thanks for your reply.

I have tried inserting a semi-colon line prior to and after each ‘INCLUDE’ code line without success.

---

<div class="post-metadata">

**Author:** ![Eugene.Miklovich](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@Eugene.Miklovich](https://techcommunity.softwareag.com/u/Eugene.Miklovich)\
**Post date:** [June 8, 2025, 10:16pm UTC](https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564/6 "2025-06-08T22:16:30Z")

</div>

Did you verify that there is a member COPY1 (object type copycode) available to be inserted?

Eugene (Gene) Miklovich

ADABAS/NATURAL Systems Support and DBA

Cell: 916-202-7047

Normal Hours: 8am-4pm E.T.

Please call or text if assistance needed outside these hours.

Out of Office Notice:

Fri May 2nd thru Tues May 6th.

---

<div class="post-metadata">

**Author:** ![Sukhman\_Deep](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/sukhman_deep/32/36943_2.png) [@Sukhman\_Deep](https://techcommunity.softwareag.com/u/Sukhman_Deep)\
**Post date:** [June 9, 2025, 12:54am UTC](https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564/7 "2025-06-09T00:54:54Z")

</div>

Sir hamara phone kaise milega

---

<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:** [June 9, 2025, 3:52am UTC](https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564/8 "2025-06-09T03:52:24Z")

</div>

I have been unable to recreate your error in Natural 9.3.1. How are you invoking the RUN command?

---

<div class="post-metadata">

**Author:** ![albertdaniel2002](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@albertdaniel2002](https://techcommunity.softwareag.com/u/albertdaniel2002)\
**Post date:** [June 9, 2025, 7:00am UTC](https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564/9 "2025-06-09T07:00:08Z")

</div>

Hi Eugene,

The copy code object does indeed exist.

If I manually edit the Natural Source Area and comment out the ‘Copy’ code line I am then able to ‘cat’ the source. It is then possible to uncomment the ‘Copy’ code line at which point I can now ‘cat’ the source.

---

<div class="post-metadata">

**Author:** ![albertdaniel2002](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@albertdaniel2002](https://techcommunity.softwareag.com/u/albertdaniel2002)\
**Post date:** [June 9, 2025, 10:15am UTC](https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564/10 "2025-06-09T10:15:40Z")

</div>

Hi Ralph,

I have stripped out the code producing the error to help with any analysis. I have had to provide this information via three posts

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

---

<div class="post-metadata">

**Author:** ![albertdaniel2002](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@albertdaniel2002](https://techcommunity.softwareag.com/u/albertdaniel2002)\
**Post date:** [June 9, 2025, 10:22am UTC](https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564/11 "2025-06-09T10:22:31Z")

</div>

Hi Ralph,

The following snippet of source code from program ADPROG2 uses user exit USR1057N to read program ADPROG1 and then write the source to the Natural Source Area and to then run it.

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

---

<div class="post-metadata">

**Author:** ![albertdaniel2002](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@albertdaniel2002](https://techcommunity.softwareag.com/u/albertdaniel2002)\
**Post date:** [June 9, 2025, 10:46am UTC](https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564/12 "2025-06-09T10:46:43Z")

</div>

Hi Ralph,

The result returning the NAT0399 is shown below;

 ![image](https://global.discourse-cdn.com/techcommunity/original/3X/9/5/9511cb239984b95017002d9be2bc92b39d1a079a.png)

---

<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:** [June 9, 2025, 1:25pm UTC](https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564/13 "2025-06-09T13:25:55Z")

</div>

It’s a simple fix. Change all your printer references from (0) to (1).

It was so long ago that I don’t remember whether I stumbled upon it or found the answer somewhere in the documentation, but I do now remember fighting with this issue. You can write source to printers 1-31, but not to 0.

---

<div class="post-metadata">

**Author:** ![albertdaniel2002](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@albertdaniel2002](https://techcommunity.softwareag.com/u/albertdaniel2002)\
**Post date:** [June 9, 2025, 4:30pm UTC](https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564/14 "2025-06-09T16:30:07Z")

</div>

Hi Ralph,

Unfortunately the change from printer 0 to 1 did not work so the Nat0399 error is still being returned.

---

<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:** [June 10, 2025, 4:12am UTC](https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564/15 "2025-06-10T04:12:52Z")

</div>

After several attempts I was able to duplicate your error. To correct it, I added a RENUMBER command to execute prior to the RUN.

```auto
SET CONTROL "Z"
DEFINE PRINTER (01) OUTPUT "SOURCE"
EJECT OFF (01) /* avoid */ insertions
*
WRITE (01) NOTITLE '*'
WRITE (01) 'WRITE "first"'
WRITE (01) "INCLUDE RGZ-INC" /* WRITE 'copy code'
WRITE (01) 'WRITE "last"'
WRITE (01) "END"
STACK TOP COMMAND "RUN"
STACK TOP COMMAND "RENUMBER"
END

```

---

<div class="post-metadata">

**Author:** ![albertdaniel2002](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@albertdaniel2002](https://techcommunity.softwareag.com/u/albertdaniel2002)\
**Post date:** [June 10, 2025, 7:39am UTC](https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564/16 "2025-06-10T07:39:38Z")

</div>

Hi Ralph,

Thank you that worked. Your help is gratefully appreciated.

---

<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:** [December 7, 2025, 7:40am UTC](https://techcommunity.softwareag.com/t/issue-writing-to-natural-work-area/310564/17 "2025-12-07T07:40:10Z")

</div>

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