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

Dynamic calls to ENTRY points in COBOL


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Wed Sep 28, 2011 8:35 am
Reply with quote

Hi,

I am trying to make a dynamic call from ProgramA to EntryB. EntryB is an ENTRY point defined in the programB as ENTRY EntryB. When I try to run the program, the job fails with the abend code S806 & I get the following error message.

Code:
CEE3501S The module ENTRYB was not found.
          From compile unit ABCCALNG at entry point ABCCALNG at compile unit offset +00000424 at entry offset +00000424 at address 19800B44.


I am not sure how can I create the load module for the ENTRY point ENTRYB.

Any guidance in solving this would be really appreciated. Thanks
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Sep 28, 2011 9:41 am
Reply with quote

the first quick and dirty rule is that the entry point must be the load module name
that' s what You see
just think about it, how in heaven is <cobol> supposed to determine the load module name...
plainly and simply from the name of the entry point called...

quoting the manual
Quote:
The program-name in the PROGRAM-ID paragraph or ENTRY statement must be identical to the corresponding load module name or load module alias of the load module that contains the program.


so if You have a load module with multiple entry points You must define at linkage editor/binder time as many aliases for that load as the number of <externalized> entry point names

after that cobol will load a module using the name corresponding to the entry point name
and giving the module the proper alias does the trick

but beware, the manuals also tells
Quote:
Restrictions: You cannot make dynamic calls to:
More than one entry point in the same COBOL program (unless an intervening CANCEL statement was executed)


I strongly recommend to read and understand the manual for the whole shebang

You can choos the manual for You cobol version/release starting from here
www-03.ibm.com/systems/z/os/zos/bkserv/zappls2.html
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: Wed Sep 28, 2011 10:52 am
Reply with quote

Seperate ENTRY points in Cobol have been out of favour with good programming practice for some time.

Do you have a really specific task which has to be accomplished with an ENTRY point?

If so, how come you don't know how to use it, even though, as enrico points out, the manual covers the topic?

If you don't have something specific, I'd suggest not using an ENTRY point.

If you have a module which provides multiple functions, requiring distinct parts of the program to be executed depending on the call yet sharing the same DATA DIVISION, there is absolutely no problem in handling this with a flag/indicator/parameter whatever you want to call it. Test at the "top" of the program, send the stuff on their seperate routes via performs. All return on completion to a single point, where you might find other things to do but where you at least GOBACK/RETURN.
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Wed Sep 28, 2011 6:44 pm
Reply with quote

Thanks very much for your inputs. I do not have any specific functionality to perform using this. or rather I am not implementing a new functionality at all. I am currently working on an maintenance project which involves converting all the static calls in the current application to dynamic calls. As I was involved in the analysis for the same, I encountered this scenario and was wondering how can I achieve this.
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: Wed Sep 28, 2011 7:02 pm
Reply with quote

Do NOT convert the static calls to dynamic calls. As you have already discovered, there will be side effects, not to mention you will have to make code changes -- such as the CANCEL statement required as per enrico's post -- and the future maintenance will be more complicated.
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Wed Sep 28, 2011 7:08 pm
Reply with quote

Thanks Robert for your response. I was always under the impression that converting static to dynamic calls can minimize the maintenance involved because of making every module stand-alone. Though the modules involving ENTRY points is a new lesson for me, I am attracted towards your words that states that the future maintenance will be more complicated because of this. I am just curious to know more disadvantages of converting the static calls to dynamic calls in terms of the mainenance issues. Is there any article that you can guide me to in this regard ?
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: Wed Sep 28, 2011 7:21 pm
Reply with quote

The best thing would be to get rid of all the entry-points, re-design, re-write, change all the calls to the single main entry (program-id). Then you can proceed with the original plan.

Of course, the number of modules and effort involved may preclude this. Then you may end up with a mix of static and dynamic, so you always have to redo the all the loads involved when the module changes.

There may be no clearcut answer to which leads to less maintenance for a given site, because it depends how all the stuff hangs together already. If you have only five load modules representing your entire batch run, yet each contains several hundred modules, static might suit better. If all are basically stand-alone, just using modules for general-purpose stuff, then dynamic might suit better.

If you have some dodgy old code with entry points in....?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Sep 28, 2011 7:26 pm
Reply with quote

my extra .02 €
if You have to go for full flexibility split everything...
one function/subroutine <==> one entry point <==> one load module
it might avoid fights on how to code the function vectors
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: Wed Sep 28, 2011 7:34 pm
Reply with quote

The general statement is that dynamic calls may reduce future maintenance, but it depends upon the specifics. The specifics of your situation indicate that maintenance would be worse -- since you would not only have to keep track of every ENTRY point for every source, but you would also have to ensure the linkage edit / binding process for every source included the appropriate aliases. The increased things to maintain and track indicate that maintenace for your specific situation would most likely be worsened by moving from static to dynamic calls, not to mention the initial overhead of adding the CANCEL statements to every program issuing a CALL.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Sep 28, 2011 9:14 pm
Reply with quote

my cent-and-a-half:

found little use for entry points in application code,
since moving to MVS from DOS last century.

as Bill inidcated,
rewrite the programs that have entry points,
and join the 21st century and do everything dynamically.

The only thing worse than a statically CALLed system
is some static and some dynamic.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
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
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top