COMPARE Statement
Compares the elements in two dynamic arrays.
Syntax
COMPARE dynArray1 TO dynArray2{ PRESENT varFound}{ MISSING varMissing}{, caseMode}
Syntax elements
dynArray1, dynArray2
The dynamic array expressions to be compared.
varFound A variable in which to return the elements from dynArray1 that were found in dynArray2.
varMissing A variable in which to return the elements from dynArray1 that were not found in dynArray2.
caseMode A string expression containing one of the following:
"S" or "s" Specifies that case is significant when comparing elements.
"I" or "i" Specifies that case should be ignored when comparing elements.
If caseMode is not specified, the current data case setting is used. See Case Sensitivity for more details.
If an invalid string is specified, a run-time error occurs.
Comments
The COMPARE statement compares each element (attribute, value and subvalue) in dynArray1 with the elements in dynArray2. Those for which matching elements are found are copied into varFound, while those that are not found are copied into varMissing. Each element in varFound and varMissing is terminated with the same system delimiter as in dynArray1.
Example
ARY1 = "X":@AM:"Y":@AM:"Z" ARY2 = "A":@AM:"X":@AM:"B" COMPARE ARY1 TO ARY2 PRESENT P MISSING M PRINT "Found = ":P PRINT "Not found = ":M
This outputs the following:
Found = X
Not found = Y^Z