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
 

 

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

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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
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
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm


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