
- Forum
- Programming Talk
- COBOL
- Convert all Uppercase to lowercase - How?
Convert all Uppercase to lowercase - How?
This is a discussion on Convert all Uppercase to lowercase - How? within the COBOL forums, part of the Programming Talk category; It is very simple question, Thing is I am new here... Please anyone among you tell me the function/procedure for ...
-
04-21-2006, 03:10 PM #1
- Join Date
- Jan 2006
- Answers
- 5
Convert all Uppercase to lowercase - How?
It is very simple question, Thing is I am new here... Please anyone among you tell me the function/procedure for converting uppercase to lowercase in Cobol.
Thanks to you all
Regards,
-
I am not Cobol expert but this one is pretty easy i think
Function Upper-case ("string")
-
Here's what I found for your problem, I hope these codes helps.
LOCS$O – Convert to Lower Case
This routine converts a buffer from upper case to lower case. It is called with two arguments, InOption and Buffer. InOption is a PIC S9999 USAGE COMP-5 (16-bit integer). Buffer is CHAR(*)VAR. The conversion is as follows:
InOption = 1: Convert all upper case letters to lower case
InOption = 2: Convert all upper case letters except the first one after a period to lower case
InOption = 3: Convert all upper case letters except the one immediately following a blank to lower case
InOption = 4: Convert all upper case letters except the one immediately following a blank or a lower case letter to lower case
InOption = 5: Convert all upper case letters except the one immediately following a non-upper case letter to lower case unless the word begins with "MC"
InOption = 6: Convert all upper case letters except the one immediately following a non-upper-case letter and a non-number
InOption = 7: Convert all upper case letters except the one immediately following a non-upper-case letter unless the next two characters are "ST", "ND", "RD", OR "TH"
-
Hope this helps
The code above displays the following messages on the system logical output device:01 Item-1 Pic x(30) Value "Hello World!".
01 Item-2 Pic x(30).
. . .
Display Item-1
Display Function Upper-case(Item-1)
Display Function Lower-case(Item-1)
Move Function Upper-case(Item-1) to Item-2
Display Item-2
The DISPLAY statements do not change the actual contents of Item-1, but affect only how the letters are displayed. However, the MOVE statement causes uppercase letters to be moved to the actual contents of Item-2.Hello World!
HELLO WORLD!
hello world!
HELLO WORLD!
-
02-19-2008, 05:51 PM #5
- Join Date
- Feb 2008
- Answers
- 1
I don't have an answer to this, but an additional question. I'm trying to make part of a word(s) uppercase. For example, I am trying to take a title like 'editor i' and make it 'editor I'. I've tried using the following code, but when I run my program it doesn't do it.
INSPECT TITLE-DESCRIPTION OF WS-AREA REPLACING ALL
' i ' BY ' I '.
INSPECT TITLE-DESCRIPTION OF WS-AREA REPLACING ALL
' ii ' BY ' II '.
INSPECT TITLE-DESCRIPTION OF WS-AREA REPLACING ALL
' iii ' BY ' III '.
INSPECT TITLE-DESCRIPTION OF WS-AREA REPLACING ALL
' iv ' BY ' IV '.
Any suggestions?
-
I use Liant's RMCOBOL and there is a very easy way to convert. I think several versions of COBOL offer the same... Try
INSPECT WS-USER-NAME CONVERTING 'abcdefghijklmnopqrstuvwxyz' TO 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'. It works both ways (UPPER AND LOWER).
-
Sponsored Ads

Reply With Quote





