| Author |
Re: Sort registers
|
|
| Michael Mattias 2004-03-26, 10:59 pm |
| "JerryMouse" <nospam@bisusa.com> wrote in message
news:obKdnZ4-bN3U6dvdRVn-jw@giganews.com...
> Hey, I'm easy.
>
> How would you add a record to an ISAM file such that when the file is
later
> read sequentially the latest date is the first record returned?
You do not read indexed files sequentially. You can read them in key order
if you want; you can even use ACCESS DYNAMIC to allow the use of the START
and READ NEXT verbs to read in key order starting somewhere other than at
the beginning.
But as far as adding records so that when you do choose to read in key order
they come out in the order you want? That has nothing to do with file access
per se; that is totally a function of the way you build the key and/or the
way the ISAM manager allows you to define those keys.
MCM
| |
| JerryMouse 2004-03-26, 10:59 pm |
| Michael Mattias wrote:
> "JerryMouse" <nospam@bisusa.com> wrote in message
> news:obKdnZ4-bN3U6dvdRVn-jw@giganews.com...
>
> You do not read indexed files sequentially. You can read them in key
> order if you want; you can even use ACCESS DYNAMIC to allow the use
> of the START and READ NEXT verbs to read in key order starting
> somewhere other than at the beginning.
Thanks for the update.
I've erased all instances of
ACCESS IS SEQUENTIAL
in my COBOL manuals where it appears in conjunction with ISAM files.
| |
| docdwarf@panix.com 2004-03-26, 10:59 pm |
| Xref: kermit comp.lang.cobol:85798
In article <xYF1c.30290$PY.10697@newssvr26.news.prodigy.com>,
Michael Mattias <michael.mattias@gte.net> wrote:
>"JerryMouse" <nospam@bisusa.com> wrote in message
>news:obKdnZ4-bN3U6dvdRVn-jw@giganews.com...
>
>You do not read indexed files sequentially. You can read them in key order
>if you want; you can even use ACCESS DYNAMIC to allow the use of the START
>and READ NEXT verbs to read in key order starting somewhere other than at
>the beginning.
This is confusing, Mr Mattias... how are you making 'in key order' to be
something other than 'in key order sequence'?
DD
| |
| Michael Mattias 2004-03-26, 10:59 pm |
| I've clearly caused some confusion here.
It "appears" the OP thought the "sequence order" and/or "PHYSICAL
construction" of the keys associated with a key-sequenced ("isam") file are
under the direct control of the COBOL language.
Of course, COBOL of and by itself has nothing to to with these things: COBOL
deals only with the LOGICAL construction of keys and order of retrieval.
Probably just should have said that the first time....
MCM
<docdwarf@panix.com> wrote in message news:c27cjf$rp3$1@panix5.panix.com...
> In article <xYF1c.30290$PY.10697@newssvr26.news.prodigy.com>,
> Michael Mattias <michael.mattias@gte.net> wrote:
later[color=darkred]
order[color=darkred]
START[color=darkred]
>
> This is confusing, Mr Mattias... how are you making 'in key order' to be
> something other than 'in key order sequence'?
>
> DD
>
| |
| Richard 2004-03-26, 10:59 pm |
| "JerryMouse" <nospam@bisusa.com> wrote
> Michael Mattias wrote:
>
> Thanks for the update.
>
> I've erased all instances of
>
> ACCESS IS SEQUENTIAL
>
> in my COBOL manuals where it appears in conjunction with ISAM files.
You should ignore that comment from MM. ACCESS SEQUENTIAL and READ ..
AT END .. gives identical results to ACCESS DYNAMIC and READ ... NEXT
RECORD AT END ..
Both of these give the records in key sequence order, and are 'reading
the indexed file sequentially'.
START _can_ be used on a file with ACCESS SEQUENTIAL and it does not
need to be DYNAMIC for this.
What DYNAMIC does is allow a RANDOM READ to be done on the file in
addition to allowing the file to be read sequentially. A random read
is one in which the key value in the record is set and a READ
statement without NEXT or AT END is done. I always use READ .. NEXT
RECORD when doing a sequential read on a file that has ACCESS DYNAMIC,
it clarifies the difference.
Both SEQUENTIAL and DYNAMIC are useful.
| |
| Richard 2004-03-26, 10:59 pm |
| "JerryMouse" <nospam@bisusa.com> wrote
> How would you add a record to an ISAM file such that when the file is later
> read sequentially the latest date is the first record returned?
>
> OPEN INPUT filename REVERSED?
START ... FIRST KEY ... REVERSED
READ ... PREVIOUS RECORD ..
This works for the whole key size, what was actually required was
parts to be ascending and other parts descending which can only be
done by setting appropriate values in the key.
|
|
|
|