ARRAY FIND
This command positions an array's CURRENT row pointer at the first row meeting specified criteria.
Command | Parameters |
---|---|
ARRAY | ARY FIND | Name [ROW()] [CRITERIA()] |
The following table describes the parameters
Parameter | Function | Notes |
---|---|---|
Name | Name of the array as established during array creation | Enter a name up to 1 to 31 alphanumeric characters |
ROW | Starting row for scan | The default is the current row. Numeric, the first element of an array is indexed by 1. |
CRITERIA | Criteria to which the row must conform | See the comments below. |
For the CRITERIA parameter, any number of criteria may be specified, connected by the Boolean operators AND and OR. Entries can be of one of the following two formats:
- Boolean operator (AND, OR), except for first criterion
- column name, 1-255 characters
- starting position, default is 1
- length used for comparison, default width of column+1 - starting position
- comparison operator, one of the following: LT, LE, EQ, GE, GT, NE, <, < =, =, > =, >, < >, ^ =
or
- Boolean operator (AND, OR), except for first criterion
- column name, 1-255 characters
- starting position, default is 1
- length used for comparison, default width of column+1 - starting position
- comparison operator, one of the following: LT, LE, EQ, GE, GT, NE, <, <=, =, >=, >, < >, ^=
- literals are enclosed in quotation marks
The following rules also apply:
- When both fields contain numerics (except leading and trailing blanks), a numerical comparison is performed. Both numbers will always be treated as unsigned integers.
- When a comparison with a literal is requested, a pattern comparison is performed (for example, wildcards such as * and + may be used).
- When two columns with different lengths are compared, a comparison with the length of the shorter of the two is done.
Condition codes are listed in the following table.
Value | Description |
---|---|
0 | Command was successfully executed. |
4 | Criteria parsing error occurred. |
8 | Array was not found. |
12 | Row specification occurred past array extension or 0. |
16 | Syntax error occurred. |
Example
This EXEC connects to the array user ID that contains information about user IDs and accounts that are associated with them. The EXEC then finds all user IDs belonging to account 3911 and prints them in the BBI-SS log.
REXX EXEC example:
"IMFEXEC ARRAY FIND USERID CRITERIA('ACCT,,,=,''3911'',OR,STAT,,,=,''ACTIVE''') ROW(1)"
do while imfcc=0
"IMFEXEC ARRAY INFO USERID"
"IMFEXEC ARRAY GET USERID"
"IMFEXEC MSG "userid
"IMFEXEC ARRAY FIND USERID CRITERIA('ACCT,,,=,''3911''') ROW("arypos+1")"
end
CLIST example:
IMFEXEC ARRAY FIND USERID
CRITERIA('ACCT,,,=,''3911'',OR,STAT,,,=,''ACTIVE''') ROW(1)
DO WHILE &IMFCC=0
IMFEXEC ARRAY INFO USERID
IMFEXEC ARRAY GET USERID
IMFEXEC MSG &USERID
IMFEXEC ARRAY FIND USERID CRITERIA('ACCT,,,=,''3911''') ROW(&ARYPOS+1)
END