PreviousUnisys Extension Language ConstructsNext

Chapter 11: Introduction to the REQL Language

This chapter introduces REQL and its implementation.

11.1 Introduction

REQL's language constructs and functions enable administrators to create project administration scripts for batch project management. Use the parameters described in this Reference Guide in conjunction with the Project Management scripts provided in the Scripts tool to create tasks like creating new projects, setting up search directories, and performing batch updates.

In addition to using the Project Management scripts, REQL is implemented in the Shell tool. The Shell tool is enabled on the User tab and is accessible from the Tools menu. It gives you an interactive command line interface for using REQL with Revolve.

Figure: 12-1 Shell Tool

11.2 REQL and the Revolve Database

REQL is the acronym for REvolve Query Language. It comprises language constructs and functions that enable you to perform specific administrative and analysis operations on the Revolve database. The Revolve database is created when you add and parse your system files to create a Revolve project. In fact, when you use Revolve in your system analysis and maintenance tasks you are actually using the Revolve database. Each database file represents the system file that was used to create it. Revolve database files comprise the following:

11.2.1 Elements

In COBOL source code there are programs, divisions, paragraphs, and statements. The divisions, statements, and other pieces of the source code are known as elements. Elements provide an extremely detailed representation of the source code, including the usage of variables in statements. COBOL constructs are used in many places in a program. For example, a MOVE statement can appear in several places. Each instance is stored in the database as a separate element and can be accessed with Revolve.

11.2.2 Attributes

Attributes describe properties of a database object. For example, attributes include an element's location in the source code, the number of lines it occupies, its size, and its name. There are many different attributes in the database. For example, a variable has a name attribute but a MOVE statement does not.

11.2.3 Types

Types are used to classify source code elements in the Revolve database. A paragraph has one type attribute while a COBOL statement has another type. Understanding the types stored in the Revolve database is an important part of learning to use REQL effectively.

There are many types of elements in a program. To classify and use them all is a complicated task. To reduce the complexity, REQL has adopted a consistent hierarchical naming convention. The hierarchy is known as the Type Hierarchy and it consists of a tree with the most general type at the root and more specific types lower down. For example, the name of each type consists of word segments separated by underscores with the first word segment describing the language and the other segments describing the element in more detail. For example, cobol_label_para. Moving left to right along the type name is like descending the type hierarchy. Figure 11-2 displays the hierarchy.

Figure 11-1: Type Hierarchy

The full name of the type is known as the formal name. Each type of element in the database has a formal name. Sometimes types are referred to by a partial name which contains only some of the word segments of the formal name. For example, para might be used instead of cobol_label_para.

11.2.4 Relationships

Relationships connect database objects to one another. For example,


There are three objects. The MOVE statement, the usage of variable A, and the usage of variable B. The MOVE statement owns the usage of A and the usage of B. The hasa relationship is used in REQL to denote ownership.

11.3 Parse Tree

The previous sections have discussed some of the parts in a typical database. This section brings the concepts together to illustrate a complete database for a simple application. During a parse of source code, a representation of the elements and relationships within the code is constructed. This representation is called a Parse Tree and it is stored in the Revolve database. REQL accesses the parse tree to answer queries.

Below is a test application. Create this file in a word processing application. Be sure to indent and tab the code according to the example below. (The initial six digits can be replaced with spaces, to make typing easier.) Save the file as TEST.COB.

000005 01 MESSAGE-FIELD.
000007    05 CUSTOMER-NAME PIC X(100).
000009 A00-DISPLAY.
000010     MOVE "John Smith" TO CUSTOMER-NAME.
000012     STOP RUN.

The following diagram represents the parse tree of the test application. The elements of the parse tree are represented by boxes, and the arrows represent relationships. Within each box is a list of the attributes that describe the associated element. For example, the parse tree shows that a paragraph element whose name is A00-DISPLAY, is located at row 9 column 8, and has a length of 4 lines. The paragraph is related to three statement elements with the hasa_cobol_state relationship.

Figure 11-2: The Parse Tree for TEST.COB

The next chapters provide definitions and examples of specific REQL constructs and functions to enhance your system analysis.

Copyright © 2000 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousUnisys Extension Language ConstructsNext