RANGE (Range) keyword for display files

Use this field-level keyword for input-capable fields to specify that the i5/OS™ operating system is to perform validity checking on the data that the workstation user types into the field.

The data typed in must be greater than or equal to the lower value, and less than or equal to the higher value. Note that the i5/OS operating system performs this checking only if the field is changed by the workstation user or if its changed data tag (MDT) is set on using DSPATR(MDT).

Note: See the CHKMSGID (Check Message Identifier) keyword for display files topic for information about defining user-specified error messages.
The format of the keyword is:
RANGE(low-value high-value)

When the field is a character field, the parameter values must be enclosed in single quotation marks. When the field is numeric, single quotation marks must not be specified.

You cannot specify RANGE on a floating-point field (F in position 35).

Option indicators are not valid for this keyword.

Example

The following example shows how to specify the RANGE keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R RECORD1
00020A* Character fields
00030A            FIELD1         1   I  2  2RANGE('B' 'F')
00040A            FIELD2         1   I  3  2RANGE('2' '5')
00050A* Numeric fields
00070A            FIELD3         1  0I  4  2RANGE(2 5)
00080A            FIELD4         4  0B  5  2RANGE(1 1500)
00090A            FIELD5         7  2B  6  2RANGE(100 99999.99)
00100A            FIELD6         3  0B  7  2RANGE(-100 -50)
00110A            FIELD7         3  2I  8  2RANGE(.50 1.00)
00120A            FIELD8         3  2I  9  2RANGE(.5 1)
00130A            FIELD9         5Y 2I 10  2RANGE(.01 999.99)
     A

FIELD7 and FIELD8 have equivalent RANGE parameter values. The reason is that for numeric fields, decimal alignment is based on the number of decimal positions specified in positions 36 through 37. For FIELD7 and FIELD8, the low value is 0.50 and the high value is 1.00.

Data entered into a numeric field is aligned on the decimal positions specified (in positions 36 through 37), and leading and trailing blanks are filled with zeros. For example, if 1.2 is typed into FIELD9, 00120 is returned to your program. If 100 is typed into FIELD9, 10000 is returned to your program.