COBOL Sign Data type

COBOL Alphanumeric Data Type COBOL Assumed Decimal Point Data Type

Advertisements


Sign data type is all about to declare the sign value for the numeric data type.

Sign data type uses S to declare the data item with sign.

The SIGN clause is used for only a signed numeric data item or data item entry whose usage is DISPLAY, or a group data item containing at least one such similar data description entry.

It states the position of the sign, whether leading or trailing, as well as whether the sign was formed by over punching in the first or last character of the data item or was formed separately.

Sign data type declaration will come with a combination of numeric data type only.

The below table will represent SIGN Over punching.

Sign Practical Example:

The below two additional options available in SIGN clause.

  1. Leading separate
  2. Trailing separate
Syntax :
	[SIGN IS] {LEADING/TRAILING} [SEPARATE CHARACTER]
Parameters :
  
	LEADING 	Indicates that the sign is at the beginning of the data 
	                item. 
	TRAILING        Indicates that the sign is at the end of the data item. 
	SEPARATE        Indicates that the sign is not over punched on last/first 
	                char of the data item and sign separately occupies the 
	                first or last character of the data item

Note:
1. SIGN S occupies extra 1 byte of storage space.
2. If Nothing of the above parameters provided with SIGN clause, by default it is to SIGN IS TRAILING

Sign Practical Example:


If any questions on the above, post your queries on Cobol Discussion forum


COBOL Alphanumeric Data Type COBOL Assumed Decimal Point Data Type

Advertisements