This statement validates data against predefined values or edit rules.
This statement has the following format:
&CONTROL SHRVARS=(field name,$VM)
-EXEC $CACALL OPT=ACTION
ACTION=VALIDATE
CLASS=DATA
PARMS='[APPL=application id]
FIELD=field name
[LIST=n]
[TEXT={YES | NO}]
[ACTIVE={YES | NO | ANY}]
DESC=description
EDITS=edit number 1,edit number 2,...
[IMSYS=system name]
[PROMPT={YES | NO}]'
An optional (required only for EDITS=17) parameter giving the application identifier.
A required parameter giving the name of the field that is to be validated. This field name must also be included in the SHRVAR= operand.
An optional parameter (required only for EDITS=18) that gives the number of valid values supplied using the &$VMFULLnnn variables. The &$VMABBRnnn and &$VMDESCnnn variables can also be defined. The range is 1 through 999.
An optional parameter (applicable only for EDITS=17) that indicates whether the text fields associated with the selected or supplied field value are to be returned. The default is NO.
An optional parameter (applicable only for EDITS=17) that indicates which entries from the table defined for the field in FIELD are to be considered as valid values. Valid values are as follows:
Only active table entries are to be considered as valid values. This is the default.
Only inactive table entries are to be considered as valid values.
All table entries are to be considered as valid values.
A required parameter (optional for EDITS=17) that gives the description of the field for use in selection list headings, help panels and error messages.
A required parameter giving the edit numbers that indicate how the field is to be validated (multiple numbers can be specified, separated by commas). Valid values are as follows:
YES/NOThe field can only contain YES (or a string beginning with Y) or NO (or a string beginning with N). If the length parameter (l) is coded, the field is set to that length. For example, 1(1) returns Y or N only.
Unsigned IntegerThe field can only contain a positive number with no sign or decimal point.
DateThe field can only contain the date format dd-mmm-yyyy or a shorthand date format.
TimeThe field can only contain the time format hh.mm or a shorthand time format.
HexadecimalThe field can only contain values in expanded hexadecimal.
Signed NumericThe field can contain a signed or unsigned number with no decimal point.
Real NumbersThe field can only contain real numbers. This includes (signed and unsigned) integers, numbers containing a decimal point, and numbers expressed in scientific notation within the range -1E-70 to +1E+70.
NameThe field can only contain numbers, alphabetic characters (upper case), and the characters @, #, and $. The first character in the field cannot be a number.
RangeThe field can only contain a value within the defined range, where l is the lowest valid value and h is the highest. If l is omitted, the value is only checked for being less than or equal to h; if h is omitted, the value is only checked for being greater than or equal to l, for example:
AlphanumericThe field can only contain numbers and alphabetic characters. Lower case characters are converted to upper case.
AlphabeticThe field can only contain alphabetic characters. Lower case characters are converted to upper case.
NationalThe field can only contain numbers, alphabetic characters, and the characters @, # and $. Lower case characters are converted to upper case.
Data Set NameThe field can only contain a valid data set name, with no quotes. Lower case characters are converted to upper case.
No Embedded BlanksThe field cannot contain any imbedded blanks.
Length Of The FieldThe length of the field must be within the defined range, where l is the lowest possible length and h is the highest. If l is omitted, the length is only checked for being less than or equal to h; if h is omitted, the length is only checked for being greater than or equal to l. The default value for l is 1.
Scroll AmountsThe field value must be one of the following valid scroll amounts:
TableThe field is validated against the values held in the table defined for the field in FIELD.
ListThe field is validated against the values given in &$VMFULLnnn, &$VMABBRnnn, and &$VMDESCnnn.
NCL KeywordThe field must not contain an NCL keyword.
TimeThe field can only contain the time format hh.mm.ss or a shorthand time format.
Hexadecimal CharactersThe field can only contain hexadecimal characters, that is, 09 and AF.
IP AddressThe address must be a valid IP address, in the format A.B.C.D, where each of A, B, C, and D have a valid range of 0 to 255.
TimeThe field must contain the time format hh:mm:ss or a shorthand time format. The returned string is in the format hh:mm:ss.
TimeThe field can only contain the time format hh:mm or a shorthand time format. The returned string is in the format hh:mm.
An optional parameter (required for EDITS=17 where the table type is IMFLD or IMREC) that gives the CA SOLVE:InfoMaster name.
An optional parameter (applicable only for EDITS=17 or 18) which determines whether a list of valid value is to be displayed if the field value contains a question mark character (?). Specifying NO lets values be defined which contain a question mark (?), and also lets validation occur from a non-full screen environment.
This statement contains the following input variables:
The data to be validated
The full values of the values (up to 20 characters) against which the field is to be validated (applicable only for EDITS=18). Up to 999 full values can be specified.
The abbreviations of the values (up to eight characters) against which the field is to be validated (applicable only for EDITS=18). Up to 999 abbreviations can be specified.
The descriptions of the values (up to 38 characters) against which the field is to be validated (applicable only for EDITS=18). Up to 999 descriptions can be specified.
This statement contains the following return variables:
The validated data.
The abbreviated value of the selected value (applicable only for EDITS=17 or 18).
The description of the selected value (applicable only for EDITS=17 or 18).
The text associated with the value (applicable only for EDITS=17 and returned only if TEXT=YES).
System message. Contains the error message (for return code 8).
If a return code of 8 is set, then additional information is available as one of the following feedback codes, set in &$CAFDBK:
Processing error
Nesting level exceeded
The following statements validate the &PCODE field against edit numbers 2 (unsigned integer) and 9 (range). The value of &PCODE must be an unsigned integer in the range 1 through 10. In the example, because &PCODE has a value of 12, an error message is returned in &SYSMSG.
&PCODE = 12
&DESC = &STR Priority Code
&CONTROL SHRVARS=(PCODE,$VM)
-EXEC $CACALL OPT=ACTION
ACTION=VALIDATE
CLASS=DATA
PARMS='APPL=$ML
FIELD=PCODE
DESC=&DESC
EDITS=2,9(1:10)'