You must indicate in the program that the cursor you are declaring may be used to update data in the database table. Programs operate more efficiently if the purpose of the cursor is identified: to only read (SELECT) or to write (INSERT or UPDATE) as well. Remember that you can declare the cursor in either the Procedure or Data Divisions.
EXEC SQL DECLARE cursorname FOR SELECT_statement FOR UPDATE END-EXEC.
EXEC SQL DECLARE COBCUR1 CURSOR FOR SELECT C_FIRST_NAME, C_LAST_NAME FROM CUSTOMER WHERE C_LAST_NAME = 'Snead' FOR UPDATE END-EXEC.
This code opens a cursor that contains a query to SELECT the C_FIRST_NAME and C_LAST_NAME fields for customer Snead. It also indicates, by means of the FOR UPDATE clause, that this information will change and the cursor will write to the database. If you are working in a transaction environment, declaring a cursor FOR UPDATE may start transaction logging or may impose locks on the database table.