A character picture specification describes a nonvarying character data item. You can specify that any position in the data item can contain only characters from certain subsets of the complete set of available characters. The data can consist of alphabetic characters, decimal digits, and blanks.
The only valid characters in a character picture specification are X, A, and 9. Each of these specifies the presence of one character position in the character value, which can contain the following:
When a character value is assigned, or transferred, to a picture character data item, the particular character in each position is validated according to the corresponding picture specification character. If the character data does not match the specification for that position, the CONVERSION condition is raised for the invalid character. (However, if you change the value by record-oriented transmission or by using an alias, there is no checking.) For example:
declare Part# picture 'AAA99X'; put edit (Part#) (P'AAA99X');
The following values are valid for Part#:
'ABC12M' 'bbb09/' 'XYZb13'
The following values are not valid for Part# (the invalid characters are underscored):
'AB123M' 'ABC1/2' 'Mb#A5;'
Table 35 shows examples of character picture specifications.
|
Source Attributes |
Source Data (in constant form) |
Picture Specification |
Character Value |
|---|---|---|---|
|
CHARACTER(5) CHARACTER(5) CHARACTER(5) |
'9B/2L' '9B/2L' '9B/2L' |
XXXXX XXX XXXXXXX |
9B/2L 9B/ 9B/2Lbb |
|
CHARACTER(5) CHARACTER(5) CHARACTER(5) |
'ABCDE' 'ABCDE' 'ABCDE' |
AAAAA AAAAAA AAA |
ABCDE ABCDEb ABC |
|
CHARACTER(5) CHARACTER(5) |
'12/34' 'L26.7' |
99X99 A99X9 |
12/34 L26.7 |