In EBCDIC:
x1 = '<><.A.B><. . ><.E><.F><>'
PARSE VAR x1 w1
w1 -> '<><.A.B><. . ><.E><.F><>'
PARSE VAR x1 1 w1
w1 -> '<><.A.B><. . ><.E><.F><>'
PARSE VAR x1 w1 .
w1 -> '<.A.B>'
The leading
and trailing SO and SI are unnecessary for word parsing and, thus,
they are stripped off. However, one pair is still needed for a valid
mixed DBCS string to be returned.
PARSE VAR x1 . w2
w2 -> '<. ><.E><.F><>'
Here
the first blank delimited the word and the SO is added to the string
to ensure the DBCS blank and the valid mixed string.
PARSE VAR x1 w1 w2
w1 -> '<.A.B>'
w2 -> '<. ><.E><.F><>'
PARSE VAR x1 w1 w2 .
w1 -> '<.A.B>'
w2 -> '<.E><.F>'
The
word delimiting allows for unnecessary SO and SI to be dropped.
x2 = 'abc<>def <.A.B><><.C.D>'
PARSE VAR x2 w1 '' w2
w1 -> 'abc<>def <.A.B><><.C.D>'
w2 -> ''
PARSE VAR x2 w1 '<>' w2
w1 -> 'abc<>def <.A.B><><.C.D>'
w2 -> ''
PARSE VAR x2 w1 '<><>' w2
w1 -> 'abc<>def <.A.B><><.C.D>'
w2 -> ''
Note that for
the last three examples '',
<>, and
<><> are
each a null string (a string of length
0). When parsing, the null string matches the end of string. For this reason,
w1 is
assigned the value of the entire string and
w2 is assigned
the null string.