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

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: 287
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: 10327
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: 10327
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 line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am

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