View previous topic :: View next topic
|
Author |
Message |
crm
New User
Joined: 14 Nov 2005 Posts: 25
|
|
|
|
where we declare the cursor
in Procedure division or in working storage section. |
|
Back to top |
|
|
andy6703
New User
Joined: 25 Jul 2005 Posts: 14
|
|
|
|
Hi crm,
We declare the cursor in the working storage section & perform an open or fetch in the Procedure division.
Andy
God Bless! |
|
Back to top |
|
|
sureshchoudey
New User
Joined: 16 Sep 2005 Posts: 12
|
|
|
|
Place the DECLARE CURSOR Statement First
The DECLARE CURSOR statement must precede any other commands (such as OPEN, CLOSE, and FETCH) relating to the cursor because of the way the DB2 precompiler parses and extracts the SQL statements from the program.
The DECLARE CURSOR statement is not an executable statement and should not be coded in the PROCEDURE DIVISION of an application program. Although doing so does not cause a problem, it makes your program difficult to understand and could cause others to think that DECLARE is an executable statement.
You should place all cursor declarations in the WORKING-STORAGE section of the application program, immediately before PROCEDURE DIVISION. All host variable declarations must precede the DECLARE CURSOR statement in the application program. |
|
Back to top |
|
|
srrao_kilari
New User
Joined: 28 Nov 2005 Posts: 12 Location: New Delhi
|
|
|
|
If u declare the Cursor in procedure division, make sure that it comes before other commands (such as OPEN, CLOSE, and FETCH) both physically and logically because DB2 precompiler parses in coding sequence and execution takes place in logical sequence. |
|
Back to top |
|
|
jeyakanthan
New User
Joined: 18 May 2005 Posts: 12 Location: chennai
|
|
|
|
we should declare cursor in working-storage section because cursor is not an executable statement.
whereas in procedure division action statements should be there. |
|
Back to top |
|
|
|