Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
String Manipulation in Cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Shweta12j

New User


Joined: 10 May 2010
Posts: 32
Location: Mumbai

PostPosted: Mon Mar 11, 2013 5:01 pm    Post subject: String Manipulation in Cobol
Reply with quote

Hello All ,

I am facing a trouble with string manipulation in cobol.
My requirement is as follows :

Input String : ABCD.T.H.O.D.N.345@q wert
Expected Output String : ABCD345@q wert

I need to remove the specific word in above case it is 'T.H.O.D.N.' from the string and continue with rest as it is without having any gaps or spaces in between.

Appreciate your suggestion in this regards.

Thanks,
Shweta.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Mon Mar 11, 2013 5:20 pm    Post subject: Re: String Manipulation in Cobol
Reply with quote

Code:
Input String : ABCD.T.H.O.D.N.345@q wert
Expected Output String :  ABCD345@q wert


Do you mean to remove ".T.H.O.D.N." instead, or is your output to be "ABCD.345@q wert"?

Edit, is the "substring" to be removed always the same? Always the same length? What is the source of it?
Back to top
View user's profile Send private message
Shweta12j

New User


Joined: 10 May 2010
Posts: 32
Location: Mumbai

PostPosted: Mon Mar 11, 2013 6:13 pm    Post subject: Reply to: String Manipulation in Cobol
Reply with quote

Hello Bill ,

Yes I want to remove this specific word from the input string and want an output as ABCD.345@q wert.

My input string is having a picture clause of X(50).
Source is an input from the User.

User can enter anything in this field which I am further using to query a database. But before that I need to manipulate the input field by removing specific words.

Regards,
Shweta.
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 310
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Mon Mar 11, 2013 6:17 pm    Post subject:
Reply with quote

Quote:

But before that I need to manipulate the input field by removing specific words.


You need to elaborate more on this. What specific words/chars you want to remove..this will help you find a pattern in that and apply some logic to remove that.
Back to top
View user's profile Send private message
Shweta12j

New User


Joined: 10 May 2010
Posts: 32
Location: Mumbai

PostPosted: Mon Mar 11, 2013 6:24 pm    Post subject: Reply to: String Manipulation in Cobol
Reply with quote

sorry forgot to state one thing.

The words which are required to be removed would vary in length.

Below are few words which needs to be removed from the input String :
1 ) B.V.
2) BV
3)VAN
4)V.A.N

Regards,
Shweta.
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10602
Location: italy

PostPosted: Mon Mar 11, 2013 6:53 pm    Post subject: Reply to: String Manipulation in Cobol
Reply with quote

Your terminology is a bit confused ...
the <words> posted are mixing up the word concept ...

until You define the word separator <char> You will not be able to deal with <words>

shall we be correct in assuming that the word seaparators will be the traditional ones ( punctuation signs, beginning of string, end of string ) ...
what about the underscore _ and the at sign @

and when eliminating a <word> what delimiter should be kept
NONE... the initial one or the ending one
( in a generalized approach they might be different )

using Your example slightly modified

not a problem for
Code:
Input  ==> ABCD.T.H.O.D.N.345@q wert
Output ==>ABCD345@q wert

( no delimiter kept)

but You should take into account the possibility of
Code:
Input  ==> ABCD.T.H.O.D.N@q wert
Output ==>ABCD@q wert

where the terminating delimiter MUST be kept


meditate a bit, meditate icon_cool.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10602
Location: italy

PostPosted: Mon Mar 11, 2013 7:19 pm    Post subject: Reply to: String Manipulation in Cobol
Reply with quote

hit enter too soon ...

and anyway You must make provision to drop the terminating separator for words at the beginning of a string
and the initial one for words at the end
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 Regarding mroe data to be processed i... vinu78 DB2 1 Mon May 27, 2019 7:31 pm
No new posts S0C7 abend while running a Cobol Program amitc23 COBOL Programming 2 Tue May 07, 2019 4:06 pm
No new posts Search string from concatenated input... srini24 JCL & VSAM 8 Sat Mar 30, 2019 9:51 pm
No new posts Can we pass cobol pointer to cobol-db... rohanthengal DB2 4 Tue Mar 19, 2019 1:04 pm
No new posts Call DB2 user defined function from C... Ziko13 DB2 5 Thu Mar 14, 2019 4:46 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us