I was quite busy this morning and did not look at the Forum for several hours. About ten minutes ago I took a break and looked at recent postings, including the thread re “casting” an A9 to N7.2.
I decided to play a bit. As a starting point I keyed in the following program which I intended as a skeleton for future playing.
DEFINE DATA LOCAL
1 #A (A9) INIT <12345>
1 #N (N7.2)
IF #A IS (N7.2)
COMPUTE #N = VAL (#A)
WRITE ‘=’ #A ‘=’ #N
Note the typo in the INIT clause for #A; I forgot the apostrophes. I ran the program. The program ran (at least on my PC, haven’t tried the mainframe yet). The output was:
#A 12345 #N 12345.00
Yes, I should have noticed that #A did not have a decimal point. But I was “on a roll”, so I changed the INIT of #A to 12345.67 (still no apostrophes). Now I got an error message (NAT0094) which surprised me. Finally, I noticed the absence of the apostrophes.
Adding the apostrophes yields the same result for #N, while #A has the expected decimal point.
I played a bit further. If #A has any integer string, or, an integer string followed by a decimal point, Natural accepts the INIT value. If you add an integer after the decimal point, Natural objects.
Also, any “mixed value” like ABC123 gets an error message.
Perhaps someone could confirm this on the mainframe. Then perhaps Software AG could comment on whether this is a bug (my guess) or a feature.