In you used something such as IEFBR14 then you can not specify a member with DISP=(OLD,DELETE). The entire file will delete.
Mr. Spock shows a solution. Other utilities can also be used, such as IEHPROGM. These use control statements which can be a problem if you want to use JCL symbolics, for example.
Disclaimer: My comments on this forum are my own and do not represent the opinions or suggestions of any other person or business entity.