Previous Topic Next topic Print topic


COMPUTATIONAL-1 Data Items with a PICTURE other than S9(4)

Solution:

To produce the result you require, you must alter the definition of the target of the MOVE statement.

Example:

The following source code causes TEST-RECORD to hold"9900" under the RM/COBOL system, but"0099" under this COBOL system.

 01 test-record                pic x(4). 
 01 comp-1-item                pic 99 comp-1. 
 procedure division. 
    ...

     move 99 to comp-1-item. 
     move comp-1-item to test-record.

To overcome this problem, alter the definition of TEST-RECORD as shown below:

 01 test-record.
     03 test-numeric-field     pic 99. 
     03 filler      pic xx. 
 01 comp-1-item                pic 99 comp-1. 
 procedure division. 
     ... 
    move 99 to comp-1-item. 
    move comp-1-item to test-numeric-field.

This avoids moving the COMPUTATIONAL-1 data item directly to an alphanumeric field.

Previous Topic Next topic Print topic