|
Hi there,
When I run the caller program, I'm gettting the MCH0602 error. I was under the impression that I do not need to recompile caller program as long as the change that I made to the service program doesn't cause the signature to change. Is that a wrong assumption?
Yes, it's a wrong assumption. Service program signatures are merely a hash taken over the list of exported items. They don't track whether you make changes to parameters or return values. All they keep track of is the export names.
Therefore it's completely possible (as you've discovered) to break backward compatibility without changing the signature.
My suggestion to you is that you don't break backward compatibility. Don't change the sizes or data types of existing parameters or return values. If you have additional parameters to add, always add them at the end, and use options(*NOPASS) and code your procedure so that it doesn't require the newly added parameter.
If you MUST change the length of an existing parameter, or add another non-optional parameter, create a wrapper subprocedure to make it backward compatible.
If you can't do that, then manually change the service program signature so that older programs won't run until they've been recompiled. (But avoid this if at all possible.)
A wrapper subprocedure would solve your problem quite nicely, in this case.
Keep the old subprocedure, but make it a wrapper. For example: P VT100GetControlChar... P B export D pi 5 varying D piName 25 value D retval s 5A /free retval = VT100GetControlChar25(piName) return retval; /end-free P E P VT100GetControlChar25... P B export D pi 25 varying D piName 25 value .... do the real work here .... P EExisting programs will work without being recompiled, since they still call VT100GetControlChar, which still only returns 5A varying.
New programs that need the extra 20 chars should call VT100GetControlChar25, since it returns the longer value.
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.