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 / bud gobbel

Actually, there is a reason for declaring the cursor in the Procedure Division, however, it is slight.

In CICS programs, the communications area (CA) is passed via the linkage section. If a cursor WHERE clause is predicated on a field in the CA area, then to avoid using a working storage variable and a MOVE statement prior to the opening of the cursor, you should code the cursor declaration in the Procedure Division, prior to the opening logic, etc.

If you don't mind using extra variables, and coding the required MOVE statements, then keep your cursor dec in WS.

In your DB2 pre-compiler, you can test this logic. Put the cursor above the linkage section, and try to use a field in the linkage section as a host variable in the where clause.

Then move it to the very early part of the Procedure Division. The pre-compiler will then be happy.

Good Luck!

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we insert update delete in view?

573


What is copy pending and check pending in db2?

577


Is db2 a programming language?

606


How can the duplicate values be eliminated from db2 select?

625


What is the use of db2?

586






In case if at some point of time db2 is down, would that impact the pre-compilation process of a db2-cobol program?

579


Mention the way of highlighting as well as putting a cursor to use in a cobol program.

626


How would you find out the total number of rows in a db2 table?

579


What is load utility in db2?

668


Explain what are the various isolation levels possible?

609


can any one provide me the link for the db2 v7 & db2 v8 manual for Z/os? i need to know about the syntax of REORG in both versions & need to know the difference as well

1806


Differentiate between cs and rr isolation levels? Where do you specify them?

581


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

749


What is a db2 schema?

762


What are the two types of logging in the db2 database? Explain them.

578