ContentsIndexPreviousNext

C$TOUPPER and C$TOLOWER Routines

These routines translate text to upper- or lower-case.

Usage

CALL "C$TOUPPER" USING TEXT-DATA, VALUE TEXT-LEN
CALL "C$TOLOWER" USING TEXT-DATA, VALUE TEXT-LEN

Parameters

TEXT-DATA PIC X(n)

Contains the data to translate to upper- or lower-case.

TEXT-LEN USAGE UNSIGNED-INT, or a numeric literal

Contains the number of characters to translate.

Description

C$TOUPPER translates the first TEXT-LEN characters in TEXT-DATA to upper-case. C$TOLOWER translates to lower-case instead. No size checking is done on TEXT-DATA, so you must ensure that TEXT-LEN has a valid value.

You can also translate character strings with INSPECT CONVERTING. The only advantage these routines have over INSPECT CONVERTING is that these routines can be configured to handle alternate character sets. With these routines, you can get proper handling of European alphabets without coding those alphabets in COBOL. Instead, you configure the alphabet in the "cblconfig" file. For details, see the configuration entry UPPER-LOWER-MAP in Appendix H.


Note that the word "VALUE" must be included in the calling statement. If it is omitted, the program will very likely encounter memory errors.