I do a similar thing using a random relative record number returned from a routine that uses an embedded SQL statement based on the number of records in the targeted dataset -
UpperLimit = 10 ** %len(%trim(%editC(nbrRcds:'Z')));
Dou rrnum <= nbrRcds;
exec sql select cast(rand() * :upperLimit as dec(9,0))
into :rrnum from sysibm/sysdummy1;
Enddo;
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Jerry C. Adams
Sent: Thursday, 31 January 2013 12:20 p.m.
To: 'Midrange Systems Technical Discussion'
Subject: RE: Random selection of 10%
Bill,
Having worked in what appears to be a similar environment, it occurs to me that you are not going to know how many cases (orders) there are per day.
In our situation there are sometimes <100, sometimes > 1000. So at the end of the line, when I presume the checking would occur, you have no way of knowing if you've inspected 10% or what.
How and when do you intend to notify the checkers which order to validate?
In our business (small/medium-sized wholesaler) we check everything, plus the customers are supposed to do so, too.
On the other hand if, unlike our operation, the cases stack up on a staging area, you could print a report which randomly picks orders for validation.
It's just that I don't see that happening in today's JIT environment.
I guess my problem is visualizing your environment. If you are content with checking only 10%, Roger's suggestion of a random number generator (there's an API for that, too) might work. One place at which I worked some years ago had a random number generator: Numbers in a hat. Pick a number (0-9) each morning and any order ending in that gets scrutinized.
Jerry C. Adams
IBM i Programmer/Analyst
To be sure of hitting the target, shoot first and call whatever you hit the target.
--
Home Office: 615-832-2730
email: midrange@xxxxxxxx
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Bill Reger
Sent: Wednesday, January 30, 2013 10:09 AM
To: midrange-l@xxxxxxxxxxxx
Subject: Random selection of 10%
We would like to audit 10% of the Cases that flow down the shipping conveyor
- checking that the contents of the Case matched what was
(supposedly) packed.
Now obviously we could count each Case and pull every 10th Case for audit.
But it would not take long for someone to figure this out - and if they
were so inclined - only short Cases other than the 10th in line.
Is there an algorithm/logic that we could employ to randomly pull Cases that
would equate to 10% over the course of a day but not be every 10th Case?
(My logic brain is on strike today and I can't think of a way to design
this.)
Bill
--
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.