Working with numbers and arithmetic
About this task
In general, you can view COBOL numeric data as a series of decimal digit positions. However, numeric items can also have special properties such as an arithmetic sign or a currency sign.
To define, display, and store numeric data so that you can perform arithmetic operations efficiently:
- Use the
PICTURE
clause and the characters9
,+
,-
,P
,S
, andV
to define numeric data. - Use the
PICTURE
clause and editing characters (such asZ
, comma, and period) along withMOVE
andDISPLAY
statements to display numeric data. - Use the
USAGE
clause with various formats to control how numeric data is stored. - Use the numeric class test to validate that data values are appropriate.
- Use
ADD
,SUBTRACT
,MULTIPLY
,DIVIDE
, andCOMPUTE
statements to perform arithmetic. - Use
the
CURRENCY SIGN
clause and appropriatePICTURE
characters to designate the currency you want.