Find a search term in the source or by name

Proprietary

Report every place a search term matches, with the file and the line, and mark each one in the source. The interactive search is the trigram index the CLI builds, and this is not a second engine: it is the same question asked so that the answer can be counted and exported, which is what a parity run against an existing search tool compares. What it has that an index over printed text does not is the tree — a literal continued across a column-7 break is one string, a comment is text rather than a line to skip, and a variable name resolves to the item, so a search for a quoted name finds where it is used and not where it is declared. Searching by name instead finds the declaration: a data name nothing in the program refers to is not a result, and a SET of a level-88 condition refers to the item it is declared under. Names of programs, copybooks and the other components are FindNames, which types them; this reports the identifiers and the text.

io.moderne.mainframe.search.FindText

Required

What to look for. A term matches whole tokens, and a period, a hyphen and an underscore each end one, so ACCT finds WS-ACCT-ID and ACC finds nothing. Terms separated by a space are alternatives and a hit on any of them is a hit; quotes make one phrase of what they hold, matched in order and across a line break, a comment's asterisks and a column-7 continuation. A quoted variable name asks where the variable is used, so the declaration is left out.

Optional

SOURCE to search the text a program is written in, which finds every occurrence, or NAME to search the names it declares, which finds the declaration. Defaults to SOURCE.

Which layer of the text to read: ALL, SOURCE_WITHOUT_COMMENTS, COMMENTS_ONLY, STRINGS_AND_LITERALS, or DOCUMENTATION for the run book members and nothing else. Defaults to ALL. Outside COBOL a line is code or comment and nothing finer, so a scope of strings and literals finds nothing in JCL, BMS or a control card.

mod run . --recipe=io.moderne.mainframe.search.FindText \ -P searchTerm='"open input" close'

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.