# Dynamic Code - Natural error msg vs. User message

**URL:** <https://techcommunity.softwareag.com/t/dynamic-code-natural-error-msg-vs-user-message/91506>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-News-and-General-Topics\
**Created:** [October 9, 2009, 8:33pm UTC](https://techcommunity.softwareag.com/t/dynamic-code-natural-error-msg-vs-user-message/91506 "2009-10-09T20:33:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Smith](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/john_smith/32/39012_2.png) [@John\_Smith](https://techcommunity.softwareag.com/u/John_Smith)\
**Post date:** [October 9, 2009, 8:33pm UTC](https://techcommunity.softwareag.com/t/dynamic-code-natural-error-msg-vs-user-message/91506/1 "2009-10-09T20:33:27Z")

</div>

Hi,

I am building a routine that will allow the users to create an object dynamically. It doesn’t matter which way I am building the object (API - USR\*, or using ‘ssource’, the question is: if there is something wrong on the object, for any reason, the compiler checks it before, and Natural intercepts the error, and it displays the message.

I would like to know if there is a way to avoid Natural message and to handle the message on the object that is being created it.

If someone has any idea, I would appreciate receiving your hint.

Thanks.

---

<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:** [October 10, 2009, 1:15am UTC](https://techcommunity.softwareag.com/t/dynamic-code-natural-error-msg-vs-user-message/91506/2 "2009-10-10T01:15:03Z")

</div>

Instead of letting the users create the object, take the user by the hand. Give them screens with selection boxes. This greatly reduces the possibility of the user entering data that will result in a non compile.

steve

---

<div class="post-metadata">

**Author:** ![John\_Smith](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/john_smith/32/39012_2.png) [@John\_Smith](https://techcommunity.softwareag.com/u/John_Smith)\
**Post date:** [October 11, 2009, 5:51pm UTC](https://techcommunity.softwareag.com/t/dynamic-code-natural-error-msg-vs-user-message/91506/3 "2009-10-11T17:51:59Z")

</div>

Hi Steve,

thanks for the info, but the problem is that I need to save the object, because I allow the user to execute it again. So, instead of the user chooses the options again, the user needs to choose the object and re-run only.

thanks, and waiting new hints.

---

<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:** [October 12, 2009, 4:19am UTC](https://techcommunity.softwareag.com/t/dynamic-code-natural-error-msg-vs-user-message/91506/4 "2009-10-12T04:19:47Z")

</div>

The point is, you must take control of the generation process. Don’t let the user enter free-form text and expect it to compile. Give the user a list of files from which to choose. Then list the fields in the file, again for selection. Give options as to what to do with the file. And so on.

Generate the code based on the user’s selections. By controlling the selections, you guarantee the compilation.

---

<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:** [October 12, 2009, 9:05am UTC](https://techcommunity.softwareag.com/t/dynamic-code-natural-error-msg-vs-user-message/91506/5 "2009-10-12T09:05:24Z")

</div>

you can set the error transaction - from Natural Security, set a default, or from your generation program set  
MOVE ‘erhndlr’ TO \*ERROR-TA  
which will let ‘erhndlr’ take control if any error (including syntax errors) occur. Check the input variables (see [http://techcommunity.softwareag.com/ecosystem/documentation/natural/nat425mf/vari/appl.htm#ERROR\_TA](http://techcommunity.softwareag.com/ecosystem/documentation/natural/nat425mf/vari/appl.htm#ERROR_TA)) to check if you have a syntax or run time error.

---

<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:** [October 13, 2009, 8:09pm UTC](https://techcommunity.softwareag.com/t/dynamic-code-natural-error-msg-vs-user-message/91506/6 "2009-10-13T20:09:33Z")

</div>

You should also look at parameter SYNERR  
Peter

---

<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:** [April 2, 2021, 2:57pm UTC](https://techcommunity.softwareag.com/t/dynamic-code-natural-error-msg-vs-user-message/91506/7 "2021-04-02T14:57:37Z")

</div>


