Question about indexed file processing 
Author Message
 Question about indexed file processing

Hi all,

I'm new at cobol programming.....obviously.

If I have an indexed file with invoice-no as the key and cust-no as an
alternate with duplicates, how do I read the file using the alternate key and
get all the records.

I have tried using access is dynamic and set key = cust-no but once all the
records for a given cust-no have been actioned, all the other customer numbers
higher than the given cust-no are actioned in ascending sequence.

I also tried access is random, it reads the first record ok, but I don't know
how to then get it to read subsequent records.

Thanks in advance for any help.

Dean.
this ng or mail would be great.



Sat, 13 Nov 1999 03:00:00 GMT  
 Question about indexed file processing


Quote:

> I'm new at cobol programming.....obviously.

> If I have an indexed file with invoice-no as the key and cust-no as an
> alternate with duplicates, how do I read the file using the alternate key and
> get all the records.

> I have tried using access is dynamic and set key = cust-no but once all the
> records for a given cust-no have been actioned, all the other customer numbers
> higher than the given cust-no are actioned in ascending sequence.

That is what the 'UNTIL' is for on the PERFORM.

         MOVE Customer-Key     TO Invoice-Customer-Key
         START Invoice-File
             KEY NOT > Invoice-Customer-Key
              INVALID KEY
             MOVE HIGH-VALUES  TO Invoice-Customer-Key
         END-START
         PERFORM
             UNTIL Invoice-Customer-Key NOT = Customer-Key

             READ Invoice-File
                 NEXT RECORD
                 AT END
                     MOVE HIGH-VALUES TO Invoice-Customer-Key
             END-READ

             IF Invoice-Customer-Key = Customer-Key
                 .....
             END-IF
        END-PERFORM



Sat, 13 Nov 1999 03:00:00 GMT  
 Question about indexed file processing


Quote:
>Hi all,

>I'm new at cobol programming.....obviously.

>If I have an indexed file with invoice-no as the key and cust-no as an
>alternate with duplicates, how do I read the file using the alternate key and
>get all the records.

>I have tried using access is dynamic and set key = cust-no but once all the
>records for a given cust-no have been actioned, all the other customer numbers
>higher than the given cust-no are actioned in ascending sequence.

>I also tried access is random, it reads the first record ok, but I don't know
>how to then get it to read subsequent records.

>Thanks in advance for any help.

>Dean.
>this ng or mail would be great.


    MOVE starting-customer-name TO customer-name-key
    START file KEY >= customer-name-key INVALID KEY
         ... you're at end of file if this happens --
    END-START
*   now read the file using
    READ file NEXT RECORD AT END ...

George Trudeau, Town of Falmouth



Sun, 14 Nov 1999 03:00:00 GMT  
 Question about indexed file processing

:>Hi all,
:>
:>I'm new at cobol programming.....obviously.
:>
:>If I have an indexed file with invoice-no as the key and cust-no as an
:>alternate with duplicates, how do I read the file using the alternate key :>and get all the records.
:>
:>I have tried using access is dynamic and set key = cust-no but once all :>the records for a given cust-no have been actioned, all the other customer :>numbers higher than the given cust-no are actioned in ascending sequence.
:>I also tried access is random, it reads the first record ok, but I don't :>know how to then get it to read subsequent records.
This is the way to do it. Do a "start" on the alternate key then
continue by using "read next". This should follow the alternate
key till you perform a "start" on another Key.
:>
:>Thanks in advance for any help.
:>
:>Dean.
:>this ng or mail would be great.

:>

-- Siegen
----------------------
Please remove the letter "x" from my email address, should you wish
to email me.

---------------------



Thu, 30 Dec 1999 03:00:00 GMT  
 Question about indexed file processing



Quote:

> :>Hi all,
> :>
> :>I'm new at cobol programming.....obviously.
> :>
> :>If I have an indexed file with invoice-no as the key and cust-no as an
> :>alternate with duplicates, how do I read the file using the alternate

key :>and get all the records.
Quote:
> :>
> :>I have tried using access is dynamic and set key = cust-no but once all

:>the records for a given cust-no have been actioned, all the other
customer :>numbers higher than the given cust-no are actioned in ascending
sequence.
Quote:
> :>I also tried access is random, it reads the first record ok, but I

don't :>know how to then get it to read subsequent records.
Quote:
> This is the way to do it. Do a "start" on the alternate key then
> continue by using "read next". This should follow the alternate
> key till you perform a "start" on another Key.
> :>
> :>Thanks in advance for any help.
> :>
> :>Dean.
> :>this ng or mail would be great.

> :>

> -- Siegen

A comment on Dean's original question is appropriate ... His confusion is
caused by the concept of implied scope delineation that a relational
database would have, i.e. select * from invoices where customer equal
'XXXXXXXX' ... This is not a criticism of Dean, his question, or the
response from Siegen, just an observation that COBOL-like indexed file
systems are not relational data bases, and are not being taught in schools
any longer, thus the confusion.

--
Kevin Corkery
Independent Consultant
Voorhees, New Jersey



Sat, 01 Jan 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. CDX Index file bloats up but shrink after re-indexing

2. indexed file question

3. Cobol Index File Format? Question

4. Question about indexed files ?

5. Question on MF - Cobol 3.1 Index files

6. indexed file question #2

7. Newbie Question: Indexed I-O File Status Error 43

8. Indexed Files question

9. File Processing from Embed Question

10. Newbie question: how to process a binary file

11. file processing question

12. Optimizing Indexing Process

 

 
Powered by phpBB® Forum Software