|
On Fri, 2005-03-18 at 16:27 +0100, PAPWORTH Paul wrote: > Does any one know if it is possible in RPG (or any other i_series) > language to do the following > > > > Ws_work_zone = %pgmvar(var) About fifteen years ago, we needed to write a program where the user could define rules that edited fields in a set of records. They needed to be able to edit against the contents of any field (in a defined list of several hundred) to see if it was blank, or zero, or matched a list, or matched one of the other fields in the list. There were ranges, and all sorts of requirements. We thought about various methods, including writing a program generator, but at the time, it would have been too slow to have the user generate and compile some kind of program every time they changed the ruleset, which was frequently. Finally, someone not really connected to the project said - As soon as the data is in memory, why not just copy each field into an array element? At first we dismissed the idea out of hand, because it wasn't 'real' softcoding, which we thought we were after. However, after a bit of thought, it became clear that the only 'hardcoding' in the project would be the bit of code to copy each field into it's array element. Once that was done, the user could write a rule like "if account type is 111 and end_date is 0, reject the record". Since we knew account type was in (say) field 15, and end date was in field (say) 38, we could easily, at run time, parse the rule(s), and then compare fields(15) with 111 and fields(38) with 0. HTH -- Regards, Rich Current Conditions in Des Moines, IA Overcast Temp 46.4F Winds out of the Southwest at 15mph Moderate Rain
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.