Previous Topic: Output EditingNext Topic: Numeric Edit Pattern Restrictions


Numeric

Currently, numeric output is synthesized into a positive, negative, or zero edit pattern based on the numeric entry. Future enhancements will allow you to specify a positive, negative, or zero edit pattern picture string for output editing.

Positive and negative picture strings are interpreted to format the data for display. Specifier characters in the picture strings have specific meaning, and are used to format the data accordingly. All other characters are literal characters, and are copied from the picture to the output field as appropriate.

The blank when zero or null property of a field also controls the presentation of the data. When this property is enabled, a zero numeric value is blanked and the field is filled only with the fill characters.

The significant digits in a numeric string are the digits on the left or right of the decimal point that provide meaning and would alter the value if removed.

The numeric concept of significance is used. Both leading and trailing zeroes are considered insignificant. However, for formatting purposes, once significance has been forced on, either by the picture or the value, proceeding from left to right, it remains on for the entire field including any decimal digits. Specification of a specific precision for use in scientific and engineering disciplines is controlled by the specification of the edit pattern picture, which the data will be formatted to match on output.

The edit pattern picture specifies optional (suppressible) digits, or mandatory digits, or both. Optional digits are denoted by Z, and mandatory digits are specified by 9.

Significance can be forced on by the edit pattern or by the value of the data.

In an edit pattern, significance is forced on by the left-most 9 in the string. Significance is turned on at that position, and for all other positions to the right of that digit, regardless of the value of the data. When significance is turned on by the picture, then leading zeroes become significant.

The value being edited also can force significance on. When the value is edited, the left-most non-zero digit can be aligned with a Z specifier. When the digit is non-zero, significance is forced on. The left-most Z and all other digit specifiers to the right are treated as a 9.

The table below shows examples of numeric output editing behavior.

Case

Float Prefix Literal

Picture

Value

Presentation

1

No

ZZ9

000

__0

2

No

ZZ9

012

__0

3

No

999

000

000

4

No

999

012

012

5

No

ZZZ,ZZ9.99

00000000

_____0.00

6

No

ZZZ,ZZ9.99

00123456

__1234.56

7

No

ZZZ,ZZ9$99

00123456

**1234.56

8

No

999,999.99

00000000

000,000.00

9

No

ZZZ,ZZZ.99

00000009

********09

10

No

999,999.99

00012345

000,123.45

11

Yes

+ZZZ,ZZ9.99

00012345

****+123.45

12

No

+ZZZ,ZZ9.99

00012345

+****123.45

13

No

$ZZZ,ZZ9.99

00012345

$****123.45

14

Yes

$ZZZ,ZZ9.99

00012345

****$123.45

The preceding table illustrates several cases where significance is controlled by the edit pattern. In all cases, an asterisk is the field fill character. This fill character explicitly demonstrates the behavior of the edit routines based on the data, pattern, and significance. Justification is not taken into account.

In case 1, significance is forced by the edit pattern picture at the last digit position (specified by the 9 specifier). The Z specifiers are optional digits, and correspond to insignificant digits in the value (leading zeroes). Significance is not already established. Therefore, the character positions occupied by the Z specifiers are removed from the result and are filled with the fill character.

Case 2 is a variation of case 1 in that the same pattern is used, but the value is now non-zero. In this case, the digit 1 in the value is the start of significance. This digit corresponds to a Z specifier, thus significance is forced on by the data, not the pattern. From that digit position onward to the right, significance is turned on, and all digit specifiers (Z and 9) are considered significant (as if they were 9s). The leading zero in the value is still associated with an optional digit, and significance has not yet been established, so it is suppressed and replaced with the fill character.

Cases 3 and 4 are additional variations, using a pattern picture that specifies only 9s. These specifiers force significance on, and cause all digits, whether they are zero or not, to be output. This can be seen with both a zero and non-zero value.

Cases 5 and 6 demonstrate the effect of infix literals and significance. Infix literals are always suppressed until significance is turned on. Then, they are copied into the output stream in the same relative position they hold in the edit pattern picture. The implied decimal point is placed based on the defined width and decimal digits as defined by the variable. This is further demonstrated in cases 7, 8, 9, and 10.

In case 5, significance is forced on by the 9 specifier in the picture, and thus all leading Z specifiers, and infix literals (,), are suppressed and replaced by the fill character.

In Case 6, the significance is forced on by the data, and corresponds to the digit position before the infix literal. Since significance is now on, all digits are significant as well as all infix literals in the edit pattern picture. It is also important to note that the decimal point character (.) in both cases is just another infix literal. There is nothing special about this character, or its position. The implied decimal point is placed based on the defined width and decimal digits as defined by the variable. This is further demonstrated in cases 7, 8, 9, and 10 of the table.

Cases 11, 12, 13, and 14 demonstrate the effect of floating or fixing the position of prefix literals. When the Float Prefix Literals property is enabled, the prefix literals (either a single character or string of characters) are floated along the field such that they immediately precede the start of significance. If the property is not enabled, then the prefix literals are placed in their exact position as specified by the picture, and suppression of insignificant digits and infix literals occurs normally (being replaced by the fill character).

The effects of output editing also depend on which picture string is used to format the data. Currently, numeric output is synthesized into a positive or a negative edit pattern based on the numeric entry. Future enhancements will allow you to specify a positive (format 1), negative (format 2), or zero (format 3) edit pattern picture string for output editing. See numeric edit pattern restrictions.

The picture string is determined by the sign and magnitude of the value, combined with the format of the edit pattern. When the edit pattern is a format 1 edit pattern, the sign is always disregarded. Negative values are displayed and formatted on output as positive, or absolute value, quantities.

When a format 2 or 3 edit pattern is defined, the sign of the value determines which edit pattern picture is used to edit the data. A zero quantity will select the positive edit pattern picture of format 2 edit patterns, or the zero picture of format 3 edit patterns. This behavior is further demonstrated in the following examples.

The different picture strings (positive, negative, and zero) of the format 2 and 3 patterns can be different lengths. As a result, the presentation space (field) length displayed will be the longer of the various patterns. When shorter pictures are formatted, they will be justified and filled based on the defined fill character and justification mode for the field.

The following table shows an example of numeric output editing using various edit pattern formats (1, 2, and 3).

Case

Format

Positive

Negative

Zero

Value

Presentation

1

1

ZZ9

 

 

123

123

2

2

+ZZ9

-ZZ9

 

123

+123

3

2

+ZZ9

-ZZ9

 

-001

**-1

4

2

ZZ9

(ZZ9)

 

-123

(123)

5

3

ZZ9CR

ZZ9DB

-0-

012

*12CR

6

3

ZZ9CR

ZZ9DB

N/A

000

N/A

More information:

Numeric Edit Pattern Restrictions