Previous Topic: Usage NoteNext Topic: Date


Picture (Numeric/Character)

Picture, also known as Numeric/Text, is a logical combination of the behavior and specification of numeric and character edit patterns and capabilities.

The edit pattern specifiers in picture fields are detailed in the following table.

Specifier

Description

X

Optional alphanumeric character. It can be any value from x'00' to x'FF,' except x'11.' unless the field is transparent.

Y

Mandatory alphanumeric character. It can be the same value as an 'X' specifier.

Z

Optional digit, may be from 0 to 9.

9

Mandatory digit, may be from 0 to 9.

A

Optional alphabetic, may be any printable non-numeric character.

B

Mandatory alphabetic, may be any printable non-numeric character.

Picture fields are most often used for non-quantity numeric values, such as part numbers, phone numbers, social security, other identification numbers, and so on. Typically, they are associated with integer numeric variables, although they can also be associated with fixed or varying length character strings.

Significance is defined differently, based on the orientation of the dialect. For dialects with a left-to-right orientation, significance is defined by the left-most non-zero digit, or the left-most non-space character. For dialects with a right-to-left orientation, significance is defined by the right-most non-space character.

Significance can be forced on by the edit pattern picture string, using either the 9 or Y specifiers. Again as either the left-most 9 or Y for left-right orientation, or right-most Y for right-left orientation.

Prefix and infix literals up to the point of significance are suppressed. This differs from numeric editing, in that the prefix literals are either fixed or floated. In picture fields, prefix literals are suppressed UNLESS significance starts immediately following the prefix literal, in which case it is not suppressed. Infix literals are always suppressed until significance begins.

The following table illustrates significance in Picture fields.

Case

Picture

Data

Presentation

1

(ZZZ) 999-9999

0005756595

______575-6595

2

(ZZZ) 999-9999

2145756595

(214) 575-6595

3

XX99-9999Y

123456X

__12-3456X

4

XX99-9999Y

AB121234C

AB12-1234C

5

XX99-9999Y

AB1212349

AB12-12349

6

XX99-9999B

AB121234Z

AB12-1234Z

Case 1 of the Picture Output Editing Examples shows data that is not significant until the fourth digit (left to right). The edit pattern picture does not force significance until the fourth digit. This means that all prefix and infix literals, and optional specifiers, are suppressed until significance has been started.

In case 2, the data is significant in the first digit position, forcing significance on. This in turn causes the prefix literals to be output, because significance is on immediately following the prefix literal.

In cases 3 and 4, a picture edit pattern specifies both digits and characters. The digit specifier only accepts a digit (0-9), while the character specifier accepts any character. This allows the picture to specify, in this case, a part number using a mixed value of characters and digits. It is also significant to note that the data can have a character value that is the same as a specifier in the edit pattern picture. These are not the same, and should not be confused.

In case 6, the edit pattern string is changed to force the last position to be a mandatory alphabetic value. Case 5 indicates that the use of a Y specifier is satisfied by either a numeric or character value.

On output, data that does not conform to the edit pattern is flagged as an error, and the user is allowed to correct it. Thus, a field is flagged in error when a numeric character is entered where the edit pattern specifies an alphabetic character. Output editing not only flags the field in error, but also flags each character position that is incorrect. This is one of the few places where output editing changes the state of a variable to error and fails an edit; normally this is performed during input editing.