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 

Unstring a field with inconsistent data

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


Joined: 24 Jul 2010
Posts: 3
Topics: 2

PostPosted: Sun Oct 24, 2010 10:06 pm    Post subject: Unstring a field with inconsistent data Reply with quote

Hi Guys,

I have one field REC-1 PIC X(30). It may contain inconsistent data delimited by ','.
Data can be as below.

1234,56,981764543,789654
1,234,78,2921726,6788,999,1
1234567834567812344,1232

I want to unstring the REC-1 filed with delimited by ',' and move the values to the o/p field of that much specific bystes. Like:

For 1st rec:
A=1234
B=56
C=981764543
D=789654

For 2nd rec:
A=1
B=234
C=78
D=2921726
E=6788
F=999
G=1

and so on...

Is there anyway to accomplish this?
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Sun Oct 24, 2010 11:40 pm    Post subject: Reply with quote

You could redefine a table over the data and the move through the table looking for commas then, using reference modification, move the data from start/last comma+1 to output field.

There are probably other ways in cobol - I assume you are using cobol?
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Mon Oct 25, 2010 6:13 am    Post subject: Reply with quote

using the COBOL UNSTRING statement, you can UNSTRING the field in REC1
into alphanumeric or numeric receiving fields.

remember to initialize your receiving fields before you do the UNSTRING.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
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