Previous Topic Next topic Print topic


Undefined Results of MOVE and Arithmetic Operations

Enterprise Developer 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 Enterprise Developer containing an alphanumeric to numeric data item MOVE statement, a warning message will be displayed indicating this.

Example

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, Enterprise Developer 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 Enterprise Developer, amend the test in the source program to:

     if numeric-field = " abc"

and resubmit the source program.

Previous Topic Next topic Print topic