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
 

 

How to replace a string by char using INSPECT statement

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

New User


Joined: 19 Jan 2006
Posts: 17
Location: bangalore

PostPosted: Thu Jan 19, 2006 11:02 am    Post subject: How to replace a string by char using INSPECT statement
Reply with quote

Hi All,


i am having input file in the format
,wwww;wwwww
wwwwwww,ww
the length of the file is 38 .And i want the out put file in the format
,w;w
w,w
i want to replace the w's by a single w.the count of w's is not constant in input file.
can this be done using inspect statement?if not is there any other method?
Back to top
View user's profile Send private message

Lkmi

New User


Joined: 04 Mar 2005
Posts: 53
Location: Newyork

PostPosted: Fri Jan 20, 2006 3:37 am    Post subject:
Reply with quote

I think we can try replacing 'wwww;' by 'w;'.

i.e, if the number of w's + ; is constant.

after this, again a replace can be made for wwww+ blank to replace the last string.


iam not sure abt this..Its just an idea.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Jan 20, 2006 11:00 am    Post subject: Re: How to replace a string by char using INSPECT statement
Reply with quote

Hi Rups,

Are you sure in your Input file DELIMITERS between Ws are only COMMA & SEMICOLON ?

Regards,

Priyesh.
Back to top
View user's profile Send private message
rups

New User


Joined: 19 Jan 2006
Posts: 17
Location: bangalore

PostPosted: Fri Jan 20, 2006 11:22 am    Post subject: Re: How to replace a string by char using INSPECT statement
Reply with quote

Hi priyesh,

I am having 11 lakh records in my input file and the delimiters that comes in each record will vary.
i am having in put record this format
wwww wwww www
www,wwww.ww
ww
ww * ww
$$ ww $$
** ww
wwww * ww
( www
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Jan 20, 2006 11:47 am    Post subject: Re: How to replace a string by char using INSPECT statement
Reply with quote

So what about output for the other records having *, SPACE, ( , ) , $, ** etc...

After looking at INPUTs seems like you just want to replace all contiguous Ws with a single W. Is it correct or you are looking for somethig else ?

Regards,

Priyesh.
Back to top
View user's profile Send private message
rups

New User


Joined: 19 Jan 2006
Posts: 17
Location: bangalore

PostPosted: Fri Jan 20, 2006 12:06 pm    Post subject: Re: How to replace a string by char using INSPECT statement
Reply with quote

yes i just want to replace all w's by single w,and special characters will remain as it is.

ex: input- $$ www $$
output-$$ w $$
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Jan 20, 2006 12:19 pm    Post subject: Re: How to replace a string by char using INSPECT statement
Reply with quote

rups....

Easiest way to achieve this is to issue below mentioned command to the input file at EDIT MODE.

Code:
Command ===> C all WW W


As your input file LRECL is 38 in the worst case you'll have to issue this command only 6 times. And that I think is far worthy coding a program.

P.S. Dont forget to back up your INPUT File before EDIT for reference.

Regards,

Priyesh.
Back to top
View user's profile Send private message
rups

New User


Joined: 19 Jan 2006
Posts: 17
Location: bangalore

PostPosted: Fri Jan 20, 2006 12:26 pm    Post subject: Re: How to replace a string by char using INSPECT statement
Reply with quote

Thanks priyesh.I will try that.

Thanks
Rups
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 Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am


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