|
Hi Buck, Buck Calabro <mcalabro@commsoft.net> wrote: > This subject comes up fairly often on the RPG list; perhaps some of > the veterans could review my reply and see what improvements could > be made so we can have a "standard" reply?! I'd love to add my 2 cents to this :) I've given most of my thoughts below, and added some new Q/A's that jump to mind... > > First, there are several good books that you can read which give ver > good information on the subject - see http://www.midrange.com for > links to good books in our field. These books will answer quite a > few questions besides this one... > > IBM have a web site where you reference every AS/400 manual! It is > http://publib.boulder.ibm.com/html/as400/onlinelib.htm "IBM have a web site"... should be "IBM has a web site" > > Here is a specific link to the ILE concepts manual: > http://publib.boulder.ibm.com:80/cgi-bin/bookmgr/BOOKS/QB3AQ702/CCON > NTS ...probably should also include a link to the RPG reference... > > To very briefly answer your specific questions, Q. What is binding? A. In an ILE language, when you compile your source code, you make a *MODULE object. Binding is the act of combining one or more modules into a callable *PGM object. This allows you to write your source code in smaller, more modular, chunks and combine them to make your program. The different modules can even be written in different languages. > > Q. What is the difference between Static and Dynamic binding? > A. Dynamic binding is the "traditional" way for one program > to call another. Static binding is the "ILE" way. Static > binding is much faster at run time than dynamic binding. I'm not sure that "dynamic binding" is the correct term... Is it? A dynamic program call is NOT BOUND, is it? I suppose you could refer to calling a procedure in a service program "dynamic binding", but it gets a bit confusing if you refer to "dynamic calls", "bound calls" and "dynamic binding." > > Q. What is the difference between a dynamic program > call and a static procedure call? > A. With dynamic binding, the "connection" between the > two programs happens at the moment the CALL > operation is executed. Between finding the program > in the library list, verifying authority, opening the files > and initialising the variables, this can be a long process > (several seconds.) > With static binding, almost all of the work (aside from > variable initialisation and file opens) takes place at compile > time. This makes a static call fast. I've never experienced a dynamic call taking "several seconds". :) Maybe "a significant fraction of a second" would be more appropriate. You should also probably differentiate between calling a procedure in a bound module vs. calling a procedure in a service program. > > Q. What difference does it make to the programmer? > A. If you currently program using many CALL operations, > you can transition pretty quickly to CALLP because > you're used to dealing with parameters. Service programs > are very much like a library of commonly used > procedures. > If you don't currently program with many CALLs, you'll > need to get used to the idea of local variables, and > accessing them via parameters. CALLP can do both static and dynamic calls, which makes its use here sort of misleading. Perhaps you meant to use CALLB, which only does static calls -- and is also much more similar to CALL in syntax -- rather than CALLP. Otherwise, you should explain the differences btw EXTPGM, EXTPROC and local procedure calls. :) > > Q. What is the advantage of static binding? > A. Speed. We can finally break up our large programs into > smaller, easier to read and maintain units without a > performance penalty. Q. What is the disadvantage of static binding? A. When you create a module, which is bound into many different program objects, it can become difficult to maintain, because when you make changes to it, you have to re-create all of the programs that use that module. You also need to determine which modules are used by a program every time you compile it which can make it difficult when you need to recompile things "en-masse". Q. Is there a happy medium between the speed of bound modules and the ease of maintenance of dynamic calls? A. Yes, Service Programs. Instead of writing reusable code as modules and then binding those modules to create programs, you can instead bind your reusable code into a service program. Then, when you create programs, you bind to that service program. The service program is a seperate object on disk, and therefore, is a bit slower than a bound call -- but you can change a service program without having to recompile all the programs its bound to, as you would with a module. Q. What is binder language? A. As mentioned above, you can make changes to a service program without having to recompile the programs that call it. This is true UNLESS you change a parameter or add a new procedure that can be called. When this happens, the "public interface" (the way your service program can be called by others) has changed, and other programs will no longer know how to call your service program. To help make this easier to work with, binder language allows you to specify which procedures in your service program can be called from outside programs, and also allows you to specify "previous" interfaces to your service program, so existing programs can continue to call your service program the same way they did before the changes. > > Buck Calabro > Aptis; Albany, NY > mailto:Buck.Calabro@aptissoftware.com > > > -----Original Message----- > > From: A.Vishnu Vardhan > > Sent: Wednesday, September 22, 1999 8:58 AM > > To: RPG400-L@midrange.com > > Subject: Diff between static binding and dynamic binding > > > > Hi all, > > > > I would like to know the difference between > > 1)Static binding and dynamic binding > > 2)Dynamic program call and Static procedural call > > > > Differnce interms of compilation, Execution, > > advantages and disadvantages. > > > > Thanks in advance. > > > > Vishnu Vardhan A > > AS/400 programmer +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.