Lowercase to Uppercase
There had been few occasions to change the inputs from a command to be converted all upper case for CPP. This is especially true when CL and Query management is used. The query source are set of SQL statements, in which the field values are case sensitive. So when, name 'Subbu' is compared with 'SUBBU', they do not match.
Like always there is a great helper API for thus purpose. It is QCLSCAN. Please refer to the following url for more information on this API.
publib.boulder.ibm.com/iseries/v5r1/ic2924/info/apis/qclscan.htm
The following source when used, converts the inputs parameter passed to all upper case and return the upper case value in the same parameter.
Please use when required.
PGM PARM(&USRIN)
DCL VAR(&USRIN) TYPE(*CHAR) LEN(10)
DCL VAR(&CHARLEN) TYPE(*DEC) LEN(3 0) VALUE(10)
DCL VAR(&STRPOS) TYPE(*DEC) LEN(3 0) VALUE(1)
DCL VAR(&PATTERN) TYPE(*CHAR) LEN(10)
DCL VAR(&PATTERNLEN) TYPE(*DEC) LEN(3 0)
DCL VAR(&TRAS) TYPE(*CHAR) LEN(1) VALUE('1')
DCL VAR(&TRIMTRBL) TYPE(*CHAR) LEN(1) VALUE('1')
DCL VAR(&WILD) TYPE(*CHAR) LEN(1) VALUE('1')
DCL VAR(&OUTPUT) TYPE(*DEC) LEN(3 0)
CALL PGM(QCLSCAN) PARM(&USRIN &CHARLEN &STRPOS +
&PATTERN &PATTERNLEN &TRAS &TRIMTRBL +
&WILD &OUTPUT)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('The +
output is' *BCAT &USRIN)
ENDPGM: ENDPGM
Thank you,
For more help reach me on iseriesconsultant@rediffmail.com

0 Comments:
Post a Comment
<< Home