Pennington / Example

XTRAN Demonstration:  Analyzing Symbol Usage in COBOL

The following analysis used a set of XTRAN rules comprising 122 (net) lines of "meta-code" (XTRAN's rules language) to analyze all declarations of, and references to, COBOL symbols, for each source file (in this case, only one).  Another set of XTRAN rules was then used to report the information.  The second (reporting) rules set is language-independent.

The input and output are untouched, except that line numbers have been added to the input for reference.



* Input to XTRAN (sample.cbl):

 1     IDENTIFICATION DIVISION.
 2     PROGRAM-ID.    SAMPLE.
 3     AUTHOR.        ALFRED E. NEUMANN.
 4     INSTALLATION.  SOME COBOL SHOP SOMEWHERE.
 5     DATE-WRITTEN.  APRIL 1993.
 6     DATE-COMPILED.
 7    *REMARKS.  JUST TO SHOW OFF XTRAN.
 8    *
 9     ENVIRONMENT DIVISION.
10     CONFIGURATION SECTION.
11     SOURCE-COMPUTER. IBM-S38.
12     OBJECT-COMPUTER. IBM-S38.
13     DATA DIVISION.
14     WORKING-STORAGE SECTION.
15     01  AMT                    PIC 9(7)V99.
16     01  PAGE-TOTAL             PIC 9(8)V99     VALUE 0.
17     01  DIFF                   PIC 9(7)V99.
18     01  TOTAL                  PIC 9(7)V99.
19     PROCEDURE DIVISION.
20     DO-IT.
21        ADD AMT TO PAGE-TOTAL.
22        SUBTRACT AMT FROM TOTAL GIVING DIFF.
23        STOP RUN.


*  Output from XTRAN:

                           COBOL Symbol Usage Report
                               Symbol Occurrences

Legend:
        D Occurrence declares symbol nonglobally
        I Occurrence declares symbol as internal global
        E Occurrence declares symbol as external global
        X Occurrence declares symbol as internal or external global
        Q Occurrence equates symbol to a value


AMT
  sample.cbl  15D, 20, 22
DIFF
  sample.cbl  17D, 22
DO-IT
  sample.cbl  20D
PAGE-TOTAL
  sample.cbl  16D, 20
TOTAL
  sample.cbl  18D, 22


COPYRIGHT 2008; reproduction prohibited without permission.  Revised 2006-11-27

XTRAN is a trademark of Pennington Systems Incorporated.

Pennington Systems Incorporated
8655 East Via de Ventura, Suite G200
Scottsdale, Arizona 85258-3321

Phone:  +1(480)626-5503
Fax:  +1(480)626-7618
Email:  Info@Pennington.com
Web:  http://WWW.Pennington.com

[home]Home