Can COBOL have multiple entry points in a program?

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

Topic author
Leena
Registered Member
Posts: 23
Joined: Fri Aug 09, 2013 10:17 pm
Has thanked: 2 times

Can COBOL have multiple entry points in a program?

Postby 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: 1184
Joined: Fri Jun 28, 2013 1:22 am
Location: East Dubuque Illinois
Has thanked: 2 times
Been thanked: 72 times

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

Postby 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: 498
Joined: Sun Aug 25, 2013 7:24 pm
Has thanked: 1 time
Been thanked: 22 times

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

Postby 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: 23
Joined: Fri Aug 09, 2013 10:17 pm
Has thanked: 2 times

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

Postby 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: 498
Joined: Sun Aug 25, 2013 7:24 pm
Has thanked: 1 time
Been thanked: 22 times

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

Postby 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: 23
Joined: Fri Aug 09, 2013 10:17 pm
Has thanked: 2 times

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

Postby 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.




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

Who is online

Users browsing this forum: CommonCrawl [Bot] and 2 guests