Previous Topic Next topic Print topic


Redefinition of COMP or COMP6 Data Items

Studio Enterprise Edition fully supports the size and capacity of RM/COBOL type COMPUTATIONAL and COMPUTATIONAL-6 data items when the RM Compiler directive is set. However, the internal representation of these data items in Studio Enterprise Edition and in RM/COBOL is not the same. See the chapter Compatibility with RM/COBOL in the product Help.

If this causes you problems, redefine these data items to take advantage of their internal format. MOVE the data items concerned to other data items which are not defined as COMPUTATIONAL or COMPUTATIONAL-6. Moving these data items converts the data automatically, overcoming any problems you might have.

Example

The following source code is coded to take advantage of the internal representation of COMPUTATIONAL-6 data items in RM/COBOL, and to analyze a date field:

 01 birthdate-1          pic 9(6) comp-6. 
 01 birthdate-2 redefines birthdate-1. 
     03 month-2         pic 99 comp-6. 
     03 day-2           pic 99 comp-6. 
     03 year-2          pic 99 comp-6. 
     ....

 procedure division. 
 start-up section. 
 para-1. 
     ....

     move 082462 to birthdate-1. 
     ....

     if year-2 = 62 
         display "records not available for 1962."

Amend your source program to use the DISPLAY format instead of redefining COMPUTATIONAL-6 data items, before submitting it to Studio Enterprise Edition:

 01 birthdate-1          pic 9(6) comp-6. 
 01 birthdate-2 redefines birthdate-1. 
     03 month-2         pic 99 comp-6. 
     03 day-2           pic 99 comp-6. 
     03 year-2          pic 99 comp-6.

 01 birthdate-1a         pic 9(6). 
 01 birthdate-2a redefines birthdate-1a. 
     03 month-2a        pic 99. 
     03 day-2a          pic 99. 
     03 year-2a         pic 99. 
     ....

 procedure division. 
 start-up section. 
 para-1. 
     ....

     move 082462 to birthdate-1. 
     move birthdate-1 to birthdate-1a. 
     ....

     if year-2a = 62 
         display "records not available for 1962."
Previous Topic Next topic Print topic