[archive] Problem with executing stored procedure

[Migrated content. Thread originally posted on 09 May 2008]

Hi,
I am using acusql 7.20 and i want to execute a stored procedure in my cobol program. When i do this the open cursor gives the next error "Attempt to execute nonexistent, unprepared or invalid statement spcurs"
I can't find what i'm doing wrong. Maybe somebody else can?
I use the next small program to test

IDENTIFICATION DIVISION.
PROGRAM-ID. magweg.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
COPY "SPECIAL.ENV".
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
COPY "STANDARD.WS".
COPY "STANDSUB.WS".
01 num-rows-read PIC 9(09).
EXEC SQL BEGIN DECLARE SECTION END-EXEC.
01 num-rows pic 9(09).
01 ret-code pic 9(09).
01 A24-NAAM PIC X(0030).
01 A24-VOORLETTERS PIC X(0005).
EXEC SQL END DECLARE SECTION END-EXEC.
COPY "SQL.WS".
COPY "DBLOGIN.LNK".
PROCEDURE DIVISION.
R00-HOOFD.
move "***********" to ws-dblogin-server.
MOVE "**" TO ws-DBLOGIN-USER.
MOVE "******" TO ws-DBLOGIN-PASSWORD.
EXEC SQL
CONNECT TO :ws-DBLOGIN-SERVER
USER :ws-DBLOGIN-USER
USING :ws-DBLOGIN-PASSWORD
END-EXEC.
display "Enter the name to search for: ", no.
accept A24-NAAM.
EXEC SQL declare spcursor cursor for
exec :ret-code = sp_listcustomer :A24-NAAM
END-EXEC.
EXEC SQL
open spcursor
END-EXEC.
perform until SQLCODE not = 0
EXEC SQL
FETCH spcursor into
:A24-NAAM, :A24-VOORLETTERS
END-EXEC
if SQLCODE = 0
add 1 to num-rows-read
display A24-NAAM, ", ", A24-VOORLETTERS
end-if
end-perform.
if num-rows not = num-rows-read
display "stored procedure error, " num-rows,
" not = ", num-rows-read
end-if.
R00-99.
GOBACK.