View previous topic :: View next topic
|
Author |
Message |
swarnasuneel
New User
Joined: 20 Apr 2012 Posts: 20 Location: chennai
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
swarnasuneel
New User
Joined: 20 Apr 2012 Posts: 20 Location: chennai
|
|
|
|
how to change Only LowerCase Only |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
swarnasuneel
New User
Joined: 20 Apr 2012 Posts: 20 Location: chennai
|
|
|
|
ALL the Alphabets Which are in Lower case Should Be replace ALL With All "XXXXXXXXXXX" |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
OK. And have you looked to see if INSPECT can do if for you? |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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? |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If i understand correctly, any/all lower-case values should be changed to an X.
So if the "input" was
the "output" would be
Is this correct? If not, please clarify with examples. |
|
Back to top |
|
|
swarnasuneel
New User
Joined: 20 Apr 2012 Posts: 20 Location: chennai
|
|
|
|
yes, it correct can any provide a solution plss |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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"? |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
You've a solution lying there already in all these posts, start with some pseudo code at least. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
dudenithy
New User
Joined: 02 Mar 2012 Posts: 48 Location: India
|
|
|
|
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 |
|
|
|