Dynamic Code - Natural error msg vs. User message


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.


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.


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.

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.

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) to check if you have a syntax or run time error.

You should also look at parameter SYNERR