Use this field-level keyword to specify a list of values that are valid for the user to type into the field. The OS/400 program performs an implied equals test on the data typed in against the value(s) you specify here. Note that the OS/400 program 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).
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.
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 apostrophes. 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 OS/400 program 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 OS/400 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-justified and padded or left-adjusted 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
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.