Can COBOL have multiple entry points in a program?

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Previous topicNext topic

Topic Author
Leena
Registered Member
Posts: 28
Joined: Fri Aug 09, 2013 10:17 pm
Zodiac: Leo

Can COBOL have multiple entry points in a program?

Post by Leena » Mon Sep 14, 2015 3:17 pm

Hi,

Can COBOL have multiple entry points in a program?



User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1338
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

Re: Can COBOL have multiple entry points in a program?

Post by Robert Sample » Mon Sep 14, 2015 5:49 pm

Research the ENTRY statement in the Enterprise COBOL Language Reference manual.




William Collins
Global Moderator
Global Moderator
Posts: 499
Joined: Sun Aug 25, 2013 7:24 pm

Re: Can COBOL have multiple entry points in a program?

Post by William Collins » Mon Sep 14, 2015 6:21 pm

And the answer is Yes, as long as you use static CALLs.

There is, however, no reason in a modern program to use multiple entrypoints.




Topic Author
Leena
Registered Member
Posts: 28
Joined: Fri Aug 09, 2013 10:17 pm
Zodiac: Leo

Re: Can COBOL have multiple entry points in a program?

Post by Leena » Mon May 23, 2016 5:26 pm

William Collins wrote:And the answer is Yes, as long as you use static CALLs.

There is, however, no reason in a modern program to use multiple entrypoints.
In past why we needed multiple entry points?




William Collins
Global Moderator
Global Moderator
Posts: 499
Joined: Sun Aug 25, 2013 7:24 pm

Re: Can COBOL have multiple entry points in a program?

Post by William Collins » Tue May 24, 2016 9:55 pm

Well, they were never really needed, in the sense that you could arrange to do the same thing another way. Unless you wanted to get really tortuous.

ENTRY-points would allow different "functions" to be processed by the same program with a logical division of the code, but exactly the same thing can be achieved just by CALLing the main entry-point with something to tell what logic is to be followed for that particular requirement (imagine OPEN, READ, CLOSE "functions" for a file, for instance).

Where things get really tangled with ENTRY-points is where there are different parameter lists for the different entry-points. This type of junk is only written by "cool" coders who think that if something exists, it's sensible to use it, even if two weeks later they themselves won't know what is going on in the program. With any programs like this, it is best to rewrite them rather than constantly getting caught by the same issues.




Topic Author
Leena
Registered Member
Posts: 28
Joined: Fri Aug 09, 2013 10:17 pm
Zodiac: Leo

Re: Can COBOL have multiple entry points in a program?

Post by Leena » Wed Mar 08, 2017 3:37 pm

Thanks. I think that's the reason that I have not seen many of such programs but manuals have a lot of details about them.



Previous topicNext topic

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”