× 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.



>From:  "Dirk Bennis", INTERNET:dbennis@blwn0009.bausch.com
>Date:  4/18/97 11:24 AM
>RE:    RPG random generator
>     Hi all, 
>     I'm looking for a way to make a random selection out of a file with 
>     alphanumeric location codes.
>     What's the best way of doing this kind of exercises? 
>     Thanks for helping me.
>     Dick Bennis - Holland 
>Dick;

This might be one of those rare occasions where RRN processing would be
neat(being that you don't know what you want till after you got it)

One way would be to open the file by Relative Record Number
(no "K" in F-spec),  Look at the File Information Feedback Data 
structure for that file and get the Number of Records in file at Open.

Then do a New RPG/IV Random Number routine by calling the "C" random
function(That code was posted in this list a while ago, maybe someone will
post a new copy of it.) for a random number with the top limit being 
the number of records at open.

Then chain to that record using the random number. This would give you 
a random selection of records from that file,  which is what I 
think you really want.  If you want not to get the same record twice,
just put the random number in to an array,  and each time look up the
new number on the array to make sure you didn't select that record twice.

It sounds like about about a 20-40 statement program(maybe 50 or 60 tops). 
If all you really want is a random selection from that file.

(I don't think you have to get envolved with the Apha code at all.)

In the event that the file has multiple records with that code, and
you want to grap a Alpha Code at random, and then go to this file and process 
all the records of that code,   Just do my routine on the Alpha Code
Master File,  and then SETLL on the real file an READE on the Alpha 
code. )

John P. Carr
EdgeTech Inc.
74711.77@compuserve.com

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the Midrange System Mailing List!  To submit a new message,   *
* send your mail to "MIDRANGE-L@midrange.com".  To unsubscribe from     *
* this list send email to MAJORDOMO@midrange.com and specify            *
* 'unsubscribe MIDRANGE-L' in the body of your message.  Questions      *
* should be directed to the list owner / operator: david@midrange.com   *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


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.