WRKSPLF SELECT(*ALL *ALL *ALL *ALL *ALL xxxxxxxxxx)
Where xxxxxxxx is the FIle name.
This will give you a list where you can view each spool file entry,
To automate this routine, create a CMD
It would receive two parms:
Then do the above command with option *PRINT
Create two temp files in QTEMP. RCDLEN(132)
CpySplf to 1st DB file.
Now read that file and when you have a record that has a detail line with spool file information, do another CPYSPLF to 2nd DB file (Mbropt(*REPLACE)
Now with SQL or FNDSTRPDM or an RPGLE program determine if string is in file.
If yes, you can DSPSPLF, or whatever you want.
Why use *PRINT and process a spooled file when it’s easier to do it the right way? Use the List Spooled Files (QUSLSPL) API with format SPLF0300. Loop through the list and check for matches against spoolfile name.
The API will be stable for at least many releases to come. The *PRINT format may change just because someone applied a PTF or issued CHGPRTF.