The Adabas & Natural by Software AG Ideas Portal is hosted by Aha! Labs Inc.. Therefore, personally identifiable information are processed by Aha! Labs Inc., a company based in the United States of America. By using this Ideas Portal you agree to the
Terms of Service of Aha! Labs Inc.. For further information about Aha’s handling of your personally identifiable information, please go to:
https://www.aha.io/legal/security/gdpr.
Hello Hezi,
The try/catch command could be used in Natural by writing the code to be analyzed in
external subroutine.
Within the external subroutine the "catch" part is on-error.
See code sample:
0010 DEFINE DATA LOCAL
0020 1 #I (I04)
0030 1 #N (I04)
0040 1 #LAST_ERROR (I04)
0050 1 #MSG (A79)
0060 END-DEFINE
0070 #N := 1
0080 #LAST_ERROR := 0
0090 F1. FOR #I := 1 TO 99
0100 PERFORM CALCMULT #I #N #LAST_ERROR
0110 IF #LAST_ERROR = 0
0120 THEN
0130 COMPRESS #I "! = " INTO #MSG LEAVING NO SPACE
0140 COMPRESS #MSG #N INTO #MSG /* LEAVING NO SPACE
0150 WRITE #MSG
0160 ELSE
0170 WRITE "Overflow occurred - processing terminated"
0180 ESCAPE BOTTOM (F1.)
0190 END-IF
0200 END-FOR /* (F1.)
0210 END
0010 DEFINE DATA PARAMETER
0020 1 #P_I (I4)
0030 1 #P_N (I4)
0040 1 #P_LAST_ERROR (I4)
0050 END-DEFINE
0060 DEFINE SUBROUTINE CALCMULT
0070 ON ERROR
0080 #P_LAST_ERROR := *ERROR
0090 ESCAPE ROUTINE
0100 END-ERROR
0110 #P_N := #P_N * #P_I
0120 END-SUBROUTINE /* (CALCMULT)
0130 END