Tuesday, December 6, 2011

Question about Sections in COBOL

I have a XXX-SECTION with PARA1,PARA2,PARA3,
and i execute a PERFORM statement to PARA3 before SECTION,          

1. Will PARA1 and PARA2 be executed before PARA3 
2. Will PARA3 be executed directly

Answers

1. No, if you had PERFORM PARA3, then only PARA3 will be executed. PARA1 and PARA2 won't.

2. Yes, PARA3 will be executed directly. 

  That is, "PERFORM paragraph-name" executes only that paragraph, even if it appears in a section, but "PERFORM section-name" executes all the paragraphs the section has.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.