ContentsIndexPreviousNext

Highlights for First-Time Users

1. UNSTRING is best suited for separating string components that share a common delimiter. The delimiter must not appear as an element of the components' values.

2. DELIMITED BY is optional. If it's omitted, each destination data item is completely filled. Effectively, the respective size of each destination data item is the respective delimiter.

3. Assignment to the destination data item is done with an implied MOVE. The MOVE operation will truncate the substring or space fill the destination data item, as required. Truncation of the substring, or space filling of the destination data item resulting from the implicit MOVE, does not raise an OVERFLOW condition.

4. The OVERFLOW condition is raised if: (a) all destination data items are used and characters still remain in the source data item; or (b) POINTER is used and the value of the pointer variable is less than 1 or greater than the length of the source data item.

5. Use the ALL option to treat contiguous occurrences of a delimiter, such as spaces, as a single occurrence.

6. Use DELIMITER IN to place the delimiting character(s) of the current substring into the named data item.

7. Use the COUNT IN option to save the length of the current substring into the named data item.

8. Use TALLYING to tally the number of destination data items assigned by the UNSTRING statement.

9. Use the POINTER option to specify a numeric holder (ptr-var) for the current position in the source data item. By pre-assigning a value to the pointer variable you can start the examination of the source data item at any position in the string. Ptr-var is incremented by one for each character in the source data item that is examined. POINTER allows the programmer to use multiple UNSTRING statements to process the source data item. Note, however, that an overflow condition will be raised if the value of ptr-var is less than the length of the string when the UNSTRING statement terminates.

You must initialize the tallying and pointer variables or results are unpredictable.

10. Use the OVERFLOW option to do special processing when the UNSTRING process does not examine every character in the source data item, or when the pointer variable has a value of less than one or more than the length of the source data item. When the overflow condition exists, the associated imperative statement (if any) executes and program execution continues immediately after the UNSTRING statement.

11. Use the NOT ON OVERFLOW option to do special processing when the UNSTRING statement processes the entire source data item.