Getting Started with RDi's Application Diagram, Part 2: Program Structure Diagram
Published: October 28, 2009
by Susan Gantner
In Part 1 of this tip, I talked about getting started with RDi's Source Call diagram. Now let's continue on the journey.
I'll first cover the basics of the second type of diagram, the Program Structure Diagram. Then I'll cover some notes that apply to both types about customizing, saving, and using your Application Diagrams for your own documentation.
The Program Structure diagram shows relationships between application objects, such as programs that call other programs or reference Service Programs. An example of a very simple Program Structure diagram is shown below.
This diagram shows the relationships between three programs that all reference the same Service Program called DateProcs. To create this diagram, simply select all the *PGMs and *SRVPGMs from the Remote Systems view (the objects, not source members this time) you want to include in the diagram, right click and select "Visualize Application Diagram." This gives you a high-level view of the object relationships.
Note that if you also want to see the Program Call diagram of the same objects, you could select the source members for the modules and/or programs. That way you could even see the specific procedures that were being called in each case. You can use the two types of diagrams together or separately. If you create a combined diagram with both objects and source, you can choose to view only one diagram type at a time from the context (i.e., right click) menu.
In the previous tip, I mentioned the palette in relation to the zoom tool. The palette is that box you see to the right of the diagram. In the palette is an icon that looks like a yellow Post-it style note. It may be occurring to you by now that this kind of diagram might be very useful to keep around as program documentation, and you're right. We'll talk about ways to save the diagram in a moment. But before you do that, you probably want to add some additional text, comments, etc., to it. There are two different ways to add text: Notes and Text. Notes appear as Post-it style notes on the diagram and are intended to be associated with a specific node (box) in the diagram; whereas Text is more free-from in nature and simply appears on the diagram without the Post-it-like background.
The easiest way to add a note to a node in the diagram is from the context menu on the node itself. To add general text to the page, use the palette. There is only one palette tool for both Notes and Text, and the default is initially set to Notes. Click on the menu arrow immediately to the right of the Note icon to change it to a Text tool. Then click in the diagram where you want the text and begin typing.
One issue I have with the palette is that it takes up valuable real estate, and because I so rarely use it, I prefer to get it out of the way. There are two ways to do this. There is an arrow at the top of the palette to collapse it to a small sliver with just the arrow remaining, which can be used to bring it back if you want to add text to your diagram. Another way to remove the palette from the diagram view is to open a special palette view. (Hint: Window pull-down menu, Show View, Palette.) When you do that, the attached palette automatically disappears. Then you can either place the palette view in a stack with many other views (such as the stack where you may have your Commands Log view, Error List view, etc.), or you can make it a Fast view. Either way, I recommend that you get the palette out of sight to buy yourself some extra real estate for more complex diagrams than the simple ones I've shown here.
Now that you have your Application Diagram the way you want it with Notes and Text, it would be shame to lose it. So, quick: Save it. You have three format options for saving the diagram: as an Application Diagram file, as a graphic, or as text.
If you save it as an Application Diagram file, it can be reopened in the Application Diagram editor. Diagrams are saved to a project in your workspace. You can create a project to save your Application Diagram files by using the File pull-down menu, option New→Project and choose a General Project type and give the project a name. Then you can use the File→Save as option when your Application Diagram has focus in the workbench and save it to your new project. This will create two XML files in your workspace--one of type .appmdl, and one with type .appmdl_diagram. To reopen it and work with it again, find either of those files in your workspace using the local connection in Remote Systems and double click to open them.
If you want to save the diagram to put into a document as a graphics file, right click on any white space in the diagram and use the File→Save as image file option. Many different image formats are supported.
You can also save the diagram as a text file, but it is nothing like the diagram we've been looking at in these examples. It is simply a list of the objects and source members with indications of "Called by" and "Calls."
There are many other things you can do with your Application Diagrams. Take a look under the "Diagram" pull-down menu in the workbench and the context menu in the diagram itself to see what else you can do.
Add this new tool to your repertoire to make your documentation more effective or to help you navigate visually through a complex logic flow.
Susan Gantner is one of the most respected System i gurus in the world and is one of the co-founders of System i Developer, an organization dedicated to RPG, DB2, and other relevant software technologies for the System i platform that hosts the new RPG & DB2 Summit conference. Gantner, who has worked in IBM's Rochester and Toronto labs, left IBM to focus on training OS/400 and i5/OS shops on the latest programming technologies. She is also a regular speaker at COMMON and other user groups. Send your questions or comments for Susan to Ted Holt via the IT Jungle Contact page.
Getting Started with RDi's Application Diagram, Part 1: Source Call Diagram
Post this story to del.icio.us
Post this story to Digg
Post this story to Slashdot