ONXFIND Search Files/Lib. Elements/JV for strings

ONXFIND [n,] param [ =W datei [, E|O] ] | =P ] [, NO] [, C[O] ] [, +-n|+n|-m ] [, NC] [, F] [, PD] [,SKIP[F]] [,TAPE] [,TYPE=t1,t2,...]

Search the contents or names of all marked files, library elements or Job variables for the occurence of one or more search criteria. The number of records or the element names which fulfill the search criteria are displayed on the screen. The count will be displayed, right-justified, in the Action Code field of the respective file if U (Update List) is given in answer to the termination query.

The option =W file will result in CFS creating a printable file with the names of the files in which the string was found. It will also contain the records in which the string occurred.

n Restrict the search to the first n records. (Standard: all records).

param single or multiple search argument.

single search argument: [ col ] [pitem

col Column range in which the string must begin.

:col1-col2: The first character of the string must begin between col1 and col2.

:col1: The string must begin at column col1.

>:col1: | <:col1: The string will be sought in the range from col1 to the end of the record (>), or from the beginning of the record to col1 (<)

Standard: The search is performed from the beginning to the end of each record.

p >    Search for a string  > item

<    Search for a string < item

-    Search for a string not equal to item

Standard: Search for a string = item

item Search string : C'string' | L'string' | X'string'

C'string' can be abbreviated to 'string' .

L'string': Lower case letters in string will not be converted to upper case.

If string contains apostrophes, these must be doubled.

Multiple Search - Format 1:  param [op param] [op param] .....

param single search argument according to the above syntax.

op Logical operator combining the two single search arguments.

  , Or operator.

  + And operator.

  * Wildcard operator: And operator, but in addition, the second search item must appear after the first. The optional parameter n determines how many separating characters must appear between the two items.

An unlimited number of search arguments can be combined with Or/And/Wildcard operators.

Notes:

The And/Or operation is restricted to a single record. This means that both search criteria must be contained within the same record.

A full description of the logical operators can be found on page 8-.

Multiple Search - Format 2:  ( )

Entering () will display a special search mask. The user then has 18 lines to enter any search arguments required. For a description of the search mask, see page 8-.

Multiple Search - Format 3:  %name | %? [, jrsave]

%name is the description of a parameter set to which a complex search argument had previously been saved with an SP %name command. For further information, see page 8-.

%?: A list of all relevant parameter sets will be displayed in a mask. One of these can be selected by marking it.

jrsave is the name of the file in which the parameter set is stored. Standard: CFS.JRSAVE [.jobname] .

Multiple Search - Format 4:  ( s-fil )

s-fil is the name of a SAM file containing the search arguments. For further information, see page 8-.

Multiple Search - Format 5:  ? | ?,%name

? will redisplay the last search argument to have been defined.

?,%name will redisplay the search argument stored in %name.

Saving the Search Results

ONXFIND... =W file [, E | O ]

The records in which the string was found will be saved to a printable file. The name of the respective data object will also be saved to the Write file. Only the name will be saved if the NO option (see below) was specified.

E The Write file is opened in Extend mode.

O The Write file is opened in Output mode.

Display the Search Results on Screen

ONXFIND ... =P

The records found to contain the search string are displayed on the screen. This option is equivalent to the Search command with a direct output of the result. For further information, see page 8-.

Scan only names of data objects for string

ONXFIND ..., NO

Names Only. Only the names of the files or library elements are scanned for the specified string. The name of the library elements whose name contains the search string will be written to the Write file. The scope of the NO option is primarily to search multiple libraries for elements with a particular name. See the second example below for such an application.

ONXFIND ..., NC

No Check for Continuation. Checking for the continuation of a BS2000 command, or a macro or source statement, is suppressed.

Normally, i.e. if the NC option is not specified, all records in BS2000 procedures, macros or source programs containing a continuation character are treated as a logical unit. If the string is found in one of the records, then all of the records of that logical unit will be written to the Write file. The physical record containing the string will be flagged with an 'X' in column 2.

ONXFIND ..., C

Standard: All records in procedures/macros/source programs will be treated as a logical unit linked to one another by continuation characters. This means, for example, that the search item 'FCB'*'BLKCTRL=DATA' will register a hit if the partial string 'FCB' occurs in one line and the partial string 'BLKCTRL=DATA' occurs later in another.

When writing the result records to another file, all records from each logical unit will be transferred to the output file. If the search string is contained completely within one of the partial records, this will be indicated by an 'X' in column 2 of the output file.

ONXFIND ..., CO

Check for Continuation Old mode. When searching a procedure, macro or source code, if a hit is found in a record containing a continuation character, then all other records containing continuation characters will also be transferred to the write file. In order to be recognised as such, the search string must be completely contained within one of the partial records.

ONXFIND ... , +-n | +n | -m

Surrounding records of the hit will be written to the output file.

+-n n records (1 <= n <= 250) before the hit, the record containing the hit itself, and n records after the hit will be written to the output file.

[+n] [-m] m records (1 <= m <= 250) before the hit, the record containing the hit itself, and n records (1 <= n <= 250) after the hit will be written to the output file.

ONXFIND ..., F

Find First. The search will be terminated after the first occurence of the string has been found, and a hit will be indicated. This option offers a quick way of determining whether or not the data object contains the search string. Normally, the search will be performed on all records occuring after the first hit as well. In this case, the number of hits will be correctly recorded.

ONXFIND ..., PD

Physical mode for archive Directories. ISAM files representing Archive directories will normally be searched at the logical level, i.e. at the level of the saved file names, resulting in a different format of the search hits. The PD parameter will cause Archive directories to be handled as normal ISAM files.

ONXFIND ..., SKIP[F]

SKIP Data objects not containing the search string will be removed from the file list with a '-' Action Code. These can be restored with a YANK command.

SKIPF Data objects which meet the search criteria are removed from the file list with the Action Code '-'. These entries can be restored with the YANK command.

ONXFIND ..., TAPE

Normally, tape files and migrated files will not be taken into account by the ONXFIND Variable Action. The TAPE parameter can be used to include these files. This will result in a request for the relevant tape to be mounted.

ONXFIND ...., TYPE=t1,t2, ...

This parameter is only relevant if files are being searched which actually represent a PLAM library.

The search will be restricted solely to library elements of the specified type. Example: TYPE=J or TYPE=J,S

By default, all elements in the library will be searched, regardless of type.

The =W file [, E | O ] option can also be entered in the Search mask (see: Multiple Search - Format 2), or in s-fil (see: Multiple Search - Format 4) after the last search string.

Notes:

In conjunction with the Write option (=W ..), the REWR command (Updating the original individual files or elements from the Write file) should also be noted. This REWR command (see page 7-) is the natural counterpart to the Write option.

If neither the E nor the O option is specified after the name of the Write file, then the following rules are valid:

If the Write file is opened for the first time in the current CFS run, it will always be in O (Overwrite) mode, i.e. the file will be created or overwritten.

If the same file is specified in multiple Variable Actions, it will be opened in Extend mode as standard.

The user can specify any mode with the E/O option.

In contrast to the FIND User Option, tape files may also be processed with the ONXFIND Variable Action.

If a BS2000 file representing a library is marked with an X and processed with an ONXFIND Variable Action, CFS will search the library at the element level, and not at the individual record or data block level. Multiple libraries can be checked in this way for the occurrence of a string in the data, or in the element name. The FIND Variable Action will display the total number of occurrences for all elements in a library, or the number of element names, which contain the specified string.

Examples:

ONXFIND 'D3470','D3475'=W CFS.D347X

All data objects marked with an X will be searched for the string 'D3470' or 'D3475'. Those records, together with the respective file/element name will be written to the file CFS.D347X.

ONXFIND 'A1015'=W L.FNDLIST,NO

Problem: a source program named A1015 needs to be found across multiple libraries, represented in the file list as BS2000 files. The necessary files are marked with an X. The Variable Action specified above will examine the names of all the elements of the flagged libraries for the string 'A1015'. The element names, together with their library names, will be written to the file L.FNDLIST. Answering U to the termination query will display the number of names fulfilling the search criteria in the Action Code field of each of the flagged files.

ON&FIND 10 '/FILE','/SET-FILE-LINK'=W CFS.FILE.RESULT

All files in the list will have their first 10 records examined for the string '/FILE' or 'SET-FILE-LINK'. All records containing at least one of the strings will be written to the file CFS.FILE.RESULT.

ONXFIND ''

If this Variable Action is carried out on a file that represents a library, the total number of records of all elements will be displayed as the result.

In connection with displaying the number of records in a file or library element, see also the RECNT (Record Count) User Option on page 4-.

ONXFIND ''=W CFS.ALL

All records from the data objects marked with an X will be written to the file CFS.ALL. This can also be compared to the ONXLIST Variable Action.

ON&FIND :1:'$A'=W #1

All selected Job variables (FCBTYPE=J) are searched for the string '$A' in column 1. A list of the names of these Job variables, together with their contents, will be written to the file #1. This file can be printed with SPACE=E.

Further examples of search arguments, in particular the combination of multiple arguments, can be found in Chapter 8 "CFS Display/Editor", in the "Searching for Character Strings (multiple search arguments)" section.