Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

breaking string on basis of spaces

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: breaking string on basis of spaces
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10291
Location: italy

PostPosted: Tue Apr 29, 2008 11:56 am    Post subject: Reply to: breaking string on basis of spaces
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    Post subject: Reply to: breaking string on basis of spaces
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: 757
Location: Germany

PostPosted: Tue Apr 29, 2008 12:44 pm    Post subject:
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    Post subject: Reply to: breaking string on basis of spaces
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

Site Director


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

PostPosted: Tue Apr 29, 2008 7:33 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts change string before sertan string anatol DFSORT/ICETOOL 8 Tue Aug 15, 2017 5:43 pm
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us