Any particular reason you cannot just use a descending order by?

On Fri, May 18, 2012 at 10:30 AM, Pete Helgren <pete@xxxxxxxxxx> wrote:

I hear you SETGT with a READEP would be the way to go...but this is a
Java program using SQL so things get a bit more interesting:

For the others who have weighed in. The reason for the logic is that I
have a program the calculates the number of minutes a person has worked
based on a time clock punch. A good example of a condition I am try to
capture is a worker who clocks in at 22:00 on 05-16-2012 and then clocks
out 0600 on 05-17-2012. When a report is run for 05-17-2012 this
employee would have a punch OUT record with no prior punch IN record
which could be an error or could be a valid punch. The only way I can
tell is to check to see what the immediately prior punch for that
employee would be. There could have been hundreds of other punch
records for other employees between the last punch and the prior punch.

So I thought a scrollable cursor would be the way to go. Grab all the
records for that employee (could be thousands), locate the specific
punch I have a question about (the one at 0600 on 05-17-2012), then walk
back one record and see what the punch is (should be an IN). The
problem is (as I discovered last night) that you can't position a
scrollable cursor by a key value. You can position by a fixed record
number or a relative number of records but you can't locate a record in
the record set by a column value (as far as I can tell).

One way to reduce the number of records would be to just bracket the
date selection to only include one day prior (otherwise that would be a
LOOONG shift) so that could reduce the records on a specific employee so
that walking through the record set to find the record I was interested
in and then walking back one.

I *think* I can just select the last record for the prior day and see if
that is the "IN" punch I am looking for but I need to walk through some
other transactions to see if this will produce a "false positive"

Still sorting through the options but appreciate the feedback so far

Pete Helgren
Value Added Software, Inc
www.petesworkshop.com
GIAC Secure Software Programmer-Java


On 5/18/2012 7:14 AM, sjl wrote:
Sigh...
RLA makes this so much easier!;-)
- sjl
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.