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 convert upper to lower, lower to upper within a strin

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

New User


Joined: 05 Dec 2005
Posts: 79

PostPosted: Wed Jan 16, 2008 1:25 pm    Post subject: How to convert upper to lower, lower to upper within a strin
Reply with quote

Hi,
I am having text like "sOftWarE'. I need to convert this to "SoFTwARe".
Upper cases to lower and lower cases to upper..
Is there any funtion avaible in cobol ?? If not, how to do it..
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Wed Jan 16, 2008 1:39 pm    Post subject:
Reply with quote

Prabhu,

Is this is a homework?
Back to top
View user's profile Send private message
Prabha
Warnings : 2

New User


Joined: 05 Dec 2005
Posts: 79

PostPosted: Wed Jan 16, 2008 2:56 pm    Post subject: Reply to: How to convert upper to lower, lower to upper with
Reply with quote

no, we have requirement like this in our project..
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Wed Jan 16, 2008 3:10 pm    Post subject: Re: Reply to: How to convert upper to lower, lower to upper
Reply with quote

Prabha wrote:
no, we have requirement like this in our project..


in 2 words: In-Credible!

;)
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jan 16, 2008 3:21 pm    Post subject:
Reply with quote

If your requirement is to change all upper to lower and all lower to upper
and
if your version of cobol does not have an upper or upper case command:

declare a 2 byte binary field. initialize to zero. move the alpha char to 2nd byte. IF the binary value of the 2 byte binary field > 169 subtract 64 from the 2 byte binary field. (will change upper to lower) if the value of the binary field is < 193 then add 64 (will change lower to upper).

this will only work for ebcdic. since ebcdic is not going to change, this will always work.

if you are using unicode, use the appropriate cobol command (upper/lower).


if you need to modify specific letters in specific words, I would use level 88s.
Back to top
View user's profile Send private message
k.junaid83

New User


Joined: 19 Apr 2006
Posts: 22
Location: bangalore

PostPosted: Wed Jan 16, 2008 4:11 pm    Post subject:
Reply with quote

Hi,
You can use the following approach for ur requirement.

01 WS-INPUT-STRING PIC X(08) VALUE 'sOftWarE'.
01 FIRST-CASE PIC X(52) VALUE
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.
01 SECOND-CASE PIC X(52) VALUE
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.

PROCEDURE DIVISION.

INSPECT WS-INPUT-STRING CONVERTING
FIRST-CASE BY SECOND-CASE.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Wed Jan 16, 2008 6:07 pm    Post subject:
Reply with quote

This was just asked last week. Did you not search the forum or manual?
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 How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Convert +9999999999999.99 to S9(12)V9(3) vnktrrd DFSORT/ICETOOL 8 Thu Nov 17, 2016 8:15 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts convert PD to ZD ram_vizag DFSORT/ICETOOL 5 Sat Nov 05, 2016 3:06 am
No new posts help: convert C'00AB' to X'00AB' alan_gu DFSORT/ICETOOL 1 Thu Sep 29, 2016 12:22 pm


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