COBOL Assumed decimal point data type

COBOL Sign Data Type COBOL Renames Clause

Advertisements


Assumed decimal point allows storing period (.) for decimal values.

Assumed decimal point data type uses P/V to declare the data item which contains a decimal value.

Assumed decimal point data type declaration will come with a combination of numeric data type which is used to declare numeric data items.

DISPLAY USAGE clause is applicable for Assumed decimal point data type.

If the decimal point is in between the values, then V will be used in declaration.


Example:

S=+12.567, The declaration of S should be like below 

01 S PIC S9(2)V9(3).  Here V represents the dot.

If the decimal point is at any end of values, then P will be used in declaration.


	
	Y= .567 	->	01 Y PIC P9(3)	 

Note:
  1. Assumed decimal point P or V does not occupy any extra storage space.
    1. P/V --- Doesn’t occupy any storage space.
    2. P --- External decimal point.
    3. V --- Internal decimal point.
  2. If the Decimal point at the boundaries of numeric value then P will use to represent the .(Dot).
  3. Numeric & alpha numeric data types are declared as alphanumeric but not vice versa.
  4. SOC7 error will occurs whenever we pass the mismatch of the data types.

Practical Example:


Code:



Output:



COBOL Sign Data Type COBOL Renames Clause

Advertisements