View previous topic :: View next topic |
Author |
Message |
desporter Beginner
Joined: 17 Oct 2006 Posts: 2 Topics: 1
|
Posted: Tue Oct 17, 2006 6:26 am Post subject: To split(unstring) a string. |
|
|
Please help me to indentify a PL/I string function to unstring STR01 into STR02,STR03,STR04 with comma as delimiter.
------------------------------
DCL STR01 CHAR(5) INIT (A,B,C);
DCL STR02 CHAR(1);
DCL STR03 CHAR(1);
DCL STR04 CHAR(1);
----------------------------- |
|
Back to top |
|
|
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Tue Oct 17, 2006 6:36 am Post subject: |
|
|
desporter,
Your declaration itself is wrong.Try this code:
Code: |
DCL STR01 CHAR(5) INIT ('A,B,C');
DCL STR02 CHAR(1) INIT (' ');
DCL STR03 CHAR(1) INIT (' ');
DCL STR04 CHAR(1) INIT (' ');
STR02 = SUBSTR(STR01,1,1);
STR03 = SUBSTR(STR01,3,1);
STR04 = SUBSTR(STR01,5,1);
PUT SKIP LIST ('STR02 IS :',STR02);
PUT SKIP LIST ('STR03 IS :',STR03);
PUT SKIP LIST ('STR04 IS :',STR04);
|
OUTPUT
Code: |
STR02 IS : A
STR03 IS : B
STR04 IS : C
|
_________________ Shekar
Grow Technically |
|
Back to top |
|
|
desporter Beginner
Joined: 17 Oct 2006 Posts: 2 Topics: 1
|
Posted: Tue Oct 17, 2006 7:13 am Post subject: To split(unstring) a string. |
|
|
Hi:
Thanks for your reply.
I am looking for something like UNSTRING verb in COBOL.
I want to split string into different variable by a delimiter. _________________ - Senthil Kumar. |
|
Back to top |
|
|
|
|