On 2021-09-03 9:33 a.m., Greg Wilburn wrote:
Without getting into the details... I made a mistake adding a procedure to a service program. I need to remove it.
This SRVPGM is used all over the place.
Can I simply remove it, recompile the module and then UPDSRVPGM?
I'm assuming you used binder source to create your service program.
If the unwanted procedure is the last entry in the binder source, you
can remove it from the module and the binder source and rebuild the
service program. Anything program that was actually calling that
procedure will fail when it's called because the export is missing, so
you'll be able to detect the problem.
If it's not the last entry in the binder source, you can't just remove
it from the binder source, since that will break the calls to any of the
procedures below it in the binder source. (Once the service program has
been bound to the program, the calls are by export number, not by name.)
You could add another exported procedure to your module, say DUMMY1 and
change the EXPORT for your unwanted procedure to be DUMMY1.
If you think something might be calling the unwanted procedure and you
don't want that, make DUMMY1 crash somehow, so you'll find out about the
illegal calls.
So just to give an example:
Say you had proc1, proc2, and proc3 before, and now you don't want proc2
now.
Your binder source before:
EXPORT(proc1)
EXPORT(proc2)
EXPORT(proc3)
Your changed binder after:
EXPORT(proc1)
EXPORT(DUMMY1) /* proc2 was removed from here */
EXPORT(proc3)
DUMMY1:
// - This procedure is used to replace proc2
// in srvpgm x.
// - It has a deliberate error, in case anything was
// actually calling proc2
dcl-proc dummy1 export;
dcl-s x int(10);
dsply 'deliberate error, illegal call to proc2';
x = 1 / x; // divide by zero
end-proc;
(A better version of DUMMY would send an escape message to its caller)
As an Amazon Associate we earn from qualifying purchases.