The GRAPH Command

In this section:

GRAPH request syntax is similar to TABLE request syntax. To produce a graph instead of a tabular report, you need only substitute the command GRAPH for TABLE in the request. Thus, you can produce graphs by simply converting TABLE requests to GRAPH requests.

However, not every TABLE facility has a GRAPH counterpart, and there are some practical limitations on the amount of information that you can effectively display in a graph. When a TABLE request is converted in this manner, the various phrases that make up the body of the request take on special meanings that determine the format and layout of the graph. The type of graph produced by a GRAPH request depends on the display command used (SUM or PRINT), and the sort phrase(s) used (ACROSS or BY).

Similarities Between GRAPH and TABLE

The GRAPH request elements generally follow the same rules as their TABLE counterparts:

Differences Between GRAPH and TABLE

There are a few notable syntactical differences between TABLE and GRAPH. Specifically, the following restrictions apply:

Example: Converting a TABLE Request to a GRAPH Request

The following illustrates how a TABLE request can easily be converted into a GRAPH request by changing the TABLE command to a GRAPH command.

TABLE FILE GGORDER
HEADING CENTER
"SAMPLE TABLE"
SUM QUANTITY
BY PRODUCT_DESC AS 'Coffee Types'
WHERE PRODUCT_DESC EQ 'French Roast' OR 'Hazelnut' OR 'Kona'
END

The output is:

        SAMPLE TABLE
Coffee Types      Ordered Units
------------      -------------
French Roast             285689
Hazelnut                 100427
Kona                      61498

The same request with a GRAPH command in place of the TABLE command is:

GRAPH FILE GGORDER
HEADING CENTER
"Sample Graph"
SUM QUANTITY
BY PRODUCT_DESC AS 'Coffee Types'
WHERE PRODUCT_DESC EQ 'French Roast' OR 'Hazelnut' OR 'Kona'
END

The output is: