I am using a scroll cursor to fetch records based on some conditions. Now, for the randomly fetched row I need to know the the position of the that row in the rowset. (I know that given a position of a row I can fetch that correponding row using scroll cursor; but what I need is the reverse, I know the row but I want the position in the rowset)
The stored procedure was having a paging logic. Now my requirement is like if the user enters the random record, say employee number, then i need to fetch the entire page where the employee number lies.
Say, my search employee number was the 155 th record and if my page has 100 rows each. The Employee number belongs to 2 nd page. So If I know the position of the record in the row set, then only I can fetch the entire second page.
Joined: 20 Oct 2006 Posts: 6968 Location: porcelain throne
not knowing anything about your tables, user or environment,
it is hard to give advice.
2. If the user specifies the employee number, then I need to display the entire page where the record lies and not the single record.
this sounds like ISPF CUROR DOWN, which would be mimic'd by a where condition of employee_no => host-variable.
as with any paging logic, you need to always save the:
number of items on page
this kind of info you could store in a cobol internal table and refer to/refresh/add-to as your program moves along.
If you are a CICS module driving a green-screen (native cics screen), you may have to resort to a dfhcommarea or TSQ.
If your are being driven by a web-front end, and have control over the front end logic, the front end should store this data.
I hate to say it, but it does not sound as if you have fully planned this.
Your question sounds as if you are trying to solve a problem,
that you did not plan for,
and are jimmy-riggin' the existing code to make it work.
my suggestion is to insure that you don't cut corners, you will get bit, believe me.