# Database Discussions > IBM DB2 >  Db2 bug using sysibm.sysdummy1 ???

## antonio_imola

first scenario:

in my program the first DB2 statement is :
EXEC SQL SELECT 
CURRENT TIMESTAMP INTO: WS-TIMESTAMP 
FROM SYSIBM.SYSDUMMY1 
END-EXEC.

the second SQL statement is a simple select from a table :
EXEC SQL SELECT * INTO :CS00TABF1 FROM CS00BF01 
WHERE CS0_CODICE_COND= :CS00TABF1.CS0-CODICE-COND 
AND CS0_TI_RAPPORTO = :CS00TABF1.CS0-TI-RAPPORTO 
AND CS0_FM_TEC_FIDO = :CS00TABF1.CS0-FM-TEC-FIDO 
AND CS0_CO_RISCHIO = :CS00TABF1.CS0-CO-RISCHIO 
AND CS0_CO_LIVELLO = :INP-LVL-ARRIVO 
AND CS0_CO_BANCA = :CS00TABF1.CS0-CO-BANCA 
END-EXEC. 

all variables named CS00TABF1.* are in DCLGEN , the variable named INP-LVL-ARRIVO
is a record field with the same structure of DCLGEN's variable.
In this case the COBOL program do not works fine ; the SQLCODE after the table
select is always "100" (row not found).

other scenario:
first DB2 statement is the select :
EXEC SQL SELECT *INTO :CS00TABF1 FROM CS00BF01 
WHERE CS0_CODICE_COND= :CS00TABF1.CS0-CODICE-COND 
AND CS0_TI_RAPPORTO = :CS00TABF1.CS0-TI-RAPPORTO 
AND CS0_FM_TEC_FIDO = :CS00TABF1.CS0-FM-TEC-FIDO 
AND CS0_CO_RISCHIO = :CS00TABF1.CS0-CO-RISCHIO 
AND CS0_CO_LIVELLO = :INP-LVL-ARRIVO 
AND CS0_CO_BANCA = :CS00TABF1.CS0-CO-BANCA 
END-EXEC. 

and then : 
EXEC SQL SELECT 
CURRENT TIMESTAMP INTO: WS-TIMESTAMP 
FROM SYSIBM.SYSDUMMY1 
END-EXEC.

now the program works correctly; after the first select the sqlcode is 
always "0" (row found) and this is OK.

In the first scenario the address of the INP-LVL-ARRIVO 
in the SQL-PVAR-ADDR is "+000000067" (from XPEDITER)
instead
in the second scenario the address of the INP-LVL-ARRIVO 
in the SQL-PVAR-ADDR is "+837739315" (from XPEDITER)

Why ?

You can find in attachment the COBOL source (scenario 1 and 2).

I hope that you can understand this mail.
Best regards
ANTONIO VIOLA
senior developper
IMOLA (ITALY)

----------


## sheevy

sorry  i can not know this means. 
so i can't help you

----------

