Rational Developer for System z
COBOL for Windows, Version 7.5, Programming Guide


Converting to uppercase or lowercase (UPPER-CASE, LOWER-CASE)

You can use the UPPER-CASE and LOWER-CASE intrinsic functions to easily change the case of alphanumeric, alphabetic, or national strings.

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 replace the contents of Item-2.

The conversion uses the case mapping that is defined in the current locale. The length of the function result might differ from the length of the argument.

related tasks
Assigning input from a screen or file (ACCEPT)
Displaying values on a screen or in a file (DISPLAY)


Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)