Aravind Kumar. S
New User
Joined: 28 Apr 2005 Posts: 26
|
|
|
|
Hi,
how to handle cursors in CICS. My req. is to fetch more than one row from table and to place in a Map. How to do that using TDQ/TSQ. It consists of paging logic ( PF7 / PF8 ).
If possible ,please provide me the code for doing that in TSQ/TDQ
Thanks, |
|
techguy
New User
Joined: 17 Jan 2006 Posts: 5 Location: India
|
|
|
|
U need to use 2 cursors.A forward cursor and a backward cursor. The forward cursor will fetch all the rows greater than ur key field value. The backward cursor will fetch all the rows lesser than ur key field value. For eg:Ur key field is sequence number. Ur forward cursor will fetch all the rows greater than ur current sequence number. For the initial throw of the screen,keep the sequence number as 0 and fetch the fwd cursor.(The number of rows should be limited according to ur screen limit,say fetch first 20 rows)After throwing the initial screen,if a user presses the PF8, then pass the 20th row sequence number as the key value and fetch the forward cursor. Similarly on any screen,if the user presses the PF7 key, pass the sequence number of the first row in the current screen as the key value and fetch the backward cursor.
This is just a basic logic and u will have to put ur mind to apply some more advanced features based on the request.
After fetching the rows,u can either populate the rows in an array or in a TSQ and when all the required rows are fetched,retriev it from the array or TSQ and populate the screen variables and throw the screen. I hope u know abt using the TSQ.
-------------------------
Ur fwd cursor will look like :
Declare fwdcsr CURSOR for
Select aaa,bbb, from xxx table
WHERE key-feild > :KEY-FIELD
IIIly
Declare bwdcsr CURSOR for
Select aaa,bbb, from xxx table
WHERE key-feild <:KEY-FIELD
I hope this helps. |
|