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

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


Joined: 29 Aug 2005
Posts: 19
Topics: 7

PostPosted: Wed Dec 28, 2005 12:07 pm    Post subject: unstring Reply with quote

Hi all,

I have a problem with unstring

input data

mvsforums
mvs forums
mvs forums com
mvs forums com new

i Want an output like this
mvsforums
mforums
mforums com
mforums com new

I need the the first byte of the first portion of the string & all the data following the first delimter only. Can any one help me
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: Thu Dec 29, 2005 6:09 am    Post subject: Reply with quote

madisand,

Your output pattern is not consistent.

ex:
input = mvsforums

output = mvsforums

Technically the output should only be M as you need to pick the first byte of the string before a space.

try this code

Code:

01 W-INP-STR           PIC X(50).
01 W-OUT-STR.                   
   05 W-STR1           PIC X(01).
   05 W-STR2           PIC X(49).

MOVE 'mvs forums com new'   TO  W-INP-STR

INSPECT W-INP-STR REPLACING FIRST ' ' BY ')'

UNSTRING W-INP-STR DELIMITED BY  ')'         
    INTO W-STR1, W-STR2                     

DISPLAY W-OUT-STR                           


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
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