Hi all,
DB2 on AS/390. I read from table using cursor:
DECLARE SAMPLCUR1 CURSOR
WITH ROWSET POSITIONING FOR
SELECT
COL1, COL2, COL3
FROM TABLENAME
WHERE
COL4 LIKE :WS-SOMEVAR
FOR FETCH ONLY
WITH UR
and from this I get e.g. 10 rows at once. Problem is, that LIKE in statement above doesn't work, when WS-SOMEVAR contain an SPACE e.g. WS-SOMEVAR = 'SANTA C%'. It works fine if WS-SOMEVAR = 'SANTA%'.
I've tried to replace all existing SPACES to underline '_' and set WS-SOMEVAR = 'SANTA_C%' but it still doesn't work.
By 'doesn't work' I mean that it returns zero records (SQLCODE = +100).
I checked this SELECT query in Spufi and there all cases work fine.
Is there an trick to force normal working of that query in cobol program ? or maybe can anyone suppose what is the reason ?
Thx for your help
Marcin Domaslawski
DB2 on AS/390. I read from table using cursor:
DECLARE SAMPLCUR1 CURSOR
WITH ROWSET POSITIONING FOR
SELECT
COL1, COL2, COL3
FROM TABLENAME
WHERE
COL4 LIKE :WS-SOMEVAR
FOR FETCH ONLY
WITH UR
and from this I get e.g. 10 rows at once. Problem is, that LIKE in statement above doesn't work, when WS-SOMEVAR contain an SPACE e.g. WS-SOMEVAR = 'SANTA C%'. It works fine if WS-SOMEVAR = 'SANTA%'.
I've tried to replace all existing SPACES to underline '_' and set WS-SOMEVAR = 'SANTA_C%' but it still doesn't work.
By 'doesn't work' I mean that it returns zero records (SQLCODE = +100).
I checked this SELECT query in Spufi and there all cases work fine.
Is there an trick to force normal working of that query in cobol program ? or maybe can anyone suppose what is the reason ?
Thx for your help
Marcin Domaslawski
Comment