Which of the following is not a valid Perform statement?
-
Perform Para-1
-
Perform Para-1 Thru Para-2
-
Perform Section-2 Section
-
Perform Para-1 20 times
In COBOL, you perform paragraphs or sections. 'Perform Section-2 Section' is invalid syntax because appending the word 'Section' after the name in a PERFORM statement is incorrect. The other statements are valid standard COBOL syntax formats.
To answer this question, we need to understand the syntax and usage of the Perform statement in a programming language.
The Perform statement is used to execute a section of code multiple times or until a specific condition is met. It can be used in different ways:
A. Perform Para-1: This syntax executes the paragraph or section named "Para-1" once.
B. Perform Para-1 Thru Para-2: This syntax executes the paragraphs or sections from "Para-1" to "Para-2" in sequence.
C. Perform Section-2 Section: This syntax is not valid. It is missing the "Thru" keyword, which is required when specifying a range of paragraphs or sections.
D. Perform Para-1 20 times: This syntax executes the paragraph or section named "Para-1" 20 times in sequential order.
Therefore, the correct answer is C. The statement "Perform Section-2 Section" is not a valid Perform statement because it is missing the "Thru" keyword.