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


  • Subject: Re: Reade & Chain
  • From: "Scott Klement" <infosys@xxxxxxxxxxxx>
  • Date: 25 Oct 1999 00:24:04 -0500

Hi,

A READE reads the next record, by key, as long as the key of the
record matches the keylist that you provide in your factor 1.
Prior to doing the READE, you need to position the file's cursor
to a record that matches the key you want to use with READE...

CHAIN positions itself to the FIRST record that matches the keylist
that you give, and then reads it into memory.

Using a SETLL, followed by a READE with the same keylist is basically
the same thing as a CHAIN...  If that helps...

Example:
  Say you've got a file like this:
     Key:    Data:
     10000   APPLE
     10001   ORANGE1
     10001   ORANGE2
     10001   ORANGE3
     10002   BANANA1
     10002   BANANA2
     22220   STRAWBERRY

     C* THIS READS THE ORANGE1 RECORD:
     C           10001     CHAINFILE                 10

     C* THIS READS THE ORANGE1 RECORD:
     C           10001     SETLLFILE
     C           10001     READEFILE                     10

     C* THIS CODE WILL NOT WORK... IT'LL ALWAYS KEEP READING
     C* THE ORANGE1 RECORD FOREVER:
     C           10001     CHAINFILE                 10
     C           *IN10     DOWEQ*OFF
     C           10001     CHAINFILE                 10
     C                     ENDDO

     C* THIS CODE WILL WORK.... IT'll READ ORANGE1, ORANGE2, ORANGE3:
     C           10001     SETLLFILE
     C           10001     READEFILE                     10
     C           *IN10     DOWEQ*OFF
     C           10001     READEFILE                     10
     C                     ENDDO

     C* THIS CODE WILL ALSO WORK: IT'll READ BANANA1, BANANA2:
     C           10002     CHAINFILE                 10
     C           *IN10     DOWEQ*OFF
     C           10002     READEFILE                     10
     C                     ENDDO

The same concepts apply to RPG IV as well...   I didn't think
the translation was difficult to warrant showing examples in
both versions of the language :)

Good Luck!


"Madhusudhana Perumal Iyah Guruswamy suresh" <igsuresh@wipsy wrote:
>
> Hi everybody,
>
>    What is the difference in the reading using READE and CHAIN
>  opcodes?.
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| 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.