PICTURE Clause in COBOL
PICTURE Clause:
The picture clause describes the general characteristics of an elementary data item. These characteristics are described below:
Class: In COBOL a data item may be one of the three classes – numeric, alphabetic or alphanumeric. The numeric items consist only of digits 0 to 9. Alphabetic items consist only of the letters A to Z (a to z) and the space (blank) character. The alphanumeric items may consist of digits, alphabets as well as special characters.
Sign: A numeric data item can be signed or unsigned. If numeric data is considered unsigned then during execution such unsigned data items are treated as positive quantities. To describe a signed data item one should use the code character S at the leftmost end of the picture clause of the corresponding variable.
Point Location: The position of the decimal point is another characteristic that can be specified in the case of numeric data items. If the said position is not specified, the item is considered to be an integer which means that the decimal point is positioned immediately after the rightmost digit. It may be noted that in COBOL the decimal point is not explicitly.
Size: The number of characters or digits required to store the data item in the memory is known as the size of the data item. All the four general characteristics described above can be specified through a PICTURE clause.