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
 
why do we write sub program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
jmalli
Currently Banned

New User


Joined: 19 Jul 2006
Posts: 8

PostPosted: Fri Dec 08, 2006 9:51 am    Post subject: why do we write sub program
Reply with quote

Hello Friends.
could you please let me know ,why do we write the sub program ? what are the advantages ? please give me details about it .
Back to top
View user's profile Send private message

cobolunni

Active User


Joined: 07 Aug 2006
Posts: 128
Location: kerala,india

PostPosted: Fri Dec 08, 2006 10:00 am    Post subject:
Reply with quote

Sub programs are used so that we can easly find the errors in the program
its a common matter a program with 1000 lines of code will be difficult to debug so we are dividing it into some subprograms with 200 or 300 lines so that we can easly identify the errors
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Dec 08, 2006 5:27 pm    Post subject:
Reply with quote

I find subprograms are a nice way to package functionality into a convenient "black box" for multiple programs to use.
Back to top
View user's profile Send private message
yaju4ever
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 19
Location: mumbai

PostPosted: Fri Dec 08, 2006 10:43 pm    Post subject: Re: why do we write sub program
Reply with quote

jmalli wrote:
Hello Friends.
could you please let me know ,why do we write the sub program ? what are the advantages ? please give me details about it .

well dear as my knowledge subroutine is used to divide ur large size progrm in to smaller and more manageable parts ..... cobol subroutine is saperatly compiled program.....and when same module is required in more than one applications it may be helpfull to design it in the saperatly compiled program...
Back to top
View user's profile Send private message
dnreddy

New User


Joined: 08 Dec 2006
Posts: 8
Location: chennai

PostPosted: Mon Dec 11, 2006 3:02 pm    Post subject:
Reply with quote

There are several reasons to create subprograms. More than one may apply in a given case.
1) Make Programs Smaller
Traditionally, COBOL programs tend to be large and monolithic. Such big programs are hard to read and harder to maintain. For unusually large load modules, it is useful to break out the major functions into subprograms of a more manageable size.
2) Make Code Reusable
If you find yourself writing the same code more than once, consider burying it in a subprogram, especially if:
? The code is extensive or tricky, or
? There are many potential uses for it.
3) Build Firewalls Around Change
In any application, some parts are are more volatile than others. Consider isolating the most volatile parts in subprograms. Then changes will be easier: first because you only need to change one program, and second because that one program is small and simple. You still need to identify and relink all of the relevant load modules (unless the subprogram is called dynamically), but you would have to do that much anyway.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    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 Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm

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