View previous topic :: View next topic
|
Author |
Message |
Lavanya_Dhushetty Warnings : 2 New User
Joined: 30 Aug 2007 Posts: 24 Location: Chennai
|
|
|
|
1.what happens if the called module issues STOPRUN command?
a.Cannot use STOP RUN in a called module.
b.None of the listed options
c.Execution of the entire program unit will be terminated
d.The called module execution will be terminated but the calling module will still be alive
e.The called module will be terminated and the control will come back to the calling module
2.What happens if goback is used instead of stoprun in main program?
a.while execution program goes into infinite loop.
b.while execution program encounters GOBACK it returns control to OS.
c.We cant compile program without STOPRUN
d.Erratic behaviour cannot be predicted.
e.none
Plsss I want the exact answer???No guesses |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Lavanya_Dhushetty wrote: |
I want the exact answer???No guesses |
What is your guess? |
|
Back to top |
|
|
amrita.chatterjee
New User
Joined: 27 Apr 2006 Posts: 48 Location: Bangalore, India
|
|
|
|
May be the answers are below:
Question:1
Answer: d
Question:2
Answer:e |
|
Back to top |
|
|
RamsIBM
New User
Joined: 08 Jan 2007 Posts: 53 Location: Chennai
|
|
|
|
1) c
2) b
Guys correct me if I am wrong |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
1 . C
2 . B |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
amrita.chatterjee wrote: |
May be the answers are below:
Question:1
Answer: d
Question:2
Answer:e |
I suggest that you review the GOBACK & STOP sections of the COBOL manual..... |
|
Back to top |
|
|
amrita.chatterjee
New User
Joined: 27 Apr 2006 Posts: 48 Location: Bangalore, India
|
|
|
|
RamsIBM, agkshirsagar has wriiten that
What happens if goback is used instead of stoprun in main program while execution program encounters GOBACK it returns control to OS. (Option B).
But I think this is wrong because, when the called module encounters GOBACK, control of the programs goes to calling module.
[/img] |
|
Back to top |
|
|
amrita.chatterjee
New User
Joined: 27 Apr 2006 Posts: 48 Location: Bangalore, India
|
|
|
|
From the MVS/Quickref 6.6
If control reaches a GOBACK statement while a CALL statement is active,
control returns to the point in the calling program immediately following
the CALL statement, as in the EXIT PROGRAM statement. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
amrita.chatterjee wrote: |
But I think this is wrong because, when the called module encounters GOBACK, control of the programs goes to calling module. |
And just who do you think is the "calling module" of the "main program"? It is the OS....... |
|
Back to top |
|
|
amrita.chatterjee
New User
Joined: 27 Apr 2006 Posts: 48 Location: Bangalore, India
|
|
|
|
Certainly not.
SAY Program A is calling Program B and after canning B program A is again calling C.
If Somebody will use GOBACK in Program B then control will again goback to A after execution of B.
OS is Z/OS obviously not the called module. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
amrita.chatterjee wrote: |
Certainly not. |
Learn to understand what you read.....
Quote: |
SAY Program A is calling Program B and after canning B program A is again calling C.
If Somebody will use GOBACK in Program B then control will again goback to A after execution of B. |
Correct, and when C does a goback, back to A......but who "called" A? The OS is Z/OS obviously not the called module, it is the "calling module"... |
|
Back to top |
|
|
BalaMuraliL
New User
Joined: 01 Aug 2007 Posts: 10 Location: Pune
|
|
|
|
Hi Lavanya,
Please find the below explanation of each & every option why & why not
1.What happens if the called module issues STOPRUN command?
Ans : C
Option A : Cannot use STOP RUN in a called module.
STOP RUN directs to the Operating System to terminate the execution of the entire program. So, If you use STOP RUN in called program, control wont gives to the calling program. STOP RUN directly transfer the control to Operating System. That is why, Opation A is not right answer. The concept of Calling and Called program is, calling program transfers the control to called prgram and as well expect the control back from called program to calling program.
Option B: None of the listed options ( Ignore it )
Option C: Execution of the entire program unit will be terminated
As i said in the Option A, STOP RUN directs to the Operating System to terminate the execution of the entire program. So, Execution of the entire program will be terminated. So, Option C is correct. It terminates entire execution.
Option D: The called module execution will be terminated but the calling module will still be alive
It's Wrong, As STOP RUN always gives the control to higher level program i.e Operating System. Once the called program execution terminates with STOP RUN, It will directs the control to OS and doesn't give the control to caling program. Once the control transfer to the OS, the calling program and called program won't be alive. So, It is wrong option.
Option E: The called module will be terminated and the control will come back to the calling module
It's agin Wrong. Yes, called module will be terminated with STOP RUN but, It wont gives the control to calling program.It always gives the control to higher level program i.e Operating System. So, control won't come back to calling program. But int the option E, they said control will come back to the calling program. So, it is wrong .
2.What happens if goback is used instead of stoprun in main program?
First of all let me explain you the two things....
STOP RUN : Control transfers to Higher Level of all the programs i.e OPERATING SYSTEM.
GOBACK: Control transfers to higher level of one program i.e One upperlevel of your program. i.e either calling or called program. if the control is in calling program, then , one upperlevel in the sence, highest program i.e Operating System. If the control is in called program, then control transfered to one upper level of program , it means, control transfered to calling program.
OS ---- ( Highest Level of All Programs )
|
First Level of Program ----- ( Calling Program )
|
Second Level of Program ( Called Program )
Option A : While execution program goes into infinite loop.
No, It wont go infinite loop. Becoz GOBACK will give the control to one upper level of program. So, Option A is not correct.
Option B: While execution program encounters GOBACK it returns control to OS.
Yes, GOBACK gives the control to OS. It is correct option.
Option C: We cant compile program without STOPRUN.
No, We can run the program without STOP RUN also. Instead of STOP RUN you can code GOBACK also. As, GOBACK transfers the control to OS, the OS treated as termination of the entire program.
Option D: Erratic behaviour cannot be predicted. (Ignore it)
Additional Note : EXIT PROGRAM is equalent to GOBACK. You can code in calling program and called program also. Both actions are similar!! |
|
Back to top |
|
|
Lavanya_Dhushetty Warnings : 2 New User
Joined: 30 Aug 2007 Posts: 24 Location: Chennai
|
|
|
|
Thanks for the detailed description. |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
Our shop standard here is to never ever use STOP RUN. All programs whether calling or called have GOBACK. |
|
Back to top |
|
|
|