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
 

 

Cobol Sub-Program and Main-Program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
Chetan Kumar

New User


Joined: 03 Dec 2012
Posts: 35
Location: India

PostPosted: Sat Oct 17, 2015 10:48 am    Post subject: Cobol Sub-Program and Main-Program
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Sat Oct 17, 2015 1:56 pm    Post subject: Reply to: Cobol Sub-Program and Main-Program
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: 7913
Location: Bellevue, IA

PostPosted: Sat Oct 17, 2015 11:23 pm    Post subject:
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: 35
Location: India

PostPosted: Mon Oct 19, 2015 11:56 am    Post subject: Reply to: Cobol Sub-Program and Main-Program
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Mon Oct 19, 2015 2:23 pm    Post subject: Reply to: Cobol Sub-Program and Main-Program
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

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Mon Oct 19, 2015 8:42 pm    Post subject:
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: 35
Location: India

PostPosted: Mon Oct 19, 2015 9:45 pm    Post subject: Reply to: Cobol Sub-Program and Main-Program
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Mon Oct 19, 2015 9:56 pm    Post subject: Reply to: Cobol Sub-Program and Main-Program
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    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
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am


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