You are on page 1of 11

PICTURE CLAUSE CHARACTERISTICS

PICTURE CLAUSE
• Describes the general characteristics of an elementary
data item
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-signed or unsigned.
• If a numeric data is unsigned then during
execution such unsigned data items are
treated as positive quantities.
• Signed data item -the code character S at the
leftmost end of the picture clause
Point Location
• The position of the decimal point can be
specified for numeric data items.
• If not specified, it is an integer - decimal point
is positioned after the rightmost digit.
• In COBOL the decimal point is not explicitly
included in the data.
• The position of the decimal point is merely
an assumed position.
Size
• The number of characters or digits required to
store the data item in the memory in known
as Size of the data item
• specified through a PICTURE clause.
PICTURE
PICTURE
Code Meaning
Char
acter
9 [Digit]
Each occurrence of this code represents a digit
X [Any character of Cobol]
Each occurrence of this code indicates any allowable character from the COBOL
character set.
A [Alphabet ]
Each occurrence of this code indicates a letter or space character.
V [Assumed Decimal Point]
The occurrence of this in a picture string indicates the position of the assumed
decimal point.
P [Assumed Decimal Point lying outside ]
The occurrence of this indicates the position of the assumed decimal point
when the point lies outside the data item.
S [Signed Data Item]
The occurrence of this indicates that the data item is signed.
• There is no special code to indicate the size.
• The total number of occurrence of 9, X or A in
the picture string indicates the size
• The occurrence of V, P and S are not counted
in determining the size of an item.
RULES
• For alphabetic - A.
• For numeric - 9, V,P and S. These are called operational characters.
It must contain at least one 9.
• V and S can appear only once and S, if it is included, must be the
leftmost
• character of the picture string.
• The symbol P can be repeated on the right or on left (but not on the
left of S) as many times as is required to indicate the position of the
assumed decimal point.
• For alphanumeric item, -all Xs or a combination of 9, A and X
(except all 9 or all A).
• Cannot be used for a group item.

You might also like