|
Bob, > I'm looking for some ammo, guys! One of many reasons I like sub-procedures is because I can pass parameters by value. Consider the following code for two programs Disclaimer: Please don't lynch me for posting RPGIII PGM 1: H 1 M INAMED DS I 1 10 FIELD1 I 11 20 FIELD2 I 'FIELD_NUM1' C CON1 I 'FIELD_NUM2' C CON2 C MOVE CON1 FIELD1 C MOVE CON2 FIELD2 C* C CALL 'PGM2' C PARM FIELD1 C* C DSPLY FIELD2 C SETON LR C RETRN PGM 2: H 1 M C* C *ENTRY PLIST C PARM INPUT 15 C* C MOVE *BLANKS INPUT C* C SETON LR C RETRN Now the obvious problem is that the parameter lengths are mismatched between the two programs. I have shown this to seasoned "RPGIII 'til I die" and they never guess that you can mess up a field that doesn't even show up in your called program. This isn't something I can take lightly if I start updating files with incorrect data. Considering the fact that this can be avoided completely by passing by value, (or prototyping) plus all the other benefits mentioned like local variables, modularity, and so on, any program I write is now modular and sub-routines are getting rarer. HTH, Andy BTW: Thanks to Jon Paris and COMMON for showing me the interesting set of programs above.
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.