View previous topic :: View next topic
|
Author |
Message |
Prabha Warnings : 2 New User
Joined: 05 Dec 2005 Posts: 79
|
|
|
|
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Prabhu,
Is this is a homework? |
|
Back to top |
|
|
Prabha Warnings : 2 New User
Joined: 05 Dec 2005 Posts: 79
|
|
|
|
no, we have requirement like this in our project.. |
|
Back to top |
|
|
acevedo
Active User
Joined: 11 May 2005 Posts: 344 Location: Spain
|
|
|
|
Prabha wrote: |
no, we have requirement like this in our project.. |
in 2 words: In-Credible!
;) |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
k.junaid83
New User
Joined: 19 Apr 2006 Posts: 22 Location: bangalore
|
|
|
|
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 |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
This was just asked last week. Did you not search the forum or manual? |
|
Back to top |
|
|
|