IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Handling Cursors _ TDQ/TSQ


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Aravind Kumar. S

New User


Joined: 28 Apr 2005
Posts: 26

PostPosted: Fri Jan 13, 2006 8:16 pm
Reply with quote

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,
Back to top
View user's profile Send private message
techguy

New User


Joined: 17 Jan 2006
Posts: 5
Location: India

PostPosted: Wed Jan 18, 2006 1:12 am
Reply with quote

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.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts File Handling COBOL Programming 9
No new posts Positioned Deletes/Updates using curs... DB2 3
No new posts Handling the numeric data in unstring... COBOL Programming 18
No new posts SORT for dynamic trailer record + CSV... DFSORT/ICETOOL 14
This topic is locked: you cannot edit posts or make replies. regarding COBOL WRITE verb (VB File H... COBOL Programming 9
Search our Forums:

Back to Top