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

Cobol Sub-Program and Main-Program


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Chetan Kumar

New User


Joined: 03 Dec 2012
Posts: 46
Location: India

PostPosted: Sat Oct 17, 2015 10:48 am
Reply with quote

How can we identify just by looking at the program whether the subprogram is called Statically or Dynamically? Except below one.

Calling the Literal value is Static call and Calling the Variable is a Dynamic Call. Does it holds good in all conditions??? (i.e. Irrespective of other compiler options in effect)

Is there any other way to identify the type of call just by looking at the program?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Oct 17, 2015 1:56 pm
Reply with quote

CALL identifier is always dynamic. CALL literal depends on compiler option.

Note, there is nothing special or different about a "main-program" or a "sub-proram" in COBOL. You can CALL an "main-program" it'll work just the same.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sat Oct 17, 2015 11:23 pm
Reply with quote

Quote:
Is there any other way to identify the type of call just by looking at the program?
Not without looking at the compile options -- a CALL literal may be a static call in one program and dynamic in another program based upon the compile options.
Back to top
View user's profile Send private message
Chetan Kumar

New User


Joined: 03 Dec 2012
Posts: 46
Location: India

PostPosted: Mon Oct 19, 2015 11:56 am
Reply with quote

Depends on what compiler options?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Oct 19, 2015 2:23 pm
Reply with quote

Whether DYNAM or NODYNAM is used.

This question has been asked many times. Didn't your search-engineing reveal anything?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Mon Oct 19, 2015 8:42 pm
Reply with quote

Code:
If compiled as NODYNAM:
CALL 'literal' is a static call
CALL WS-label is a dynamic call

If compiled as DYNAM:
CALL 'literal' is a dynamic call
CALL WS-label is a dynamic call


So answer to your original question is NO. we can't judge that by simply lookin at the program.
Back to top
View user's profile Send private message
Chetan Kumar

New User


Joined: 03 Dec 2012
Posts: 46
Location: India

PostPosted: Mon Oct 19, 2015 9:45 pm
Reply with quote

Basically my question is, In-spite of DYNAM or NODYNAM in effect. The way program is called : Literal or Identifier, does any other compiler option or any other parameter has effect on way of calling a program.


Also I think if we examine the loads, we can determine whether it is statically called or dynamically called.

Suggestions please
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Oct 19, 2015 9:56 pm
Reply with quote

Nothing else than what has been mentioned already affects whether a program is statically or dynamically CALLed. You cannot tell by looking at the source, end of story.

If you have a loadmodule (or Program Object with V5 of Enterprise COBOL) of course you can determine the difference. The code generated is different for static than for dynamic.

There must be another question underneath this, you've been clearly answered so far but are still looking...
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top