Trusted Contributor.
Trusted Contributor.
140 views

Both F10 and F11 steps into sub routine when debugging

I have a INT/GNT Project consisting of a two files: Program1.cbl and SubRoutine1.cbl. I call SubRoutine1 from Program1 with a simple CALL statement.

Now, when I debug it doesn't matter if I press F10 or F11; the debugger will step into the sub routine in both cases. Is it supposed to be that way?

0 Likes
9 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Both F10 and F11 steps into sub routine when debugging

You need to open the project properties, open the Debug settings, and change the Start project output setting from the subprogram to the calling program.

Fano_MF_0-1585148560511.png

 

–Ғɑɳօ
0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Both F10 and F11 steps into sub routine when debugging

The example given above was wrong; that example works. But this one won't. If you press F10 on the line below *> 1 then the debugger will stop on the line below *> 2. The problem seems to occur when a subroutine calls Another subroutine. But maybe this is by design?

 

Program1.cb

 

       IDENTIFICATION DIVISION.

       PROGRAM-ID. PROGRAM1.

 

       DATA DIVISION.

       WORKING-STORAGE SECTION.

       01 W23-SR1-PARAM.

         05 W23-SR1-FILENAME PIC X(255).

       01 W23-SR1-ERROR  PIC 9(4) COMP-X.

 

       PROCEDURE DIVISION.

           INITIALIZE W23-SR1-PARAM.

           INITIALIZE W23-SR1-ERROR.

 

           MOVE "TEST" TO W23-SR1-FILENAME.

 

           *> 1

           CALL "SubRoutine1" USING W23-SR1-PARAM

                                    W23-SR1-ERROR.

           IF W23-SR1-ERROR = ZERO

               DISPLAY "Succesful call to SubRoutine1"

           ELSE

               DISPLAY "Call to SubRoutine1 failed for "

                   W23-SR1-FILENAME UPON SYSERR

           END-IF.

 

       END PROGRAM PROGRAM1.

 

SubRoutine1.cbl

 

       IDENTIFICATION DIVISION.

       PROGRAM-ID. SUBROUTINE1.

 

       DATA DIVISION.

       WORKING-STORAGE SECTION.

       01 W23-SR2-PARAM.

         05 W23-SR2-FILENAME PIC X(255).

       01 W23-SR2-ERROR  PIC 9(4) COMP-X.

 

       LINKAGE SECTION.

       01 W23-SR1-PARAM.

         05 W23-SR1-FILENAME PIC X(255).

       01 W23-SR1-ERROR  PIC 9(4) COMP-X.

 

       PROCEDURE DIVISION USING W23-SR1-PARAM W23-SR1-ERROR.

           INITIALIZE W23-SR2-PARAM.

           INITIALIZE W23-SR2-ERROR.

 

           IF W23-SR1-FILENAME = "TEST"

               MOVE W23-SR1-FILENAME TO W23-SR2-FILENAME

               CALL "SubRoutine2" USING W23-SR2-PARAM

                                        W23-SR2-ERROR

               *> 2

               IF W23-SR2-ERROR = 0

                   MOVE 0 TO W23-SR1-ERROR

               ELSE

                   MOVE W23-SR2-ERROR TO W23-SR1-ERROR

               END-IF

           ELSE

               MOVE 9 TO W23-SR1-ERROR

           END-IF.

 

       END PROGRAM SUBROUTINE1.

 

SubRoutine2.cbl

 

       IDENTIFICATION DIVISION.

       PROGRAM-ID. SUBROUTINE2.

 

       DATA DIVISION.

       WORKING-STORAGE SECTION.

       LINKAGE SECTION.

       01 W23-SR2-PARAM.

         05 W23-SR2-FILENAME PIC X(255).

       01 W23-SR2-ERROR  PIC 9(4) COMP-X.

 

       PROCEDURE DIVISION USING W23-SR2-PARAM W23-SR2-ERROR.

           IF W23-SR2-FILENAME = "TEST"

               MOVE 0 TO W23-SR2-ERROR

           ELSE

               MOVE 9 TO W23-SR2-ERROR

           END-IF.

 

       END PROGRAM SUBROUTINE2.

 

0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Both F10 and F11 steps into sub routine when debugging

And, which I forgot to mention, Start Project Output is set to Program1.int.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Both F10 and F11 steps into sub routine when debugging


@Jens Forsberg wrote:

The example given above was wrong; that example works. But this one won't. If you press F10 on the line below *> 1 then the debugger will stop on the line below *> 2. The problem seems to occur when a subroutine calls Another subroutine. But maybe this is by design?

If I press F10 on the line below *> 1, which is the following:

           CALL "SubRoutine1" USING W23-SR1-PARAM

                                    W23-SR1-ERROR.

It runs through the call and stops at the following line as expected:

           IF W23-SR1-ERROR = ZERO

If I press F11 from the beginning to step line by line, it follows the logic as expected (Program1 calls SubRoutine1 > SubRoutine1 calls Subroutine2 > SubRoutine2 returns to SubRoutine1 > SubRoutine1 returns to Program1 > Program1 stops run).

My project is attached if you wish to test it.

–Ғɑɳօ
0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Both F10 and F11 steps into sub routine when debugging

Then I suppose our Visual COBOLs are set up in different ways because when I debug your solution I get exactly the same behaviour: I press F10 on the line below *> 1 and the debugger stops on the line below *> 2.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Both F10 and F11 steps into sub routine when debugging

What is the version of Visual COBOL and its Patch Update level?

Is it Visual COBOL for Visual Studio Personal Edition?

What is the version of Visual Studio and its update level?

–Ғɑɳօ
0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Both F10 and F11 steps into sub routine when debugging

This is interesting:

  1. Open Program1.cbl in the text editor.
  2. Press F11 to start the program.
  3. After the program has started, press F10 for each line until the program stops. The program will NOT step into SubRoutine1. In other words, the debugger will act just as expected.

Now do this:

  1. Open Program1.cbl in the text editor.
  2. Put the cursor on the line below *> 1 and press Ctrl + F10 (run to cursor).
  3. After the program has started and stopped on the line below *> 1, press F10. The program will now enter SubRoutine1 and stop on the line below *> 2.

 

 

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Both F10 and F11 steps into sub routine when debugging

I see what you mean now. I can now reproduce the problem by:

  1. Hitting F11 or F10 to start debugging
  2. Running to cursor on the CALL statement
  3. Hitting F10 on the CALL statement

or:

  1. Setting a breakpoint on the CALL statement
  2. Hitting F5 to start debugging
  3. Hitting F10 on the CALL statement

If you are using a paid license, can you please report this issue with your local Micro Focus Support? 

–Ғɑɳօ
0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Both F10 and F11 steps into sub routine when debugging

I'll do that. Thanks for your help.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.