× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Helo,

I don't know if it is exactly what you want but you can make a sampling by
this sql line.

SELECT RRN(A01), A01.*
FROM LIBFILE/FILE A01 WHERE MOD(RRN(A01), 98) = 0

You can change "= 0" by the number you want to take different records.

Best Regards.

Yannick.Jacqueline
Service Informatique
Tél : 02-31-66-46-69
E-Mail : yjacqueline@xxxxxxxxxxxxxx
Visitez notre site Web à : http://www.guydegrenne.fr/



                                                                                
                                        
                    CWilt@xxxxxxxxxxxx                                          
                                        
                    Envoyé par :              Pour :  rpg400-l@xxxxxxxxxxxx     
                                        
                    rpg400-l-bounces@mi       cc :                              
                                        
                    drange.com                Objet : RE: Pulling Random 
Records from a file                            
                                                                                
                                        
                                                                                
                                        
                    24/03/04 16:49                                              
                                        
                    Veuillez répondre à                                         
                                        
                    RPG programming on                                          
                                        
                    the AS400 / iSeries                                         
                                        
                                                                                
                                        
                                                                                
                                        




If it were me, I'd simply generate 30 random numbers from 1 to (n=number of
records in file).  Then just chain to the file based on RRN.

Now if you need the code to do a random number in RPG, check the archives.
I'd be willing to bet someone has already posted it.

If nothing else, you could use C calls.

HTH,
Charles


> -----Original Message-----
> From: JMBauman@xxxxxxxxxxxxxxxx [mailto:JMBauman@xxxxxxxxxxxxxxxx]
> Sent: Wednesday, March 24, 2004 10:25 AM
> To: rpg400-l@xxxxxxxxxxxx
> Subject: Pulling Random Records from a file
>
>
>
>
>
>
> Wanted to get some feedback about possible options to pull
> random records
> from a file.   I am dealing with an invoice file for a date
> (one day) for
> multiple locations.  I need to pull thirty random bills from
> this file for
> a date and the number of bills I pull for a location must be
> proportionate
> to that location's number of bills compared to number of
> bill's for all
> locations.  With that being said, my quandary is how to pull
> these bills
> randomly.  My first attempt at this, I read through the file
> and selected a
> record every "random" number of seconds.  This was not random
> enough as I
> was always grabbing my bills from the first hundred records for every
> location (about 500 records per location).  Any thoughts
> would be greatly
> appreciated.
>
> John M. Bauman
> Project Manager - Lead Programmer/Analyst
> Ward Trucking
> Second Avenue & Seventh Street, Greenwood
> Altoona, PA 16603
>
> Direct Voice (814) 947-1284
> Fax (814) 944-5470
> www.wardtrucking.com
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L)
> mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>
_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.







As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.