Tips & Techniques > Systems Management

Tips & Techniques

Four Tips for Coding RPG Faster in WDSC

Tips & Techniques - Four Tips for Coding RPG Faster in WDSC

Bookmark and Share Print Email

Let’s face it: IBM* WebSphere* Development Studio Client (WDSC) has had a rough entry into many System i* shops because there’s so much to learn about how to use the tool. You might also find it challenging to figure out which of the many features can best benefit your shop. If your programmers aren’t saving time by using WDSC, then it probably isn’t worth the investment in hardware and retraining. Fortunately, there’s plenty in WDSC to help improve programmer efficiency. This round of WDSC tidbits and goodies (see the others online at www.ibmsystemsmag.com) focuses on using four tips for faster RPG coding.

Tip 1: Block Comment

I wish RPG had the capability to comment out a whole section of code using the /* and / delimiters (similar to Java* and other languages). Unfortunately for me, the compiler team doesn’t have that feature at the top of its priority list, so I’m left to devise other means, and I think I have an acceptable work-around.

WDSC’s Fill Selection feature lets you fill a highlighted selection with a value. For this tip, you want to do a Fill Selection with two slash characters since that’s an RPG comment. It’d be one thing to do this with the mouse by clicking around, but that mouse is giving me carpal tunnel syndrome, so I’ll show you how to do a block comment with Fill Selection entirely from the keyboard.

First, place your cursor two spaces to the left of the code you wish to comment out. The two spaces ensure you don’t overwrite the code. Next, select Alt+R to put the cursor selection in block mode. Hold down the Shift key and use the arrow keys to highlight two columns for the length of code you wish to comment (see part 1 of Figure 1). Next, press Shift+F10, which is the same as doing a right mouse click. This will bring up the source menu letting you further select options. From here, press the L key and then the E key, which are mapped to “Selected” and “Fill selection ...” respectively. You’ll now be presented with the Fill characters prompt where you should enter a single or double slash—either will work (see part 2 of Figure 1). Press “Enter.” The third part of Figure 1 shows the result of your keystrokes. Pretty nifty, eh? As you learn the key sequences it becomes much faster than your initial trials.

Tip 2: Indenting Blocks of Code

The first tip talked about block commenting your code, but if your code starts in column 8 (the first valid column to start your C-specs), you can’t put two forward slashes starting in column 6 without the compiler returning errors. To remedy this, you can quickly indent your code using the RR shift prefix command. This is an old-school command that exists in SEU, but it’s even more useful now that we have /Free form code and can do things like the above block copy. See Figure 2 for a before and after use of this command.

Ever wonder where the ending to a particular IF statement was because of multiple IFs embedded, or if the IF statement spans many lines of code or screens?

Next page: >>

Page 1 2

Aaron Bartell is an RPG and Java developer for www.krengeltech.com. Aaron can be reached at aaronbartell@mowyourlawn.com.

Advertisement



Advertisement