SlideServe
Menu
Préférences
© SlideServe · v2026

Advanced RPG

danil avatar
17 diapositives · 370 Views · Sep 02, 2012

Advanced RPG. Chapter 10 Modular Programming Concepts. Modular Programming. Developing smaller standalone units of code makes units reusable easier to test code changes with less side effects easier to spread among programming team. Modular Programming.

Advanced RPG - slide 1
01 / 17Advanced RPG
1 / 17

Télécharger la présentation

Advanced RPG
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Advanced RPG Chapter 10 Modular Programming Concepts

  2. Modular Programming • Developing smaller standalone units of code • makes units reusable • easier to test • code changes with less side effects • easier to spread among programming team

  3. Modular Programming • Figure 10.1 Flow of Control with calls • Call passes control to called program until it reaches a return, then it returns control to the program that called it.

  4. Modular Programming • Dynamic binding: • compile each program separately • use call to invoke another program • System will look for program and bound it to the calling program during runtime • reduced performance compared to subroutines • Static binding: • introduced with ILE • option to connect modules prior to runtime

  5. Modular Programming • Static binding: • Use CRTRPGMOD (create RPG module) • Creates object of type *Module (not *pgm) • Once modules are create, you create *pgm and bind together the modules. • Once run, binding is completed and performance is not affected.

  6. Modular Programming • Use Call command to activate module • CALL (call a program, Dynamic) • CALLB (call a bound module, Static) • CALLP (call a Prototyped Procedure or program)

  7. Modular Programming • Call • Used to call objects of type *pgm • Use actual file name when possible • Can use a variable name • Will return to called program on return • Be sure to turn on LR if you want subsequent calls to rerun the program, otherwise it will return to where you left off. • Example: p. 211

  8. Modular Programming • CallB • Invokes a program module *module • Cannot call a bound program *pgm • Can be a literal or variable • Example p.213

  9. Modular Programming • PARM (Identify Parameters): used to pass values between called programs (works with Call and CallB) • List of Parms in calling program must have a list of Parms in called program • Listed after the call • Each field to pass is listed separately • Name of fields can be different but type and size must be the same

  10. Modular Programming C CALL ‘Prog2’ PARM FldA PARM FldB PARM FldC

  11. Modular Programming • Alternative Option: C PlistA PLIST PARM FldA PARM Fldb PARM Fldc C CALL ‘Prog2’ PlistA

  12. Modular Programming • Called Program (can contain only one): C *Entry PLIST PARM FldA PARM Fldb PARM Fldc (Fields or variables must be defined in called program)

  13. Modular Programming • Parm passes address of storage location, therefore any changes in called program will be reflected in calling program. (pass by reference, not pass by value) • Can get around this with modified Parm C CALL ‘Prog 1’ PARM FldA FldX

  14. Modular Programming • Additional CallB feature: • Two new keywords in D specs will cause values to be parmed without specifically specifying it. • Calling Program: EXPORT • Called Program: IMPORT • Page 215 - 216

  15. Modular Programming • Subprocedure: similar to subroutine • Can be independent from a program • Variables are not global through subprocedures, they are local • Coding is more complex, p.216 • CALLP is used to initiate a subprocedure that does not return values. • Uses Prototype to pass values to called module.

  16. Modular Programming • Prototype Differences: • VALUE keyword: actual value instead of memory address is passed • CONST keyword: read only reference

  17. Modular Programming