IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

breaking string on basis of spaces


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
scorp_rahul22
Currently Banned

New User


Joined: 06 Aug 2007
Posts: 42
Location: chennai

PostPosted: Tue Apr 29, 2008 11:47 am
Reply with quote

I want to parse string from input file

INPUT FILE (VARIABLE LENGTH)
-----------------------------------------

a b c d e fg hikl

OUTPUT
---------
I need to break above line into number of lines whenever space is encountered.(It can be one space as well as many spaces)

I want output as

a
b
c
d
e
fg
hikl


I want to know is this possible in COBOL
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Apr 29, 2008 11:56 am
Reply with quote

yes
http://catb.org/~esr/faqs/smart-questions.html
Back to top
View user's profile Send private message
scorp_rahul22
Currently Banned

New User


Joined: 06 Aug 2007
Posts: 42
Location: chennai

PostPosted: Tue Apr 29, 2008 12:00 pm
Reply with quote

can u please paste that thing here if possible, as i am not able to open that page because of access issues
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Tue Apr 29, 2008 12:44 pm
Reply with quote

Hi Rahul Gupta !

Perhaps, if you reflect on the way, you posted your questions, you could come to the conclusion, why you're getting short and single-line answers.

A shade more gentleness would be indicated.

So now, back to your problem.

Use UNSTRING command. Design a little loop, where you unstring the first string delimeted by space and the rest into two variables. Move back only the rest. Unstring again.

Regards, UmeySan
Back to top
View user's profile Send private message
scorp_rahul22
Currently Banned

New User


Joined: 06 Aug 2007
Posts: 42
Location: chennai

PostPosted: Tue Apr 29, 2008 7:09 pm
Reply with quote

I am not able to get logic for that. It wud be very kind of you if u can help me in that
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Apr 29, 2008 7:33 pm
Reply with quote

Hello,

Post what you have tried and where there are questions or problems.

If you have no idea where to start, i suggest you look in the COBOL Language Refverence and Programmers Guide available via the "IBM Manuals" link at the top of the page. There is a lot of material on UNSTRING as well as examples.

If you read something you do not understand, post it here and we will try to clarify.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 2
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
No new posts file manager is doing string conversion IBM Tools 3
Search our Forums:

Back to Top