The SET PROGRAM MASK (SPM) instruction has been in the architecture since the original System/360.
INSERT PROGRAM MASK (IPM) was added with 370 Extended Architecture (370/XA) circa 1984. If you're still supporting customers that are running on pre-XA systems, then the only thing I can offer is prayer. As noted previously in this thread, BAL and BALR will capture the instruction-length code, condition code, and program mask ... but ONLY in the 24-bit addressing mode. If you're program operates in the 31- or 64-bit addressing mode, BAL and BALR won't cut it. Note that on some zSystem machines, IPM is not the swiftest instruction in the machine, and you might prefer BALR if you can live within 24-bit addressing ... and you need to capture the CC a gazillion times a second. However, if you need to capture the CC that frequently, you might want to consider some program design ... for the vast majority of applications, IPM is the way to go.