Using SUPERC to Search for Text Strings

SUPERC (super compare) is one of ISPF’s most useful utilities; It allows to compare datasets or search for text strings. Normally, SUPERC is used via ISPF panels but it can also be used in batch job.

SUPERC is able to process:

  • Sequential datasets
  • Partitioned datasets (including individual members)
  • Concatenated datasets

 

To use SUPERC in batch job, we can use the following sample JCL:


//SEARCH EXEC PGM=ISRSUPC,
//      PARM=(SRCHCMP,ANYC,IDPFX,NOPRTCC)
//NEWDD DD DSN=your.input.dataset,DISP=SHR
//OUTDD DD SYSOUT=A
//SYSIN DD *
SRCHFOR 'string'[,t][,startcol][:stopcol]
SRCHFORC 'string'[,t][,startcol][:stopcol]
/*

 

Parameters:

SRCHCMP – Searches and compares
ANYC – Any case search (uppercase and lowercase)
IDPFX – Prefixes text matches with an identifier or member name on the report file
NOPRTCC – Puppresses print carriage control in the report file

 

Notes:

There is no need to use SRCHFOR and SRCHFORC simultaneously. We can opt for using one or the other, and in the same way, we only need to use the syntax arguments that relate to the search we want to perform.

Argument Description
SRCHFOR Searches for a text string.
SRCHFORC Searches for a text string on the same input line as the preceding SRCHFOR string.
‘string’ Text string to search for. Needs to be enclosed in single quotes.
type Type of search to be performed:

·      (blank) – This is the default. Searches for any occurrence of the string within the dataset.

·      P – Prefix search. The string appears at the start of a word.

·      S – Suffix search. The string appears at the end of a word.

·      W – The string is a full word.

startcol Column in which SRCHFOR begins to look for the string. All columns to the left of this column are ignored.
stopcol Column in which SRCHFOR ends its search for the string within that record. All columns to the right of the column are ignored.

 

Examples:

1) The following batch job will search for the string ‘security risk’ in every member of the partitioned dataset USER1.REPORT.DATA:

//SEARCH EXEC PGM=ISRSUPC,
//      PARM=(SRCHCMP,ANYC,IDPFX,NOPRTCC)
//NEWDD DD DSN=USER1.REPORT.DATA,DISP=SHR
//OUTDD DD SYSOUT=A
//SYSIN DD *
SRCHFOR  'security risk'
/*

 

2) The following job will search all members of several concatenated partitioned datasets for several strings. It will search for occurrences on the suffix ‘net’, the string ‘cyber’ and the string ‘crime’ on the same line as the string ‘cyber’.


//SEARCH EXEC PGM=ISRSUPC,
//      PARM=(SRCHCMP,ANYC,IDPFX,NOPRTCC)
//NEWDD DD DSN=USER1.FILE1,DISP=SHR
//      DD DSN=USER1.FILE2,DISP=SHR
//      DD DSN=USER1.FILE3,DISP=SHR
//OUTDD DD SYSOUT=A
//SYSIN DD *
SRCHFOR  'net',s
SRCHFOR  'cyber'
SRCHFORC 'crime'
/*

 

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.