Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
swarnasuneel

New User

Joined: 20 Apr 2012
Posts: 20
Location: chennai

 Posted: Mon May 14, 2012 5:20 pm    Post subject: How to replace a string all the capital letters how to replace a string all the capital letters with capitals of the same ,and alll the small letters with default xxxx...

Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7312

 Posted: Mon May 14, 2012 5:45 pm    Post subject: Reply to: how to convert 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?
swarnasuneel

New User

Joined: 20 Apr 2012
Posts: 20
Location: chennai

 Posted: Mon May 14, 2012 5:58 pm    Post subject: how to change Only LowerCase Only
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7312

 Posted: Mon May 14, 2012 6:05 pm    Post subject: Reply to: how to convert 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.
swarnasuneel

New User

Joined: 20 Apr 2012
Posts: 20
Location: chennai

 Posted: Mon May 14, 2012 6:12 pm    Post subject: ALL the Alphabets Which are in Lower case Should Be replace ALL With All "XXXXXXXXXXX"
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7312

 Posted: Mon May 14, 2012 6:25 pm    Post subject: Reply to: How to replace a string all the capital letters OK. And have you looked to see if INSPECT can do if for you?
Bill O'Boyle

CICS Moderator

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

 Posted: Mon May 14, 2012 6:41 pm    Post subject: Reply to: How to replace a string all the capital letters 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?
Bill O'Boyle

CICS Moderator

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

 Posted: Mon May 14, 2012 7:14 pm    Post subject: Reply to: How to replace a string all the capital letters 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....
dick scherrer

Site Director

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

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

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.
swarnasuneel

New User

Joined: 20 Apr 2012
Posts: 20
Location: chennai

 Posted: Mon May 14, 2012 8:45 pm    Post subject: yes, it correct can any provide a solution plss
Akatsukami

Global Moderator

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

Posted: Mon May 14, 2012 9:02 pm    Post subject:

 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.
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7312

 Posted: Mon May 14, 2012 9:02 pm    Post subject: Reply to: How to replace a string all the capital letters 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).
Bill O'Boyle

CICS Moderator

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

 Posted: Mon May 14, 2012 9:03 pm    Post subject: Reply to: How to replace a string all the capital letters 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"?
Anuj Dhawan

Senior Member

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

 Posted: Mon May 14, 2012 9:04 pm    Post subject: You've a solution lying there already in all these posts, start with some pseudo code at least.
dick scherrer

Site Director

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

 Posted: Mon May 14, 2012 9:10 pm    Post subject: 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.
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7312

 Posted: Mon May 14, 2012 9:26 pm    Post subject: Reply to: How to replace a string all the capital letters 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?
dudenithy

New User

Joined: 02 Mar 2012
Posts: 48
Location: India

 Posted: Thu Jul 26, 2012 12:16 pm    Post subject: 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.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Search string from concatenated input... srini24 JCL & VSAM 8 Sat Mar 30, 2019 9:51 pm How to copy\replace the members in pr... abdulrafi JCL & VSAM 6 Fri Mar 22, 2019 7:02 pm Add week number to a file name or rep... tejdeep0274 JCL & VSAM 2 Thu Jan 03, 2019 6:49 am Silly question maybe - REPLACE member... Cloink TSO/ISPF 15 Thu Oct 25, 2018 6:38 pm UNSTRING a big string Apurva Ghogale COBOL Programming 16 Thu Sep 20, 2018 12:12 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us