The LCWORD3 function converts the letters in a character string to mixed-case by converting the first letter of each word to uppercase and converting every other letter to lowercase. In addition, a single quotation mark indicates that the next letter should be converted to uppercase, as long as it is neither followed by a blank nor the last character in the input string.
For example, 'SMITH' would be changed to 'Smith' and JACK'S would be changed to Jack's.
LCWORD3(length, string, output)
Is the length, in characters, of the character string or field to be converted, or a field that contains the length.
Is the character string to be converted, or a field that contains the string.
Is the name of the field that contains the result, or the format of the output value enclosed in single quotation marks. The length must be greater than or equal to length.
LCWORD3 converts the strings O'CONNOR’s and o’connor’s to mixed-case:
DEFINE FILE EMPLOYEE MYVAL1/A10='O'CONNOR'S'; MYVAL2/A10='o'connor's'; LC1/A10 = LCWORD3(10, MYVAL1, 'A10'); LC2/A10 = LCWORD3(10, MYVAL2, 'A10'); END TABLE FILE EMPLOYEE SUM LAST_NAME NOPRINT MYVAL1 LC1 MYVAL2 LC2 END
On the output, the letter C after the first single quotation mark is in uppercase because it is not followed by a blank and is not the final letter in the input string. The letter s after the second single quotation mark is in lowercase because it is the last character in the input string:
MYVAL1 LC1 MYVAL2 LC2 ------ --- ------ --- O'CONNOR'S O'Connor's o'connor's O'Connor's