Use CHECK at the field level to specify that the OS/400 program or the device is to check the validity of the data typed into an input-capable (input-only or output/input) field.
CHECK validates the data by applying one or more edit/check algorithms against the data. An error message is displayed if a specified edit/check algorithm is not satisfied.
The valid edit/check codes are:
Use this code at the file, record, or field level to allow all-blank input to satisfy validity checking for an input-capable field should any associated validity check fail. This enables the passing of data to the program when the work station user has positioned the cursor to the field but left it blank (for instance, by pressing the Erase Input key, the Field Exit key, or the spacebar). For example, FLD1 is an input-capable field with CHECK(M10 ME) in effect. If the work station user accidentally types into the field, the M10 algorithm must be satisfied. Specifying (CHECK(M10 ME AB)) allows the display station user to blank the field to satisfy validity checking.
When specified at the file level, this keyword applies for all input-capable fields in the file for which a validity checking keyword is coded. Likewise, when specified at the record level, this keyword applies for all input-capable fields in the record for which a validity checking keyword is coded. At the field level, always specify this keyword with another validity checking keyword (CHECK(M10, M10F, M11, M11F, VN, VNE), CHKMSGID, COMP, RANGE, or VALUES).
CHECK(AB) should not be specified if SFLROLVAL or SFLRCDNBR is also specified for the field.
CHECK(AB) can be used in database files for reference purposes.
When you consider using CHECK(AB) with other validity checking functions, note that processing occurs in the following order:
You cannot specify the CHECK(AB) keyword on a floating-point field (F in position 35).
Option indicators are not valid for this keyword.
This code specifies that at least 1 character of data (a blank is valid) must be typed into the field. Note that when no field currently on the display has been changed, the display station does not enforce mandatory enter. To enforce mandatory enter, specify DSPATR(MDT) for at least one field in each record on the display. For all other fields in the record, CHECK(ME) is then enforced. However, because the device cannot determine if the user has typed data to a field with both DSPATR(MDT) and CHECK(ME), you should also specify DSPATR(ND) so that this field is not displayed.
Option indicators are valid for this keyword.
This code specifies that if any part of the field is altered, each position in the field must have a character entered in it. Blanks are considered valid characters.
This code cannot be specified with keyboard control codes (RB or RZ) or with the WRDWRAP keyword.
Option indicators are not valid for this keyword.
This code specifies that data typed into the field must satisfy the IBM Modulus 10 (M10 or M10F) or Modulus 11 (M11 or M11F) self-check algorithm. When you specify CHECK(M10) or CHECK(M11), the self-check verifies that the field has a valid Modulus 10 or Modulus 11 number when you press the Enter key or a function key. When you specify CHECK(M10F) or CHECK(M11F), the self-check verifies that the field has a valid Modulus 10 or Modulus 11 number as the user types the data into the field. You cannot specify both the Modulus 10 and the Modulus 11 self-check algorithms for the same field or both formats of the same algorithm for the same field.
A self-check field is composed of two parts: the base number and one check digit. The check digit is the farthest right digit in the field. The base number and the check digit together make up a field in your database (for example, an account number). The following illustration is an example of an 8-digit self-check field.
See the Application Display Programming book for information on how to use CHECK(M10), CHECK(M10F), CHECK(M11), and CHECK(M11F).
Notes:
For each position in the base number, there is a Modulus 10 weight factor and a Modulus 11 weight factor. Positions are counted from the farthest right digit (not including the check digit).
The Modulus 10 weight factor is 2 for positions 1, 3, 5, ..., 31. It is 1 for positions 2, 4, 6, ..., 30. The Modulus 11 weight factors are 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7,..., 2, 3, 4, 5, 6, 7, 2 for positions 1, 2,..., 31, respectively.
To calculate the Modulus 10 self-check digit, do the following:
The difference is the self-check digit.
To calculate the Modulus 11 self-check digit, do the following:
Base number 9 9 1 2 4 6 3 5 1 Weight factors 4 3 2 7 6 5 4 3 2
The difference is the self-check digit.
For example:
Option indicators are not valid for CHECK(M10), CHECK(M10F), CHECK(M11), or CHECK(M11F).
Use this code to specify that the data typed into the field must be a valid simple name. The first character must be $, #, @, or A through Z. The remaining characters must be alphanumeric ($, #, @, A through Z, 0 through 9, or underscore (_), and must not contain embedded blanks.
When the CHECK(VN) keyword is specified on a field, the field must be character (keyboard shift of A, N, X, W, or I), and must be input-capable (usage of I or B).
CHECK(VN) cannot be specified with any of the following keywords:
CHECK(M10) CHECK(M10F) CHECK(M11) CHECK(M11F) |
CHECK(VNE) COMP RANGE VALUES |
Option indicators are not valid for this keyword.
Use this code to specify that the data typed into the field must be a valid extended name.
When the CHECK(VNE) keyword is specified on a field, the field must be character (keyboard shift of A, N, X, W, or I), input-capable (usage of I or B), and have a maximum length of 255 characters.
If the name is not delimited by double quotation marks:
If the name is delimited by double quotation marks:
CHECK(VNE) cannot be specified with any of the following keywords:
CHECK(M10) CHECK(M10F) CHECK(M11) CHECK(M11F) |
CHECK(VN) COMP RANGE VALUES |
Option indicators are not valid for this keyword.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.