Undefined Results of MOVE and Arithmetic Operations


You can overcome most of these incompatibilities by redefining the data items involved, or by recoding the comparisons. If you submit a program to this COBOL system containing an alphanumeric to numeric data item MOVE statement, a warning message will be displayed indicating this.


If you submit a source program containing the following data items and procedural statements the specified test will fail at run time:

 01 numeric-field        pic 9(5). 
 procedure division. 
     move "abc" to numeric-field. 
     if numeric-field = "00abc" 

When the RM directive is set, this COBOL system partially emulates the behavior of the RM/COBOL system for alphanumeric to numeric MOVEs by treating the numeric item as an alphanumeric item which is right justified. However, the above example will still fail because the RM/COBOL system treats the literal ABC as numeric, and places 00ABC in the numeric item. To make the statement run successfully under this COBOL system, amend the test in the source program to:

     if numeric-field = " abc"

and resubmit the source program to the system.