Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Can we use multiple program-id in a single COBOL program?

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sbprem1

New User


Joined: 05 Mar 2010
Posts: 5
Location: Chennai

PostPosted: Fri Mar 05, 2010 1:48 pm    Post subject: Can we use multiple program-id in a single COBOL program?
Reply with quote

Please resolve this: Is it possible to use multiple PROGRAM-IDs in as single COBOL program?
Back to top
View user's profile Send private message

PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2442
Location: Netherlands, Amstelveen

PostPosted: Fri Mar 05, 2010 1:50 pm    Post subject:
Reply with quote

Well Prem, why dont you resolve it yourself?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Fri Mar 05, 2010 2:07 pm    Post subject: Re: Can we use multiple program-id in a single COBOL program
Reply with quote

sbprem1 wrote:
Please resolve this: Is it possible to use multiple PROGRAM-IDs in as single COBOL program?
What?
Why?
Huh?
Say again?
Please explain?
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Mar 05, 2010 5:03 pm    Post subject:
Reply with quote

With IBM Enterprise COBOL for z/OS 3.4.1 you'll get a syntax-error, saying A duplicate "PROGRAM-ID" paragraph header was found.

Well, Manuals say - COBOL programs are divided into DIVISIONS and SECTIONS which, depending upon the specific DIVISION and SECTION and the requirements of the specific program, may be further divided into paragraphs. Each paragraph is preceded by a paragraph name which may appear only once in a given SECTION. In this case "PROGRAM-ID" appears more than once in the same SECTION. So the indicated duplicate paragraph name was ignored.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Mar 05, 2010 5:06 pm    Post subject:
Reply with quote

But even if that was possible why would one like to call some program with two different names? Shakespers's famous quote does not fit well at all the places - COBOL just does not like duplicate names... icon_smile.gif
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Fri Mar 05, 2010 6:05 pm    Post subject:
Reply with quote

Check the Cobol Reference Manual, Part 2. Cobol Source Unit Structure. That will answer your question, or at least give you the knowledge to place a more qualified question here.

Also, if you intend to have multiple entry points in your source module, you should reference the ENTRY statement in the same manual.

Lastly, do confirm your intentions with your installation or development support, as introducing multiple modules in the same source deck (pds-member) can cause conflict in some (most) source library systems. I think you should have an explicit architectural requirement to exploit these possibilities.
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Fri Mar 05, 2010 6:07 pm    Post subject:
Reply with quote

The answer to the original question is either YES or NO, depending on what is meant by the term "program". In a single program unit, the answer is NO, but in a "nested" program, the answer is YES. From the Enterprise COBOL Language Reference Manual (sic):

A COBOL program can contain other COBOL programs, which in turn can contain still other COBOL programs. These contained programs are called nested programs. Nested programs can be directly or indirectly contained in the containing program. Nested programs are not supported for programs compiled with the THREAD option. In the following code fragment, program Outer-program directly contains program Inner-1. Program Inner-1 directly contains program Inner-1a, and Outer-program indirectly contains Inner-1a:
Code:
Id division.
Program-id. Outer-program.
  Procedure division.
    Call "Inner-1".
    Stop run.
Id division.
Program-id. Inner-1
  ...
    Call Inner-1a.
    Stop run.
Id division.
Program-id. Inner-1a.
  ...
  End Inner-1a.
  End Inner-1.
End Outer-program.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2442
Location: Netherlands, Amstelveen

PostPosted: Fri Mar 05, 2010 6:10 pm    Post subject: Re: Can we use multiple program-id in a single COBOL program
Reply with quote

sbprem1 wrote:
Please resolve this: Is it possible to use multiple PROGRAM-IDs in as single COBOL program?


Am i missing something? Thought this site is to give help in solving others
problems they came across AFTER doing something.

The only thing i did see the TS DO is saying "please resolve this".
I almost got fooled by the word "please"
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Fri Mar 05, 2010 6:19 pm    Post subject:
Reply with quote

Ronald Burr wrote:
The answer to the original question is either YES or NO, depending on what is meant by the term "program". In a single program unit, the answer is NO, but in a "nested" program, the answer is YES.

You can provide multiple entry points into a single program. Execution will start at the statement following the ENTRY statement.

This construct can be used to provide alternative linkage areas to a module, or it can be used to execute completely different paths in your module. The last option is not recommended (by me , at least). If you have different functionalities, make different modules!
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Fri Mar 05, 2010 6:29 pm    Post subject: Re: Can we use multiple program-id in a single COBOL program
Reply with quote

PeterHolland wrote:
sbprem1 wrote:
Please resolve this: Is it possible to use multiple PROGRAM-IDs in as single COBOL program?


Am i missing something? Thought this site is to give help in solving others
problems they came across AFTER doing something.

The only thing i did see the TS DO is saying "please resolve this".
I almost got fooled by the word "please"

I think it is allright to seek the advice of the forum on one's intentions, only in this case the topic poster have offended the forum by putting a very general question that could easily be answered by COBOL manuals. icon_confused.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
No new posts ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us