View previous topic :: View next topic |
Author |
Message |
bindugs Beginner
Joined: 13 Oct 2004 Posts: 1 Topics: 1
|
Posted: Wed Oct 13, 2004 5:06 am Post subject: Navigating in TSQ |
|
|
Can u provide me with a sample program for Navigating thru a TSQ ?Pageup ,Pagedown logic |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
ramu_mohan21 Beginner
Joined: 29 Jun 2004 Posts: 106 Topics: 41 Location: Bangalore, INDIA
|
Posted: Sun Nov 14, 2004 5:52 am Post subject: |
|
|
Hi Kolusu,
I have gone through the link which is provided by you. Really it very much useful. I am new the CICS. Please clarify my doubts regarding writing a new CICS Program containing the PageUp/PageDown Logic.
Please check my below assumptions in writing PageUp & PageDown logic in CICS-DB2. If any errors please correct it. [I am new to this kind of logic].
1) We should fetch all the records into TSQ from the Select Statement
(If SELECT returns more number of rows what will happen. Is that TSQ is self expandable?)
2) Then read TSQ record by record until the ASSUMED-PAGE-RECCOUNT =
TSQ-READCOUNT and send the map to the terminal.
3) Before sending the map to the terminal store the last key read from the TSQ in any hostlanguage variable.
(Where we should store this Last Key Read. Because CICS terminates the transaction as soon as the map shown on the screen. I feel the value present in the hostlanguage variable-last key read also will be lost.)
(OR)
If user presses PageDown-Send the KEY of the Last Row shown on the MAP to the program again to retrieve the next records. And read the TSQ from the last key onwards
5) If user presses PageUp -> How can we handle it?
6) And also if the user is in the middle of pages. There also PageUp And PageDown logic should work. How can we handle these cases.
I totally confused about this logic. Can you help. _________________ Best Regards,
----------------
Rammohan Pabba
Software Engineer |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Sun Nov 14, 2004 7:17 pm Post subject: |
|
|
ramu_mohan21,
Quote: |
If user presses PageDown-Send the KEY of the Last Row shown on the MAP to the program again to retrieve the next records. And read the TSQ from the last key onwards
|
Yes you are absolutely right. Take the last record of the map and retrieve the records GREATER than that key.
Quote: |
If user presses PageUp -> How can we handle it?
|
Same as pagedown logic but instead of the last key of the map , you will store the FIRST key of the map and retrieve records which are LESS than the first key
Quote: |
And also if the user is in the middle of pages. There also PageUp And PageDown logic should work. How can we handle these cases.
|
what exactly do you mean of the middle of the pages? let us say the cics map shows 20 records at a time . so you are in the middle in the sense that your cursor is postiioned on records no: 10. Now if you press pagedown key , do you want to show the key 10 as your first key and populate the records 21 thru 29 of the tsq as the map records 11 thru 20?
If that is the case then you need to store the key based on your cursor position and follow the same logic as pagedown and pageup.
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
ramu_mohan21 Beginner
Joined: 29 Jun 2004 Posts: 106 Topics: 41 Location: Bangalore, INDIA
|
Posted: Wed Nov 24, 2004 5:54 am Post subject: |
|
|
Hi Kolusu,
I'm sorry for responding very late. In the middle of the pages means
A) If there are 10 pages of data to be retrieved. Then user is in 5 page. He should be able to go to 4,3,2,1 as well as 6,7,8,9,10.
As you suggested, I think this can be handled by storing the first key and last key of the map and reading the TSQ accordingly. Am I right?
But here I have doubt that- First Key and Last key will be stored in the Host Language Variables before sending the Map (or) After sending the Map. Please can you clarify.
B) If the page consisting of 10 records and the user kept the cursor at the 5th record and pressed PageDown key. Then that record should become as the first record of the page. I mean relocation of the record. How it can be handled. Because the user is pressing the key by keeping the cursor at a perticular record within the page dynamically.
Kolusu,
If I am not clear and you didn't understand what I mean to say, please let me know. I will reply with some examples. _________________ Best Regards,
----------------
Rammohan Pabba
Software Engineer |
|
Back to top |
|
 |
Mike Chantrey Intermediate
Joined: 10 Sep 2003 Posts: 234 Topics: 1 Location: Wansford
|
Posted: Fri Nov 26, 2004 10:58 am Post subject: |
|
|
You don't want to use the data keys to keep track of screen postiions, you need to use the TSQ item numbers instead, since you can't address the TSQ by data key, only by item number. If you have for example 10 items per page, then TSQ items 1-10 would be read to display a full page, items 11-20 for the next full page etc.
You only need to keep track of the current top of page item number. You can pass the current value of this field from transaction to transaction via the COMMAREA in the normal way.
A) You will need something like a page number field on your map for this. Then you can calaculate a TSQ item number, e.g. the user types 7 in the page number field, you have 10 items per page, then the top of page item number is 10*7+1 = 71
So you read and display by item number a page full of TSQ items starting from item 71.
B) You can use the EIBCPOSN field to get the cursor position and from this you can calculate what line number it was on and add this offset to the current top of screen item number to calculate the new top of screen item. |
|
Back to top |
|
 |
vak255 Intermediate

Joined: 10 Sep 2004 Posts: 384 Topics: 79
|
|
Back to top |
|
 |
ramu_mohan21 Beginner
Joined: 29 Jun 2004 Posts: 106 Topics: 41 Location: Bangalore, INDIA
|
Posted: Tue Nov 30, 2004 6:08 am Post subject: |
|
|
Hi Mike and Kiran,
Thank you very much for giving me the solutions. _________________ Best Regards,
----------------
Rammohan Pabba
Software Engineer |
|
Back to top |
|
 |
|
|