COBOL Manual for TNS/E Programs (H06.03+)
Procedure Division Verbs
HP COBOL Manual for TNS/E Programs—520347-003
9-264
UNSTRING
If you execute
UNSTRING U DELIMITED BY SPACE
INTO WORD-1 WORD-2 WORD-3
WORD-4 WORD-5 WORD-6
The fifth item to be copied is “handy.” There is no sixth item to be copied.
The unstring operation handles the set of characters thus examined (excluding
the delimiter string, if any) as an elementary alphanumeric data item and
copies it to the current receiving area in accordance with the rules for the
MOVE statement. When the set contains no characters (that is, if a delimiter
string begins at the very first character examined in this cycle), the unstring
operation moves a null value to the current receiving area. If the current
receiving area is described as numeric or numeric-edited, the value 0 is
moved; otherwise the value spaces is moved.
If you include a DELIMITER phrase in the INTO phrase for this cycle, the
unstring operation handles the set of characters in the delimiter string as an
elementary alphanumeric data item and copies it to delimstore in
accordance with the rules for the MOVE statement. If the delimiting condition is
the end of the sending area (that is, there is no delimiter string), then the
unstring operation fills the delimiter data item with spaces.
If the delimiter is described as a figurative constant with the ALL qualifier, only
one occurrence of the unqualified figurative constant is moved.
If you execute
UNSTRING U DELIMITED BY SPACE OR "."
INTO WORD-1 DELIMITER IN DEL-1
...
WORD-5 DELIMITER IN DEL-5
you get
"The "
in WORD-1,
" "
in DEL-1, and so on down to
"handy "
in WORD-5 and
"."
in DEL-5.
If you include the DELIMITER phrase in the INTO phrase for this cycle, the
unstring operation advances the current character position in the sending area
to the first character following the delimiter string located in this cycle.










