View previous topic :: View next topic |
Author |
Message |
iknow Beginner
Joined: 09 Jan 2006 Posts: 39 Topics: 15 Location: Inside the MATRIX
|
Posted: Fri Jan 13, 2006 10:22 am Post subject: Mainprogram or subprogram |
|
|
Hi Folks,
Please clarify my doubt.
How to identify is this MAINPROGRAM or SUBPROGRAM by seeing application program without using JCL? |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Fri Jan 13, 2006 11:57 am Post subject: |
|
|
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 |
|
 |
Bithead Advanced

Joined: 03 Jan 2003 Posts: 550 Topics: 23 Location: Michigan, USA
|
Posted: Fri Jan 13, 2006 1:06 pm Post subject: |
|
|
Unless the program is IMS when all main programs have a USING statement. Also, "Main" programs can be called as subroutines. |
|
Back to top |
|
 |
iknow Beginner
Joined: 09 Jan 2006 Posts: 39 Topics: 15 Location: Inside the MATRIX
|
Posted: Sat Jan 14, 2006 5:12 am Post subject: |
|
|
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 |
|
 |
MikeBaker Beginner
Joined: 04 May 2004 Posts: 96 Topics: 9
|
Posted: Sat Jan 14, 2006 5:50 pm Post subject: |
|
|
iknow,
Thanks. This is really great information! You have clarified my doubts. |
|
Back to top |
|
 |
haatvedt Beginner
Joined: 14 Nov 2003 Posts: 66 Topics: 0 Location: St Cloud, Minnesota USA
|
Posted: Sun Jan 15, 2006 2:31 am Post subject: |
|
|
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 |
|
 |
issac1029 Intermediate

Joined: 10 Dec 2005 Posts: 159 Topics: 75
|
Posted: Tue Feb 14, 2006 10:15 pm Post subject: |
|
|
In what condition I need to 'to create an alternate entry point to a COBOL statement'? |
|
Back to top |
|
 |
Heikki Beginner

Joined: 22 Feb 2006 Posts: 6 Topics: 0 Location: Stockholm, Sweden
|
Posted: Wed Feb 22, 2006 7:18 am Post subject: |
|
|
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 |
|
 |
acevedo Beginner

Joined: 03 Dec 2002 Posts: 127 Topics: 0 Location: Europe
|
Posted: Wed Feb 22, 2006 7:37 am Post subject: |
|
|
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...
 |
|
Back to top |
|
 |
neilxt Beginner
Joined: 01 Mar 2004 Posts: 23 Topics: 1
|
Posted: Tue Sep 19, 2006 4:21 pm Post subject: Re: Mainprogram or subprogram |
|
|
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 |
|
 |
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Wed Sep 20, 2006 11:20 am Post subject: |
|
|
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 |
|
 |
|
|