Can we use goto statement in inline_perform ?

Answers were Sorted based on User's Feedback



Can we use goto statement in inline_perform ?..

Answer / sivakumar sekharannair

Yes go to can be used in inline perform. when GO TO is used
in inline perform then irrespective of the number of times
the perform has to execute.. the control will go to GO TO.
example:
PERFORM VARYING A1 FROM 1 BY 1 UNTIL A1 > 4
DISPLAY 'SIVAKUMAR'
GO TO DISPLAY-PARA
END-PERFORM.

DISPLAY-PARA
DISPLAY 'KUMAR'.

SYSOUT:
SIVAKUMAR
KUMAR

Instead of
SIVAKUMAR
SIVAKUMAR
SIVAKUMAR
SIVAKUMAR


Actually the perform has to execute 4 times and so the
display should be executed 4 times. but because GO TO is
given inside the inline perform the control goes to display-
para and and dose not come back.

Is This Answer Correct ?    16 Yes 0 No

Can we use goto statement in inline_perform ?..

Answer / shan

The example used by Sivakumar is perfect,

Perform is used for looping, so it should have a exit
condition. simply perform and end perform wont make wright
syntax.

another kind of perform is

PERFORM <paragraph name> until < conditions>

Is This Answer Correct ?    4 Yes 0 No

Can we use goto statement in inline_perform ?..

Answer / chaitanya

could u please clarify d perform which was specified
PERFORM VARYING A1 FROM 1 BY 1 UNTIL A1 > 4
is inline perform??
I think the format of inline perform is...


perform
...
....
,,,
end perform.

Is This Answer Correct ?    3 Yes 1 No

Can we use goto statement in inline_perform ?..

Answer / rajesh

In-line PERFORMs work as long as there are no internal GO
TOs, not even to an exit.

Is This Answer Correct ?    2 Yes 0 No

Can we use goto statement in inline_perform ?..

Answer / sroul4

The format of inline perform is...


perform
...
....
Go TO para2
display' inline perform'
end perform.

Para2

you can put a GO TO but the control would pass to the go to
label , and it would not display inline perform.

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More COBOL Interview Questions

if someone is using my file,how can i find which user id is using?

4 Answers  


I have two questions here. 1. How to read a flat file in reverse order? 2. How to read a VSAM KSDS file in reverse order? In both the cases we donot know the total number of records.

2 Answers   L&T,


SSRange is used to do a range check on which of the Following. SUBSCRIPT,INDEX,REFERENCE MODIFICATION,Run-time option.

3 Answers   Lehman Brothers,


HOW WE WILL SORT THE ARRAY WHICH IS GOING TO USE FOR SEARCH ALL?

2 Answers   Cap Gemini,


When is a scope terminator mandatory?

3 Answers  






What is the difference between PIC 9.99 and 9v99?

7 Answers  


What is the difference between a binary search and a sequential search? What are the pertinent cobol commands?

0 Answers  


01 var1 pic x(10) 01 var2 redefines var1 pic 9(10). then in procedure division move 'abcde' to var1 then waht is the value of var1 and var2

9 Answers   HSBC,


What is the Purpose of Pointer in the string?

0 Answers  


How to know whether the module is dynamical or statistical?

0 Answers  


What are the differences between OS VS COBOL and VS COBOL II?

1 Answers   IBM,


Which of the following EDITind and PICTURE symbols is to be used if a minus(-) is to appear before the value if the value is -ve and a plus(+) is to appear before the value if the value is +ve? (a) + (b) - (c) + OR (d) It is not possible

7 Answers   TCS,


Categories