VALUES (Values) keyword for display files

You use this field-level keyword to specify a list of values that are valid for the user to type into the field.

The IBM® i operating system performs an implied equals test on the data typed in against the value(s) you specify here. Note that the IBM i operating system performs this checking only if the field is changed by the workstation user or if its modified data tag (MDT) is set on using DSPATR(MDT).

Note: The CHKMSGID keyword information defines user-specified error messages.
The format of the keyword is:
VALUES(value-1 [value-2... [value-100]])

There can be 1 to 100 values; specify them as parameter values with the keyword and separate them by at least one blank.

Note: You cannot specify more than 5000 characters in a single DDS statement. Therefore, you cannot specify character values that cause VALUES to be longer than 5000 characters. If you specify other keywords for the same field, they also count toward the 5000-character limit. For example, specifying DSPATR(HI) for the field reduces the number of characters left for VALUES.

A value can be a numeric or a character value, corresponding in length to the field that is to be tested. A character value must be enclosed in single quotation marks. A numeric value is restricted to the digits 0 through 9 and can be preceded by a minus sign (-) for negative values. Alignment is on the low-order character position.

Defining a numeric field for display files

When a workstation user types in data, the IBM i operating system aligns the entered characters according to the number of decimal positions in the field. Leading and trailing blanks are filled with zeros when the field is passed to your program. If no decimal character is typed, the IBM i program places a decimal character to the right of the farthest right character typed in. For example, for a numeric field with a length of 5 (specified in position 34) and 2 decimal positions (specified in position 37), 1.2 is interpreted as 001.20, and 100 is interpreted as 100.00.

The compare is based on the value as it is passed to your program (for example, right-aligned and padded or left-aligned and padded).

You cannot specify VALUES 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 VALUES keyword for a character and numeric values test.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A            RESPC         11   I  8  2VALUES('A' 'B' 'C' 'D')
00020A            RESPN         31  0I  9  2VALUES(33 -42 01)
00030A            DECFLD         1  2I 11  2VALUES(1.2 100)
     A