The ISRSUPC SRCHFOR function is commonly used in batch jobs to search for text across PDS members. In our daily work, we often use the SRCHFOR command interactively to search for specific text within members of a PDS. For batch processing, IBM provides the ISRSUPC utility, which serves as the batch equivalent of the interactive SuperC search.
How ISRSUPC SRCHFOR Works with ANYC
When using PARM=(SRCHCMP,'ANYC'), the utility performs a case-insensitive search across dataset members. Here’s what the parameters mean:
SRCHCMP: Activates search mode instead of comparison mode, enabling the use ofSRCHFORstatements.ANYC: Stands for “Any Case”, allowing matches regardless of letter casing (e.g.,error,ERROR,Errorwill all match).
🧾 Sample JCL Example
//SEARCH EXEC PGM=ISRSUPC,PARM=(SRCHCMP,'ANYC')
//NEWDD DD DSN=TEST.JCL,DISP=SHR
//OUTDD DD DSN=TEST.OUTPUT.SRCH2,DISP=(NEW,CATLG,DELETE),
// SPACE=(133,(5,5)),
// DCB=(LRECL=133,BLKSIZE=133,RECFM=FB)
//SYSIN DD *
SRCHFOR 'TEXT STRING'
SRCHFOR 'TEXT STRING2'
/*
//STEP02 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTMSG DD SYSOUT=*
//SORTIN DD DSN=TEST.OUTPUT.SRCH2,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(30,6,CH,EQ,C' -----')
OUTREC FIELDS=(1,8)
/*
The above ISRSUPC SRCHFOR example searches for two text strings across all members of the input PDS and writes the results to an output dataset for further processing.
Processing ISRSUPC SRCHFOR Output with DFSORT
The second step uses DFSORT to process the output generated by ISRSUPC SRCHFOR. It filters lines containing ' -----' beginning at column 30, which typically identifies member header records in SuperC output.
The OUTREC FIELDS=(1,8) statement extracts the first eight characters of each matching line, which are usually the member names. This provides a simple way to generate a list of members that contain the requested search strings.
If you want to save the extracted member names to a dataset instead of writing them to spool output, replace SYSOUT=* in the SORTOUT DD statement with an appropriate dataset definition.