Numeric only character (M)
Numeric only character (M)
The M keyboard shift defines a character field that allows you to type only the digits 0 through 9, plus (+), minus (-), comma (,), period (.), and blank into the field.
The Field Exit, Field+ Exit, Field- Exit, and Dup keys are allowed. The Field+ Exit is processed as an unsigned Field Exit. The Field- Exit is processed as follows:
- If you do not specify CHECK(RZ) or CHECK(RB), the farthest right position is changed to a brace.
- If you specify CHECK(RZ) or CHECK(RB), the last character you type into the field must be a digit (or a keyboard error is issued). The farthest right digit, n, is converted from hex Fn (positive) to hex Dn (negative).
The display length for an M field is the length coded in positions 30 through 34. You must include any additional positions needed for a sign character or decimal point in the field length.
The field displays as a blank-filled field when you do not specify any keyword. If you specify a CHECK(RZ) keyword, the field displays as right-aligned zero. If you specify a CHECK(RB) keyword, the field displays as right-aligned blank filled.
When the IBM i operating system passes the contents of the field to a program, the following considerations apply:
- The program always sees a character field.
- The field length in the input buffer is the program length.
- The field contents are passed directly to the program. The IBM i operating system neither converts embedded blanks to zeros nor removes nonnumeric characters, such as sign characters and decimal points.
In a database file, you can specify the M keyboard shift on the REFSHIFT keyword if the field data type is character (A).