Some FUN with GO TO



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Some FUN with GO TO

Postby sandeepan » Wed Oct 06, 2010 3:27 pm

Guys,
I want to understand the flow using GO TO. Can u guys tell me what will the displays in order for the below code .

   PROCEDURE DIVISION
   
   PERFORM A1.
   PERFORM B1.
   STOP RUN.
      
   
   A1   SECTION.

      DISPLAY 'A1 SECTION'.

   A11.
      DISPLAY 'A11 PARA'.
   A12.
      DISPLAY 'A12 PARA'.
   A13.
      DISPLAY 'A13 PARA '.
               
               EXIT.
       
       
        B1    SECTION.
       
        B11.
                 DISPLAY 'B11 PARA'.
        B12.
           DISPLAY'B12 PARA'.
           GO TO A12.
        B13.
           DISPLAY 'B13  PARA'.
           
           EXIT.
sandeepan
 
Posts: 2
Joined: Mon Jun 14, 2010 2:29 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Some FUN with GO TO

Postby Robert Sample » Wed Oct 06, 2010 4:41 pm

What do you think they will be?

Hint: you have an infinite loop defined in your code.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Some FUN with GO TO

Postby KRISHAN » Wed Oct 06, 2010 10:01 pm

it goes infinete loop............
KRISHAN
 
Posts: 6
Joined: Wed Oct 06, 2010 6:12 pm
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol