Coding for Extension exceptions in Natural

My Natural Server Extension is doing validation before storing a record in Adabas. If the validation fails how do I pass the information back to the originating program so it can take the appropriate action? In the Tamino documentation under ‘Exceptions’ there is nothing for Natural and I can’t figure out what to do in Natural. The samples in SYSEXSXS don’t seem to have any error processing other than STOP.

Hello Priscilla,

I asked our Natural SXS experts and this is what they told me:

To raise an exception in Natural, the system variable *ERROR-NR has to be set to a non-zero value.

If this value (the error number) is defined by the Natural utility SYSERR, the so defined string is returned as well when the exception is raised.

Best regards,

Julius Geppert
Quality Engineer Tamino

Thanks for your reply, Julius.
It has taken me a bit of time to try to test this and I have not really had success. I copied the library SYSEXSXS to my own library(TESTSXS) , changed the name of the class, used new GUIDs, etc. I made a few changes to SXSMI-N to put something in *ERROR-NR. I am attaching the program. I then installed the extension, changed the tsd, defined the schema and loaded the Collection. I then processed a document with ‘ZZZ’ in the Curr-code. The document got added to Tamino but the text document did not get created in TEMP. Should I not have the ON ERROR statement? Also which library should the SYSERR be in? I added it to TESTSXS.
Thanks for any help!
SXSMI-N.txt (650 Bytes)

Thanks to Julius and Thomas Schwade I have now progressed a bit further. I removed the ‘on error’ statement from my program. What I now get is the following:

<?xml version="1.0" encoding="iso-8859-1" ?>
- <ino:response xmlns:ino=“http://namespaces.softwareag.com/tamino/response2” xmlns:xql=“http://metalab.unc.edu/xql/”>
- <ino:message ino:returnvalue=“0”>
ino:messagelinedocument processing started</ino:messageline>
</ino:message>
- <ino:message ino:returnvalue=“7126”>
<ino:messagetext ino:code=“INOSXE7126”>Server extension failed</ino:messagetext>
ino:messagelineLine 25, Column 2: INOSXE7034: The Server extension (/!NATURAL!////natrun/TESTSXS/SXSMI-N///) threw exception 8001 NAT8001 (Messagetext doesn’t exist!)</ino:messageline>
</ino:message>
</ino:response>

It looks like we can only send back Natural errors which really isn’t what we want to do - my error 8001 WAS in library TESTSXS.

On a different tack, is there any way to use SXS_EXCEPTION(Errno, “text”) as described under ‘Exceptions’ in the ‘Developing Server Extensions’, and if so how do I code this in Natural? (I’m not clued up on COM in Natural).
Thanks again for the help so far.

Priscilla

The mentioned behavior is an error in Natural, entered as P227396 in SAGSIS.