MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Question with delimited data.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Bravo
Beginner


Joined: 05 Dec 2005
Posts: 26
Topics: 12

PostPosted: Fri Dec 23, 2005 7:33 pm    Post subject: Question with delimited data. Reply with quote

Hi All,

I am getting the following with pipe | as delimited in VB format. I want to unstring and move the data to three different fields which is declared as

A PIC X(5)
B PIC X(10)
C PIC X(15)

input as

"1"|"2"|"3"
"11"|"22"|"33"
"111"|"222"|"333"

o/p should be

First record

A = 1
B = 2
C = 3

2nd record

A = 11
B = 22
C = 33

3rd record

A = 111
B = 222
C = 333

Could you please suggest me the efficient to handle the above data.

Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Dec 23, 2005 7:59 pm    Post subject: Reply with quote

Bravo,

Try this untested code.

Code:

01 W-STR PIC  X(30).                 

MOVE '"11"|"22"|"33"' TO  W-STR   

INSPECT W-STR REPLACING ALL '"' BY ' '     

UNSTRING W-STR DELIMITED BY '|' INTO A,B,C

DISPLAY A
DISPLAY B
DISPLAY C


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bravo
Beginner


Joined: 05 Dec 2005
Posts: 26
Topics: 12

PostPosted: Sat Dec 24, 2005 4:19 pm    Post subject: Reply with quote

I just gave the sample data but the real time data could be any values other than the provided in my post.

I do not want to hard code the data in the program.Is there any alternative way.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Sat Dec 24, 2005 6:44 pm    Post subject: Reply with quote

Quote:

I just gave the sample data but the real time data could be any values other than the provided in my post.

I do not want to hard code the data in the program.Is there any alternative way

Bravo,

The above posted code works for any kind of data. Just move your input data to w-str and you are all set

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group