SQL$HELP_OLD72.HLB  —  RELEASE  Example
    Example 1: Using the RELEASE statement

    The following fragment from a COBOL program shows using a RELEASE
    statement to release resources from a prepared SELECT statement:

            .
            .
            .

    FETCHES.
            DISPLAY "Here's the row we stored:"

            EXEC SQL PREPARE STMT FROM
            'SELECT * FROM EMPLOYEES WHERE EMPLOYEE_ID = "99999"'
            END-EXEC
            EXEC SQL DECLARE C CURSOR FOR STMT END-EXEC

            EXEC SQL OPEN C END-EXEC
            .
            .
            .

            EXEC SQL FETCH C INTO
                    :EMP_ID:EMP_ID_IND,
                    :LNAME:LNAME_IND,
                    :FNAME:FNAME_IND,
                    :MID_INIT:MID_INIT_IND,
                    :ADDR_1:ADDR_1_IND,
                    :ADDR_2:ADDR_2_IND,
                    :CITY:CITY_IND,
                    :STATE:STATE_IND,
                    :P_CODE:P_CODE_IND,
                    :SEX:SEX_IND,
                    :BDATE:BDATE_IND,
                    :S_CODE:S_CODE_IND
            END-EXEC

            DISPLAY EMP_ID," ",
                    FNAME," ",
                    MID_INIT," ",
                    LNAME," ",
                    ADDR_1," ",
                    ADDR_2," ",
                    CITY," ",
                    STATE," ",
                    P_CODE," ",
                    SEX," ",
                    BDATE," ",
                    S_CODE.

            PERFORM CHECK
            EXEC SQL CLOSE C END-EXEC.
            PERFORM CHECK.
            EXEC SQL RELEASE STMT END-EXEC.
            PERFORM CHECK.
            .
            .
            .
Close Help