[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: COBOL compiler



On Fri, 2003-08-29 at 16:28, Bijan Soleymani wrote:
> On Tue, Aug 26, 2003 at 08:03:35PM -0500, Ron Johnson wrote:
> > On Tue, 2003-08-26 at 18:23, Bijan Soleymani wrote:
> > > On Tue, Aug 26, 2003 at 02:30:57PM -0500, Ron Johnson wrote:
> > > > On Tue, 2003-08-26 at 13:29, David Turetsky wrote:
> > > > > > On Tue, 2003-08-26 at 10:05, Kirk Strauser wrote:
> > > > > > From: Ron Johnson [mailto:ron.l.johnson@cox.net] 
[snip]
> > That's great for in-memory stuff.  
> > 
> > What about when there are, say, 10 or 40M records to process?
> > 
> > And what if you only need to SORT a fraction of those 40M records,
> > and the winnowing algorithm is very complicated, possibly needing
> > to access other files or database tables in the process?
> 
> Well then you do it differently:
> open(INPUT,"records.txt");
> LOOP: while($record = <INPUT>)
> {
> if(!input_filter($record))
>   {
>     next LOOP;
>   }
>   else
>   {
>     #code to process record
>   }
> }
> close(INPUT);
> 
> Where input_filter() is the winnowing function you define.

That's good, but where's the sort function?  Also, what if each
record-to-be-sorted doesn't come directly from records.txt?  Maybe,
for each record read from records.txt, you must also query some
other file(s), or a database, or must do some other algorithmic
calculation.

The COBOL SORT verb has 3 sections:
INPUT - Records (from whatever input) are RELEASEd to the SORT buffers.
        Any winnowing or transformations can happen here.
SORT - You can figure that part out.
OUTPUT - Records are RETURNed from the actual sort and can be pro-
         cessed (transformed, summarized, etc).

-- 
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l.johnson@cox.net
Jefferson, LA USA

Spit in one hand, and wish for peace in the other.
Guess which is more effective...



Reply to: