MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Mainprogram or subprogram

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
iknow
Beginner


Joined: 09 Jan 2006
Posts: 39
Topics: 15
Location: Inside the MATRIX

PostPosted: Fri Jan 13, 2006 10:22 am    Post subject: Mainprogram or subprogram Reply with quote

Hi Folks,

Please clarify my doubt.

How to identify is this MAINPROGRAM or SUBPROGRAM by seeing application program without using JCL?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Jan 13, 2006 11:57 am    Post subject: Reply with quote

iknow,

Look at the procedure division statement

If the procedure Division has an USING clause then it is a subprogram or else it is a main program.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bithead
Advanced


Joined: 03 Jan 2003
Posts: 550
Topics: 23
Location: Michigan, USA

PostPosted: Fri Jan 13, 2006 1:06 pm    Post subject: Reply with quote

Unless the program is IMS when all main programs have a USING statement. Also, "Main" programs can be called as subroutines.
Back to top
View user's profile Send private message
iknow
Beginner


Joined: 09 Jan 2006
Posts: 39
Topics: 15
Location: Inside the MATRIX

PostPosted: Sat Jan 14, 2006 5:12 am    Post subject: Reply with quote

Hi,

Adding to what Kolusu said, a subprogram doesn't necessarily have to use the "USING" phrase in the PROCEDURE DIVISION statement. When no data is being passed back or forth, it's not required.

It's a rare occurance, but it can happen.


Correct me if I am wrong.
Back to top
View user's profile Send private message
MikeBaker
Beginner


Joined: 04 May 2004
Posts: 96
Topics: 9

PostPosted: Sat Jan 14, 2006 5:50 pm    Post subject: Reply with quote

iknow,

Thanks. This is really great information! You have clarified my doubts.
Back to top
View user's profile Send private message
haatvedt
Beginner


Joined: 14 Nov 2003
Posts: 66
Topics: 0
Location: St Cloud, Minnesota USA

PostPosted: Sun Jan 15, 2006 2:31 am    Post subject: Reply with quote

The ENTRY statement can be used to create an alternate entry point to a COBOL statement. This is another reason that you can not determine if a program is a main program or a subroutine.

Chuck H.
_________________
Chuck Haatvedt

email --> clastnameatcharterdotnet

(replace lastname, at, dot with appropriate
characters)
Back to top
View user's profile Send private message
issac1029
Intermediate


Joined: 10 Dec 2005
Posts: 159
Topics: 75

PostPosted: Tue Feb 14, 2006 10:15 pm    Post subject: Reply with quote

In what condition I need to 'to create an alternate entry point to a COBOL statement'?
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Heikki
Beginner


Joined: 22 Feb 2006
Posts: 6
Topics: 0
Location: Stockholm, Sweden

PostPosted: Wed Feb 22, 2006 7:18 am    Post subject: Reply with quote

Bithead wrote:
Unless the program is IMS when all main programs have a USING statement. Also, "Main" programs can be called as subroutines.

And in this case, the Main program is actually running as a subprogram of IMS.

Heikki
Back to top
View user's profile Send private message
acevedo
Beginner


Joined: 03 Dec 2002
Posts: 127
Topics: 0
Location: Europe

PostPosted: Wed Feb 22, 2006 7:37 am    Post subject: Reply with quote

kolusu wrote:
iknow,

Look at the procedure division statement

If the procedure Division has an USING clause then it is a subprogram or else it is a main program.

Kolusu


and unless you use cee3prm (LE)... rare cases...

Wink
Back to top
View user's profile Send private message
neilxt
Beginner


Joined: 01 Mar 2004
Posts: 23
Topics: 1

PostPosted: Tue Sep 19, 2006 4:21 pm    Post subject: Re: Mainprogram or subprogram Reply with quote

iknow wrote:
Hi Folks,

Please clarify my doubt.

How to identify is this MAINPROGRAM or SUBPROGRAM by seeing application program without using JCL?


Since the advent of COBOL II there really is no absolute such thing as a "Main" or "Sub" program any more. Every "main" program is a "Sub" program of MVS and, indeed, what used to be called "main" programs often have "Using" clauses to recieve PARM= data from MVS.

The only real meaning nowadays is for a specific paired relationship. The one that does the CALL is the "Main" and the one that got CALLed is the Sub.

But the Main is still a Sub of something else even if it's MVS.
Back to top
View user's profile Send private message Send e-mail
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Wed Sep 20, 2006 11:20 am    Post subject: Reply with quote

haatvedt wrote:
The ENTRY statement can be used to create an alternate entry point to a COBOL statement. This is another reason that you can not determine if a program is a main program or a subroutine.

Chuck H.


Or, if you a set of programs calling each other statically in one big load module, then the first program to be executed would be the main program. That first program would be the one whose object code first appears in the IEWL step unless overridden by a ENTRY statement.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group