I have a PIC X(5) field which can have the following values -
Out of these 4, the vallid values are - 12345 & -12.3 only. I am trying to find out a way using which I can ascertain that. I tried using IS NUMERIC but, that doesn't consider -12.3 a numeric digit. Another option which I was toying around with was to redefine the PIC X(5) Field as
05 WS-X1 REDEFINES WS-X.
06 WS-X1C PIC X OCCURS 5 TIMES.
& then, checking the redefined field as shown below -
UNTIL WS-9 = 5
IF WS-X1C(WS-9) = '1' OR
WS-X1C(WS-9) = '-' OR
WS-X1C(WS-9) = '.'
---Check for all the Numerals---
This seems to be working fine but, I am concerned if this is the right way of doing this. Can someone please advise me on this or if there is a better way of doing this.