|
Booth, >Procedures on the other hand are becoming a nightmare of complexity and >impossible maintenance by mere mortals. I heartily disagree. To me, subprocedures are the best thing that ever happened to RPG IV. They *increase* readability -- dramatically -- and make programs *more* maintainable. >Procedures are not simple to undderstand at any level. Again, I vehemently disagree. Do you use any of the %BIF's in RPG IV? Why or why not? User-defined procedures are verly nearly like BIFs, except you get to create it yourself. (I'll admit we have a few less possibilities, mainly due to lack of full operational descriptor support for non-character fields.) When procedures are properly constructed (including a meaningful name), they just become a "black box" which performs its magic and returns a value. You can build up whole collections of useful things to put in service programs which the most junior member of the staff can call just like the %BIFs. A case in point would be my recommendation the other day to use a subprocedure to calculate variance percentages. It can hide the "complexity" of handling zero divisors and intelligently handle overflow for the space alloted without simple truncation of digits. Then in the code all you do is: Eval Percent = CalcPctVariance( NewValue: BaseValue: 999.99 ) I use the third parameter to tell me allowable range so I can return it when space constraints prohibit accomodating "unreasonable" figures. Users may need minimal training to understand a reported variance of 999.99% is likely not the true figure but at least alerts them it is not 2% when it should be 1002%. I *do* think all programmers need to learn to use subprocedures (and pointers, and APIs, and...). My point was that, if we expect them to learn these language features to increase their productivity, why not other language features too? The fact that few other languages have anything as slick as level breaks and even matching records does not negate their usefulness. Doug
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.