Cursors can be declared in both working-storage & procedure
division, Agreed.
But is there any difference? If could you please suggest
what is the difference.
TIA
Answer Posted / sam
yes there sre diffrence.
If we declare cursor in working storage section then it is
called as static cursor without parameters from cobol.
If we declare cursor in procedure division then we can use
COBOL variables as parameters to the cursor. See the
examples for both the cases...
Eg: STATIC CURSOR
WORKING-STORAGE SECTION.
01 HV-EMPNO PIC 9(4) value 7934.
EXEC SQL
DEFINE C1 CURSOR FOR SELECT * FROM EMP WHERE EMPNO=HV-EMPNO
END-EXEC.
In the above case EMPNO is static. We cannot move a value
or read a value in to empno, because it is in working
storage section.
DYNAMIC CURSOR:
PROCEDURE DIVISION.
ACCEPT HV-EMPNO.
EXEC SQL
DECLARE C1 CURSOR FOR SELECT * FROM EMP WHERE EMPNO=:HV-
EMPNO
END-EXEC.
In the above example we can read EMPNO from another table
or file or we can take it from user. Now cursor becomes
dynamic.
I hope now its clear for you. If you need more information
let me know.
| Is This Answer Correct ? | 6 Yes | 24 No |
Post New Answer View All Answers
How connect db2 database to datastage?
What is difference between isnull and coalesce?
What is the meaning concurrency in the db2 database?
is it compulsory commitment control in journal?
Define buffer pool.
How do I delete a column in db2?
What is the difference between db2 and oracle?
What is dbrm in db2 database?
What is the difference between cursor and select statement?
What are the prerogatives?
When do you specify the isolation level?
How to execute stored procedures?
Hi Everyone... Under the Logical files, when am working on multiple rec format logical file, I have joined two pf's using the multiple record format logical file concept, but when i run queried the LF only the first mentioned pf records are reflecting and I am not able to see any of the field records specified under the second pf. Kindly let me know whats the reason behind this. Below is the str of LF., R rec PFILE(LOGICAA) CUSTNO CUSTNAME BILL K CUSTNO R rec1 PFILE(LOGICAA1) CUSTNO ADD K CUSTNO .....
What is commit in db2?
What is a cursor in programming?