INPUT stored in temp
03 WS-TERM-FIELD PIC 9(4) VALUE ZERO.
03 WS-TERM-ID PIC 9(4) VALUE ZERO.
03 WS-TERM-ID PIC 9(4) VALUE ZERO.
Error check:
IF WS-TERM-FIELD NOT NUMERIC
DISPLAY 'INVALID FIELD'
INITIALIZE MSG-002
MOVE '002' TO MSG-WORK-NUM
SET MSG-WORK-ERR TO TRUE
MOVE CARDI-WORK TO MSG-002-COMMAND
MOVE SPACES TO MSG-WORK-DTL
MOVE MSG-002 TO MSG-WORK-DTL
PERFORM DISP-RTN THRU DISP-EXIT
END-IF.
IF WS-TERM-ID NOT NUMERIC
DISPLAY 'INVALID ID'
INITIALIZE MSG-002
MOVE '002' TO MSG-WORK-NUM
SET MSG-WORK-ERR TO TRUE
MOVE CARDI-WORK TO MSG-002-COMMAND
MOVE SPACES TO MSG-WORK-DTL
MOVE MSG-002 TO MSG-WORK-DTL
PERFORM DISP-RTN THRU DISP-EXIT
END-IF.
Result:
No error and ID = 0002
Why is B taken to be 2? How to correct this?
If there are two letters it gives an error but if there is one letter, no error.