Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Why do we need reorg in db2?

922


What is a cursor in programming?

1013


How do I delete a column in db2?

1048


What is the use of commit in db2?

1001


When a COBOL-DB2 program in PRODUCTION is updating main tables and gone for long run, what have to do?

3520


File not opened because library is *PROD and debug is UPDPROD(*NO). ? what may be the reason? how to solve it..?

2865


What is reorg?

1071


What is package in db2 mainframe?

917


When the like statement is used?

1156


Mention data types used in db2 ?

1105


Give a brief description of db2 isolation levels?

1013


What is the latest version of ibm db2?

1200


Explain the function of data manager.

991


can we view the access paths created by dbrm ? how ? thx

6973


How can we retrieve the total number of records in RPG & CLLE?

577