Figure 19 shows the execution results for an example of the UNSTRING statement.
UNSTRING ID_SEND DELIMITED BY DEL_ID OR ALL "*" INTO ID_R1 DELIMITER IN ID_D1 COUNT IN ID_C1 (All the data ID_R2 DELIMITER IN ID_D2 receiving fields ID_R3 DELIMITER IN ID_D3 COUNT IN ID_C3 are defined as ID_R4 COUNT IN ID_C4 alphanumeric) WITH POINTER ID_P TALLYING IN ID_T ON OVERFLOW GO TO OFLOW_EXIT. DEL_ID ID_SEND at execution at execution __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | 1| 2| 3| *| *| 4| 5| 6| 7| 8| ?| ?| 9| 0| A| B| C| D| E| F| | ?| |__|__|__|__|__|__|__|__|__|__|__|__|__|__|__|__|__|__|__|__| |__| |____ ___|__ __|_______ ______| _|_ |_______ ______| 7 | | | | | | 1 | 2 | 3 | 4 | 5 | 6 | | |______ |_____ | |_______ |______________________ | |_________ | _________________ | _________________ | | ______________ __ __ __ __ __ __ | __ __ __ __ __ __ | | __ __ __ __ __ __ __ __ | 1| 2| 3| b| b| b|| | 4| 5| 6| 7| 8| b| | | | b| b| b| | 9| 0| A| B| C| |__|__|__|__|__|__|| |__|__|__|__|__|__| | | |__|__|__| |__|__|__|__|__| ID_R1 after | ID_R2 after | | ID_R3 after ID_R4 after execution | execution | | execution execution ____________| ______________| |___ ID_D1 ID_C1 ID_D2 ID_D3 ID_C3 ID_C4 __ __ __ __ __ __ | *| | 3| | ?| | ?| | 0| | 8| |__| |__| |__| |__| |__| |__| (after execution) (after execution) (after execution)
ID_P ID_T The order of execution is: (pointer) (tallying field) 1 3 characters are placed in ID_R1. __ __ __ __ | 2| 1| | 0| 5| 2 Because ALL * is specified, all consecutive asterisks |__|__| |__|__| are processed, but only one asterisk is placed in ID_D1. (after execution__ both initialized to 3 5 characters are placed in ID_R2. 01 before execution) 4 A ? is placed in ID_D2. The current receiving field is now ID_R3.
5 A ? is placed in ID_D3; ID_R3 is filled with spaces; no characters are transferred, so 0 is placed in ID_C3.
6 No delimiter is encountered before 5 characters fill ID_R4; 8 is placed in ID_C4, representing the number of characters examined since the last delimiter.
7 ID_P is updated to 21, the total length of the sending field + 1; ID_T is updated to 5, the number of fields acted upon + 1. Since there are no unexamined characters in the ID_SEND, the OVERFLOW EXIT is not taken.
Figure 19. Results of UNSTRING Statement Execution
Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.