I think you need to handle that outside of the PC-DMIS process, ie. a .BAS won't do it, but a .VBS might.
Pseudocode:
Execute VBS
The VBS fetches the partprogram filename
The VBS closes the current partprogram
The VBS deletes the partprogram (using the partprogram filename fetched earlier)
VBS closes
I think you need to handle that outside of the PC-DMIS process, ie. a .BAS won't do it, but a .VBS might.
Pseudocode:
Execute VBS
The VBS fetches the partprogram filename
The VBS closes the current partprogram
The VBS deletes the partprogram (using the partprogram filename fetched earlier)
VBS closes