Guild Companies, Inc.  
 
Midrange Programmer - How-To Advice & Free Code
OS/400 Edition
Volume 1, Number 6 - March 28, 2002

CODE/400's Code/Editor: Tips and Tricks

by Shannon O'Donnell

In the last issue, I introduced you to CODE/400's Code/Editor. Using this cool new tool from IBM, available as a part of the IBM WebSphere Development Studio toolset for iSeries, developers can very quickly create a multitude of applications in a variety of languages, including RPG IV, Java, COBOL, and more. In this issue, I'm going to show you a few tips and techniques that will make your editing experience much more enjoyable.

Comparing Source and Other Things

Using Code/Editor, you can very easily compare source members. For example, you may have a source member on the iSeries, and you may have a copy on your PC's local hard drive. If you can't remember which source member has the latest changes, then it's time to use Code/Editor to compare them and find out.

Open both source members in Code/Editor. If one or more members reside on the iSeries, then simply maneuver to that library and source file on iSeries and download it to your PC using Code/Editor. Otherwise, open the local version of the source from your PC's hard drive. Once you have the source members loaded in Code/Editor, click on the "Actions" menu item, and then click on "Compare." You'll be prompted with a list of all source files you currently have open in Code/Editor. The source member currently in focus in the Code/Editor window is automatically selected for you. Find the source member you want to compare it to, click on it to highlight it, and then click the "Compare" button. A side-by-side view of both members is displayed in Code/Editor, with differences highlighted in yellow and red. Note that once the Compare view is open, a new "Compare" menu item will appear, from which you can further refine the comparison process.

You can use Code/Editor's Compare feature to compare more than "normal" iSeries file types. You can also use it to compare files on your local PC's hard drive, too. For example, if you have two HTML files, or two Rich Text Format (*.RTF) files on your hard drive, you can open both in Code/Editor and compare them the same as you would any normal iSeries source member.

Finding Lost Code

As you begin to use Code/Editor, you'll quickly discover that you tend to "lose your way" in longer source members. That is, you'll find that it's a bit difficult to locate a particular place in the code. This is mostly because you typically use the mouse to slide the scrollbars up and down to navigate through the source member. When you do this, it's very easy to get lost and scroll past a particular piece of code you are looking for.

One way to help ease that particular pain is by setting Marks. A Mark in Code/Editor means that you are identifying to Code/Editor a particular place you want to locate quickly. There are a couple of ways to do this.

The first is by setting a new Mark. To do so, scroll through the code until you find a line that you want to return to quickly. Once you do that, click on the "Edit" menu item, then click on the "Name a Mark" menu item. A prompt will appear that will allow you to type in any name you like for the Mark. Now when you want to quickly jump back to this piece of code, click on the "Edit" menu item and then click on "Locate" and "Mark." A prompt will appear showing you all of the Marks you have created. Click on the one you want to jump to and then click the "OK" button. You'll be taken to that place in the code.

The other way to jump quickly to a specific place in the code is by using the "Quick Mark" feature. To set a "Quick Mark, click on the "Edit" menu item then click on "Quick Mark." A mark is placed on that line of code. To quickly jump back to that mark, you can either click on the "Edit/LocateQuick Mark" menu item or press the "Alt" + "Q" keys from the keyboard.

You can also very quickly jump to a particular line of code by pressing the "CTL" + "L" keys and entering the line of code that you wish to jump to.

Filtering What You See

If you only want to view a certain group of source lines, say only lines that contain the "BEGSR" opcode in RPG IV source members, you can do so very easily by using Code/Editor's "Filter" feature. To get to it, click on the "View" menu item, then click on "Filter." A prompt in which you can type whatever text you want to filter for will appear. You can even make it case sensitive or match the exact pattern you enter. Click the "OK" button to display the source member with only those source lines that match your filter. To undo your filter, click "View" and then click "Show All." This will remove the filter.

Free Form RPG

If you want to experiment with free-form RPG but you're still on OS/400 V4R5, or even if you're on OS/400 V5R1 but are not sure how to use the new free-form RPG style of coding, then have I got a tip for you! Open an RPG IV source member in Code/Editor. Click on the "Actions" menu item. Then click on the "Convert all to C Free Form." All of the C-spec lines of code in your RPG IV source member will be converted to the new free-form style. Cool, huh? Keep in mind that OS/400 V4R5 does not yet support free-form C-specs, so you won't be able to compile your newly converted source there. Still, this is a great way to see what the new format looks like.

Ready, Set, Experiment

This is only a small sample of the many shortcuts and tips available in Code/Editor. But, it gives you an idea of some of the functionality the tool provides. So rather than me writing about all of them here, you should start experimenting with Code/Editor. After all, the best way to learn is by doing it yourself. And, for a great online resource that covers more great tips and tricks for Code/Editor, see CODE/400 Tips and Techniques.

Sponsored By
MIDRANGE BLUE BOOK

Visit the world's first and only Midrange Blue Book, at www.thembb.com.

Covering wholesale and retail prices on everything: systems, upgrades, memory, disk, tape, features, and so on.

Specializing in AS/400-iSeries and RS/6000-pSeries, covering products from HP, Sun, Cisco, and dozens more.

Guild Companies readers: Use the promotion code "MSI-01" when you sign up for the $399 annual subscription, and Midrange Blue Book will chop off $50.

Midrange Blue Book also offers the Dynamic Midrange Exchange, which allows end user companies to search the blue book for prices and post a request for proposal into the exchange where used equipment dealers can see if they have what you need. The Dynamic Midrange Exchange is a FREE service to end user companies--no dealers, please--that allows them to buy, sell, lease, or rent equipment from dealers.

The Midrange Blue Book will also offer a wholesale guide for verifiably qualified dealers and equipment brokers.

Become an educated consumer. Sign up now at www.thembb.com.

THIS ISSUE
SPONSORED BY:
BCD Int'l
Client Server Dev.
COMMON
SoftLanding Systems
Profound Logic Software
Midrange Blue Book
BACK ISSUES
TABLE OF CONTENTS
Form Up to Learn About HTML Forms
Recursive Calls Using Subprocedures
Getting Started with XML
Working with Parameters and Variables in Qshell Scripts
Test Data Queue Applications Using Java
CODE/400's Code/Editor: Tips and Tricks
  Newsletters | Subscribe | Advertise | About Us | Contact | Search | Home  
  Last Updated: 3/27/02
Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.