ADELIA |
VADELIA |
SADELIA |
WADELIA |
MADELIA |
(I/B) |
(I/B) (C/S) |
(B) (S) |
(I/B) (C/S) |
(I) (C/S) |
User paragraph
All
Syntax
SPLIT_STRING SourceString SeparatorString AlphaList
SourceString |
Þ |
<Alphanumeric variable> | <Alphanumeric constant> |
SeparatorString |
Þ |
<Alphanumeric variable> | <Alphanumeric constant> |
AlphaList |
Þ |
List with a single ALPHA(n)-type field. |
Description
This instruction splits the SourceString string into substrings in the AlphaList list according to the SeparatorString separator.
The results list is emptied beforehand.
This instruction updates the reserved word *RETURN_CODE:
0: executed normally
1: at least one substring was truncated as the list field was too short to contain it
-1: internal error when processing the instruction
Example
Example no. 1
ALPHA(50) SUBSTRING
LIST RES_LST SUBSTRING
ALPHA(100) MY_STRING
MY_STRING = PAUL;PATRICK;DAVID
SPLIT_STRING MY_STRING ';' RES_LST
* RES_LST contains 3 elements 'PAUL', 'JOHN', 'DAVID'
* *RETURN_CODE = 0
Example no. 2
ALPHA(5) SUBSTRING4
LIST RES_LST SUBSTRING4
ALPHA(100) MY_STRING
MY_STRING = PAUL;PATRICK;DAVID
SPLIT_STRING MY_STRING ';' RES_LST
* RES_LST contains 3 elements 'PAUL', 'PATR', 'DAVI'
* *RETURN_CODE = 1