FREE CONNECTION HANDLE (Release connection handle)
Function
FREE CONNECTION HANDLE releases a connection handle that was allocated by ALLOCATE CONNECTION HANDLE.
Format
FREE CONNECTION HANDLE :PDCNCTHDL-type-variable
:return-code-receiving-variable
Operands
Specifies the PDCNCTHDL-type variable that was specified in ALLOCATE CONNECTION HANDLE.
Specifies the return code receiving variable that was specified in ALLOCATE CONNECTION HANDLE.
The following values are returned to the return code receiving variable:
Common rules
Note
Connection handles that have been reserved are not released when a DISCONNECT statement is issued. To release a connection handle, a FREE CONNECTION HANDLE statement must be issued.
Example
Release the connection handle that was allocated in the example shown in the section on ALLOCATE CONNECTION HANDLE:
EXEC SQL BEGIN DECLARE SECTION;
PDCNCTHDL CnctHdl;
long FrchdlRtn;
EXEC SQL END DECLARE SECTION;
EXEC SQL FREE CONNECTION HANDLE :CnctHdl,
:FrchdlRtn;
DATA DIVISION.
WORKING-STORAGE SECTION.
EXEC SQL
BEGIN DECLARE SECTION
END-EXEC.
01 CNCTHDL SQL TYPE IS PDCNCTHDL.
01 FRCHDLRTN PIC S9(9) COMP.
EXEC SQL
END DECLARE SECTION
END-EXEC.
:
PROCEDURE DIVISION.
:
EXEC SQL
FREE CONNECTION HANDLE :CNCTHDL,
:FRCHDLRTN;
END-EXEC.