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 all the capital letters

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

New User


Joined: 20 Apr 2012
Posts: 20
Location: chennai

PostPosted: Mon May 14, 2012 5:20 pm    Post subject: How to replace a string all the capital letters
Reply with quote

how to replace a string all the capital letters with capitals of the same ,and alll the small letters with default xxxx...
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Mon May 14, 2012 5:45 pm    Post subject: Reply to: how to convert
Reply with quote

Have a look at INSPECT, or just do it yourself in a loop of your choice. Only specify lower-case for changing. Decide how to know what to change them to, given that presumably you are "masking" data, and it shouldn't be done so it can be readily "unmasked". You can get at random numbers in your program. Search the forum if you don't know about them.


Check at your site - perhaps there is already a tool?
Back to top
View user's profile Send private message
swarnasuneel

New User


Joined: 20 Apr 2012
Posts: 20
Location: chennai

PostPosted: Mon May 14, 2012 5:58 pm    Post subject:
Reply with quote

how to change Only LowerCase Only
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Mon May 14, 2012 6:05 pm    Post subject: Reply to: how to convert
Reply with quote

Only secify lowercase Only to be changed.

If you were to replace "a" by "x", only "a" would be replaced. If you replaced "A" by "x", only "A" would be replaced.
Back to top
View user's profile Send private message
swarnasuneel

New User


Joined: 20 Apr 2012
Posts: 20
Location: chennai

PostPosted: Mon May 14, 2012 6:12 pm    Post subject:
Reply with quote

ALL the Alphabets Which are in Lower case Should Be replace ALL With All "XXXXXXXXXXX"
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Mon May 14, 2012 6:25 pm    Post subject: Reply to: How to replace a string all the capital letters
Reply with quote

OK. And have you looked to see if INSPECT can do if for you?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon May 14, 2012 6:41 pm    Post subject: Reply to: How to replace a string all the capital letters
Reply with quote

Introduced with COBOL/370, review FUNCTION UPPER-CASE, which will convert lower-case to upper-case.

I think this is what you're trying to accomplish? icon_question.gif
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon May 14, 2012 7:14 pm    Post subject: Reply to: How to replace a string all the capital letters
Reply with quote

If by chance, you're still on OS/VS COBOL and you've chosen to use the EXAMINE (Ansi 68) or TRANSFORM (Ansi 74) Verb (both predecessors to INSPECT) in a CICS environment, you'll need to find another method.

Under the covers, EXAMINE/TRANSFORM issue an MVS GETMAIN but not an MVS FREEMAIN. If you invoke either of these Verbs too many times in a given region, the region will abend with an S80A (Virtual Storage Exhausted).

Just a heads-up....
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon May 14, 2012 8:19 pm    Post subject: Reply to: How to replace a string all the capital letters
Reply with quote

Hello,

If i understand correctly, any/all lower-case values should be changed to an X.

So if the "input" was
Code:
AbcdEFghijKlmnoP
the "output" would be
Code:
AXXXEFXXXXKXXXXP

Is this correct? If not, please clarify with examples.
Back to top
View user's profile Send private message
swarnasuneel

New User


Joined: 20 Apr 2012
Posts: 20
Location: chennai

PostPosted: Mon May 14, 2012 8:45 pm    Post subject:
Reply with quote

yes, it correct can any provide a solution plss
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Mon May 14, 2012 9:02 pm    Post subject:
Reply with quote

swarnasuneel wrote:
yes, it correct can any provide a solution plss

As you count COBOL amongst your skills, you ought to easily be able to deduce how to use the INSPECT statement mentioned twice to you by Sr. Woodger.

ETA: And a third time whilst I was writing this.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Mon May 14, 2012 9:02 pm    Post subject: Reply to: How to replace a string all the capital letters
Reply with quote

Look at INSPECT CONVERTING in the manual (link at the top of the page) or code your own loop-construct of choice, preferably avoiding reference-modification, specifying the lower-case letters and 26 X's (or one X if doing it yourself).
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon May 14, 2012 9:03 pm    Post subject: Reply to: How to replace a string all the capital letters
Reply with quote

So, Dick's assessment is correct?

How are you going to distinguish a legitimate (unconverted) capital "X" from a converted lower-case letter, now represented as a capital "X"?

You need to reevaluate your idea or did this come from "Management"? icon_rolleyes.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon May 14, 2012 9:04 pm    Post subject:
Reply with quote

You've a solution lying there already in all these posts, start with some pseudo code at least.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon May 14, 2012 9:10 pm    Post subject:
Reply with quote

Hello,

As others have mentioned, look at INSPECT. It will do what you need.

At the top of the page is a link to "IBM Manuals". At the top of the list are manuals for COBOL.

In the COBOL Language Reference (Using the manual search (yellow flashlight/tubelight) search for INSPECT). From the results, notice the entry for INSPECT statement, 6.2.21

Click on this and Read about INSPECT. If you find something in the manual that is not clear, post what you found and your doubt. Someone will be able to clarify.

If you click on the COBOL Programming Guide and search for INSPECT, there is an example of what you want to do in that manual.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Mon May 14, 2012 9:26 pm    Post subject: Reply to: How to replace a string all the capital letters
Reply with quote

It's a good point from Mr Bill, and you've changed your requirement since your initial posts.

Don't tell me it'll be fine the way you have it, unless you want to mess-up names like Raul-Xavier Quango and similar...

From your original, there was at least some point in keeping the uppercase unchanged (so you could, for instance, verify correct processing of mixed-case text). Now, why bother to keep anything original?
Back to top
View user's profile Send private message
dudenithy

New User


Joined: 02 Mar 2012
Posts: 48
Location: India

PostPosted: Thu Jul 26, 2012 12:16 pm    Post subject:
Reply with quote

As Bill suggested, we have FUNCTION for converting lower case to Upper case and vice versa through the commands UPPER-CASE and LOWER-CASE respectively.
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 Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
This topic is locked: you cannot edit posts or make replies. Sort card to replace text using cross... Susanta SYNCSORT 32 Tue Sep 13, 2016 4:17 pm
No new posts Replace function abdulrafi COBOL Programming 13 Mon Sep 12, 2016 10:12 am
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm


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