Edit Masks

#### Search Results

Search

# Edit Masks

This appendix describes the edit masks available in Super Natural. The information has been taken from the section General Information in the Natural Reference documentation. Information not relevant to Super Natural users has been removed and other slight alterations have been made.

This section covers the following topics:

- What are Edit Masks?

## What are Edit Masks?

Edit masks determine how fields are displayed. Using an edit mask, you can do the following when displaying fields:

- Insert blanks

- Insert characters

- Display the field with leading or trailing characters

- Display numeric fields with a sign before or after the number

- Suppress leading zeros in numeric fields

You can also use edit masks to determine how the date and time are displayed.

### Abbreviating Edit Masks

You can use abbreviated notation for long edit masks. The following examples show abbreviated notation for numeric, hexadecimal, and alphanumeric edit masks:

Abbreviation | Equivalent
--- | ---
9(4)-9(5) | 9999-99999
H(10) | HHHHHHHHHH
X(6)..X(3) | XXXXXX..XXX

You can only use this notation with the characters "9", "H", "X" and "Z" which represent significant print positions in the numeric, hexadecimal, and alphanumeric edit masks.

### Blanks in Edit Masks

Blanks within an edit mask are represented by the character which corresponds to H'5F', i.e. "^" or "¬" in hexadecimal code on your keyboard.

### Edit Masks for Numeric Fields

A numeric edit mask used with N, P, I, or F format fields must contain at least one "9" or "Z". If there are more 9s or Zs than the number of positions contained in the field value, the number of print positions in the edit mask is adjusted to the number of digits defined for the field value. If there are fewer 9s or Zs, the high-order digits before the decimal point and/or low-order digits after the decimal point are truncated.

Two options are available when using numeric edit masks. The first option allows the insertion of a special character as the first character in the edit mask.

#### Edit Mask Notation for Numeric Fields

Character | Function
--- | ---
9 | Position to be displayed.
Z | Zero suppression for leading zeros. This is the default for numeric fields. The letter "Z" may be repeatedly specified to represent floating zero suppression. A "Z" must not be specified to the right of the decimal point. A zero value may be displayed as blanks using all "Z"s in the edit mask.
+ | A floating sign is to be displayed preceding/following the number. The sign may be generated as a plus or minus depending on the value of the field.
- | A floating minus is to be displayed preceding/following the number if the value of the field is negative.
S | A sign is to be displayed to the left of the value. A plus sign is displayed for a positive value and a minus sign is displayed for a negative value. If "S" is used, it must be specified as the first character in an edit mask.
N | A minus sign is to be displayed to the left of the column if the value of the field is negative.
. | A period, if used as the first character, represents a decimal position and is significant.
H | Designates the beginning of a hexadecimal edit mask. If an "H" appears as the first position, all other character which are not "H" will be considered insertion characters.

The second option allows any number of leading characters to appear prior to the first displayable position (as indicated with the digit "9"). The first of these leading characters must not be any of the edit characters described above unless enclosed in quotes. The first of these insertion characters specified will appear in the output only if the value contains leading zeros and the edit mask is defined with Z (leading zero suppression). This character will then be displayed instead of a blank for leading zeros.

Both options permit the use of insertion and trailing characters. The symbol (^) may be used to represent a leading, inserted, or trailing blank. By enclosing significant characters (9, H, Z, X) in apostrophes, it is possible to use any characters as leading, insertion, or trailing characters. Insignificant edit mask characters need not be enclosed in apostrophes. Within the same edit mask notation, it is possible to have groups of leading, insertion, and/or trailing character strings, some of which are bounded by apostrophes and some of which are not.

A trailing sign character can be specified for numeric edit masks by using the "+" or "-" characters as the last character in the edit mask. A "+" will produce a trailing "+" or "-" sign depending on the value of the field. A "-" will produce a trailing space or "-" sign depending on the value of the field. If a leading and trailing sign are specified in the edit mask, both will be produced.

### Edit Masks for Alphanumeric Fields

An alphanumeric edit mask which is only to be used with A format fields must contain at least one "X" which represents a character to be displayed. An "H" as the first character designates a hexadecimal edit mask (see Edit Masks for Fields in Hexadecimal Format). A blank is represented by a (^) symbol. All other characters except parentheses are permissible including leading, trailing, and insertion characters. It is also possible to specify leading, insertion, or trailing characters enclosed within apostrophes. If the character "X", a closing parenthesis, or a quotation mark is specified as an insertion character, it must be enclosed within apostrophes.

If leading characters are used before the first displayable position X, the first of these leading characters will not be displayed. Trailing characters which immediately follow the last permissible print position will be displayed.

The number of positions to be displayed will be adjusted to the length of the edit mask if the mask is shorter than the field.

Note
An edit mask specification will override any settings for the session parameters AL, ES and ZP.

#### Examples of Edit Mask for Alphanumeric Fields

The following table shows alphanumeric edit masks for a field that is defined with format/length A4 and contains the value "BLUE":

Edit Mask | Output
--- | ---
X.X.X.X | B.L.U.E
X^X^X^X | B L U E
X--X--X | B--L--U
X-X-X-X-X-X | B-L-U-E-
X' 'X' 'X' 'X | B L U E
XX....XXX | BL....UE
1234XXXX | 234BLUE

### Edit Masks for Fields in Hexadecimal Format

If the character "H" is specified as the first character in an edit mask, the content of an alphanumeric or numeric field will be displayed in hexadecimal format. Each "H" represents two print positions that will occur for each byte in the source field. Characters other than "H" serve as insertion or trailing characters in the mask. The number of positions to be displayed will be adjusted to the length of the edit mask if the mask is shorter than the field. The length of the edit mask will be adjusted to the length of the field if the field length is shorter than the edit mask.

Insertion or trailing characters may be optionally specified bounded by apostrophes.

All fields displayed with a hexadecimal edit mask are treated as alphanumeric. Therefore, if the edit mask is shorter than the field to be edited, numeric or alphanumeric positions will be displayed from left to right disregarding any decimal point positions.

#### Examples of Edit Masks for Fields in Hexadecimal Format

The table below lists the hexadecimal edit masks with results obtained from the original fields and values shown above each column. All numeric values ("-10", "+10", "01") to which edit masks have been applied originated in fields defined with N2 format. The alphanumeric value "AB" originated from a field defined with A2 format:

Edit Mask | Output for: AB | Output for: -10 | Output for: +10 | Output for: 01
--- | --- | --- | --- | ---
HH | C1C2 | F1D0 | F1F0 | F0F1
H¬H | C1 C2 | F1 D0 | F1 F0 | F0 F1
HH¬H | C1C2 | F1D0 | F1F0 | F0F1
H-H | C1-C2 | F1-D0 | F1-F0 | F0-F1
H | C1 | F1 | F1 | F0

### Edit Mask Characters for Fields in Date and Time Format

You can use the characters for fields defined with Date format in edit masks for fields defined with Time format. You cannot use the characters for fields defined with Time format in edit masks for fields defined with Date format.

#### Edit Mask Characters for Fields in Date Format

The following characters may be used in edit masks for fields defined with format D (date). You can also use them for fields defined with T (time) format.

Character | Usage
--- | ---
DD | Day.
ZD | Day with zero suppression.
MM | Month.
ZM | Month with zero suppression.
YYYY | Year (4 digits).
YY | Year (2 digits).If used for input, 19 is concatenated before the input value.
Y | Year (1 digit).May not be used for input.
WW | Number of Week.
ZW | Number of Week with zero suppression.
JJJ | Julian day.
ZZJ | Julian day with zero suppression.
N...N | Name of Day (language dependent).
N(n) | Name of Day using length "n".
L...L | Name of Month (language dependent).
L(n) | Name of Month using length "n".
R | Year in Roman numerals (maximum 13 digits).

If MM, YY or YYYY are not specified within an input edit mask, the current system date is used to provide values for month and year.

If a week is displayed which belongs to the previous or the next year, the display for year is modified accordingly.

#### Edit Mask Characters for Fields in Time Format Only

The following edit mask characters may only be used for fields defined with T (time) format.

Character | Usage
--- | ---
T | Tenth of a second.
SS | Second.
ZS | Second with zero suppression.
II | Minute.
ZI | Minute with zero suppression.
HH | Hour.
ZH | Hour with zero suppression.
AP | AM/PM element.

#### Examples of Edit Masks for Fields in Date Format

Edit Mask | Output | Description
--- | --- | ---
No Edit Mask | 87-07-11 | Date Internal
R | MCMLXXXVII | Roman
MM/DD/YY | 07/11/87 | American
YYJJJ | 87192 | Julian
ZD.L(10)YY | 11.July87 | Gregorian
N(9)' 'ZW.'WEEK 'YY | Saturday 28.WEEK 87 |
ZZJ'.DAY 'YYYY | 192.DAY 1987 |

#### Examples of Edit Masks for Fields in Time Format

Edit Mask | Output | Description
--- | --- | ---
No Edit Mask | 10:27:50 | Time Internal
HH:II:SS:T | 10:27:50.8 |
HH:II:SS' 'AP | 10:27:50 AM |
HH | 10 |