Use this keyword to perform a number of functions, depending on the parameter values specified.
CHECK(validity-checking-code [. . .]) CHECK(keyboard-control-code [. . .]) CHECK(cursor-control-code)
The following CHECK keywords are the preferred form of other DDS keywords:
The following CHECK keyword functions can also be specified using the Change Input Default (CHGINPDFT) keyword at the file, record, or field level:
Option indicators are valid only for CHECK(ER) and CHECK(ME).
Use CHECK at the field level to specify that the i5/OS™ operating system or the device is to check the validity of the data typed into an input-capable (input-only or input/output) field.
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 workstation 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 workstation 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 figure is an example of an 8-digit self-check field.
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.
To calculate the Modulus 10 self-check digit, do the following tasks:
The difference is the self-check digit.
For example:
Base number: 6 1 2 4 8 Units position and every alternate position: 6 2 8 Multiply by the weight factor, 2: x2 x2 x2 Products: 12 4 16 Digits not multiplied: 1 4 Add the digits of the products and the digits from the base number that were not used for multiplication: ( 1 + 2 ) + 4 + ( 1 + 6 ) + 1 + 4 = 19 Next higher number ending in 0: 20 Subtract: -19 Self-check digit: 1
To calculate the Modulus 11 self-check digit, do the following tasks:
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.
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(VNE) |
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.
CHECK(VNE) cannot be specified with any of the following keywords:
CHECK(M10) |
CHECK(VN) |
Option indicators are not valid for this keyword.
When the CHECK keyword is used with a keyboard control code, it controls certain data-entry aspects. The valid keyboard control codes are:
Use this code so that the workstation user does not need to press the Enter key. Whenever the workstation user keys a character (including a blank) into the last position of the field, the record is sent from the device just the same as if the Enter key had been pressed. If you also specify DSPATR(SP) for the field, the record is sent from the device as soon as the workstation user selects the field. If you use this function, it should be on the last field typed in by the user for this record.
Option indicators are valid for this keyword.
This code specifies that the workstation user cannot advance to the next input field without pressing one of the field exit keys. The cursor remains under the low-order character position of the field until a valid field exit key has been pressed, even though that character has been typed in. If the user presses any other key, an error results.
If you want to specify CHECK(FE) for all the input-capable fields in a record format, specify CHGINPDFT(FE) at the record level. If you want to specify CHECK(FE) for all the input-capable fields in a file, specify CHGINPDFT(FE) at the file level.
Field exit keys include the Field Exit, Field+, Field-, and cursor movement keys. Which keys are valid field exit keys depends on the keyboard style being used.
This code applies only to input fields into which the workstation user can type.
Option indicators are not valid for this keyword.
Use CHECK(LC) for input-only or input/output fields to permit the workstation user to type lowercase a through z. The way the workstation user keys in the characters (uppercase or lowercase) is the way the characters appear on the display and are returned to your program.
If you want to specify CHECK(LC) for all the character input-capable fields in a record format, specify CHGINPDFT(LC) at the record level. If you want to specify CHECK(LC) for all the character input-capable fields in a file, specify CHGINPDFT(LC) at the file level.
Your program can display a field that contains both uppercase and lowercase characters.
If you specify this keyword, lowercase a through z remain lowercase. If you do not specify this keyword, lowercase a through z are changed to uppercase.
The CHECK(LC) keyword has no effect on data-entry keyboards. Data-entry keyboards do not support lowercase characters a through z.
Option indicators are not valid for this keyword.
Figure 1 shows how to specify the CHECK(LC) keyword.
This code shifts data typed into the field to the farthest right positions and fills the remaining positions with blanks.
For signed numeric fields, you do not need to specify CHECK(RB). right-aligned with blank fill is the default. When the value of a signed numeric field is zero, it appears as all blanks on the display.
The i5/OS program converts blanks to zeros when returning numeric fields to your program.
Option indicators are not valid for this keyword.
This code shifts data typed into the field to the farthest right positions and fills the remaining positions with zeros.
For signed numeric fields, if you do not specify CHECK(RZ), CHECK(RB) is the default.
Option indicators are not valid with this keyword.
The following list shows programming considerations for CHECK(RB) and CHECK(RZ):
The following example shows how to specify the CHECK keyword for right-aligned with blank fill (RB) and for right-aligned with zero fill (RZ).
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 00010A R RECORD1 00020A* Numeric only 00030A DATA1 7Y OI 2 2TEXT('No right-adjust') 00040A DATA2 7Y OI 3 2CHECK(RZ) 00050A* Signed numeric 00060A DATA3 7S OI 4 2TEXT('CHECK(RB) is the default') 00070A DATA4 7S OI 5 2CHECK(RZ) 00080A* Character 00090A DATA5 7 I 6 2TEXT('No right-adjust') 00100A DATA6 7 I 7 2CHECK(RB) A
When you specify the CHECK keyword for right-aligned with zero or blank fill, fill the following displays:
Field name | Data typed in | Key pressed | Result on display |
---|---|---|---|
Numeric only | |||
DATA1 |
|
|
|
DATA2 |
|
|
|
Signed Numeric | |||
DATA3 |
|
|
|
DATA4 |
|
|
|
Note: The i5/OS operating system converts
blanks to zeros when returning numeric fields to your program. Therefore,
this field is returned to your program as all zeros.
|
|||
Character | |||
DATA5 |
|
|
|
DATA6 |
|
|
|
When the CHECK keyword is used with a cursor control code, it specifies that the cursor is to move from right to left. This feature is designed for languages where information is read right to left.
the i5/OS operating system does not ensure that right-to-left files are opened only for display stations capable of right-to-left cursor movement. Therefore, all workstations in the same system should be configured with the same language capability and with the same right-to-left capability.
The valid cursor control codes that can be specified for cursor control are:
Use the CHECK(RL) keyword at the file, record, or field level to specify that the cursor should move from right to left within input-capable character fields. At the file level, specifying CHECK(RL) makes the cursor move from right to left in all input-capable character fields in the file. At the record level, specifying CHECK(RL) makes the cursor move from right to left in all input-capable character fields in the record. At the field level, specifying CHECK(RL) makes the cursor move from right to left in only the field with which it is associated.
Example 2:
The following example shows how to specify the CHECK(RL) keyword at the file level.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 00010A CHECK(RL) 00020A R DSPLY A
Example 3:
The following example shows how to specify the RL cursor control with edit check.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 A : A : A R RECORD1 CHECK(RL AB) A : A : A R RECORD2 A INPFLD 4 I 4 10CHECK(RL MF) A : A : A
Example 4:
The following example shows how to specify the CHECK(RLTB) keyword.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 00010A CHECK(RLTB) 00020A R PROMPT A
The right-to-left capability includes the following restrictions:
A warning message appears for the following conditions:
Option indicators are not valid with cursor control codes.
The following example shows how to specify the validity-checking CHECK keywords.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 00060A R RECORD1 CHECK(AB) 00070A FIELD11 10 B 1 2TEXT('CHECK(AB) not propagated to + 00080A this field') 00090A FIELD21 10 B 1 22CHECK(VN) 00100A TEXT('CHECK(AB) is propagated to + 00110A this field') 00120A FIELD31 10 B 1 42CHECK(VNE) 00130A TEXT('CHECK(AB) is propagated to + 00140A this field') 00150A* 00160A R RECORD2 00170A FIELD12 10 B 2 2CHECK(VN) CHECK(AB) 00180A FIELD22 10 B 2 22CHECK(VN AB) 00190A FIELD32 1 B 2 42CHECK(AB) VALUES('A' 'B' 'C') 00200A FIELD42 10 B 2 62CHECK(VN) 00210A FIELD52 10 B 3 2CHECK(VNE) 00220A FIELD62 10 B 3 22CHECK(VNE AB) 00230A FIELD72 10 B 4 1CHECK(ME MF) 00240A FIELD82 8 OB 4 22CHECK(M10) 00250A FIELD92 10 OB 4 42CHECK(M11) A