We are having issues with qryslt in clp on V7R1.
The code does this:
CHGVAR VAR(&QRYSLT) VALUE('T1ORDR *NE '' ''')
CHGVAR VAR(&QRYSLT) VALUE(&QRYSLT *TCAT ' *AND +
%CHAR(T1DATE "*ISO") *GE ' *CAT '''' *CAT +
&SDATE *CAT '''' *CAT ' *AND %CHAR(T1DATE +
"*ISO") *LE ' *CAT '''' *CAT &EDATE *CAT +
'''')
OPNQRYF FILE((QTEMP/POE79WS)) OPTION(*INP) +
QRYSLT(&QRYSLT) KEYFLD((T1DATE) (T1LOAD))
We get this messageon the OPNQRYF statement:
CPD3131
Message . . . . : Operand for *GT function not valid.
Cause . . . . . : The operator or built-in function *GT, was specified at
position 8 in the expression on the QRYSLT parameter. If the error occurred
on the MAPFLD parameter, the expression was specified for the definition of
field *N. For the %RANGE, %VALUES, and %WLDCRD built-in functions, the
error may be caused by the first operand for the *EQ operator that is
associated with the built-in function. Conditions that can cause this error
include:
Software/Hardware used:
as/400 CLP V7R1
ASKED:
September 4, 2012 2:43 PM
And the code ran in a previous version of the Op Sys?
Odd that it says the error is on code for *GT and you don’t use *GT in this query.
It also said “position 8″, and that matches my count for the position of *LE. What was the message ID? — Tom
Your change makes sense if T1ORDR is a numeric field.
There may be less casting of variables done in OPNQRYF under v7r1 although I doubt that was the intention.
The error listing still baffels us.
If the change worked and T1ORDR is numeric, the change does make sense. It certainly doesn’t make sense that it worked before the 7.1 upgrade, especially a comparison to a blank. That is, unless the field definition itself also changed around the time of the upgrade.
Interesting that the original was “*NE” and the eventual working version was “>” (i.e., “*GT”).
You might slightly simplify the second CHGVAR:
CHGVAR VAR(&QRYSLT) VALUE( &QRYSLT *TCAT ‘ *AND + %CHAR(T1DATE “*ISO”) *GE ”’ *CAT &SDATE + *CAT ”’ *AND %CHAR(T1DATE “*ISO”) *LE + ”’ *CAT &EDATE *CAT ”” )
Tom
Another programmer had changed the source without documenting or telling me. So, what I first saw was not the way it was when the error popped. Argggh!nick