Hi, this is the example that generates the error:
[libgixsql-pgsql] [error] ERROR (7 - 08P01): ERROR: bind message supplies 0 parameters, but prepared statement "" requires 1
01 DYNSTMT1 SQL TYPE IS VARCHAR(1000).
* declare cursor for select
EXEC SQL
DECLARE CUR_EMPTABLE CURSOR FOR SQLSTMT1
END-EXEC .
PROCEDURE DIVISION.
EXEC SQL START TRANSACTION END-EXEC.
MOVE "SELECT " &
" E.ENO , " &
" E.LNAME , " &
" E.FNAME , " &
" E.STREET || ',' || " &
" E.CITY || ',' || " &
" E.ST || '' || " &
" ZIP AS " &
" ADDRESS , " &
" E.DEPT , " &
" E.PAYRATE , " &
" CASE " &
" WHEN E.COM IS NOT NULL THEN E.COM " &
" ELSE 0.00 " &
" END AS COMMISSION , " &
" COALESCE(E.DNUM1 , " &
" 0.00) + COALESCE(E.DNUM2 , " &
" 0.00) + COALESCE(E.DNUM3 , " &
" 0.00) AS TOTAL_DNUM , " &
" E.MISCDATA " &
"FROM" &
" EMPTABLE E " &
"WHERE" &
" LNAME = TRIM($1)"
TO DYNSTMT1-ARR.
MOVE FUNCTION LENGTH(FUNCTION TRIM(DYNSTMT1-ARR))
TO DYNSTMT1-LEN.
EXEC SQL
PREPARE SQLSTMT1 FROM :DYNSTMT1
END-EXEC.
MOVE "XYZ1" TO WEMPNAME
* open cursor
MOVE "OPEN CUR_EMPTABLE USING :WEMPNAME" TO SQL-STEP
DISPLAY "SQL-STEP " SQL-STEP
EXEC SQL
OPEN CUR_EMPTABLE USING :WEMPNAME
END-EXEC
I attach two cobol sources with the same cursor. The first one has the cursor declaration in working and works correctly. The second is the one that uses the prepared statement and generates the error.
Bug181.zip
Comparing the sources after running gixpp I find these differences
By modifying the second source like this:
GIXSQL*
GIXSQL* ESQL CURSOR DECLARATIONS (START)
GIXSQL GO TO GIX-SKIP-CRSR-INIT.
GIXSQL GIXSQL-CI-P-TSQL179B1-CUR-EMPTABLE.
GIXSQL CALL "GIXSQLStartSQL"
GIXSQL END-CALL
GIXSQL CALL "GIXSQLSetSQLParams" USING
GIXSQL BY VALUE 16
GIXSQL BY VALUE 10
GIXSQL BY VALUE 0
GIXSQL BY VALUE 0
GIXSQL BY REFERENCE WEMPNAME
GIXSQL BY REFERENCE 0
GIXSQL END-CALL
GIXSQL CALL "GIXSQLCursorDeclareParams" USING
GIXSQL BY REFERENCE SQLCA
GIXSQL BY REFERENCE x"00"
GIXSQL BY VALUE 0
GIXSQL BY REFERENCE "TSQL179B1_CUR_EMPTABLE" & x"00"
GIXSQL BY VALUE 0
GIXSQL BY REFERENCE SQ0001
GIXSQL BY VALUE 0
GIXSQL BY VALUE 1
GIXSQL END-CALL
GIXSQL CALL "GIXSQLEndSQL"
GIXSQL END-CALL.
GIXSQL GIX-SKIP-CRSR-INIT.
GIXSQL*
GIXSQL* ESQL CURSOR DECLARATIONS (END)
The program works correctly.
The gixpp version
gixpp -V
gixpp - the ESQL preprocessor for Gix-IDE/GixSQL
Version: 1.0.20b
libgixpp version: 1.0.20b
The cobc version
cobc -V
cobc (OpenCOBOL) 2.0.0
Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Keisuke Nishida
Copyright (C) 2006-2012 Roger While
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Built Nov 30 2023 11:35:35
Packaged Feb 11 2012 12:36:31 UTC
C version "8.3.0"
Hi, this is the example that generates the error: [libgixsql-pgsql] [error] ERROR (7 - 08P01): ERROR: bind message supplies 0 parameters, but prepared statement "" requires 1
I attach two cobol sources with the same cursor. The first one has the cursor declaration in working and works correctly. The second is the one that uses the prepared statement and generates the error. Bug181.zip
Comparing the sources after running gixpp I find these differences
By modifying the second source like this:
The program works correctly.
The gixpp version
The cobc version
Os Version