Picture characters for character data
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.
- X
- Any character of the 256 possible bit combinations represented by the 8-bit byte.
- A
- Any alphabetic or extralingual (#, @, $) character, or blank.
- 9
- Any digit, or blank. (Note that the 9 picture specification character allows blanks only for character data.)
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.) Consider the following 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 1 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 |