Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

About calling and called module

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: About calling and called module
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: 2150
Location: At my coffee table

PostPosted: Thu Sep 13, 2007 2:32 pm    Post subject: Re: About calling and called module
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    Post subject:
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    Post subject:
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: 685
Location: Earth

PostPosted: Thu Sep 13, 2007 2:51 pm    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Thu Sep 13, 2007 3:08 pm    Post subject:
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    Post subject:
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    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Thu Sep 13, 2007 4:41 pm    Post subject:
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    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Thu Sep 13, 2007 5:33 pm    Post subject:
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    Post subject: Reply to: About calling and called module
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    Post subject: Reply to: About calling and called module
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts How does a called pgm know if its cal... Graeme Westerman COBOL Programming 4 Tue Nov 29, 2016 9:25 pm
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am
No new posts Copybook structure in Load module Vai123 COBOL Programming 7 Fri Sep 16, 2016 8:29 pm
This topic is locked: you cannot edit posts or make replies. How to supply called sub-program from... dchristensen JCL & VSAM 25 Wed Sep 14, 2016 11:36 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us