Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Handling Cursors _ TDQ/TSQ

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
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    Post subject: Handling Cursors _ TDQ/TSQ
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    Post subject: Re: Handling Cursors _ TDQ/TSQ
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    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ON ERROR handling soundarr PL/I & Assembler 2 Wed May 11, 2016 3:37 am
No new posts Exception Handling in Native Stored P... Mariraj DB2 1 Thu Feb 25, 2016 4:08 am
No new posts Handling Rexx Abend trushant.w CLIST & REXX 3 Thu Jan 08, 2015 6:42 pm
No new posts Handling a string more than 250 chara... prasadchikane CLIST & REXX 3 Fri Nov 07, 2014 11:12 am
No new posts Handling Variable length files in SAS... mushreyas All Other Mainframe Topics 7 Fri Oct 31, 2014 11:12 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us