Skip to main content

PERFORM-TYPE logic flow thru a program

  • December 29, 2014
  • 0 replies
  • 0 views

 We have a program that contains a PERFORM PARA1 THRU PARA1-EXIT, but when the EXIT is reached instead of returning to the statement after the PERFORM, the code falls thru to the next paragraph. Why is this happening?
 
 
 Re-compile your program to create a listing file showing all the directives. To do this use the additional directives of RAWLIST SETTING(COL) and LIST() to give you a complete listing file with all directives at the top.
 
 Look in the list for the PERFORM-TYPE directive. The list is alphabetic if you ignore the prefix of 'NO'. Check to see what option is used for the PERFORM-TYPE directive. This directive affects the flow of processing for PERFORM ranges. When an EXIT is encountered, IBM will honor it as an ending point for the perform range and so will the Micro Focus emulation of IBM’s mainframe dialects. The Micro Focus dialect will not treat the EXIT as an ending point. So if you are falling thru the EXIT in your code before you expect to return to the PERFORM range defined ending with that EXIT, then you are not passing the directive option you want to use.
 
 Here is the Help reference and a sample program that will explain the logic flow for the PERFORM-TYPE directive:
 
  Enterprise > Micro Focus Enterprise Developer 2.2 Update 1 for Eclipse > General Reference > Compiler Directives > Compiler Directives - Alphabetical List > PERFORM-TYPE
 
       IDENTIFICATION DIVISION.
       PROGRAM-ID.  LORINCE.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       77  A  PIC 9.
       77  B  PIC 9.
       PROCEDURE DIVISION.
       P1.
           DISPLAY ' STARTING PFMTYPE '
           MOVE 1 TO B
           PERFORM P2 THRU P2-EXIT
           PERFORM END-IBM.
       P2.
           DISPLAY ' IN P2 '
           PERFORM P3 THRU P3-EXIT
           PERFORM END-MICROFOCUS.
       P3.
           DISPLAY ' IN P3 '
           MOVE 1 TO A.
       P2-EXIT.
           EXIT.
       P3-EXIT.
           EXIT.
       END-MICROFOCUS.
           DISPLAY ' IN END-MICROFOCUS '
           STOP RUN.
       END-IBM.
           DISPLAY ' IN END-IBM '
           STOP RUN.
 
 With PERFORM-TYPE"ENTCOBOL" (or any mainframe dialect), the flow will go from paragraph P1 to the PERFORM P2 THRU P2-EXIT statement to P3 THRU P3-EXIT in paragraph P2 and once the EXIT in paragraph P2-EXIT is encountered, the flow will return to paragraph P1 where the next line will be the PERFORM END-IBM statement.
 
 When using PERFORM-TYPE"MF", the flow will be the same until the EXIT in paragraph P2-EXIT is encountered where the flow does not return to paragraph P1 but instead continues on to paragraph P3-EXIT where we will end the PERFORM range for PERFORM P3 THRU P3-EXIT. The next line will then be PERFORM END-MICROFOCUS.


#MFDS
#EnterpriseDeveloper

0 replies

Be the first to reply!