GithubHelp home page GithubHelp logo

broadcommfd / cobol-control-flow Goto Github PK

View Code? Open in Web Editor NEW
9.0 8.0 7.0 25.19 MB

COBOL Control Flow is an extension for Visual Studio Code that provides graphical visualization of program flow for programs written in COBOL.

Home Page: https://marketplace.visualstudio.com/items?itemName=broadcomMFD.ccf

License: Other

cobol mainframe vscode zos zowe

cobol-control-flow's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cobol-control-flow's Issues

Option of "View COBOL Control Flow" does not appear on the context menu

Hello,
after installing the extention Cobol Control Flow and following the instructions, the option of "View COBOL Control Flow" does not appear ont the context menu;
In terms of configurations on VSC, I've:

java 14.0.1
Version: 1.47.0
Commit: d5e9aa0227e057a60c82568bf31c04730dc15dcd
Date: 2020-07-09T08:02:06.629Z
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.19041

Thank you in advance,
joao

"exit section" is a statement, not a section label

Hi,

Since version 1.0.3, statements "exit section" are reported in CCF graph as labels. That's wrong.

"exit section" are statements, as "exit paragraph", or "exit perform" and they are written un marge B (columns 12 thru 72), not un marge A (columns 8 thru 11).

We use "perform section-from thru section-to" statements, and the "section-to" contains only an "exit section" statement.

In version 1.0.3 the CCF graph became unreadable due to the processing error on the "exit section" instructions.

CCF must only take into account for the labels the information which begins in margin A, that is to say between columns 8 and 11.

image

Same graph program with CCF 1.0.2:

image

In version 1.0.3, the "label-to" labels are displayed in graph whereas they were not in version 1.0.2: OK.
But the "exit section" statements must not appear in the graph.
We also see links between these "exit section" statements and other labels which a priori have no reason to exist.

Use case program:
S91100.cbl.txt

gnuCOBOL support

This extension looks amazing. After installing I read it can only be used with IBM Enterprise COBOL.
Are there any plans to expand support to gnuCOBOL?

The language structure, is pretty much the same, so I'm assuming that it should be fairly easy to support other dialects?

Arrows are not very visible

When you try to check the flow of a commonly called procedure (such as print, close or error handling) the arrows are not very visible. It is kinda hard to follow the flow if i am just checking the chart.

It would be great if I could move the boxes and re-arrange the flow chart so the arrows will not overlap but I am not sure if that is possible πŸ˜„

Capture

Also, The difference between a PERFORM.. THRU and PERFROM... UNTIL is not that obvious. I wish it could be distinct so that I know that there is a loop.

image

Project level call-chain analysis [enhancement request]

We find this extension super useful.

It would be significantly more useful if we could get a call-chain analysis across all the modules in a project. The output would be very similar to the control-flow output, but at the inter-module call level across the project (or folder).

FR: please co-publish on Open VSX Registry

https://open-vsx.org/?search=broadcom lists 5 extensions while https://marketplace.visualstudio.com/publishers/broadcomMFD lists 10 extensions. This extensions (and 4 others) are missing.

Update 2020-12-01: currently 6 vs. 11 extensions listed

As the namespace is already registered and extensions are published this is likely not needed, but it cannot harm:
Details on the publishing can be found at https://github.com/eclipse/openvsx/wiki/Publishing-Extensions.

Disable CCF graph generation for single copybook files

CCF is not expected to render graphs directly for COBOL copybooks files, however as of now, this option is available which leads to the graph being loading endlessly.

'Generate COBOL Control Flow' option should NOT be available for copybook files.

Note:
Copybooks can still be recognized by COBOL LS extension and they are part of the graph for the main program.

"View COBOL Control Flow" not added to Context Menu

Hello

Installed this extension newly. I'm not able to see "View COBOL Control Flow" option when we right click (Refer below snapshot).

image

Below is the snapshot of vscode. Any help in this regard is much appreciated.

image

Thanks
Soma

Support 'GOBACK' statement

The graph is generated despite the fact that in the code, the 'GOBACK' statement is used, and statements following it are not executed.

Example:

   IDENTIFICATION DIVISION.
   PROGRAM-ID. HLLOWRLD
   DATA DIVISION. 

   WORKING-STORAGE SECTION. 
   01  USRNAME           PIC X(10).

   PROCEDURE DIVISION.
   0000-MAIN SECTION.
       PERFORM 1000-GET-NAME
       PERFORM 2000-TEST
       DISPLAY 'HELLO 'USRNAME
       GOBACK
       .
   1000-GET-NAME.
       ACCEPT USRNAME.
       PERFORM 1000-EXIT.
   1000-EXIT.
       EXIT.
   2000-TEST.
       PERFORM 2000-EXIT.
   2000-EXIT.
       EXIT.

Output:

image

Therefore in the above-mentioned example, the arrow pointing from 1000-EXIT to 2000-TEST should not exist due to the 'GOBACK' statement interrupting the program in the 0000-MAIN SECTION

Cobol coded with SECTION not recognized

Hi,
We are giving a try to your plugin but it sems not working properly with the code base we have.
The code use a lot of Cobol section. Is there any workaroud to make it works ?

Thanks a lot !

Arnaud

Support for a Ligth Theme in CCF

Hi,

CCF only offers a Dark Theme.

This is fine if the active theme in VS Code is also a Dark Theme, but denotes when the active theme in VS Code is a Light Theme.

In addition, to make screenshots in the form of an image and include them in a document, the Light Theme (white background) is more appropriate, (changing color in an image editor does not produce good results).

Visually represent the PERFORM THRUs

Hi,

In addition to request #31, regarding PERFORMs, there should also be a way to identify PERFORM THRUs which chain several paragraphs or sections (and paragraphs within sections).
For this, a particular type of link could be established between the chained paragraphs / sections:

  • at the caller level: a specific link to the 1st paragraph / section called
  • at the level of the paragraphs / sections called: a particular link between these paragraphs / sections, step by step, according to the order of execution (which is also the order of declaration)

support EXEC CICS HANDLE AID

Hello,
Is it possible to add the support of EXEC CICS HANDLE AID for exemple I have a cobol program that contain 13 section but the flow show only one. The CCF don't take into consideration the branching using EXEC CICS HANDLE AID.

EXEC CICS HANDLE AID
PF4(5600-CANCEL)
PF5(5700-PRINT)
PF6(5300-CONFIRM)
PF7(5000-TEL-ANT)
PF8(5100-TEL-PROX)
PF9(5200-INC-NEW)
PF10(9910-MENU)
PF22(9910-MENU)
PF12(9990-SAI-CICS)
PF24(9990-SAI-CICS)
CLEAR(9990-SAI-CICS)
ENTER(2000-PROCESS)
ANYKEY(9700-TEC-INVALID)
END-EXEC.

CCF in Endevor Explorer

I am using CCF 0.4.0 and have selected a Cobol source in Endevor explorer... when I ask for a control flow, it starts create the flow, but never ends. I will have to kill VS Code to stop it.
2021-06-11_12-06-40

Not able to see 'Generate COBOL Control Flow'

Hi,
When I am doing a left-click on .CBL file, I am unable to see the 'Generate COBOL Control Flow' option. I have installed the 'COBOL Control Flow 0.2.0' extension in Visual studio

Forced installation of COBOL Language Support by COBOL Control Flow

Hi,

It seems that since the version 1.0.6 of COBOL Control Flow, the installation of COBOL Language Support is mandatory and automatically triggered...

image

This does not meet our expectations because while we like COBOL Control Flow, we do not use COBOL Language Support, and do not intend to use it...

COBOL Language Support conflicts with the extension that we have chosen to use to manage our COBOL sources, in particular on the search for COPYBOOKs, but surely on other points as well.

image

It also triggers false problems on certain COBOL syntaxes.

image

image

However, it is indicated at the COBOL Control Flow level that the use of COBOL Language Support is recommended, but not required.

COBOL Language Support cannot be uninstalled or disabled without also uninstalling or disabling COBOL Control FLow.

image

image

Is this a definitive situation, or is it possible to return to the previous situation where COBOL Language Support is not mandatory?

Export CCF Graph to JSON - Missing menu?

Hi,

CCF has a command to export the graph in JSON format, but this command is not accessible by a menu... an oversight?

Is it possible to have other export formats? in particular formats in various image standards, or compatible with other standards, as YAML, XML, SVG?

A compatibility with Graphviz, and VS Code extension supporting Graphviz?

A test made by adapting the package.json file to add a menu suggests that the functionality is operational, but graph must be built before to be exported.

Always try to generate a graph regardless the file extension

Open a valid COBOL program with a 'non-cobol' extension (e..g. .txt) and manually select 'COBOL' Language Mode from the VSC right bottom menu.
"Generate COBOL Control Flow" right-click option becomes available but if selected, the error msg is displayed:
ECCF0002: Flow can be generated only for .cob | .cobol | .cbl files.

CCF should try to render the graph regardless of the actual file extension.

Support for nested program

Hi,

Although probably not often used, it might be interesting in the future that CCF support nested programs.

At this time, it is not a priority for us, just an opportunity to complete the functionalities of CCF.
But maybe in the future we will use the COBOL functionality of nested programs because we are in the process of reviewing our entire COBOL development framework to take advantage of the latest developments in the IBM Enterprise COBOL compiler.
COBOL V6R4, supports user-defined functions, maybe we'll implement them through nested programs, (which also assumes that CCF supports user-defined functions).

image

Consider EXEC CICS RETURN as end of program

Hi,

In a CICS program, it is the EXEC CICS RETURN statement that terminates the program, and in principle the COBOL GOBACK instruction is absent from the program.

CCF does not treat the EXEC CICS RETURN command as an end of program sequence and as a result the graph is badly constructed.

With EXEC CICS RETURN and with goback:

image

With EXEC CICS RETURN and without goback:

image

Allow to exclude certain elements from the graph

Hi,

In our standard for writing our COBOL code, we declare certain paragraphs or sections which have no interest in appearing in the graph built by CCF, which would lighten the graphical representation of the program accordingly.

These are mainly paragraphs that mark the end of scope of a PERFORM (PERFORM PARA THRU PARA-EXIT, or PERFORM SECT with a final PARA-EXIT), and which contain only an "exit" statement or a variant of type "exit paragraph" or "exit section".

These paragraphs are usually not explicitly referenced and are just executed in sequence.
On the other hand, if these paragraphs (or sections) are explicitly referenced by a GO TO, or even by a PERFORM, they must be included in the graph.

For this, it would be necessary to be able to declare in CCF the list of paragraphs or sections to be ignored in the form of patterns of regular expressions.
To take the example above: ignore the paragraphs responding to the regex pattern /\b.*-EXIT\b/i.

The rule would therefore be: if a paragraph (or section) responds to an exclusion pattern and is not explicitly referenced, then do not make it appear in the graph.

The graph loses focus once the tab is moved at the bottom

  1. generate a CCF graph
  2. by default it appears in the right side tab
  3. move the tab to the bottom of VSC to display it horizontally
  4. change the cursor position in the code to a different section - > the graph loses focus and disappear from the screen

The expected result is that the selected node of the graphs always stays in the center of the tab (like in vertical view)

Horizontal Tab Graph Offset

When the control flow tab is manually moved to a horizontal position (below the editor tab), the graph moves out of the viewport when navigating by clicking through the code.

Support for "exit paragraph" statement

Hi,

It seems that CCF does not understand the COBOL exit paragraph statement.

image

Consequence: part of the graph is missing.

The exit paragraph statement does not have the same behavior at runtime as the exit statement (just like the exit section statement, but this is well recognized by CCF).

Thanks.

EXIT SECTION causes graph to end instead of continue.

Issue:

Putting an EXIT SECTION instead of just an EXIT will cause the graph to stop looking at the rest of the program.

Example Code:

   IDENTIFICATION DIVISION.
   PROGRAM-ID. HLLOWRLD
   DATA DIVISION. 

   WORKING-STORAGE SECTION. 
   01  USRNAME           PIC X(10).

   PROCEDURE DIVISION.
   0000-MAIN SECTION.
       PERFORM 1000-GET-NAME
       PERFORM 2000-TEST
       DISPLAY 'HELLO 'USRNAME
       GOBACK
       .
   1000-GET-NAME SECTION.
       ACCEPT USRNAME.
       PERFORM 1000-EXIT.
   1000-EXIT.
       EXIT SECTION.
   2000-TEST SECTION.
       PERFORM 2000-EXIT.
   2000-EXIT.
       EXIT SECTION.

Example Graph

image

Comments:

Notice how we perform both 1000-GET-NAME and 2000-TEST, but only 1000-GET-NAME is shown on the graph

ECCF0002: Flow can be generated only for ...

There are at least two more "commonly used" extension names for COBOL on PC: pco and sqb - both for files that need to be run through a SQL preprocessor.
Other than directly adding those two extensions (I guess I'd be able to send a PR for this) I suggest to either drop the file check completely - inspecting whatever the LSP extension does - because this works on those files (possibly because of a file setup in vscode "recognize pco as COBOL files") or making this list an extension setting with the current 3 values ".cob", .cobol, .cbl" as default (this way people that only use cbl can also adjust to look out only for this file extension).

Is there a reason that ccf is not enabled on copybooks? It would be reasonable in this case to start the process at its top (where for multi-section-copybooks the "main" part may be).

A procedure was not detected

The WRITE-HEADERS is not part of the initial procedures connected to PROCEDURE DIVISION.

The correct flow should be:

  1. OPEN FILES
  2. WRITE HEADERS
  3. READ NEXT RECORD
    A. READ RECORD
    B. WRITE RECORD
    i. WRITE HEADERS (If Report Page Break)
  4. WRITE TRAILERS
  5. CLOSE STOP

image

"Failed to generate flow"

Every file I've tried this on fails and I just get a little notification popup that says "Failed to generate flow". I can't find any other information on why its failing. I'm on Win10 x64 and the latest version of VSCode. This extension looks like it could be very helpful if it worked. Is there any way I could produce some error output or anything?

Differing Graph based on SECTION

Example Code:

Code 1:

   IDENTIFICATION DIVISION.
   PROGRAM-ID. HLLOWRLD
   DATA DIVISION. 

   WORKING-STORAGE SECTION. 
   01  USRNAME           PIC X(10).

   PROCEDURE DIVISION.
   0000-MAIN SECTION.
       PERFORM 1000-GET-NAME
       PERFORM 2000-TEST
       DISPLAY 'HELLO 'USRNAME
       GOBACK
       .
   1000-GET-NAME.
       ACCEPT USRNAME.
       PERFORM 1000-EXIT.
   1000-EXIT.
       EXIT.
   2000-TEST.
       PERFORM 2000-EXIT.
   2000-EXIT.
       EXIT.

Graph 1:

image

Code 2:

   IDENTIFICATION DIVISION.
   PROGRAM-ID. HLLOWRLD
   DATA DIVISION. 

   WORKING-STORAGE SECTION. 
   01  USRNAME           PIC X(10).

   PROCEDURE DIVISION.
   0000-MAIN SECTION.
       PERFORM 1000-GET-NAME
       PERFORM 2000-TEST
       DISPLAY 'HELLO 'USRNAME
       GOBACK
       .
   1000-GET-NAME SECTION.
       ACCEPT USRNAME.
       PERFORM 1000-EXIT.
   1000-EXIT.
       EXIT.
   2000-TEST SECTION.
       PERFORM 2000-EXIT.
   2000-EXIT.
       EXIT.

Graph 2:

image

Issue:

Notice how the only difference between the first code and the second code is that "SECTION" is put after 1000-GET-NAME and 2000-TEST. Both codes exit regardless and will function the same way, however the graph is different between the two.

CCF issue with Gen/Cobol

Here's the email from the Endevor Support Engineer at Travelers.

We are on Java 8+. Control Flow runs all of the time, it’s just that some of the time it produces bad results.

The 2 examples we have are:

The chart skips much of the program. Our example seems to see the initialization read of the input file, decide it is at end-of-file, and then skip straight to termination.
A large (12,000 lines) CoolGen program. Clicking on a paragraph bubble in the flow chart is supposed to bring you to that paragraph in the source code. Instead it brings you someplace nowhere close.

Marc A Hanna

HSCM Support (Endevor)

I've opened this issue on behalf of Travelers.
Feel free to contact me at "[email protected]"

Regards,

Milt

Error Message: Failed to generate flow

I am experiencing this error when I try to:

  1. use the extension to a large COBOL file that has 38k lines of code.
  2. open an small COBOL file that has invalid parameters like the image below but it should be fine because the procedure division is okay.

image

I am not sure what the problem with the 2 scenarios. The error message is too generic.

Flow is generated but not for all

I was installed the plug in in VSCode and tried to generate flow using plug in . Fore code with 23k lines of code I got only the following

workflow

The plug in recognizes only few sections for example:
PROCEDURE DIVISION USING
0-STEUERUNG SECTION.
EINGANG.
9-098-TRACE SECTION.
EINGANG.
AUSGANG.

Could be that a problem due to German language or something else? Java is installed and COBOL Language Support Plug in for VSCode.

Open-source?

Please consider to open the source-code of the tool. The openness

  • shares maintenance expenses with the community,
  • makes development more intensive,
  • rewards the authors of the dependencies,
  • inspires successors.

Open ANTLR files will help develop new tools for Enterprise COBOL ecosystem:

  • CobolLexer.g4
  • CobolParser.g4

Dependencies in use:

  • @babel/cli: MIT
  • @babel/core: MIT
  • @babel/preset-env: MIT
  • antlr4ts: BSD-3-Clause
  • antlr4ts-cli: antlr4ts-cli
  • codemirror: MIT
  • d3: BSD-3-Clause
  • del-cli: MIT
  • jest: MIT
  • jest-fetch-mock: MIT
  • jquery: MIT
  • lodash: MIT
  • node-fetch: MIT
  • npm-run-all: MIT
  • react: MIT
  • react-dom: MIT
  • react-scripts: MIT
  • service-worker-mock: MIT
  • sinon: BSD-3-Clause
  • ts-jest: MIT
  • ts-loader: MIT
  • ts-mock-imports: MIT
  • tslint: Apache-2.0
  • typescript: Apache-2.0
  • typescript-string-operations: MIT
  • vscode-extension-telemetry: MIT
  • webpack-cli: MIT

Differentiate the types of chaining visually

Hi,

Would it be possible to differentiate the different types of chaining in the graph by means of a link carrying visual information (an icon on the starting or ending point of the link, a color, use of a dash, etc.) :

  • GO TO (currently unmanaged)
  • PERFORM
  • CALL (currently unmanaged)

Unreachable Code is still graphed

Example Code:

   IDENTIFICATION DIVISION.
   PROGRAM-ID. HLLOWRLD
   DATA DIVISION. 

   WORKING-STORAGE SECTION. 
   01  USRNAME           PIC X(10).

   PROCEDURE DIVISION.
   0000-MAIN SECTION.
       PERFORM 1000-GET-NAME
       PERFORM 2000-TEST
       DISPLAY 'HELLO 'USRNAME
       GOBACK
       .
   1000-GET-NAME SECTION.
       ACCEPT USRNAME.
       PERFORM 1000-EXIT.
       PERFORM 2000-TEST.
   1000-EXIT.
       EXIT.
   2000-TEST SECTION.
       PERFORM 2000-EXIT.
   2000-EXIT.
       EXIT.

Example Graph:

image

Issue:

In 1000-GET-NAME, a perform to 1000-EXIT is done before 2000-TEST. 1000-EXIT does an EXIT, thus 2000-TEST will never be performed. However, the graph still has an arrow from 1000-GET-NAME to 2000-TEST.

Failed to load active editor

Hi,
I am giving a try to get flow using your plugin, but it seems not working properly with the code base I have.
For almost 22k LoC I get only one flow:
Cobol Flow Control

I have also installed the following Plugins: IBM Z Open Editor and Language Support

When I try to call "Generate COBOL Control Flow" through command palate, I got an error:

Failed to load active editor

Is there something wrong with code structure or with Plug In configuration?
Thanks a lot !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.