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




When the user edits one of the displayed subfile records and hits enter I
attempt to save it back to the correct file using a DOW to loop through
each record returned from the subfile using READC(E) until I get an %EOF.

Why (E)? Why not just READC? Seems to me that if something goes wrong, you want to know about it.

In this loop I use a KLIST to search using SETLL(E) on the physical file
to find the corresponding entry to the subfile entry I'm working on.  If I
get an %EQUAL result then I know it's an update to an existing record in
the physical file so I use UPDATE(E) to write it out.  Otherwise I use
WRITE(E) to write the new record.

Same comment about (E).

You have to read a record before you can update it. So you need to CHAIN to that record, or use a READE after the SETLL (making sure that you get the same record) and then you can change the fields and issue an update.

Normally, if you didn't READ prior to the UPDATE, you'd get an error message, but since you have (E) on the UPDATE opcode, you're telling it to completely ignore the errors, so you don't even know why it failed.

Frankly, putting (E) on everything isn't a good idea. Only use (E) when you're expecting an error and your program knows how to handle it. And make darned sure that you check %error so that you know whether the operation succeeded or failed.

Otherwise, leave the (E) off, and use a *PSSR to dump the job log and e-mail it to you if something fails. That way, unexpected errors will default to notifying you and providing you details instead of just continuing the program with nobody understanding that something went wrong.


This all works fine for the case of adding a new record, but when I go to
update an existing one the changes don't make it back to the physical
file.  Any ideas?

(as I said above) it's because you're not reading the record before updating.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.