Can COBOL have multiple entry points in a program?

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Leena
Registered Member
Posts: 30
Joined: Fri Aug 09, 2013 10:17 pm

Can COBOL have multiple entry points in a program?

Post by Leena »

Hi,

Can COBOL have multiple entry points in a program?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post by Robert Sample »

Research the ENTRY statement in the Enterprise COBOL Language Reference manual.
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

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

Post by William Collins »

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.
Leena
Registered Member
Posts: 30
Joined: Fri Aug 09, 2013 10:17 pm

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

Post by Leena »

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: 490
Joined: Sun Aug 25, 2013 7:24 pm

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

Post by William Collins »

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.
Leena
Registered Member
Posts: 30
Joined: Fri Aug 09, 2013 10:17 pm

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

Post by Leena »

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.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

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