Previous Topic Next topic Print topic


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

In Studio Enterprise Edition, a COMPUTATIONAL-1 data item is assumed to have a picture-string of S9(4). In RM/COBOL, when a COMP-1 item is used as the source of a MOVE statement to an alphanumeric item, the picture clause is preserved.

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"99 " in RM/COBOL, but"0099" in Studio Enterprise Edition.

 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