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
What is access path in db2?
Explain in brief how does db2 determine what lock-size to use?
What is nvl in db2?
What is a db2 package?
What is an instance database?
What db2 400?
What is a db2 table?
What is alias in db2?
How and when does the db2 enforces the unique key?
How do you simulate the explain of an embedded sql statement in spufi/qmf?
What is a bind in db2?
What is the physical storage length of time data type?
What are the various data types available in db2?
How to access db2 tables in mainframe?
What is iseries database?