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.
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:
- 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.
- insert at least one comment line after each INCLUDE
and let us know
Thanks
Bill
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.
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.
Hi Eugene,
Thanks for your reply.
I have tried inserting a semi-colon line prior to and after each ‘INCLUDE’ code line without success.
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.
Sir hamara phone kaise milega
I have been unable to recreate your error in Natural 9.3.1. How are you invoking the RUN command?
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.
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
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.
Hi Ralph,
The result returning the NAT0399 is shown below;
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.
Hi Ralph,
Unfortunately the change from printer 0 to 1 did not work so the Nat0399 error is still being returned.
After several attempts I was able to duplicate your error. To correct it, I added a RENUMBER command to execute prior to the RUN.
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
Hi Ralph,
Thank you that worked. Your help is gratefully appreciated.