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
Can we insert update delete in view?
What is copy pending and check pending in db2?
Is db2 a programming language?
How can the duplicate values be eliminated from db2 select?
What is the use of db2?
In case if at some point of time db2 is down, would that impact the pre-compilation process of a db2-cobol program?
Mention the way of highlighting as well as putting a cursor to use in a cobol program.
How would you find out the total number of rows in a db2 table?
What is load utility in db2?
Explain what are the various isolation levels possible?
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
Differentiate between cs and rr isolation levels? Where do you specify them?
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
What is a db2 schema?
What are the two types of logging in the db2 database? Explain them.