|
>> 2) Using the UPDAT command is more overhead than you really need. Again there is >> nothing wrong with UPDAT, but we prefer an EXCPT with only the fields that are >> being changed listed. (Besides it makes it very clear as to which field values >> the program affects. > >Actually, I find UPDATE much easier to understand myself, from a self documenting >point of view. If I come across a program that is changing fields, then does an >UPDATE >I know what it is doing. But, when I come across a program that has an EXCEPT to >out output spec, I have to jump down and see what is being updated. The use of EXCPT rather than UPDAT speaks to the "intent" of the programmer. UPDAT is a shotgun approach to updating a record - it isn't easy to tell exactly which fields you intended to update, since you're updating them all. With an EXCPT, your intent is clearer. What does this fragment intend to do? FMASTER UP E DISK FTOLLS IF E K DISK C* If status = G, process C STATUS IFEQ 'G' C TOLKEY CHAINRTOLL 90 C ADD TOLTOT TOLYTD C UPDATRMAS C ENDIF How about now? C* If status = G, process C STATUS IFEQ 'G' C TOLKEY CHAINRTOLL 90 C ADD TOLTOT TOLYTD C EXCPTUPDTOL C ENDIF ORMAS E UPDTOL O TOLYTD O TOLAMT O TOLDAT Note that both snippets have equally poor comments and the database files have nondescriptive field names. Only now, you can see that we're grabbing the TOLAMT and TOLDAT fields from TOLLS and updating their counterparts in MASTER. Buck Calabro +--- | 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 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.