|
Hi James, > Be that as it may, why are you complicating things by using pointers to > get things into structures? If your program is always going to be > triggering on the same file, you can probably get away with defining the > data structures directly on the trigger buffer, and even if you can't you > can certainly just define one big alphanumeric field on the trigger > buffer, then use substrings on it. A few reasons why I recommend the pointer approach: 1) Hard-coding the fields in the data structure has already broken during previous release upgrades. But, you have no promise from IBM that it will only break during a release upgrade! They pass you numbers in the data structure that tell you where the field data is -- nowhere does it say that the number will always be the same. They make no promises that this position won't break with a PTF, or even during day-to-day use of the program. 2) The substring approach would work, assuming that you used variables for the substring positions -- but that would be an order of magnitude more complicated than the pointer approach. 3) When you use the pointer approach, you can use the external definitions for your files. That means that you don't have to re-code the data structure positions every time you change your file, you can just recompile the trigger and let it pick up the new definitions -- and that in turn makes maintenance MUCH simpler. > Besides which, if you're using pointers, and doing it right, then you > should be mapping the structures on the data where it is, in the trigger > buffer, rather than moving it around (which defeats anything you could > possibly gain by using pointers), Who said anything about moving it around? The pointer should be set once, when the program starts, to put the external definition into the right position of the trigger buffer... > in which case, you never moved it out of the trigger buffer, and should > therefore have no need to move it back in. There's no need to move it back in... the way he had his code written, changing a field in the after image would've changed the actual trigger buffer. He just didn't understand. Just my recommendation, of course...
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.