You should avoid closing a CURSOR
inside a PERFORM
statement, because it could impact performance or lead to unexpected
behavior if the cursor was not opened in the same loop.
Noncompliant code example
PERFORM UNTIL (NOT DA-OK)
OR (Y00CIA-CD-RET-PGM = ZERO)
EXEC SQL CLOSE C2
END-EXEC
END-PERFORM.