| |||||||||
Technical Support On-Line Manuals A166 User's Guide | MATCH FunctionThe MATCH MPL function searches a character string for a delimiter character and assigns the substrings on either side of the delimiter to specified identifiers. The syntax for the MATCH function is: %MATCH (id1 delimiter id2) (balanced-text) Where
The MATCH function searches balanced-text for the specified delimiter. When the delimiter is found, all characters to the left are assigned to id1 and all characters to the right are assigned to id2. If the delimiter is not found, the entire balanced-text string is assigned to id1 and the null string is assigned to id2. Source Text
%DEFINE (text) (-1,-2,-3,-4,-5)
%MATCH (next,list) (%text)
%WHILE (%LEN (%next) NE 0)
( MOV R8,#%next
MOV [R1+],R8 %MATCH
(next,list)(%list)
)
Output Text MOV R8,#-1 MOV [R1+],R8 MOV R8,#-2 MOV [R1+],R8 MOV R8,#-3 MOV [R1+],R8 MOV R8,#-4 MOV [R1+],R8 MOV R8,#-5 MOV [R1+],R8 | ||||||||
| |||||||||