Op Code (Hex) | Extender | Operand 1 | Operand 2 | Operand 3 | Operand 4 | Operand [5-6] |
---|---|---|---|---|---|---|
SEARCH 1084 |
| Receiver | Array | Find | Location |
|
| ||||||
SEARCHB 1C84 | Branch options | Receiver | Array | Find | Location | Branch targets |
| ||||||
SEARCHI 1884 | Indicator options | Receiver | Array | Find | Location | Indicator targets |
Operand 2: Character array or numeric array.
Operand 3: Character variable scalar or numeric variable scalar.
Operand 4: Binary scalar.
Operand 5-6:
Description: The portions of the array operand indicated by the location operand are searched for occurrences of the value indicated in the find operand.
The operation begins with the first element of the array operand and continues element by element, comparing those characters of each element (beginning with the character indicated in the location operand) with the characters of the find operand. The location operand contains an integer value representing the relative location of the first character in each element to be used to begin the compare.
The integer value of the location operand must range from 1 to L, where L is the length of the array operand elements; otherwise, a scalar value invalid (hex 3203) exception is signaled. A value of 1 indicates the leftmost character of each element.
The length of the find operand must not be so large that it exceeds the length of the array operand elements when used with the location operand value; otherwise, a length conformance (hex 0C08) exception is signaled. The array element length used is the length of the array scalar elements and not the length of the entire array element, which can be larger in noncontiguous arrays.
The array and find operands can be either character or numeric. Any numeric operands are interpreted as logical character strings. The compares between these operands are performed at the length of the find operand and function as if they were being compared in the Compare Bytes Left-Adjusted (CMPBLA) instruction.
As each occurrence of the find value is encountered, the integer value of the index for this array element is placed in the receiver operand. If the receiver operand is a scalar, only the first element containing the find value is noted. If the receiver operand is an array, as many occurrences as there are elements within the receiver array are noted.
If the value of the index for an array element containing an occurrence of the find value is too large to be contained in the receiver, a size (hex 0C0A) exception is signaled.
The operation continues until no more occurrences of elements containing the find value can be noted in the receiver operand or until the array operand has been completely searched. When the second condition occurs, the receiver value is set to LB-1, where LB is the value of the lower bound index of the array. If LB is the most negative 32-bit integer, then LB-1 is the most positive 32-bit integer; otherwise, LB-1 is 1 less than LB. If the receiver operand is an array, all its remaining elements are also set to LB-1. The find operand can be a variable length substring compound operand.
Resultant Conditions: The numeric value(s) of the receiver operand is either LB-1 or in the range LB through UB, where UB is the value of the upper bound index of the array. When the receiver is LB-1, the resultant condition is zero. When the receiver is in the range LB through UB, the resultant condition is positive. When the receiver is an array, the resultant condition is zero if all elements are LB-1; otherwise, it is positive. The resultant condition is unpredictable when the no binary size exception program template option is used.
06 Addressing
08 Argument/Parameter
0C Computation
10 Damage Encountered
1C Machine-Dependent
20 Machine Support
22 Object Access
24 Pointer Specification
2C Program Execution
2E Resource Control Limit
32 Scalar Specification
36 Space Management
44 Protection Violation