Page 1 of 1

tsq or read directly from file

PostPosted: Wed Apr 07, 2010 5:59 pm
by pradeepgowda
Hi for paging logic(page down and page up) using vsam which is better from performance point

a) to read the file every time using readnext(page down) and readprev(page up)
b) to read the file and write all the records which satisfy some condition into tsq and then use tsq for paging logic

Re: tsq or read directly from file

PostPosted: Wed Apr 07, 2010 7:24 pm
by Robert Sample
for paging logic(page down and page up) using vsam which is better from performance point
Perhaps if you explained what performance metrics are important to you .... CPU time? I/O time? memory usage? something else?

What is your site standard? Follow it.

Honestly, you have ALREADY wasted more time thinking about this question than you are likely to save in the next 10 years of the application, no matter which approach you use. And the approach will definitely depend upon the application. If the selection logic is complicated and not many records qualify, run through the file one time and save the accepted records in temporary storage. If the selection logic is simple and many records will qualify, just save the first and last record keys on the page and use them to implement your paging logic by reading the next (or previous) records from the file when asked.

This is not a question where one answer fits all -- the response will depend upon the circumstances. Hence your best advice is to follow your site standards.

Re: tsq or read directly from file

PostPosted: Fri Apr 09, 2010 12:09 am
by enrico-sorichetti
the site standards dictate the approach! but...

my personal advice is to, regardless of the complexity of file access,
always use TS for paging,
this ensures consistents displays in forw/backw paging and bottom page totals

if You page reading the file the application designers will be cursed at ,
on a reread the data might have changed, and all the numbers jotted on a pad
will have to be reworked with great joy of the end user 8-)

usually in any decently managed developing environment
the paging will be done thru TS queues
the data gathering program will not be concerned with terminal I/O,
it will simply write the formatted data to a TS queue and transfer control
to a generalized TSQ display program ( no need to reinvent the paging wheel )
written once and used everywhere