Previous Topic: Action=NAVIGATE Class=PDOMAIN

Next Topic: Menu Service Procedure Interface


Action=VALIDATE Class=DATA

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}]’
APPL=application id

(Optional) (required only for EDITS=17) Specifies the application identifier.

FIELD=field name

Specifies the name of the field that is to be validated. This field name must also be included in the SHRVAR= operand.

LIST=n

(Optional) (required only for EDITS=18) Specifies 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.

TEXT={YES | NO}

(Optional) (applicable only for EDITS=17) Specifies whether the text fields associated with the selected or supplied field value are to be returned.

Default: NO

ACTIVE={YES | NO | ANY}

(Optional) (applicable only for EDITS=17) Specifies which entries from the table defined for the field in FIELD are to be considered as valid values. Valid values are as follows:

YES

Only active table entries are to be considered as valid values. This is the default.

NO

Only inactive table entries are to be considered as valid values.

ANY

All table entries are to be considered as valid values.

DESC=description

(Optional for EDITS=17) Specifies the description of the field for use in selection list headings, help panels and error messages.

EDITS=edit number1,edit number 2,...

Specifies 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:

1(l)

YES/NO—The 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.

2

Unsigned Integer—The field can only contain a positive number with no sign or decimal point.

3

Date—The field can only contain the date format dd-mmm-yyyy or a shorthand date format.

4

Time—The field can only contain the time format hh.mm or a shorthand time format.

5

Hexadecimal—The field can only contain values in expanded hexadecimal.

6

Signed Numeric—The field can contain a signed or unsigned number with no decimal point.

7

Real Numbers—The 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.

8

Name—The field can only contain numbers, alphabetic characters (upper case), and the characters @, #, and $. The first character in the field cannot be a number.

9(l:h)

Range—The 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:

  • 9(1:10) accepts values from 1 to 10
  • 9(:3) accepts values less than or equal to 3
  • 9(12:) accepts values greater than or equal to 12
10

Alphanumeric—The field can only contain numbers and alphabetic characters. Lower case characters are converted to upper case.

11

Alphabetic—The field can only contain alphabetic characters. Lower case characters are converted to upper case.

12

National—The field can only contain numbers, alphabetic characters, and the characters @, # and $. Lower case characters are converted to upper case.

13

Data Set Name—The field can only contain a valid data set name, with no quotes. Lower case characters are converted to upper case.

14

No Embedded Blanks—The field cannot contain any imbedded blanks.

15(l:h)

Length Of The Field—The 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.

16

Scroll Amounts—The field value must be one of the following valid scroll amounts:

  • MAX (or a string beginning with M)
  • CSR (or a string beginning with C)
  • DATA (or a string beginning with D)
  • PAGE (or a string beginning with P)
  • HALF (or a string beginning with H)
  • A number between 1 and 99999 (if the string starts with a number, it is truncated at the first non-numeric character)
17

Table—The field is validated against the values held in the table defined for the field in FIELD.

18

List—The field is validated against the values given in &$VMFULLnnn, &$VMABBRnnn, and &$VMDESCnnn.

19

NCL Keyword—The field must not contain an NCL keyword.

20

Time—The field can only contain the time format hh.mm.ss or a shorthand time format.

21

Hexadecimal Characters—The field can only contain hexadecimal characters, that is, 0–9 and A–F.

22

IP Address—The 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.

23

Time—The field must contain the time format hh:mm:ss or a shorthand time format. The returned string is in the format hh:mm:ss.

24

Time—The field can only contain the time format hh:mm or a shorthand time format. The returned string is in the format hh:mm.

IMSYS=system name

(Optional) (required for EDITS=17 where the table type is IMFLD or IMREC) Specifies the CA SOLVE:InfoMaster name.

PROMPT={YES | NO}

(Optional) (applicable only for EDITS=17 or 18) Specifies whether a list of valid values 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.

Input Variables

This statement contains the following input variables:

field name

The data to be validated

&$VMFULLnnn

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.

&$VMABBRnnn

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.

&$VMDESCnnn

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.

Return Variables

This statement contains the following return variables:

field name

The validated data.

&$VMSELABBR

The abbreviated value of the selected value (applicable only for EDITS=17 or 18).

&$VMSELDESC

The description of the selected value (applicable only for EDITS=17 or 18).

&$VMTEXT1..10

The text associated with the value (applicable only for EDITS=17 and returned only if TEXT=YES).

&SYSMSG

System message. Contains the error message (for return code 8).

Feedback Codes

If a return code of 8 is set, then additional information is available as one of the following feedback codes, set in &$CAFDBK:

8

Processing error

10

Nesting level exceeded

Example

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)'