What is difference between copy book and sub-program?
-
- New Member
- Posts: 2
- Joined: Wed Jan 28, 2015 11:40 am
What is difference between copy book and sub-program?
This question was strange for me. I have never thought that this can be a question...question was, What is difference between copy book and sub-program? When they can serve the nearly similar feature?
- Robert Sample
- Global Moderator
- Posts: 1895
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: What is difference between copy book and sub-program?
A copy book brings code into the program at COMPILE time. Hence, it is done once when the compile is done and that's it. A subprogram, on the other hand, is invoked at EXECUTION time and hence can be done many times (each time the program executes). Furthermore, a change to the copy book requires a recompile of the program (and possibly many other programs as well). If the subprogram is linked dynamically, it can be changed without causing a recompile of the calling program.
Code in a copy book (yes, copy books can contain code as well as data structures) could be placed in a subprogram. If the code can be executed at multiple points in a program, use a subprogram. If the code exists only once in the program (but will be used in several programs), use a copy book.
Code in a copy book (yes, copy books can contain code as well as data structures) could be placed in a subprogram. If the code can be executed at multiple points in a program, use a subprogram. If the code exists only once in the program (but will be used in several programs), use a copy book.
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