Stuff
OS/400 Edition
Volume 1, Number 15 -- August 29, 2002

Cool Things in CODE/400: A Bag Full of Tips


by Scott Mildenberger

I have assembled a collection of useful tips for CODE/400. The collection includes a description of the Default to Ring option as well as how to quickly edit or browse a copy member. There are always times that we can use some help in understanding a program's structure. The Indent, Navigator, and Cross-Reference functions can all help here. To fill our bag of tips, we have the Open New View function. Everyone will find something they can use here.

display

Default to Ring Option

From the very first time I used CODE/400, I disliked how each source member was opened within the same window. CODE/400 uses what are called rings to allow you to organize your open source members. All the members within a ring appear in one CODE/400 window, and you move between the different members by choosing the Next in Ring or the Previous in Ring options.

The day I discovered the Default to Ring option, I was elated. The Default to Ring option (in the View menu) is selected by default, and this is what causes each source member to be opened in the ring from a certain location. By deselecting Default to Ring, every source member will be opened in a separate window. Not everyone will want each source member in its own window, but if, like me, you prefer to work this way, then get that Default to Ring deselected right away. The good news is, you've got a choice.

Edit or Browse a Copy Member

When you are editing a source member, there are times you would like to either edit or browse a /copy member that is being referenced. One way this can be accomplished is by choosing the File menu, then choosing Open from the submenu, but this requires you to navigate to the /copy source member. Two shortcuts make this easier. At the bottom of the Edit menu is the /COPY member (EDIT) option, which will open a copy member in Edit mode. A similar option, at the bottom of the View menu, is /COPY member (SEE), which will open the member in browse mode. You will want to position the cursor on the line containing the /copy statement before choosing either of these options, then the source member to be opened will be filled in automatically for you.

Indent Function

The Indent function, in the View menu, allows you to view your source with the code inside conditions (if, select, or loop) indented, which makes the structure of your code easier to see. This is very similar to the INDENT option on the compile commands. Choosing the Indent option opens another view of your source with the code indented. The Indent view is just for browsing; you can't edit the code through this view. The Indent function won't do anything with the new free-form RPG code option available in V5R1. That isn't a problem though, because one of the benefits of the free-form option is that you can indent the code as you write it.

Open New View Function

The Open New View function, in the File menu, opens another view of the same member you are in. This allows you to easily see two or more sections of code in the same program at the same time. And the really neat thing about it is you can edit in any of the views and the changes are automatically reflected in all the other views.

Navigator Function

The Navigator function, in the View menu, opens a window displaying a graphical call hierarchy. This allows you to easily see where all subroutines and subprocedures are referenced or see the calls they make. Double-clicking one of the names in the Navigator window displays that routine in the CODE/400 window. The View menu allows you to zoom the display in or out. The View menu also has an Overview option, which opens a small window showing an overview of the Navigator model zoomed way out. This window has a gray box identifying the region being displayed in the main Navigator window. If you drag the box to a different position with the mouse, the main window will change to show the new position.

Cross-Reference Function

The Cross-Reference function, in the View menu, opens a window similar in function to the cross-reference provided at the bottom of a compile listing. Be patient after choosing this option; it's a Java application and can take several seconds to appear when first opened. The Cross-Reference is shown in a tree structure showing all identifiers and indicators used in the program. The items can be expanded or collapsed by either clicking the button to the left of the name or by double-clicking the name itself. When each item is expanded, you will see a list of the source line numbers where the item is referenced. Clicking one of the line numbers moves your source member to that line in the editor.

Show Option

The Show option, in the View menu, allows you to see only certain types of statements in your source member. The options are Control, Comments, Subroutines, SQL Statements, and Procedures. To return your member to showing all lines, select the Show All (Ctrl-A) option in the View menu. The Show option makes it really easy to move around in your source and to find particular items. I particularly like the Show-Control option. "Control" refers to control op codes, which are If statements, loops, and call statements. This makes it easy to see the overall structure of your code without having all the details in the way. It can make it a lot easier to make sure you are adding code to the proper ELSE when you have nested If statements.

Help

The CODE/400 editor has context-sensitive help. When you press F1, Help will open to the section of the manual describing where your cursor is. This is extremely useful when you can't remember something about an op code. Position your cursor on the op code, press F1, and you will have the Reference page opened before your eyes.

In case you want to look for something in particular, there are a bunch of options in the Help menu. The options will be different, depending on the source type of the member you are editing. For example, when editing RPG IV, the Help menu will have (under the ILE/RPG Help submenu) Reference, Programmers Guide, What's New, Operation Codes, Built-in Functions, and Articles.

The Bag Is Full

I'm sure there is something for everyone in this bag of tips. I encourage you to try them all out and to keep those that you find helpful. And if there are any that aren't helpful to you, pass them on to a fellow CODE/400 user and maybe he will find them useful.


Scott Mildenberger is a senior programmer/analyst with Washington Corporations in Missoula, MT, who has been working with the AS/400 and iSeries since 1993. He can be reached at smildenber@washcorp.com.


Sponsored By
LANSA

LANSA Integrator Simplifies Business

Apria Healthcare, Celtic Insurance, John Wiley & Sons and others have used LANSA Integrator to automate their business operations and reduce transaction costs with their trading partners.

See what LANSA Integrator can do for your business.

http://www.lansa.com/products/integratoroverview.htm


THIS ISSUE
SPONSORED BY:

T.L. Ashford
Aldon Computer Group
LANSA
ASNA
Profound Logic Software
WorksRight Software


BACK ISSUES

TABLE OF CONTENTS
Back To Basics: Message Subfiles

The 5250 Word Wrap Utility

Cool Things in CODE/400: A Bag Full of Tips

The Opportunity of a Lifetime

Security Made Easy with Operations Navigator

More on XLE and XML File Creation


Editors
Shannon O'Donnell
Kevin Vandever

Managing Editor
Shannon Pastore

Contributing Editors
Howard Arner
Joe Hertvik
Ted Holt
David Morris
Richard Shaler

Publisher and
Advertising Director

Jenny Thomas

Contact the Editors
Do you have a gripe, inside dope or an opinion?
Email the editors:
editors@itjungle.com



Last Updated: 8/29/02
Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.