COBOL Manual for TNS and TNS/R Programs

Data Division
HP COBOL Manual for TNS and TNS/R Programs522555-006
7-55
PICTURE Clause
Usage Considerations:
Size of character-string
The maximum number of characters in character-string is 30. To signify
more than one consecutive instance of a picture character, you can write it once,
followed by an unsigned integer in parentheses. The integer tells how many times
that character is to occur. For example, PICTURE 99999 is equivalent to PICTURE
9(5). While a character-string can have at most 30 characters, using the
repetition technique lets you define items longer than 30 characters. You cannot
use this technique for characters that are limited to one occurrence in a PICTURE
character-string.
Composition of character-string
The meaning of each character used in a PICTURE character-string is
peculiar to the PICTURE clause and is independent of any meaning assumed in
other contexts.
The character-string in a PICTURE clause consists of certain allowable
combinations of symbols formed from the COBOL character set. The particular
combination of symbols in the character-string determines the size,
category, sign, and editing attributes of the elementary item that it describes. The
symbols also specify any restrictions on the values that the program can assign to
the item and any editing that COBOL is to perform in conjunction with an
assignment.
Most individual symbols serve two purposes:
°
Represent character positions in the item value
°
Describe the characteristics of these positions
Some symbols merely contribute attribute information without defining character
positions. Within the character-string, the presence of a symbol followed by a
repetition factor has the same meaning as the presence of the symbol repeated
the specified number of times.
The symbols are shown in uppercase, but both uppercase and lowercase are
effective.
Table 7-2 lists and explains the symbols used to describe an elementary item.
Table 7-2. PICTURE Character-String Symbols (page 1 of 3)
Symbol
Symbol Counts
in Item’s Size Description
A Yes Represents a character position for a letter or the space
character.
B Yes Represents a character position for a space character.
N No Indicates that the picture string is a national data item.