Are RPG Subroutines Obsolete?

RPG
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

If you want to get a bunch of programmers cooking, say something like this: “Anyone who uses GOTOs ought to be fired,” or “The RPG cycle should be banned.” I’m going to throw in another condiment of the same flavor and say, “Subroutines should be consigned to history.” Let me first say that I plan to stand well clear of the discussions that will no doubt ensue—I like to leave myself room to backtrack. The only absolute I adhere to is “Keep the customer satisfied.” But, just for the record, I haven’t used a GOTO in many years, I’ve almost forgotten how the cycle works, and the last time I coded a BEGSR was over two years ago when V3R6 first delivered the prototyped subprocedure.

Now, allow me to divulge some thoughts on what kinds of programs keep customers happy. They’re the programs you said would be ready with that new mod by Monday, and they are. They go right to work from the day you ship them and don’t come back for rework. When you assign the job of maintaining them to a programmer, there is no hint of fear on his face. They are programs that offer some little improvement the customer didn’t ask for but got anyhow.

In my view, none of these positive elements are possible with programs that are difficult to read, difficult to understand, difficult to test. With most programmers working directly off of screens, certain conditions should be met: Blocks of logic should span no more than a few screen loads. Logic should be structured (and names given) in such a way that it is understood with the least necessary effort. If anything goes wrong, the malfunctioning code should be easy to isolate and correct. And, most important, as a program’s task becomes more complex, its internal structure must become more simple (you can get away with all sorts of poor structure and ill-conceived assumptions when your task is minor).

Compare subroutines to subprocedures with these requirements in mind, and there’s no contest. Subprocedures have local variables; defined physically near to where they are used; and no matter what you call them, they are unique to that specific subprocedure. Subroutines can use only global variables. Subprocedures have formal interfaces; subroutines don’t. Subprocedures can call themselves recursively; subroutines

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: