[Migrated content. Thread originally posted on 25 November 2010]
Hello,I get sqlcode -2 in my testprogram the second time I call a section. This does not make any sence to me. Can someone help me with this. The section is called TEST-CAPACITEIT and works fine the first time.
WORKING-STORAGE SECTION.
EXEC SQL INCLUDE SQLCA END-EXEC.
EXEC SQL BEGIN DECLARE SECTION END-EXEC.
01 pDepId PIC 9(10).
01 pDepId1 PIC 9(10).
01 pDepId2 PIC X(10).
01 dsn-name pic x(12).
01 userid pic x(8).
01 passwd.
49 passwd-length pic s9(4) comp-5 value 0.
49 passwd-name pic x(18).
EXEC SQL END DECLARE SECTION END-EXEC.
******************************************************************
PROCEDURE DIVISION.
Main Section.
perform initialization-routine.
perform make-connection.
perform select-data.
perform disconnect-connection.
Display "press Enter to Exit".
accept omitted.
stop run.
select-data.
PERFORM TEST-CAPACITEIT.
PERFORM TEST-CAPACITEIT.
PERFORM TEST-CAPACITEIT.
initialization-routine.
display "Enter datasource name: ",no.
accept dsn-name.
display "Enter your user id (default none): ",no.
accept userid.
display "Enter your password : ",no.
accept passwd-name.
inspect passwd-name tallying passwd-length for characters
before initial " ".
end-initialization-routine.
make-connection.
EXEC SQL CONNECT TO :dsn-name as C1
USER :userid USING :passwd
END-EXEC.
if sqlcode = 0 display "Connection successful...".
end-make-connection.
disconnect-connection.
EXEC SQL COMMIT END-EXEC.
EXEC SQL DISCONNECT ALL END-EXEC.
TEST-CAPACITEIT SECTION.
BEGIN.
move 254274 to pdepid1.
EXEC SQL
SELECT Bis$DSV.Bis$Get_DSV_Pct_Gevuld(:pDepId1)
INTO :PDEPID
FROM DUAL
END-EXEC.
move 254274 to pdepid1.
EXEC SQL
SELECT Bis$DSV.Bis$Get_DSV_Pct_Gevuld(:pDepId1)
INTO :PDEPID
FROM DUAL
END-EXEC.
move 254274 to pdepid1.
EXEC SQL
SELECT Bis$DSV.Bis$Get_DSV_Pct_Gevuld(:pDepId1)
INTO :PDEPID
FROM DUAL
END-EXEC.
ENDS.
EXIT.



