Alphanumeric pictures

Alphanumeric pictures control formatting of alphanumeric strings. An alphanumeric picture allows you to mix constant characters in the picture specification with the data being processed. You can also mask out unwanted character types.

When the HPL processes an alphanumeric picture, the picture string is scanned until a picture-control character is found. All noncontrol characters in the picture string are placed directly into the output string.

When a control character is found in the picture string, the input data is scanned until a character that matches the type of the picture-replacement character is found. This character is placed in the output string, and the process is repeated.

The alphanumeric picture-control characters are X, a, A, 9, and \. A picture string that includes any of the preceding characters is, by definition, an alphanumeric picture string. All other characters in an alphanumeric picture string are treated as literals and inserted directly into the resulting output string.

The following list describes the behavior of the alphanumeric picture-control characters.
Character
Definition
X
Replaces the control character with any character from input data
A
Replaces the control character with an alphanumeric character from input
a
Replaces the control character with an alphabetic character from input
9
Replaces the control character with a numeric character from input Fills the string with leading 0 characters so that the length of the input string matches the length of the picture specification.
\
Causes the character that follows the backslash to be placed in the output. That is, the character that follows a backslash is not a control character.
The following table lists some examples of alphanumeric pictures.
Picture Input data Output data
XX-AJXXXX 12P45-q 12-PJ45-q
AA-\AJAAAA 12P45-q 12-AJP45q
aaaaaaaa 12P45-q Pq
aa99999 123abc ab00000