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 utility for parm lib
What are the bind parameters ibm db2?
How do I copy a table in db2?
How do you find the maximum value in a column in db2?
What is runstats db2?
What is the result of open cursor statement?
When the like statement is used?
Hello All, We have requirment to Replace BMC Db2 Load product thru CA FAST LOADPlus product. Do anyone have JCL to for FAST LOADPLUS and what all are thing need to take in consideration.
Mention the various locks that are available in db2.
SET is the ANSI standard for variable assignment, SELECT is not. SET can only assign one variable at a time, SELECT can make multiple assignments at once. If assigning from a query, SET can only assign a scalar value. If the query returns multiple values/rows then SET will raise an error. SELECT will assign one of the values to the variable and hide the fact that multiple values were returned (so you'd likely never know why something was going wrong elsewhere - have fun troubleshooting that one) When assigning from a query if there is no value returned then SET will assign NULL, where SELECT will not make the assignment at all (so the variable will not be changed from it's previous value) As far as speed differences - there are no direct differences between SET and SELECT. However SELECT's ability to make multiple assignments in one shot does give it a slight speed advantage over SET.
What is the role of data manager in the db2 database?
What is a system catalog table in db2?
How do you stop a db2 database in linux?
What is the usage of open cursor command?
What does reorg do in db2?