RAMESH KRISHNA REDDY mainframe discussion forum - cobol, db2,cics,jcl,file-aid,changeman,interview questions
Online Tutorials   | PREV  | TOP  | NEXT


GOTO Statement


GO TO Statement

GO TO statement GO TO statement permanently transfers control from one part of program to other part of program. Format. GO TO Paragraph-name. Example - PROCEDURE DIVISION. MAIN-PARA. DISPLAY 'MAINPARA STARTS HERE'. GO TO PARA-1. DISPLAY 'A VALUE ', A. STOP RUN. PARA-1. COMPUTE A = B + C. cobol go to statement In above exmaple, control first executes the DISPLAY statement to display the string ' MAINPARA STARTS HERE' , then control executes GO TO statement, now control will go to PARA-1 and executes COMPUTE statement. that's it. control wont come back to next statement after GO TO, because control permanently transfered to PARA-1 - Structured programming languages techniques suggest to avoid using GO TO , use PERFORM instead - Programmer may face more logic errors with GO TO compare than PERFORM - Readability of programs goes down, if we use more GO TO statements in the program



Previous chapter in COBOL tutorial Starting of COBOL tutorial Next chapter in COBOL tutorial

Visit COBOL books section in this site for good books

Home | Donations | Online Tutorials | Books | Entertainment | Contactme | privacy |  sql tutorial | jcl interview questions | JCL Tutorial | JCL Tutorial - chapter1 | JCL Tutorial - chapter2 | JCL Tutorial - chapter3 | JCL Tutorial - chapter4 | JCL Tutorial - chapter5 | JCL Tutorial - chapter6 | JCL Tutorial - chapter7 | JCL Tutorial - chapter8 | JCL Tutorial - chapter9 | JCL Tutorial - chapter10 | JCL Tutorial - chapter11