• Welcome to the upgraded JDELIST forum and thank you for your patience.
    Please restrict discussions and issues regarding the new forum software to the Off Topic forum. We will be monitoring that forum for issues.
    If you have trouble logging in, please reset your password using the forgotten password form: https://www.jdelist.com/community/index.php?lost-password/
    If you are unable to successfully reset your password, please contact us: Click here!
    We hope that you enjoy the upgraded forum.
  • Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

Using the built in function %UPPER in a CL

Frosty the Coder

Legendary Poster
I'm coding a CLP where a value comes to me in mixed upper/lower case.
I'm trying to use the %UPPER built in function to get unmixed upper case.

Per the IBM documentation:
"The %UPPER built-in function returns a character string that is the same length as the argument specified with each lowercase letter replaced by the corresponding uppercase letter.

The %UPPER built-in function can be used anywhere that CL supports a character expression.
%UPPER can be used alone or as part of a more complex character expression.

For example, %UPPER can be used to convert character CL variables to have only upper case characters
before comparing them in the COND parameter of an IF or WHEN command.

%UPPER can also be used to set the value of a CL command parameter,
if the associated command object defines the parameter with EXPR(*YES) and TYPE of *CHAR, *NAME, *SNAME, *CNAME, *PNAME, *GENERIC, *DATE, *TIME, or *X."


They cite an example of:
SNDPGMMSG (%UPPER(&STR))

When I try to use %UPPER, even the IBM example, I get error CPD0056
"Message . . . . : Built-in function %UPPPER not valid.
Cause . . . . . : Built-in function name not found or built-in function name is not valid for the type of program in which it is specified.
Recovery . . . : Change the name specified for the built-in function or omit the percent sign in front of the name."


Does %UPPER work in CLP?
Would someone please post an example of %UPPER in a CLP?

Thanks
Frosty
 
Top