I'm getting this error when entering a number that is too big for the field (for example, if I enter 999 for a N1.4 field).
I would like to catch this situation and display a more meaningful error message if possible. Is it possible to bypass the Natural system error and display my own error message?
I tried it using a few variations of ON-ERROR / IF *ERROR-NR = 1125, REINPUT " " , but it still is displaying the system error.
I'm thinking it's possible to work with the field as an alpha instead, but I would like to avoid having to do that if possible.
NAT1125: Too many significant digits in numeric input value
- RGZbrog
- Posts: 101
- Joined: Mon Nov 23, 2009 1:34 pm
- Skillset: Natural, Adabas, Predict, Natural Security, Construct, EntireX, SPoD, NaturalONE
- Referer: SAG Developer Forum
- Location: California, USA
- Contact:
Re: NAT1125: Too many significant digits in numeric input va
Yes, we all fight this one. 
Natural sends the message due to an error condition, and he does not relinquish control (back to your program) until the error is resolved. So the ON ERROR and IF *ERROR-NR statements won't execute until the user fixes the problem - too late.
Change the input field from numeric to alpha. Then decide if you want to make things easy for yourself or for your user. I recommend the latter.
If the user knows that the input must be entered in the format number-decimal-number-number-number-number, then you can use the MASK clause.But this doesn't allow flexibility for input values such as "1.1" or ".123", nor does it allow for negative values.
For flexibility, use the VAL function. But now you need to be concerned with too many decimal digits. That is, the user could enter ".12345" and VAL will truncate.Note that the input value is tested for non-blank, as older versions of Natural will abend when VAL is presented with a blank.

Natural sends the message due to an error condition, and he does not relinquish control (back to your program) until the error is resolved. So the ON ERROR and IF *ERROR-NR statements won't execute until the user fixes the problem - too late.
Change the input field from numeric to alpha. Then decide if you want to make things easy for yourself or for your user. I recommend the latter.
If the user knows that the input must be entered in the format number-decimal-number-number-number-number, then you can use the MASK clause.
Code: Select all
DEFINE DATA LOCAL
1 #A (A6)
...
IF NOT #A = MASK (N'.'NNNN)
THEN
REINPUT 'Enter a value of format N1.4'
END-IF
For flexibility, use the VAL function. But now you need to be concerned with too many decimal digits. That is, the user could enter ".12345" and VAL will truncate.
Code: Select all
DEFINE DATA LOCAL
1 #A (A7) /* allow for negative
1 #T (N5.6) /* too many decimals
1 #N (N1.4)
END-DEFINE
REPEAT
INPUT ' Input:' #A (AD=M)
// 'Numeric:' #N (AD=O)
IF #A IS (N1.4)
THEN
IF #A <> ' '
THEN
#N := VAL (#A)
#T := VAL (#A) * 10000 /* too many decimals
IF FRAC (#T) <> 0 /* too many decimals
THEN
REINPUT FULL 'Too many decimal positions'
END-IF
ELSE
RESET #N
END-IF
ELSE
REINPUT 'Enter a value of format N1.4'
END-IF
END-REPEAT
END
Re: NAT1125: Too many significant digits in numeric input va
Thanks for the helpful info
I also learned something new about VAL and FRAC (which I never have seen used before), and the ability to use an expression like IF #A IS (N1.4)
Thanks again!

I also learned something new about VAL and FRAC (which I never have seen used before), and the ability to use an expression like IF #A IS (N1.4)
Thanks again!
David
-
- Posts: 1
- Joined: Wed Dec 21, 2016 9:15 pm
- Skillset: COBOL, NATURAL, Adabas, DB2, Oracle
- Referer: google
Re: NAT1125: Too many significant digits in numeric input va
How do we easily identify the errant field if there are a lot of them on the stack?
- Akatsukami
- Global moderator
- Posts: 1058
- Joined: Sat Oct 16, 2010 2:31 am
- Skillset: Rexx, JCL, DB2/SQL, TSO/ISPF, PL/I
- Referer: ibmmainframes
- Location: Bloomington, IL
- Contact:
Re: NAT1125: Too many significant digits in numeric input va
Not by reanimating a five-year-old thread.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
-
- Similar Topics
- Replies
- Views
- Last post
-
-
Retain non numeric character in IFTHEN - BUILD
by Shambu » Wed Dec 01, 2021 5:00 pm » in Syncsort/Synctool - 1
- 1971
-
by sergeyken
View the latest post
Sat Dec 04, 2021 2:28 pm
-
-
- 2
- 1355
-
by RazVorox
View the latest post
Tue Dec 05, 2023 11:06 am
-
- 23
- 4376
-
by collinsm
View the latest post
Thu Sep 22, 2022 5:29 am
-
-
Convert fixed-length input records to variable-length output
by xcspg3 » Wed Oct 23, 2024 1:45 pm » in DFSORT/ICETOOL/ICEGENER - 5
- 1448
-
by sergeyken
View the latest post
Wed Oct 30, 2024 1:09 pm
-
-
-
File Handling 3 input files and 1 output file by using EZT
by pavan426 » Thu Sep 09, 2021 12:17 am » in CA-Easytrieve - 0
- 4421
-
by pavan426
View the latest post
Thu Sep 09, 2021 12:17 am
-