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



Douglas,

C     DVNDNO        CHAIN     PAYABLES
C                   DOW       NOT %EOF

CHAIN does not set %EOF!!

CHAIN does not set %EOF on if no record is found. So this code is incorrect. This loop won't even be entered if the previous READ or READE operation hit the end of file. Even if the CHAIN succeeds, it will never enter the loop. Furthermore, if the CHAIN fails, it'll still enter the loop because CHAIN doesn't set %EOF!

You need to either do this:

  C     DVNDNO        SETLL     PAYABLES
  C     DVNDNO        READE     PAYABLES
  C                   DOW       NOT %EOF

Or this:

  C    DVNDNO         CHAIN     PAYABLES
  C                   IF        %FOUND
  C                   DOW       NOT %EOF


C                   READE     PAYABLES

Here you're reading a file that you just CHAINed to. That means, you skipped a record -- the one you read with CHAIN a moment ago will never be processed.


C                   IF        DREFNO = PREFNO
C                   DELETE    PAYABLES
C                   UPDATE    PAYABLES
C                   ELSE

Here you've just deleted a record. That record is no longer there! Now you're trying to update it? How can you update it, if it's no longer there?

Even if you put the UPDATE before the DELETE, it wouldn't work because you'd release your record lock the moment you update it, so the delete would fail.

Not to mention that the whole idea of deleting a record you just updated makes no sense. Why update something you no longer want?


I am chaining to the file with no problem and I need to stay within the key
(which is why I am using the reade), I am checking for a specific refno and
if I find it I need to delete it, but the system is complaining that I have
not performed an input operation....I would have thought the reade performed
that, what is the proper way to handle this?

That's because you did a DELETE after the READE. When you try to update it, you'll get the "need an input operation" error because you have to read a different record before updating it. As soon as you do an update or delete, you lose the record lock, and you have to read again before issuing the next update or delete.

Not to mention that it makes absolutely no sense to delete a record and then try to update it. OR update a record and then delete it. If you don't want the record, just delete it. No need to do an update.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.