COBOL flow charts

Visustin generates flow charts from code written in several COBOL dialects, mainly COBOL 74 and COBOL 85.

The COBOL support is built by using Fujitsu COBOL 3.0 as a reference. This compiler is compliant with ANSI Standard COBOL X3.23 1985 (ISO-1989-1985) and ANSI '74 COBOL X3.23-1974. Fujitsu COBOL85 extensions are supported too. According to Fujitsu, this compiler is also compliant with OS/VS COBOL and Micro Focus, but we have not verified this. We have checked the documentation of IBM VS COBOL II for any incompatibilities. Other COBOL variants are supported to the extent that their syntax conforms to ANSI COBOL or Fujitsu COBOL85. If you use some language extensions, please experiment with Visustin and contact us if you find any problems.

COBOL modes

Visustin can visualize a complete PROCEDURE DIVISION, one or more SECTIONs or a smaller executable snippet. There are 3 modes to select from. The modes differ in which columns are visualized:

  1. COBOL (fixed, columns 7-72). This mode skips columns 1-6 and 73- of each line, that is, the sequence or line number area and the Program Identification Number Area. Only the code in columns 7-72 is visualized.
  2. COBOL (variable, columns 7-). This mode skips columns 1-6, that is, the sequence or line number area. All other columns are assumed to contain code. Line length is not limited.
  3. COBOL (free format) assumes that all columns are equal and visualizes all the code as if line numbers and the Program Identification Number Area didn't exist. Line length is not limited.

Other than that, the column positions are insignificant to Visustin. All code is analyzed as if it were written in a column-free format. The columns and modes are summarized in the below table. The Indicator and Code areas are processed by Visustin.

COBOL columns and modes
Fixed 7-72 123456 789101112...72 7374757677787980
Sequence nr (skip)IndicatorCodeIdentification nr (skip)
Variable 7- 123456 789101112...
Sequence nr (skip)IndicatorCode
Free format 1...
Code

When the fixed or variable format is selected, you will see a ruler displaying the expected column format, and source code appears in a fixed-width font.

Tab stops. If your code contains (hard) tab characters, the fixed and variable modes may process it incorrectly. Try setting the tab stops via the Options menu. If this does not solve the problem, you need to convert hard tabs to soft tabs (spaces) with an external program before loading the code in Visustin. This is especially important for fixed mode source utilizing the Program Identification Number Area (columns 73-80).

Tip

COBOL programs are often big and complex. Maybe even too complex for humans and computers. Use the Structure tab to create several smaller charts out of a big file. More about large charts

Supported COBOL statements

Visustin notices the following words as COBOL statements. ACCEPT, ADD, ALTER, CALL, CANCEL, CLOSE, COMPUTE, CONTINUE, DELETE, DISPLAY, DIVIDE, EJECT, ENTRY, EVALUATE, EXEC, EXIT, GENERATE, GO, GOBACK, IF, INITIALIZE, INITIATE, INSPECT, MERGE, MOVE, MULTIPLY, NEXT, OPEN, PERFORM, READ, RELEASE, RETURN, REWRITE, SEARCH, SET, SKIP1, SKIP2, SKIP3, SORT, START, STOP, STRING, SUBTRACT, SUPPRESS, TERMINATE, TITLE, UNLOCK, UNSTRING, USE, WRITE.

The following statements have a special visualization.

In addition, statements with an ON EXCEPTION, ON OVERFLOW, AT END, ON SIZE ERROR or a similar clause are displayed as a combination of a normal statement + a conditional.

Notes on COBOL procedures

COBOL does not support procedures (functions or sub-programs) the way most other languages do. Instead, sections and paragraphs are used as "procedures". By default, they execute in the order they exist in the code. One can control the order with PERFORM and PERFORM...THRU statements.

Considering the next code snippet, it is not immediately evident whether MORE-CODE will execute after GCD or not.

000200 GCD.
000210     code goes here...
000280 EXIT-GCD.
000290     EXIT.
000300 MORE-CODE.

A call such as PERFORM GCD THRU EXIT-GCD will cause a return at the EXIT statement. A call such as PERFORM GCD THRU MORE-CODE will cause everything to be executed in a sequence, by-passing the EXIT statement. (Note that the EXIT statement is simply a placeholder and has no run-time effect.)

What is the meaning of this? PERFORM statements affect the shape of the resulting flow chart. To make sure that all sections and paragraphs are flowcharted in the correct order, with "procedures" correctly displayed as a unit while keeping unrelated sections and paragraphs separated, make sure your code includes all relevant PERFORM statements. It is best to flowchart entire files at a time. Short code snippets may miss relevant PERFORM statements, causing "procedures" to be incorrectly displayed in a sequence (or separated). Instead of snippets, load entire COBOL files in Visustin and use the Structure tab to select the sections and paragraphs to flowchart.

Unsupported COBOL code

Flow charts include PROCEDURE DIVISION code only. Preceding divisions are discarded.

Comments are not displayed. In free format, a line starting with "*" or "/" is a comment. In fixed and variable format, "*" or "/" in column 7 indicates a comment. Anything to the right of " *>" on a line is also a comment.

Visustin supports only those COBOL statements that are listed in this document. If your code is written in another COBOL dialect than what is supported by Visustin, it may contain other statements. You may notice incomplete visualization, such as missing statements. In this case, add periods between the statements to build sentences of one statement in each. Visustin is more forgiving in the visualization of single-statement sentences than multi-statement sentences in COBOL. You can also try this trick to eliminate the effects of bugs, should we have accidentally left any.

The following statements have a special meaning in COBOL but they are not visualized in any special way by Visustin.

National characters (other than A-Z, 0-9) are not supported. If your code uses national characters outside of string literals ("..."), you may notice some effects.

Changes

Since v4: To reduce flow chart complexity, procedure calls via PERFORM statements are no longer visualized. A "PERFORM procedure-name" or "PERFORM procedure-1 THRU procedure-2" is not shown as a link to the target section or paragraph.

Since v5: "Procedures" are analyzed with the help of PERFORM statements. See "Notes on COBOL procedures" above.

©Aivosto OyVisustin Help