IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

About calling and called module


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Lavanya_Dhushetty
Warnings : 2

New User


Joined: 30 Aug 2007
Posts: 24
Location: Chennai

PostPosted: Thu Sep 13, 2007 2:20 pm
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Sep 13, 2007 2:32 pm
Reply with quote

Lavanya_Dhushetty wrote:
I want the exact answer???No guesses
What is your guess?
Back to top
View user's profile Send private message
amrita.chatterjee

New User


Joined: 27 Apr 2006
Posts: 48
Location: Bangalore, India

PostPosted: Thu Sep 13, 2007 2:44 pm
Reply with quote

May be the answers are below:

Question:1

Answer: d

Question:2

Answer:e
Back to top
View user's profile Send private message
RamsIBM

New User


Joined: 08 Jan 2007
Posts: 53
Location: Chennai

PostPosted: Thu Sep 13, 2007 2:50 pm
Reply with quote

1) c

2) b

Guys correct me if I am wrong
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Sep 13, 2007 2:51 pm
Reply with quote

1 . C
2 . B
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Sep 13, 2007 3:08 pm
Reply with quote

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
View user's profile Send private message
amrita.chatterjee

New User


Joined: 27 Apr 2006
Posts: 48
Location: Bangalore, India

PostPosted: Thu Sep 13, 2007 3:22 pm
Reply with quote

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
View user's profile Send private message
amrita.chatterjee

New User


Joined: 27 Apr 2006
Posts: 48
Location: Bangalore, India

PostPosted: Thu Sep 13, 2007 3:24 pm
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Sep 13, 2007 4:41 pm
Reply with quote

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
View user's profile Send private message
amrita.chatterjee

New User


Joined: 27 Apr 2006
Posts: 48
Location: Bangalore, India

PostPosted: Thu Sep 13, 2007 5:23 pm
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Sep 13, 2007 5:33 pm
Reply with quote

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
View user's profile Send private message
BalaMuraliL

New User


Joined: 01 Aug 2007
Posts: 10
Location: Pune

PostPosted: Thu Sep 13, 2007 6:23 pm
Reply with quote

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
View user's profile Send private message
Lavanya_Dhushetty
Warnings : 2

New User


Joined: 30 Aug 2007
Posts: 24
Location: Chennai

PostPosted: Mon Sep 17, 2007 6:59 pm
Reply with quote

Thanks for the detailed description.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Mon Sep 17, 2007 11:26 pm
Reply with quote

Our shop standard here is to never ever use STOP RUN. All programs whether calling or called have GOBACK.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Calling Java method from batch COBOL ... COBOL Programming 5
No new posts Calling an Open C library function in... CICS 1
No new posts calling a JCl inside a JCL JCL & VSAM 3
No new posts step by step trace 4 ISPF dialog call... TSO/ISPF 17
Search our Forums:

Back to Top