The pattern supplied is matched against the object, the match being based on the wildcard characters found in the pattern. This routine is called recursively to scan for the current segment from the pattern. A segment is one of the following:
Portion up to node separator (nodal)
Portion up to (excluding) question mark
Portion up to (excluding) asterisk
Portion up to (excluding) dash
Portion up to end of pattern
The following examples illustrate segments:
SSDDEV.\@#@!?.A*C.*.-XYZ SSDDEV. \@#@! ?. A *C. *. -XYZ
Recursion is necessary to ensure that an accurate match is made when using the wildcard characters ?, * or - to prefix a pattern, such as:
???ABC *ABC -ABC
Consider the following pattern and object (nodal):
Pattern: ABC-XYZ.DATA Object: ABC.LMNOXYZ.TUV.XYZ.DATA
The pattern matches an object beginning with ABC and ending with XYZ.DATA. When the pattern is matched, the first segment to be matched is ABC. The matching routine looks for ABC at the current location. Since it matches, it moves to the next segment, -XYZ. The dash indicates that the object is to be scanned for the string, XYZ. This is found in the object within the second node, LMNOXYZ.
The next segment to be compared is DATA. Since the next node of the object is TUV., a mismatch occurs. The scan routine must step back to the original segment that started the scan, -XYZ., and continue. This scan would stop at the fourth node of the object, XYZ.. Since the next segment of the pattern and the object would both match, the pattern would be considered to match the object.
If the last node of the object had been something other than DATA, the comparison would have failed.
|
Copyright © 2014 CA.
All rights reserved.
|
|