Joined: 06 Jun 2008 Posts: 892 Location: Atlanta, GA
The compiler probably generates a ZAP instruction to move the data to the COMP-3 field. ZAP instructions assume the zones are valid and converts only the value parts of each byte -- as long as the last 4 bits of the byte are in the 0 to 9 range you won't get an abend.
If you know you've got bad data, you should be coding
Code:
IF WS-NUM1 NUMERIC
MOVE WS-NUM1 TO WS-NUM2
ELSE ....
The compiler probably generates a ZAP instruction to move the data to the COMP-3 field. ZAP instructions assume the zones are valid and converts only the value parts of each byte -- as long as the last 4 bits of the byte are in the 0 to 9 range you won't get an abend.
If you know you've got bad data, you should be coding
Code:
IF WS-NUM1 NUMERIC
MOVE WS-NUM1 TO WS-NUM2
ELSE ....
Forgot to mention but the suggestion that was provided did work. Many thanks.