# Natural error code for user-initiated error condition

**URL:** <https://techcommunity.softwareag.com/t/natural-error-code-for-user-initiated-error-condition/298406>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural\
**Created:** [July 24, 2024, 11:08am UTC](https://techcommunity.softwareag.com/t/natural-error-code-for-user-initiated-error-condition/298406 "2024-07-24T11:08:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SteffGladstone](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@SteffGladstone](https://techcommunity.softwareag.com/u/SteffGladstone)\
**Post date:** [July 24, 2024, 11:08am UTC](https://techcommunity.softwareag.com/t/natural-error-code-for-user-initiated-error-condition/298406/1 "2024-07-24T11:08:29Z")

</div>

#### _ **Product/components** used and **version/fix** level:_

**Natural**** all levels**

#### _Detailed explanation of the problem:_

Does anyone know if there is a Natural error code reserved for user use?  
For example, if 1234 was the reserved error code, then

```
 MOVE '1234' TO *ERROR-NR

```

would trigger a user-initiated program error condition and then in the program the ON ERROR block would receive control:

ON ERROR  
IF _ERROR-NR = 1234 /_ user-initiated  
WRITE ‘PROGRAM TERMINATED BY USER’  
TERMINATE 16  
END-IF  
…  
END-ERROR

Thanks,  
Steff Gladstone

#### _Error messages / **full error** message screenshot / **log** file:_

#### _Question related to a **free trial** , or to a **production (customer)** instance?_

---

<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:** [July 24, 2024, 1:05pm UTC](https://techcommunity.softwareag.com/t/natural-error-code-for-user-initiated-error-condition/298406/2 "2024-07-24T13:05:48Z")

</div>

I don’t believe there is one reserved for users, but it is modifiable.

You could choose one that is not being used (via SYSERR).

Then you would do a FETCH of \*ERROR-TA (which is also modifiable or defined via NSS).

Try it and let us know.

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.

---

<div class="post-metadata">

**Author:** ![wolfgang.winter](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/wolfgang.winter/32/17954_2.png) [@wolfgang.winter](https://techcommunity.softwareag.com/u/wolfgang.winter)\
**Post date:** [July 24, 2024, 2:12pm UTC](https://techcommunity.softwareag.com/t/natural-error-code-for-user-initiated-error-condition/298406/3 "2024-07-24T14:12:44Z")

</div>

Basically there are two types of error codes and especially messages associated with them: NATURAL and USER Error messages

When assigning a value to \*ERROR-NR NATURAL will always trigger a SYSTEM error, even if a message with that number is defined for the respective user library in SYSERR.

As there are no defined ranges for “user initiated errors” you will need to make sure you are preferably picking an error code NOT associated with an error (currently) used by NATURAL.

Like Eugene said, you can do this using the SYSERR utility which is there for viewing and manipulating message texts, both NATURAL and USER messages.

Current list of used error numbers from OpenSystems NATURAL for the range starting 1200, for example

 ![image](https://global.discourse-cdn.com/techcommunity/original/3X/6/5/6577237283bf12c546c04e4b3219eaa1c34e85c7.png)

---

<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:** [July 30, 2024, 9:44am UTC](https://techcommunity.softwareag.com/t/natural-error-code-for-user-initiated-error-condition/298406/4 "2024-07-30T09:44:30Z")

</div>

There is no number or range reserved for user-initiated messages. In any case, I would strongly recommend not to use just any ‘free’ number. Many which looks free, are reserved for specific tools or on other platforms and can be used at any new version. Best is if you open an Aha request for User-defined system messages. Then we can reserve (and maybe initialize) a range of messages for users.  
For now (temporary), you may use the number 2007. This is in a range which we want to release anyway. But if the range of user-defined system messages is finally implemented elsewhere (or nowhere), it can happen that you have to move you message to another number.

---

<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:** [January 26, 2025, 9:44am UTC](https://techcommunity.softwareag.com/t/natural-error-code-for-user-initiated-error-condition/298406/5 "2025-01-26T09:44:39Z")

</div>

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