Menu

Last line before starting a new paragraph must ends with Dot "."

Help
2015-01-20
2015-01-21
  • Suman Saurabh

    Suman Saurabh - 2015-01-20

    Hi KrisDS,

    I was trying to parse below code koopa was failing due to it expecting last line before starting a new paragraph must ends with Dot "."
    "." is optional in COBOL before start of the paragraph, so please make it optional.

    Not working COBOL:

           IDENTIFICATION DIVISION.                                         
           PROGRAM-ID. MYTEST01.                                            
           AUTHOR.         SAURABH.                                           
          *                                                                 
           ENVIRONMENT DIVISION.                                            
          *                                                                 
           DATA DIVISION.                                                   
          *                                                                 
           WORKING-STORAGE SECTION.                                         
           01  WS-VARIABLES.                                                
               05  WS-ABC                    PIC  S9(16) COMP.              
               05  WS-PROGRAM                PIC   X(08).                   
               05  WS-RESP                   PIC  S9(08) COMP               
                                                         VALUE ZERO.        
    
           LINKAGE SECTION.                                                 
           PROCEDURE DIVISION USING SPL-COMMAREA.                           
               EXEC SQL INCLUDE ABCDEFGH END-EXEC                           
    
           100-PROCESS. 
    
           100-EXIT.
           EXIT. 
    

    Working COBOL :

           IDENTIFICATION DIVISION.                                         
           PROGRAM-ID. MYTEST01.                                            
           AUTHOR.         SAURABH.                                           
          *                                                                 
           ENVIRONMENT DIVISION.                                            
          *                                                                 
           DATA DIVISION.                                                   
          *                                                                 
           WORKING-STORAGE SECTION.                                         
           01  WS-VARIABLES.                                                
               05  WS-ABC                    PIC  S9(16) COMP.              
               05  WS-PROGRAM                PIC   X(08).                   
               05  WS-RESP                   PIC  S9(08) COMP               
                                                         VALUE ZERO.        
    
           LINKAGE SECTION.                                                 
           PROCEDURE DIVISION USING SPL-COMMAREA.                           
               EXEC SQL INCLUDE ABCDEFGH END-EXEC                           
           .
           100-PROCESS. 
    
           100-EXIT.
           EXIT.                                                            
    

    Regards
    Saurabh

     

    Last edit: Suman Saurabh 2015-01-21
  • KrisDS

    KrisDS - 2015-01-20

    Ugh; sometimes I wonder what people were thinking when designing Cobol...

    Could you make a an issue for this in the tracker ? I'm not sure when I'll get the time to fix this. And it will take some time for sure...

     
    • Simon Sobisch

      Simon Sobisch - 2015-01-20

      EXEC something is not part of the COBOL design, it's an extension. And I guess it's not a feature but a bug in the compiler originally used...
      So I think it may could be a good idea to fix the sources? In the hope to sound not too harsh: "If I pass a Lorem Ipsum text to Koopa it doesn't recognize COBOL" (some compiler may do this, recognizing all words as paragraph names)...

      BTW: For starting a paragraph there must not be any open sentences (and of course a sentence is finished with a dot).

      This both works (did not checked if Koopa get's both the section and paragraph name correct in sample two)

                  [...]
                  CONTINUE.
             *----------------------------------------------------
              some-sec SECTION.
              some-par.
      
                  [...]
                  CONTINUE.
             *----------------------------------------------------
              some-sec SECTION some-par.  *> no dot before some-par
      

      Simon

       
  • mahesh

    mahesh - 2015-01-21

    Saurabh,

    From what I know also, a period IS required before starting a new paragraph or section in COBOL grammar. Period is optional for the statements within Paragraphs, EXCEPT FOR the last statement. Quick ref: http://condor.depaul.edu/jpetlick/COBOL02.html - Where a period is required.

    Reading few COBOL dialect manuals would be required to re-confirm it. Compiling the code without a period before a Para name would be the quickest way to confirm.

    Which COBOL compiler and version r u using?

     
  • Suman Saurabh

    Suman Saurabh - 2015-01-21

    Hi,

    I tried to present sample based on the code which I received from Mainframe.
    I just wanted to present the problem here.

    I have a working COBOL source which is running on mainframe system, but when I am trying to use koopa to parse that source, it is failing since it doesn't have period in last line before starting a new paragraph.

    I think they are using COBOL 2 to compile the code.

    Regards
    Saurabh

     

Log in to post a comment.