Undefined Results of MOVE and Arithmetic Operations

Visual COBOL and RM/COBOL differ in the results of MOVE statements, arithmetic operations, and comparisons that involve numeric and alphanumeric data items.

You can overcome most of these incompatibilities by redefining the data items involved, or by recoding the comparisons. If you submit a program in Visual COBOL 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 Compiler directive is set, Visual COBOL partially emulates the behavior of RM/COBOL 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 RM/COBOL treats the literal ABC as numeric, and places 00ABC in the numeric item. To make the statement run successfully in Visual COBOL, amend the test in the source program to:

     if numeric-field = " abc"

and resubmit the source program.