This sql seems okay but hit error during compiling ..
SELECT COUNT(*)
INTO :W9-TOT-TRXN
FROM IRC02
WHERE SUBSTR(P9_IRC_PST_DT,1,6) = :Ws-DATE-YM
AND F9_IRC_FI = :W9-FI-PARAM
AND P9_IRC_PRIN_CRN = :F9-IR025-CRN
AND F9_IRC_LOC_ACCT = :F9-IR025-LOC-ACCT
The error message as below :
Error at line 757, column 60 in file RCCO.cbl
WHERE SUBSTR(P9_IRC_PST_DT,1,6) = :Ws-DATE-YM
PCB-S-00204, Group items cannot be used except in INTO or VALUES clause
01 Ws-DATE-YMD.
03 Ws-DATE-YM.
05 W9-DATE-YY PIC 9(04) VALUE ZEROES.
05 W9-DATE-MM PIC 9(02) VALUE ZEROES.
03 W9-DATE-DD PIC 9(02) VALUE ZEROES.
any idea ? thanks 🙂
Group items cannot be used as host variables in the
whereclause as the error says. You’ll need to reference the elementary items separately, something like:Or maybe more performant:
Though I’m going from the docs rather than from experience, so this is completely untested; also not sure if you’d need to include the parent
Ws-DATE-YMDbefore both parts, or of it will be happy with one level.