Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp

6.1.8.6.1 Size of Operands



The maximum size of each operand is 18 decimal digits. The composite of operands is a hypothetical data item resulting from aligning the operands at the decimal point and then superimposing them on one another. It must not contain more than 18 decimal digits.

For example, assume that each item is defined as follows in the Data Division:


     A  PICTURE 9(7)V9(5).
     B  PICTURE 9(11)V99.
     C  PICTURE 9(12)V9(3).

If the following statement is executed, the composite of operands consists of 17 decimal digits:


     ADD A B TO C

It has the following implicit description:


     COMPOSITE-OF-OPERANDS PICTURE 9(12)V9(5).


X The composite of operands can be more than 18 digits. For more
X information, see the section on intermediate results in the IBM COBOL
X Programming Guide for your platform.

In the ADD and SUBTRACT statements, if the composite of operands is 18 digits or less, the compiler ensures that enough places are carried so that no significant digits are lost during execution. The following table shows how the composite of operands is determined for arithmetic statements:


 Table 35. How the Composite of Operands is Determined                     
 Statement   Determination of the Composite of Operands                    
 SUBTRACT  
 ADD       
 Superimposing all operands in a given statement (except those 
 following the word GIVING)                                    
 MULTIPLY    Superimposing all receiving data items                        
 DIVIDE    
           
 Superimposing all receiving data items, except the REMAINDER  
 data item                                                     
 COMPUTE     Restriction does not apply                                    


In all arithmetic statements, it is important to define data with enough digits and decimal places to ensure the desired accuracy in the final result.

Previous Topic Next Topic © Copyright IBM Corp. 1991, 1998

IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.





Return to library:   z/OS | z/OS.e | TPF | z/VSE | z/VM | IBM Hardware | IBM System z Redbooks
Glossary:   IBM terminology
Publications:   How to order publications
Readers:   Download IBM Library Reader | Download IBM Softcopy Reader | Download Adobe® Acrobat® Reader®
Library management:   Download IBM Softcopy Librarian
Contacts:   Contact z/OS


Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.