Character and character string edit patterns use X and Y as specifiers. Each specifier represents a single character (not necessarily a byte) in the data. Any character other than a specifier in the edit pattern is assumed to be a literal character.
The Y specifier represents a mandatory character position (like the 9 for numeric), while the X represents an optional character position (like the Z for numeric). When a Y is specified, then the character position must be filled with a non-space and non-fill characters. When an X is specified, then the position may or may not have a non-space or non-fill character.
Literal characters can be prefix, infix, or postfix. The operation and use of these literals is basically the same as for numeric and character strings. Significance is defined as being the left-most non-blank character for left-right orientation dialects, and the rightmost non-blank character for right-left orientation dialects. Significance may also be forced on by the picture, just as for numeric edit patterns (the first occurrence of a Y specifier, either left-right or right-left based on dialect).
Character edit patterns are always format 1 edit patterns. There is never a negative or zero picture. The positive picture supplies the edit pattern picture string for use in editing the field.
If a character string is edited, and there is less data in the string than required to satisfy the optional characters specified in the picture, then fill characters are inserted for these missing characters. This is true for fixed or varying length strings. In the case of varying length strings, the string may have fewer characters than those necessary to satisfy the optional characters in the picture (especially for NULL strings).
The following table illustrates character string output edit patterns.
|
Case |
Picture |
Value |
Presentation |
|---|---|---|---|
|
1 |
XXXXXXXXXY,YY |
DALLASTX |
____DALLAS,TX |
|
2 |
(XXXX)XXXXXXX |
DEWAYNE |
______DEWAYNE |
|
3 |
(XXXX)XXXXXXX |
DLH DEWAYNE |
(DLH_)DEWAYNE |
|
4 |
(XXXX)XXXXXXX |
XYZ ZEBRA |
(XYZ_)__ZEBRA |
|
5 |
(YYYY)YYYYYYY |
XYZ ZEBRA |
(XYZ ) ZEBRA |
Case 1 in the Character Output Editing table shows a picture that specifies a literal character (,) between two groups of significant characters. The result is edited, with the literal inserted, and the fill character pads the field to account for insignificant characters.
In case 2, the picture specifies entirely optional character specifiers. The data is the same length, but no significant data is present for the left portion of the picture. Prefix literals and infix literals are suppressed until significance is started.
Case 3 is similar to case 2, except that significant data exists in the variable to force significance on immediately. This causes the prefix literal to be displayed. The fill character is inserted for all optional character positions that do not have a character in the data or spaces in the data.
Cases 4 and 5 demonstrate the different behaviors when the data is shorter than the picture, and the picture specifies both optional and mandatory character specifiers.
|
Copyright © 2013 CA.
All rights reserved.
|
|