Cobol Products
  
Home
Download
Buy
About
Contact Us
 

Beautifier
Reporter
Grep
MF, IBM, ICobol to Fujitsu Converters
Try Converters & Tools
Buy Converters & Tools
Contact Us

CobolTransformer . Tools  .
Cobol Grep

Cbl-Grep is named after popular search program grep. Grep searches files specified by the user for a text pattern specified by the user. The only drawback of grep as seen by Cobol programmers is that it cannot search files for patterns expressed in terms of Cobol lanaguage.

That is, we can ask regular grep to "Show me all the lines in my files that contain string XXX" but we cannot ask regular grep to "Show me all the lines in my files that contain reference to data item named XXX".

The two queries above are not the same because regular grep does not understand Cobol and it will happily find the lines containing XXX even if XXX is a part of comment or a part of nonnumeric literal.

We think that in large scale maintenance and reengineering projects it is very important to formulate queries on Program Source in terms of Cobol language. This helps to dramatically cut a number of false matches and thus increase the productivity of Cobol developer or analyst.

This is why Siber Systems developed Query Language (QL) that is used to formulate Cobol-specific queries on Cobol Program Source.

Querying Program Tree

Cobol Program Source is represented by Cobol Program Tree in CobolGrep and queries, in fact, are performed on Cobol Program Tree.

Every node in Cobol Program Tree represents a structural unit of Cobol language and these units can be as big as whole Working-Storage Section or as small as Cobol identifier reference.

Query in QL searches the Program Tree for nodes that satisfy the condition contained in the query.

For instance, if we ask CobolGrep to "Show all lines that contain data item declarations that have VALUE clause and belong to LINKAGE SECTION or FILE SECTION", we would present the following query to CobolGrep:

E.OP==DECL_DD_ENTRY AND (E.ISDESCOF(SECTION_WORKING_STORAGE) OR E.ISDESCOF(SECTION_LINKAGE)) AND E.ARG(DD_VALUE) != NULL

It means: "Find a node in Cobol Program Tree such that this node is data item declaration and this node is a descendant of Working-Storage Section node or of Linkage Section node and this node has Value Clause node".

For every node that satisfies the query the source line that corresponds to this Program Tree node is displayed.

Useful analogy: Query Language (QL) is to Cobol program what SQL is to a relational data base.

Features

  • Understands 14 dialects of Cobol.
  • Searches the whole Cobol program including the copybooks that the main program references.
  • Can search only the main program if copybooks are not found.
  • Can take QL queries from command line or from file.
  • Can search one or many files.

Download Evaluation

Please proceed to Cobol Tools Evaluation Page. You will return here after the download.

Run Evaluation

To find all INSPECT statements, type the following at the command line prompt:

cbl-grep -q=STMT_INSPECT example.cbl

Try more queries contained in the file QUERY-EXAMPLES.txt:

cbl-grep -qf=QUERY-EXAMPLES.txt:DDnoPICclause1 example.cbl cbl-grep -qf=QUERY-EXAMPLES.txt:DDhasValueClause example.cbl cbl-grep -qf=QUERY-EXAMPLES.txt:TableRefIndexPlusMinusOrMinusPlus example.cbl

Here individual queries are put in one file QUERY-EXAMPLES.txt called a Query Library. Individual query is identified in the file by the header:

Query DDhasValueClause DECL_DD_ENTRY and arg(DD_VALUE) != NULL

Buy It

Please proceed to Cobol Tools Pricing Page.

Siber Systems
Copyright © 1997-2010 by Siber Systems Inc.