S Search (simple Search argument)

Notes:

When entering the column range col in the search statement, certain differences to entering column ranges in EDT should be noted:

1) :col1-col2: means that the argument enclosed in quotation marks must begin within the specified column range.

In EDT, the search argument must be wholly contained within the column range.

2) :col: means that the search argument enclosed in quotation marks must begin exactly at the specified column.

Entering a single column in EDT in the form :col: causes the search to proceed from :col: to the end of the record. In CFS this is achieved by entering >:col2:, whereby col2=col-1. By entering <:col:, a search can be made from the beginning of the record to col.

In most cases, string can be entered without the quotation marks (S,string). The quotation marks need only be specified if string contains spaces, or is followed by a replacement string (page 8-), or a Write command (page 8-).

Once the search argument has been defined, it is valid for all succeeding S commands, and need not be re-entered. It remains valid until a new string needs to be found.

If the user is only interested in the number of hits in the file, this can be achieved by entering the command S,'string'='' (in Non Modify mode only). In this case, only the number of hits found up to the end of the file is displayed.

A particularly long search can be interrupted by pressing the K2 key (branch to BS2000 command mode), and then entering the command /INTR R. The window will be positioned at that point in the file that was last read.

PAM: Search over Block Boundaries

When searching PAM files, the string does not have to be contained completely within a data block. If the string (e.g. 'DATABASE') begins at the end of a PAM block and is continued at the beginning of the next PAM block (e.g. 'DA' + 'TABASE'), then this combination will be recognised by CFS and flagged as a hit.

Examples:

S,C'XYZ'

Search from the first displayed record to the end of the file for the character string C'XYZ'.

S,C'C'' '''

Search for the character string C'_' over the whole file (Quotation marks in the search string must be doubled).

S,L'File'

Search all data records for the character string 'File'. The lowercase characters contained within the string are not converted before the search begins.

S,:73:-' '

Search in column 73 of each record for any character other than a blank. Records with fewer than 73 columns will not be flagged as a hit.

S,:1:>X'0054'

To detect records of a specific length, enter the Offset command O-4 to display the record length field. The above Search command for a RECFORM=V file will then find all records whose length, including the record length field, is greater than 84 bytes.

S10,:100-200:X'47'

Search the next 10 records in the column range 100 - 200 for the string X'47'.

S,'CFS'=''

In Non Modify mode: The number of records in which the string 'CFS' occurs at least once is counted. No replacement of the search string takes place in the file in Non Modify mode.

S,'CFS'='',A

In Non Modify mode: The total number of hits are counted.

A: multiple occurrences in one record are all counted.

In Modify mode, each occurrence of the search string is deleted in an ISAM file.

S,''

The length of the first record in the window is displayed in the commentary line (search to the end of the record).