Exforsys
+ Reply to Thread
Results 1 to 6 of 6

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

  1. #1
    Matrix_2006 is offline Junior Member Array
    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,


  2. #2
    iatbm's Avatar
    iatbm is offline Member Array
    Join Date
    Apr 2006
    Answers
    34
    I am not Cobol expert but this one is pretty easy i think

    Function Upper-case ("string")


  3. #3
    encoder is offline Junior Member Array
    Join Date
    Apr 2006
    Answers
    9
    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"



  4. #4
    Allan is offline Member Array
    Join Date
    May 2006
    Answers
    40
    Hope this helps

    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 code above displays the following messages on the system logical output device:

    Hello World!
    HELLO WORLD!
    hello world!
    HELLO WORLD!
    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.


  5. #5
    cobolnovice is offline Junior Member Array
    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?


  6. #6
    eddie13 is offline Junior Member Array
    Join Date
    Jul 2007
    Answers
    8
    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



Latest Article

Network Security Risk Assessment and Measurement

Read More...