17 lines
514 B
Plaintext
17 lines
514 B
Plaintext
== Why is this an issue?
|
|
|
|
You should avoid declaring a cursor inside a ``++PERFORM++`` statement because doing so could impact performance. It could also lead to unexpected behavior if the opening and closing of the cursor are not defined in the same loop.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,cobol]
|
|
----
|
|
PERFORM UNTIL (NOT DA-OK) OR (Y00CIA-CD-RET-PGM = ZERO)
|
|
EXEC SQL DECLARE C2 CURSOR FOR
|
|
SELECT DEPTNO, DEPTNAME, MGRNO FROM DEPARTMENT WHERE ADMRDEPT = 'A00'
|
|
END-EXEC
|
|
END-PERFORM.
|
|
----
|
|
|