Search code examples
cobol

In Cobol why would you have a PERFORM THRU with non existent paragraph names


I am trying to figure out what the purpose of the PERFORM command is below. Code was written 20 years ago. ACPY-READ-FIRST, ACPY-READ-NEXT, and ACPY-EXIT don't exist anywhere in the program.

  MOVE ACPY-ID                TO WS-ACPY-ID.
       PERFORM ACPY-READ-FIRST THRU ACPY-EXIT.
   150-PYMTS.
       PERFORM ACPY-READ-NEXT  THRU ACPY-EXIT.
       IF  NOT SUCCESSFUL      OR
           ACCT-ID NOT = ACPY-ACCT-ID
               GO TO 160-DONE.

Solution

  • Answer: You wouldn't as this would create a syntax error with every compiler.

    The paragraphs (or even sections, but I'd look for the former) have to be somewhere in the source unit, I'd say: 95% likeliness to find it in a copybook named in the COPY statement (= COBOL's "include"), 4% that it is inserted by a code generator that was used to process this and 1% that you've just overlooked it (COBOL is case-insensitive, just in case).

    Hint: If you have all necessary sources you can use GnuCOBOL to process it and create a listing which shows you the copybook it the paragraphs are included in.