Saturday, December 12, 2009

How will work GOBACK statement & STOP RUN & EXIT-PROGRAM in COBOL ?

Question :How will work GOBACK statement & STOP RUN & EXIT-PROGRAM in COBOL ?


Answers :


goback 
- When specified in main program, will act like stop run. i.e give control back too O.S
- When specified in sub-program, will give control back to main program

Exit-program
- When specified in main program, will throw abend4038 (compilation) error, since it wont give the control back to the O.S
- When specified in sub-program, will give control back to main program

stop run 
- Will stop the current program and give control back to O.S (even in sub-program)



Answer2:


GOBACK gives the controll to main program if we have called the subprogram from the main program.

STOP RUN: This statement halts the execution of the object program and returns control to the system.

EXIT-PROGRAM: This statement specifies the end of a called program and returns control to the calling program.