Splitting data items (UNSTRING)
Use the UNSTRING
statement to split a
sending field into several receiving fields. One UNSTRING
statement
can take the place of several MOVE
statements.
About this task
In the UNSTRING
statement you can specify:
- Delimiters that, when one of them is encountered in the sending
field, cause the current receiving field to stop receiving and the
next, if any, to begin receiving (
DELIMITED BY
phrase) - A field for the delimiter that, when encountered
in the sending field, causes the current receiving field to stop receiving
(
DELIMITER IN
phrase) - An integer data item that stores the number of characters placed
in the current receiving field (
COUNT IN
phrase) - An integer data item that indicates the leftmost character
position within the sending field at which
UNSTRING
processing should begin (WITH POINTER
phrase) - An integer data item that stores a tally of the
number of receiving fields that are acted on (
TALLYING IN
phrase) - Action to be taken if all of the receiving fields are filled before
the end of the sending data item is reached (
ON OVERFLOW
phrase)
The sending data item and the delimiters in the DELIMITED
BY
phrase must be of category alphabetic, alphanumeric, alphanumeric-edited,
DBCS, national, or national-edited.
Receiving data items can be of category alphabetic, alphanumeric, numeric, DBCS, or national. If numeric, a receiving data item must be zoned decimal or national decimal. If a receiving data item has:
USAGE DISPLAY
, the sending item and each delimiter item in the statement must haveUSAGE DISPLAY
, and each literal in the statement must be alphanumericUSAGE NATIONAL
, the sending item and each delimiter item in the statement must haveUSAGE NATIONAL
, and each literal in the statement must be nationalUSAGE DISPLAY-1
, the sending item and each delimiter item in the statement must haveUSAGE DISPLAY-1
, and each literal in the statement must be DBCS
Related references
UNSTRING statement (Enterprise COBOL for z/OS® Language Reference)
Classes and categories of data (Enterprise COBOL for z/OS Language Reference)
UNSTRING statement (Enterprise COBOL for z/OS® Language Reference)
Classes and categories of data (Enterprise COBOL for z/OS Language Reference)