What is the purpose and usage of SCROLLABLE CURSOR in COBOLDB2 program?

DB2DatabaseBig Data Analytics

A cursor can move only in forward direction, which means that it can extract the next row after every fetch. It is not possible to extract the previous row using a cursor.For example, if our resultant cursor contains following rows−


If our cursor is currently pointing to 3rd row i.e. order id A77890 then the next fetch will point the cursor to the next row i.e. order id A96832. It is not possible to point the cursor to the previous order id i.e. A66756.

In order to achieve this, we use the concept of SCROLLABLE CURSOR. The SCROLLABLE CURSOR can move both in forward and backward direction, it can also move in the relative or absolute position from the current position. The SCROLLABLE CURSOR is very useful in implementing page up and page down logic in CICS screen.

Published on 15-Sep-2020 14:36:09