IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to replace a string by char using INSPECT statement


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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: 1448
Location: Chicago, IL

PostPosted: Fri Jan 20, 2006 11:00 am
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
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: 1448
Location: Chicago, IL

PostPosted: Fri Jan 20, 2006 11:47 am
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
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: 1448
Location: Chicago, IL

PostPosted: Fri Jan 20, 2006 12:19 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top