Function List for COBOL paragraph

Function List for COBOL paragraph

1
NewbieNewbie
1

    Jul 26, 2006#1

    Hi everyone,

    Is there a way to list all paragraph in a COBOL program in the function list.

    I have tried a few things, but....

    Here's a sample of a COBOL program and what I need to be in the function list:

    Code: Select all

          0000-XXDRPRIC.
               PERFORM 0100-INITIALISER THRU 0100-EXIT.
               PERFORM 0200-READ-TD      THRU 0200-EXIT.
               PERFORM 0300-VALIDER-PRINTER THRU 0300-EXIT.
               PERFORM 0400-ROUTE-PRINTER THRU 0400-EXIT.
               PERFORM 0500-SEND-FIRST-LIGNE THRU 0500-EXIT.
               MOVE SPACES TO CST-RAPPORT-FIN.
    
               PERFORM 0600-SEND-LIGNE THRU 0600-EXIT
                       UNTIL CST-RAPPORT-FIN = 'FIN'.
    
               GO TO 0000-XXDRPRIC.
    
          0000-EXIT.
               EXIT.
          0100-INITIALISER.
    
               SET CARO-IDX TO 1.
               MOVE 17 TO CST-P-LENGTH.
               SET CAR-IDX TO 1.
               MOVE 1 TO CST-SEND-FRST-IND.
               MOVE 8185 TO CST-Q-LENGTH.
               MOVE 0 TO CST-FF-IND.
    
               EXEC CICS LOAD PROGRAM('XXTBPRIA')
                              SET(ADDRESS OF COM-TABLE-TERMPRINT)
               END-EXEC.
               MOVE COM-PR-NB-OCC TO COM-PR-NB-OCC.
    
          0100-EXIT.
               EXIT.
    Keep in mind that there are characters preceding the code (column 1-7)

    It's not possible to highlight strings in a code block. So here are the lines which limits a function:

    0000-XXDRPRIC.
    :
    :
    :
    0000-EXIT.
    EXIT.

    0100-INITIALISER.
    :
    :
    0100-EXIT.
    EXIT.

    6,686585
    Grand MasterGrand Master
    6,686585

      Jul 26, 2006#2

      Try this where the number is included in the function list

      /Function String = "%[ ^t]++^([0-9]+-[0-9A-Z]+^)[ ^t]++."

      or this where only the name after the number is included in the function list

      /Function String = "%[ ^t]++[0-9]+-^([0-9A-Z]+^)[ ^t]++."

      The problem of these function strings is that the EXIT of the function is also in the function list. There is no possibility to search for a string which contains "..." but does not contain the string "???" with UltraEdit regular expression engine.


      I have only following ideas to exclude the EXIT lines from the function list.

      Variant 1: Find only function names which does not start with E.

      /Function String = "%[ ^t]++[0-9]+-^([~E][0-9A-Z]++^)[ ^t]++."

      Variant 2: Find only function names with a least 5 characters.

      /Function String = "%[ ^t]++[0-9]+-^([0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]+^)[ ^t]++."


      Wait a moment. We have up to 6 function strings. So we can include more without including EXIT.

      /Function String = "%[ ^t]++[0-9]+-^([~E][0-9A-Z]++^)[ ^t]++."
      /Function String 1 = "%[ ^t]++[0-9]+-^(E[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]+^)[ ^t]++."
      /Function String 2 = "%[ ^t]++[0-9]+-^(E^)[ ^t]++."
      /Function String 3 = "%[ ^t]++[0-9]+-^(E[0-9A-Z]^)[ ^t]++."
      /Function String 4 = "%[ ^t]++[0-9]+-^(E[0-9A-Z][0-9A-Z]^)[ ^t]++."
      /Function String 5 = "%[ ^t]++[0-9]+-^(E[~X][~I][~T]^)[ ^t]++."

      The first includes all function names not starting with E.
      String 1 includes all function names starting with E and has a length higher than 4.
      String 2 includes the function name E.
      String 3 includes all function names starting with E and has a length of 2.
      String 4 includes all function names starting with E and has a length of 3.
      String 5 includes all function names starting with E, has a length of 4 and the second character is not a X and the third character is not an I and the fourth character is not a T.

      With this set EXIT is excluded from the list and unfortunately also function names with exactly 4 characters like ESDT, EXKK, E0IF, ... But this is better than nothing, isn't it.


      If you have never a function with name "E", you can replace string 2 with following:

      /Function String 2 = "%[ ^t]++[0-9]+-^(E[0-9A-Z][~I][~T]^)[ ^t]++."

      This would include also function names with exactly 4 characters and where the second character could be also a X and 3rd character is not an I and 4th character is not a T.

      I hope you have understand the mechanism of these regular expressions and you can find the set of functions strings to include as many of your function names as possible without including EXIT.
      Best regards from an UC/UE/UES for Windows user from Austria