Prototyping -- The New Call Syntax

Article ID: 56387

Well , this week it seems I finally caught what everyone else has been talking about. Some kind of flu bug. Since I'm down, I thought I'd avoid staring at the ThinkPad screen for too long and instead produce a short video for you to watch entitled: Prototyping - The New Call Syntax.

One I find that people often overlook when moving to RPG IV subprocedures is that they don't thoroughly understand prototyping. That's okay -- in fact, I was recently in a car with a few IBMers, one of which said "I would love to do something about those stupid prototypes. I sure wish we could get rid of them."

Prototypes are both beneficial and bothersome. They're good in that they provide the compiler with information on programmer-written routines and the parameter requirements for those routines. In turn, the compiler gets to complain when we, the authors of those prototypes, don't follow their rules. But they're bothersome in that the compilers of 2008 and beyond can figure out that kind of stuff without us programmers needing to explicitly tell the compiler about it. After all, the prototype is nothing more than an exact copy of the subprocedure's parameter list; can't it just use that information instead of looking for a prototype?

For today, prototypes are a fact of life, and we have to work with them. To that end, I've produce a short video that covers the following topics:

  1. What are prototypes?
  2. How to prototype programs
  3. How to prototype subprocedure
  4. How to convert a program's *ENTRY/PLIST to prototype and procedure interface statements

A description of each of these topics follows.

  • Prototypes are a copy of the parameter list of the subprocedure or program for which they apply. The parameter list is sometimes known as the procedure interface.
  • Programs can be prototyped by migrating their *ENTRY/PLIST to prototype statements. Any program can be prototyped and called using the "call with prototype" opcode, including RPG IV, RPG III, API, and other *PGM objects.
  • A subprocedures can be prototyped by copying its procedure interface statements and updating the copy -- turning it into a prototype. All subprocedures and most new IBM i5/OS APIs are subprocedures and need to have hand-coded prototypes created for them.
  • Did you know that you can migrate your program's *ENTRY/PLIST to prototypes? And did you realize that if you do that, you can take advantage of the i5/OS V6R1 "MAIN" keyword enhancement that eliminates the RPG Cycle components from your program? It's true. The first step is to convert the old RPG IV *ENTRY/PLIST Calc specs to prototypes up in the Definition specs.

To watch this video, for free -- no registration, no signing on, just click and Watch -- go to this URL: www.rpgworld.com and then click on the "Watch Prototyping Video" link. The video will buffer about 10% and then start playing for you.

Next week, assuming that I'm feeling better, I'm planning on going over that fourth topic on that video: Migrating *ENTRY/PLIST to prototype statements.

Bob Cozzi has been an RPG programmer since 1978. His best selling book, The Modern RPG IV Language along with earlier editions have sold more than 60,000 copies worldwide. Bob, along with authors Greg Veal (CL Programming for the IBM AS/400), Bob Tipton (Untangling IT), IBM's George Farr (Java for RPG Programmers), and others will be at the annual RPG World Conference, the place to get the kind of training and information you can take back and start using immediately.

ProVIP Sponsors

ProVIP Sponsors