Giter Site home page Giter Site logo

cschneid-the-elder / mapa Goto Github PK

View Code? Open in Web Editor NEW
31.0 2.0 15.0 402.45 MB

mainframe application portfolio analysis, antlr4 grammars and java for static analysis of cobol+cics+db2, jcl

License: MIT License

Makefile 2.16% Java 45.22% ANTLR 51.36% Awk 0.88% Shell 0.38%
mainframe analysis application-portfolio cobol jcl application-portfolio-analysis static-analysis antlr4-grammar db2 sbom

mapa's People

Contributors

bmnascimento avatar cschneid-the-elder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mapa's Issues

x.COB file not COBOL?

I get following message at parsing a small (SQL) COBOL program at running the CobolTree under OMVS:

"[Tue Mar 29 08:48:42 GMT+01:00 2022] INFO: getprml0.cob not COBOL?"

I can run the same parsing under Windows for the program without any error.

Another question for the same running environment: how can I define the -file parameter for an OMVS file?
My guess was something like -file "//'my-mvs-file'"
...but the file name was not recognized by the app.

How can I use the JCLLexer file ?

Hi

Thanks for providing such a good Antlr Grammar for JCL

I'm just getting started of Grammar Parsing or Antlr4,
When I tried to get a Grammar Tree with JCLParser & JCLLexer , there are some Errors.
Mostly cause of [channels] statement at JCLLexer.g4 file

I've gooled and been told [channels] statement is not for all versions of Antlr4,
I'm using 4.7.1 , Is that the reason ?

Here is the Error Details:

Multiple markers at this line

  • parser rule 'channels' not allowed in lexer
  • missing RULE_COLON at '{ COMMENTS }'

asd

catch unhandled exceptions and continue processing

Hi,
i'm using the JCL parser to convert a set of files containing JCL to csv format. Not all input files contains a valid jcl and i the program halt with the error below.

Is there any way to log the errors without halting?

Thanks.

    Parser error line 128:11 mismatched input 'EXEC' expecting JOB
    Parser rule stack: [startRule, jcl, execJCL, jobCard]
    Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.antlr.v4.runtime.tree.TerminalNode.getSymbol()" because the return value of "JCLPPParser$JobCardContext.JOB()" is null
            at PPListener.enterJobCard(PPListener.java:66)
            at JCLPPParser$JobCardContext.enterRule(JCLPPParser.java:4975)
            at org.antlr.v4.runtime.tree.ParseTreeWalker.enterRule(ParseTreeWalker.java:50)
            at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:33)
            at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:36)
            at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:36)
            at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:36)
            at Demo01.lexAndParsePP(Demo01.java:260)
            at Demo01.main(Demo01.java:83)

New Parser for Shell

Hi, Do you have an Antlr4 parser/lexer for Linux Shell ?
KShell is the best.

BTW, thanks for providing JCL Parser 2 years ago,
It's very very helpful.

See more than one level deep for the tree visual of JCL

Hi,

I am wondering if it is at all possible to see more than one level deep for JCL files? Ie:

Imagining you have a JCL Proc named PROC001 that calls out to another PGM called FORMATPGM:

//PROC001  PROC                                                                 
//**********************************************************************        
//* S030 S040 - DELETE LAST RUN'S DATA FILES                                    
//**********************************************************************        
//*                                                                             
//S030     EXEC PGM=DELPROG,                                                    
//             PARM='GEN.CMP.DP.WEEKLY'                                    
//S040     EXEC PGM=DELPROG,                                                    
//             PARM='GEN.CMP.DP.WEEKLY'                                  
//*                                                                             
//**********************************************************************        
//* S050  - REFORMAT THE COMMA DELIMITED DP EXTRACT                 
//**********************************************************************        
//S050     EXEC PGM=FORMATPGM                                                    
//INP01    DD DSN=GEN.CMP.DS.FOO.WEEKLY,                                       
//            DISP=SHR                                                          
//OUT01    DD DSN=GEN.CMP.DP.WEEKLY.FALL,                                       
//            DISP=(NEW,CATLG,DELETE),                                          
//            UNIT=SYSDA,                                                       
//            SPACE=(CYL,(50,50),RLSE),                                         
//            RECFM=FB,LRECL=600,AVGREC=K                                       
//**********************************************************************        
//* S060  - REFORMAT THE COMMA DELIMITED DP EXTRACT               
//**********************************************************************        
//S060     EXEC PGM=FORMATPGM                                                    
//INP01    DD DSN=GEN.CMP.DS.BAR.WEEKLY,                                      
//            DISP=SHR                                                          
//OUT01    DD DSN=GEN.CMP.DP.WEEKLY.BAZ,                                     
//            DISP=(NEW,CATLG,DELETE),                                          
//            UNIT=SYSDA,                                                       
//            SPACE=(CYL,(50,50),RLSE),                                         
//            RECFM=FB,LRECL=600,AVGREC=K                                          

And the FORMATPGM file looks like the following:

      ******************************************************************        
      ******************************************************************        
       IDENTIFICATION DIVISION.                                                 
      ******************************************************************        
      ******************************************************************        
                                                                                
       PROGRAM-ID.     FORMATPGM.                                               
       AUTHOR.         AUTHOR NAME                                              
       INSTALLATION.   GENERIC ORGANIZATION.                                    
       DATE-WRITTEN.   MM/DD/YY.                                                
       DATE-COMPILED.                                                           
                                                                                
      ******************************************************************        
      * Changes and updates are noted here with generic descriptions.  *        
      ******************************************************************        
                                                                                
      ******************************************************************        
       ENVIRONMENT DIVISION.                                                    
      ******************************************************************        
                                                                                
      ******************************************************************        
       CONFIGURATION SECTION.                                                   
      ******************************************************************        
                                                                                
       SOURCE-COMPUTER.        GENERIC-COMPUTER.                                
       OBJECT-COMPUTER.        GENERIC-COMPUTER.                                
                                                                                
      ******************************************************************        
       INPUT-OUTPUT SECTION.                                                    
      ******************************************************************        
                                                                                
       FILE-CONTROL.                                                            
                                                                                
           SELECT INPUT-FILE                                                    
               ASSIGN TO INP01.                                                 
                                                                                
           SELECT OUTPUT-FILE                                                   
               ASSIGN TO OUT01.                                                 
                                                                                
      ******************************************************************        
       DATA DIVISION.                                                           
      ******************************************************************        
                                                                                
      ******************************************************************        
       FILE SECTION.                                                            
      ******************************************************************        
                                                                                
       FD  INPUT-FILE                                                           
           RECORDING MODE IS F                                                  
           LABEL RECORDS ARE STANDARD                                           
           BLOCK CONTAINS 0 RECORDS.                                            
                                                                                
       01  INPUT-FORMAT-RECORD       PIC X(600).                                
                                                                                
       FD  OUTPUT-FILE                                                          
           RECORDING MODE IS F                                                  
           LABEL RECORDS ARE STANDARD                                           
           BLOCK CONTAINS 0 RECORDS.                                            
                                                                                
       01  OUTPUT-FORMAT-RECORD      PIC X(600).                                
                                                                                
      ******************************************************************        
       WORKING-STORAGE SECTION.                                                 
      ******************************************************************        
                                                                                
       01  WS-PROGRAM-CONTROL.                                                  
           05  WS-END-OF-INPUT-FLAG      PIC X(01)  VALUE 'N'.                  
               88  WS-END-OF-INPUT                   VALUE 'Y'.                 
                                                                                
       01  WS-VARIABLES.                                                        
           05  WS-INPUT-DATA            PIC X(600).                            
                                                                                
       01  WS-OUTPUT-DATA.                                                      
           05  WS-DATA1                 PIC X(18).                             
           ...                          
           05  WS-DATA27                PIC X(18) VALUE SPACES.                 
      ******************************************************************        
      ******************************************************************        
       PROCEDURE DIVISION.                                                      
      ******************************************************************        
      ******************************************************************        
                                                                                
       MAIN-LOGIC.                                                              
           PERFORM INITIALIZE-PROCESS.                                          
           PERFORM PROCESS-LOOP UNTIL WS-END-OF-INPUT.                          
           PERFORM WRAP-UP.                                                     
           STOP RUN.                                                            
                                                                                
       INITIALIZE-PROCESS.                                                      
           OPEN INPUT INPUT-FILE.                                               
           OPEN OUTPUT OUTPUT-FILE.                                             
           PERFORM READ-INPUT-RECORD.                                           
                                                                                
       PROCESS-LOOP.                                                            
           UNSTRING WS-INPUT-DATA DELIMITED BY ","                              
               INTO WS-DATA1, ..., WS-DATA27.                                   
                                                                                
           INSPECT WS-OUTPUT-DATA REPLACING ALL X'0D' BY X'40'.                 
           WRITE OUTPUT-FORMAT-RECORD FROM WS-OUTPUT-DATA.                      
           PERFORM READ-INPUT-RECORD.                                           
                                                                                
       WRAP-UP.                                                                 
           CLOSE INPUT-FILE OUTPUT-FILE.                                        
                                                                                
       READ-INPUT-RECORD.                                                       
           READ INPUT-FILE INTO WS-INPUT-DATA                                   
             AT END SET WS-END-OF-INPUT TO TRUE.                                

I have provided the -include PATH.TO.FOLDER.CONTAINING.FORMATPGM in the command:

java -jar jcl/JCLParser.jar -include ../PATH.TO.FOLDER.CONTAINING.FORMATPGM -file ../PROCLIB/PROC001 -outtree PROC001.proclib.tsv -outcsv PROC001.proclib.csv  -logLevel FINEST -saveTemp

The output from running this, namely the PROC001.proclib.tsv, looks like the following:

   1   │ 
   2   │ PROC001
   3   │     S030    1   PGM DELPROG
   4   │     S040    2   PGM DELPROG
   5   │     S050    3   PGM FORMATPGM
   6   │     S060    4   PGM FORMATPGM

I was anticipating that FORMATPGM's definition would be parsed and unfurled in the tree as well, but it seems as though that may not be supported, at least for this given invocation of the JCL jar. Is there some way to get the parser to output an outtree that resolves the FORMATPGM tree, and any programs IT calls as well?

Thanks in advance!

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.