FINDSTR statement

Syntax

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

Description

Use the FINDSTR statement to locate substring in dynamic.array. The field, value, and subvalue positions of substring are placed in the variables fmc, vmc, and smc respectively.

FINDSTR succeeds if it finds substring as part of any element in dynamic array. If substring is found in dynamic.array, any THEN statements are executed. If substring 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, FINDSTR fails and the program terminates with a run-time error message.

Example

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

This is the program output:

FM=      1
VM=      1
SM=      1