Numeric only (Y)

You can only type the numbers 0 through 9, plus (+), minus (-), period (.), comma (,), and space ( ) into the field. You can press any key to leave the field.

The display length for a numeric-only field is one more than the program length when both of the following conditions occur (the program length is specified in positions 30 through 34):
  • The field is an unedited, input-capable field.
  • The value in positions 36 and 37 (decimal positions) is greater than zero.

The extra position in the display length is for the decimal point.

When the IBM® i operating system passes the contents of the field to your program, the following considerations apply:
  • Your program sees a numeric, decimally aligned field.
  • To type digits to the right of the decimal, positions 36 and 37 must be greater than zero and you must type the decimal character.
  • You cannot type the maximum number of digits, a decimal character, and a sign character, because the display length of the field equals only the program length plus one. You can press the Field+ key or the Field- key to avoid typing a sign character.
  • The IBM i operating system removes all characters except 0 through 9 (whether typed or supplied through the EDTWRD keyword) and the sign.
  • The IBM i operating system converts embedded blanks (hex 40) to zeros (hex F0) before decimal alignment. (Embedded blanks are blanks between any significant digits in the field.) Leading blanks, trailing blanks, zeros, plus signs, and minus signs are not treated as significant digits. Embedded ampersands in an edit word are also converted to zeros before decimal alignment.
  • All nonnumeric characters are removed before decimal alignment and validity checking for the RANGE, COMP, CMP, VALUES, CHECK(VN), CHECK(M10), CHECK(M11), and CHECK(VNE) keywords. Numeric characters (0 through 9) supplied by the EDTWRD keyword are not removed. Validity checking for the CHECK(M10F) and CHECK(M11F) keywords is performed before the nonnumeric characters are removed.
  • The field length in the input buffer is the program length.

When the IBM i operating system displays a numeric-only field, the EDTCDE or the EDTWRD keyword, if specified, applies. You can specify EDTCDE and EDTWRD only for numeric-only fields. The display length equals the program length plus the editing characters from the specified edit code or edit word.

Negative numbers are handled as follows:
  • The user can type a negative number on input in one of two ways:
    • Type the digits, then a minus. The minus sign (-) appears (hex 60) on the display where it was typed in.
    • Type the digits, then press the Field- key.

      If you do not specify CHECK(RZ) or CHECK(RB), a brace (}) is displayed in the farthest right position. This causes an error message to appear at the workstation if you specify decimal positions other than zero in positions 36 and 37. If you specify CHECK(RZ) or CHECK(RB), the digits typed in are right-aligned. No minus sign appears in either case.

      If you specify an EDTCDE keyword that displays a minus sign and you do not specify CHECK(RZ) or CHECK(RB), a brace (}) is displayed in the farthest right position. This does not cause an error message to appear at the workstation. A minus sign appears in the farthest right position on output.

      If you specify an EDTCDE keyword that displays a minus sign and you also specify CHECK(RZ) or CHECK(RB), the farthest right significant digit is displayed as hex Dn (negative). A minus sign appears on the output.

      When a negative number passes to your program, the IBM i operating system converts the farthest right significant digit from hex Fn (positive) to hex Dn (negative), where n is the significant digit.

  • The sign appears in the farthest right display position on output and takes up one of the positions in the display length.
Note: The IBM i program examines each character of a numeric-only field to remove the nonnumeric characters plus sign (+), minus sign (-), comma (,), and decimal point(.) and nonsignificant digits, and to convert embedded blanks to zeros. This examination and removal can delay response time if a significant number of fields must be processed on an input operation.