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 problem

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


Joined: 29 Jun 2004
Posts: 11
Topics: 8
Location: Bangalore

PostPosted: Tue Jul 04, 2006 7:21 am    Post subject: UNSTRING problem Reply with quote

Friends,

I am using UNSTRING to split a CSV file.

WS-USER-REC : 111116862,01,101010101010

UNSTRING WS-USER-REC DELIMITED BY WS-COMMA
INTO
WS-CONTRACT-ID ( X(12))
WS-SET (X(02))
WS-C-NUMBER (X(12))

But most of the time WS-CONTRACT-ID length is 9 characters in the CSV file sometimes even in the complete CSV file.Hence WS-CONTRACT-ID is taking WS-SET values also even if there is a comma in between. i.e. it is looking for the values for full 12 characters evenif there is comma in between.

The WS-CONTRACT-ID is appearing as 111116862 01 instead of 111116862.

Please suggest how to overcome this problem..

Please let me know if you need some more details about this..
_________________
Regards,
Vishwakiran
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jul 05, 2006 7:55 am    Post subject: Reply with quote

Vishwakiran,

Try this

Code:

01 WS-STR                PIC X(80) VALUE
   '123456789,01,101010101010'.         
                                       
01 WS-CONTRACT-ID        PIC X(12).     
01 WS-SET                PIC X(02).     
01 WS-C-NUMBER           PIC X(12).     


UNSTRING WS-STR DELIMITED BY ','   
    INTO WS-CONTRACT-ID           
        ,WS-SET                   
        ,WS-C-NUMBER               
                                   


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