FIND statement

Syntax

FIND element IN dynamic.array [ ,occurrence] SETTING fmc [ ,vmc 
[ ,smc] ]
{THEN statements [ELSE statements] | ELSE statements}

Description

Use the FIND statement to locate an element in dynamic.array. The field, value, and subvalue positions of element are put in the variables fmc, vmc, and smc respectively.

element evaluates to a character string. FIND succeeds only if the string matches an element in its entirety. If element is found in dynamic.array, any THEN statements are executed. If element is not found, or if dynamic.array evaluates to the null value, fmc, vmc, and smc are unchanged, and the ELSE statements are executed.

If occurrence is unspecified, it defaults to 1. If occurrence is the null value, the FIND statement fails and the program terminates with a run-time error message.

Example

A="THIS":@FM:"IS":@FM:"A":@FM:"DYNAMIC":@FM:"ARRAY"
FIND "IS" IN A SETTING FM,VM,SM ELSE ABORT
PRINT "FM=",FM
PRINT "VM=",VM
PRINT "SM=",SM

This is the program output:

FM=      2
VM=      1
SM=      1