View previous topic :: View next topic
|
Author |
Message |
santy780
New User
Joined: 15 Jul 2006 Posts: 9
|
|
|
|
if the data to be displayed is from a DB2 table and the number of rows retrieved for the query is around 1000, where as in a single screen a maximum of 10 rows can only be displayed. how should this be implemented? if all the maps are accumulated wont there be a decrease in the cics performance and also say if we are viewing the second page of the result and another person has in the meanwhile modified a data in the table which has been accumulated in our (say) 100th page the change will not be reflected in our display, so how else shud this be implemeted?
OR
if everytime the user wants to scroll to the next page, shud the sql query be executed (soodo convers), by taking into consideration of the last record retrieved from the previous query and making sure the result for this query would values greater than previous results( by making a filed/set of fields as keys), if this is one solution can anybody give a real time example of such a query that incorporates such scrolling. somebody who has worked real time on such things pl reply. |
|
Back to top |
|
|
Hanfur
Active User
Joined: 21 Jun 2006 Posts: 104
|
|
|
|
Santy,
The best approach in this scenario would be to go for TSQ's.Put all the data from the result set to TSQ.Then get data stored in TSQ thru CICS comands.You can implement it thru a pseudo conversing prog by passing the first and last record that you accessed thru the commarea (ie,assumunig your screen is designed to populate 10 data at a time)along with the user response keys(ie,PF7 or PF8 Scroll UP/Down).
Programtically this needs be controlled.So in this scenario all it requires is to populate just 10 output data fields at a time to map before senting map to screen.
One thing to note here is at the time when you create TSQ make sure to give a TSQ a unique name ie,use your own id as the first 4 letters followed by any other standar way of naming the TSQ.This would ensure uniqness of TSQ name.This is cos all the transactions running would be able to access the TSQ names just by pointing to its name which would cause not only confusion but some times unwanted results..
-Han. |
|
Back to top |
|
|
santy780
New User
Joined: 15 Jul 2006 Posts: 9
|
|
|
|
fine Han, say the query result is very large( hundred 10 row pages). by executing the query once the entire result would be written to TSQ. now in the meantime someone changes the data in the table (the data that is part of our result) our pages will not reflect the changes. this strategy has this drawback, how do you overcome it? |
|
Back to top |
|
|
Mickeydusaor
Active User
Joined: 24 May 2006 Posts: 258 Location: Salem, Oregon
|
|
|
|
Your second approach is the way to go. In your cics program you keep an array in the commarea of the first key displayed on the screen and the last key displayed. You create 2 cursors on for forward and 1 for backward
processing of the keys. You are then going to get any data that has changed and you do not need a TSQ as you are only fetching the 10 lines each time to fill the screen. |
|
Back to top |
|
|
santy780
New User
Joined: 15 Jul 2006 Posts: 9
|
|
|
|
Thanks mickey, so this every-time-fetch approach is used real time. hope u have replied having seen such an implemetation real time? |
|
Back to top |
|
|
Mickeydusaor
Active User
Joined: 24 May 2006 Posts: 258 Location: Salem, Oregon
|
|
|
|
This is still pseudoconversational programming, the user enters a command in cics and your program responds to the requested action weather its the enter key or a function key. you display the screen with the first rows of data selected, when the user uses a function key to page forward or backward your program needs to fetch the next rows to be displayed. this is done by keeping the first line displayed and the last line displayed on the screen in an array in the commarea. For each screen display you place the first and last lines here and this is what you use to do you next fetch with. |
|
Back to top |
|
|
Hanfur
Active User
Joined: 21 Jun 2006 Posts: 104
|
|
|
|
Santy,
You can go with the option of execuiting a query every time based the users response since you dont want to compromise on the read/update/write integrity..During BIND use CS and also if its for read and only limited rows only required can code FETCH 10 ROWS ONLY etc for DB2 to perform the block fetching.
-Han. |
|
Back to top |
|
|
santy780
New User
Joined: 15 Jul 2006 Posts: 9
|
|
|
|
thanks a lot people |
|
Back to top |
|
|
|