This command is in TAATOOL
Delete Old Spooled Files – TAA (DLTOLDSPLF)
There are also sample programs in the Information Center on how to perform various tasks using system APIs. One example, Deleting old spool files appears to demonstrate how to do what you want. Examples are provided with OPM RPG, OPM COBOL, and C though it wouldn’t be difficult to “upgrade” to ILE RPG/COBOL.
In current releases of i5/OS, you can run CHGPRTF to specify EXPDATE(), and potentially DAYS(), to begin setting up more automated purging of spooled files. The DLTEXPSPLF command is used to delete spooled files that have reached expiration.