Discover and understand RPG applications with X- Analysis plug-in and Rational Developer for
by user
Comments
Transcript
Discover and understand RPG applications with X- Analysis plug-in and Rational Developer for
Discover and understand RPG applications with XAnalysis plug-in and Rational Developer for Power Systems Software DATABOROUGH This product requires a security code to activate it. For Security Code, please call Databorough N.America: (705) 458 8672 Europe: (44) 1932 848564 Alternatively contact Databorough by email at: [email protected] Or [email protected] Beacon House, South Road, Weybridge, Surrey, U.K. KT13 9DZ Telephone:Weybridge (01932) 848564 Facsimile: Weybridge (01932) 859211 © Copyright 2010. Databorough Ltd. All rights reserved. Table of Contents Table of Contents Introduction................................................................................2 Assumptions...................................................................................................................... 2 General Instructions ............................................................................................................2 Using X-Analysis .........................................................................4 Select Application Library on RSE..................................................................................... 5 Data Flow Diagram .........................................................................................................14 Structure Chart Diagram................................................................................................. 14 Expanded Structure Chart ..................................................................................................17 Detailed Structure Chart ....................................................................................................17 Source Browser ............................................................................................................... 18 Source Legend and Source Levels.......................................................................................19 View Source Modes ...........................................................................................................20 Pseudo Code....................................................................................................................21 Source Outline ................................................................................................................ 22 Program Structure Chart ................................................................................................ 23 Zoom in LPEX Editor........................................................................................................ 24 Annotate ......................................................................................................................... 25 Document Manager......................................................................................................... 28 Mark for Documenter ........................................................................................................28 Document produced ..........................................................................................................34 Variable Where Used....................................................................................................... 35 Meanings of Variable Where Used Levels.............................................................................38 Member X-Reference ......................................................................................................39 Enhanced Member X-Reference...................................................................................... 40 File Field Details.............................................................................................................. 41 LFs / Access Paths ..........................................................................................................42 Access Path Diagram ......................................................................................................43 Data Modelling ..........................................................................46 Conclusion.................................................................................50 Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page i Introduction Introduction Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 1 Introduction Introduction Databorough's X-Analysis product suite is an essential Tool for IBM i application documentation, design recovery, and modernization. X-Analysis for Eclipse is fully functional under RDp 7.5 enabling the users to browse and visualize an application from high-level model right down to individual lines of code. Data Model Extraction, RPG & COBOL as Pseudo code, variable level impact analysis, Graphical Flow/Structure charts, MS Word/Visio wizards, Business Logic Extraction, test data management, database and application modernization, are just some of the features packed into this globally renowned tool. The X-Analysis allows technical analysts to graphically navigate through an IBM i application from a Windows PC. Working in a true client-server mode, X-Analysis automatically cross-references the database and ensures that what is displayed is always up-to-date and a true representation of the application on the IBM i. Assumptions It is assumed that the server and client components of X-Analysis are installed on IBM i and Windows PC, respectively. It is also assumed that the demo library i.e. XAN4CDEM and its cross-reference library i.e. XAN4CDXA have been successfully restored on the IBM i. For details, refer to the X-Analysis_User_Manual.doc If the above assumptions are correct, then we are ready to start with the tutorial chapters. Note that this tutorial only teaches the usage of X-Analysis tool and not issues like Reverse Engineering or Initialization of X-Analysis. The tutorial is written in a step-by-step instructive manner and would help if the chapters are followed sequentially. General Instructions When running X-Analysis, opt for actions either by: • • • • Clicking on the relevant buttons on the Toolbar Selecting the relevant options from the menu bar Selecting the relevant options from the right click menu Double click selects the most obvious action/command Function key F1 brings up the context-sensitive help for the X-Analysis screens. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 2 Using X-Analysis Using X-Analysis Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 3 X Access information Please refer to the information in Table 1 during this tutorial exercise. System i hostname System i user ID System i password Application library Workspace Table 1. Access information for this tutorial iseriesd.demos.ibm.com SOADEMO demo4you XAN4CDEM C:\PoT\SOAiV75\workspace Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 4 X Using X-Analysis X-Analysis for Eclipse can be used in the following two ways: • • Work With X-Analysis Perspective X-Analysis as extension to RSE Perspective In this tutorial we intend to display the usage of X-Analysis as an extension to the RSE Perspective. Select Application Library on RSE Start the RSE perspective on the IBM Rational Developer for Power Systems Software (RDp) 7.5 Select Application Library on RSE Start RSE perspective on Rational Developer for Power Systems Software (RDp) 7.5 from the Windows Start menu in the Sandbox menu and use the default workspace location to store your files and folders. If RDp is already started you can skip this step 1 and 2. To start the product and set the workspace location: 1. Click Start on the task bar of your virtual desktop. 2. Select Programs > IBM Software Development Platform > IBM Rational Developer for Power Systems Software v7.5 > Rational Developer for Power System Software, as shown. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 5 X ALT: Directory is C:\PoT\SOAiV75\workspace Tip: Do not worry about the directory path or name, because it might vary from one workstation to the other. 1. Click OK to open the workbench. The workbench opens and displays the Welcome view. 2. Click the X in the Welcome or Getting Started tab to close the Welcome view. RSE Perspective in RDp Double click on IBM i… under ‘New Connection’ node to make a connection to IBM i where X-Analysis Tutorial Application is installed. This invokes a new connection wizard. Following screen appears with parent profile (PC name) name. Connection Wizard in RSE Perspective Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 6 X Provide the IP of the IBM i and click ‘Finish’ to end the connection wizard. System i hostname System i user ID System i password Application library Workspace iseriesd.demos.ibm.com SOADEMO demo4you XAN4CDEM C:\PoT\SOAiV75\workspace After the RSE Perspective prepares the connection, user can see the IBM i connection on the Navigation View, as below. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 7 X New Connection in RSE Perspective To add an application library, expand ‘Work with Libraries’ under the IP node. This invokes the ‘New Library Filter’ dialog. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 8 X Adding Application Library to work with Provide the library name as ‘XAN4CDEM’ which is the Tutorial Application Library and click ‘Next’. This invokes the following dialog: Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 9 X New Library Filter dialog Provide a relevant ‘Filter name’ for the application library being added. Let us call it ‘DemoApp’. Click ‘Finish’. This action creates a new node in the name ‘DemoApp’ under the new connection IP added, as shown below. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 10 X ‘DemoApp’ added as an Application Library Filter Expand Filter Library, ‘DempApp’. This invokes the Sign On dialog for IBM i connection. Sign On dialog to connect to IBM i Provide a valid IBM i profile to sign on. After a valid sign on, this should display Application Library ‘XAN4CDEM’. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 11 X Application Library under DemoApp Filter Expand the application library. This should list all objects that belong to the application library ‘XAN4CDEM’. Expanded View of Application Library Let us invoke X-Analysis here. Locate *File object ‘CUSF’, on the expanded library view, and right click on it. The context menu has X-Analysis as a menu option, as shown below: Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 12 X X-Analysis menu on CUSF object The X-Analysis menu has two options, ‘Data Flow Diagram’ and ‘Zoom Source’. Let us opt for ‘Data Flow Diagram’. The user is presented with X-Analysis Login dialog when the X-Analysis option is taken for the first time. X-Analysis Login dialog A valid user profile on the IBM i should be used to sign in. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 13 X Data Flow Diagram X-Analysis enables the user to see how the objects within an application relate to each other. ‘Data Flow Diagram’ depicts this very nicely. The option invokes the Data Flow Diagram, displaying Data Flow Diagram (DFD) for ‘CUSF’. User can see how ‘CUSF’ fits into the application, i.e. what programs use ‘CUSF’, which one updates it, what are the various Logical Views/Access Paths for ‘CUSF’. Data flow Diagram for CUSF Double clicking on any object from the DFD, displays the Data Flow Diagram of that object. Double Click on ‘OE002’ to bring up the DFD for ‘OE002’. Thus, the user can browse at will through a single large model. Note the ‘Outline View’, which is associated with the Data Flow Diagram. This displays the Outline DFD. X-Analysis determines the exact usage of each field by examining the detail of the underlying source code. The Data Flow Diagrams display various types of objects in different colours. The type of Objects in the Data Flow Diagram can be interpreted using the Legend dropdown bottom. Structure Chart Diagram The Structure Chart Diagram is a graphic display of the program’s call stack. The diagram is color coded giving an overview of where the inputs, updates, prints, etc. take place in the call stack of the program. Select the object ‘CUSFMAINT’ and right click on it. Opt for the ‘Structure Chart Diagram’ option. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 14 X Structure Chart Diagram option This invokes screen displaying the ‘Structure Chart Diagram’. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 15 X Structure Chart Diagram for CUSFMAINT Structure Chart Legend From the above SCD, one can interpret that ‘CUSFMAINT’ calls five programs. The nature of the called programs may be ascertained through the Structure Chart legend bar. The Structure Chart displayed above is the normal view of the Structure chart Diagram. User has the options to view the ‘Expanded Structure Chart’ or’ Detailed Structure Chart’, and can export the Structure Chart to MS Visio (if installed on the PC). These are available as ‘Show Files’, ‘Show Narratives’ ‘and Export Options’ buttons respectively on Structure Chart Diagram (SCD). Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 16 X Expanded Structure Chart From the Structure Chart Diagram, click the ‘Show Files’ button from the toolbar. This brings up the Expanded Structure Chart, displaying the I/O files for all the programs in the call stack. Expanded Structure Chart Diagram for CUSFMAINT Detailed Structure Chart From the Structure Chart diagram, click the ‘Show Narratives’ button. This generates the detailed structure chart showing the files used by each program along with the automatically generated program narratives. This text is automatically recovered by X-Analysis from the application and describes the program’s purpose Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 17 X Detailed Structure Chart Diagram for CUSFMAINT Source Browser From the SCD of the ‘CUSFMAINT’, user can also zoom to the source listing of the program. Select ‘Zoom Source’ option from the right click menu on ‘CUSFMAINT’. Zoom Source Option Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 18 X This invokes the Source Browser for ‘CUSFMAINT’, as shown below: Source Browser for CUSFMAINT Source Legend and Source Levels To understand the Source Code coloring, click the Source level icon available on the Zoom Source Toolbar. Option to Invoke Source Levels The default source level is ‘Level 4’. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 19 X Source Levels To reduce the source level, select Level 1 from Source Level. This will reduce the source list to the absolute minimum - just the subroutines and comments. Source list – Comments Only Increase the Source Level from 1 - 5 to see the number of source lines increase. Selecting View/Source Level/Level 4 returns you to the normal source listing. View Source Modes The Source Mode, allow the user to view various Source Modes. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 20 X Source Mode Indented Source View Select ‘Indented Source Code’ option, from the Source Mode dropdown button. The normal source code for the ‘CUSFMAINT’ program is presented as indented source code. Indented Source Return to the normal view. Pseudo Code Click on the ‘Pseudo Code’ button available on the Source browser toolbar. Here, the Source Lines are displayed as English like statements, as shown below: Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 21 X Pseudo Code Return to the normal view by again clicking the pseudo code option button. Source Outline Source outline view lists all subroutines/modules and called programs available in the program source code. Option to Invoke Source Outline Cursor is positioned to the particular line of code in the Source Browser when any of the items listed in the outline view is double clicked. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 22 X Source Outline Program Structure Chart Program Structure Chart graphically displays the sequence of calls in the program. The call could be to execute a Subroutine / Program / Module / Service Program. Select the ‘Program Structure Chart’ option from the ‘Diagramming Options’ dropdown, as shown below: Option to Invoke Program Structure Chart Following diagram is displayed on selecting the ‘Program structure Chart’ option: Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 23 X Program Structure Chart Subroutines are depicted as the small rectangles with gray background, displaying the name of the subroutine. The object’s Function Type determines the coloring of all other icons viz. Programs, Modules, and Service Programs. Icons other than subroutines are of the size of Program element as on the Structure Chart. Program Structure Chart legend depicts the type of object displayed. Program Structure Chart Legend If there is no Main Procedure and there are only sub-procedures, then PSC displays each Sub-Procedure's PSC independently, one after the other. If no Sub-Procedures exists then PSC just display the program. Zoom in LPEX Editor Context menu on the programs in SCD also has an option to ‘Zoom in Lpex’. Take this option on CUSFMAINT program, as shown below: Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 24 X Zoom in LPEX option This action invokes the LPEX Editor with the program source. LPEX Editor with CUSFMAINT Source Annotate X-Analysis provides the facility of annotating an object. Navigate back to the diagram displaying an SCD for ‘CUSFMAINT’ object. Right click on ‘CUSFMAINT’ and select option 'Annotate', as shown below: Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 25 X Annotate option On selecting ‘Annotate’ option following dialog is displayed: Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 26 X Annotation Dialog to Add Text The user can supply the annotation text to the selected object. On saving, the text gets stored in the cross-reference repository. After having saved the annotation text, a small icon appears next to that object on various diagrams, indicating that the object is annotated. (The user needs to refresh the diagram to see the icon). The following screen displays annotation icon for ‘CUSFMAINT’ on SCD: Annotate Icon for CUSFMAINT on Structure Chart Diagram Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 27 X User can see/modify annotate text using the same ‘Annotate’ option. Document Manager The Documenter facilitates the generation of MS Word Document containing System Design information for the specified objects. Mark for Documenter The object to be documented is to be marked for documentation. To do this, right click on ‘CUSFMAINT’ from the Structure Chart Diagram and opt for ‘Mark for Documenter’. Context menu on CUSFMAINT on Structure Chart Diagram Double click on CUSFMAINT to generate its Data Flow Diagram. Mark ‘DISTS’ and ‘WWCUSF’ for documenter as done for ‘CUSFMAINT’. Invoke Document Manager by clicking the ‘Generate System Document’ option on ‘XAN4CDEM’ node as shown below: Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 28 X Launch System Document This invokes the Document Manager, as shown below: Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 29 X Document Manager The Document Manager lists all the objects that are marked for documentation. Click on the ‘Generate Document’ button to invoke the System Documentation Wizard, as shown below: Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 30 X System Documentation Wizard – Step 1 The wizard page provides the facility to choose the type of document, i.e.: • • Single System Document: Single MS Word Document gets generated Individual System Document: This generated one MS Word Document per object. Select ‘Generate Single System Document’. If you wish to specify the different file name or location other than the default file name/location, click on the ‘Browse…’ button and specify the filename/location for the Document and click ‘Save’ button. Click Next to invoke next screen of the wizard. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 31 X System Documentation Wizard – Step 2 Step 2 of the ‘System Documentation Wizard’ allows the user to specify the contents to be included in the documentation. Select from the features listed on the dialog, as shown above, besides already selected features. Click Next to invoke next screen of the wizard. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 32 X System Documentation Wizard – Step 3 Confirm the sequence of the features to document and Click Next. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 33 X System Documentation Wizard – Step 4 Select the formatting options for the document to be generated and click ‘Finish’ button to start the documentation. Document produced The documenter runs and generates the required document. The documenter also creates Table of contents and Index for the document. Flow Charts are generated using MS Visio and are shown as hyperlinks in the PDF document. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 34 X Preview of the System Document Variable Where Used Locate *File object ‘CUSTS’, from the expanded library view, right click on it and select ‘Zoom Source’ option, as shown below: Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 35 X Zoom Source option for CUSTS From the X-Analysis Source Browser, locate the variable ‘CUSNO’ using search on the Source Browser. Right click on it and select the ‘All References’ option under the ‘File/Field Where Used’ submenu. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 36 X Variable Where Used option for CUSNO This action invokes ‘Variable Where Used’ View for ‘CUSNO’, listing all references of the field ‘CUSNO’ in file ‘CUSTS’, in the entire application. Variable Where Used View for CUSTS/CUSNO Variable Where Used (VWU) lists all the Source Lines where the field/variable of a file/program is used/referenced, in the Member source and its associated Device Files and Copybooks, through out the application for ‘CUSTS/CUSNO’ The ‘Variable Where Used Level’ menu, allow seven levels of VWU Viewing. As we select the higher VWU level, references with greater indirections are displayed in the VWU view. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 37 X Variable Where Used Levels Menu The default level for ‘Variable Where Used’ (VWU Level) can be set using the X-Analysis Preferences. Meanings of Variable Where Used Levels Each variable level has specific search criteria and it display records that comes under the search criteria. The specific meaning associated with each level is as under: Level 1: Direct references to the field. Level 2: Records displayed at Level 1 along with the references to any other field, which refers the first field. Level 3: Records displayed at Level 2 along with further indirection/references to the field in level 2 referencing the first field. Level 4: Records displayed at Level 3 along with the references where the Field has been passed as parameter. Level 5: All of the above and references where the Field has been passed as parameter in a function which is in turn being called by another. Level 6: All of the above and references to all the aliases of the Field. Level 7: Tracks the usage of variable or field to maximum level of indirection. This level displays Variable Where Used for all the above levels. Note the differences of the results of Level 1 and Level 7. The above screen display Variable Where Used results for Level 1 and it have 96 lines. Following screen display Variable Where Used results for Level 7 and it have 168 lines. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 38 X Variable Where Used at Level 7 Member X-Reference Return to the Source Browser listing ‘CUSFMAINT’ source and locate the variable ‘CUSNO’. Right click on it and select ‘Member X-Ref’, as shown below: Member X-Ref option for ‘CUSNO’ Member X-Reference lists all the source lines where the selected Field / Variable is used / referenced. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 39 X Member X-Ref on ‘CUSNO’ The Member X-Reference may be viewed at various levels using the ‘VWU level’ dropdown from the toolbar. Enhanced Member X-Reference Select the variable ‘CUSNO’ from the Source Browser of CUSFMAINT. Right click on it and select ‘Enhanced Member X-Ref’ option, as shown below: Enhanced Member X-Ref option for ‘CUSNO’ Enhanced Member X-Ref option displays the references of a variable in the member, along with the information on how each subroutine deals that variable. It also presents the logical order in which the variable actually gets used and not the order of how it is physically placed in the source. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 40 X Enhanced Member X-Ref on ‘CUSNO’ File Field Details File Field Details option displays the field details for a file. This option is only available for PF and LF type objects. File Field Details Menu Return to the DFD for ‘CUSF’. Right click on it and opt for ‘File Field Details’. The following screen displays the ‘File Field Details’ for CUSF: Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 41 X File Field Details for CUSF LFs / Access Paths LF / Access Paths option displays all Access Paths for the selected Physical File. Right click menu option for LFs / Access Paths on CUSF Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 42 X LFs / File Access Paths for CUSF The user can zoom into the source of an LF by either double clicking on it or by opting for Zoom Source on context menu. Access Path Diagram Access Path Diagram is the diagrammatic representation of LF/Access Path list. 'LF/Access Path' lists all the available access paths for the selected Physical File, whereas the ‘Access Path Diagram’ displays them diagrammatically. Navigate back to the Data Flow Diagram for CUSF and select the option ‘Access Path Diagram’ as shown below: Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 43 X Right click menu option for Access Path Diagram On selecting the ‘Access Path Diagram’ following diagram is displayed: Access Path Diagram for CUSF Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 44 Data Modelling Data Modelling Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 45 Data Modelling Data Modelling Data Model Diagram displays the file relationships for an individual file object. Switch to the DFD for ‘CUSF’ and select ‘Data Model Diagram’ option on the right click menu, as shown below: Data Model Diagram option on CUSF This brings up the DMD for CUSF object. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 46 Data Modelling DMD for CUSF ‘DMD Details’ is also shown below the DMD. This displays the ‘File Connection Details’ for the DMD. Single click on a specific DMD Object displays the references of that object only. Click on ‘PTYPES’ object on the DMD and it displays the relations for ‘PTYPES’ only, as shown below: Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 47 Data Modelling DMD Displaying Relations for PTYPES • When the user clicks on a specific relation on the ‘DMD Details’, the DMD shows only those objects connected that are on the selected relation. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 48 Conclusion Conclusion Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 49 Conclusion Conclusion We just experienced a few key features of X-Analysis as an extension to RSE perspective. In order to experience the full potential of X-Analysis, use X-Analysis Perspective under IBM Rational products 7.x or Eclipse 3.2 and above. Discover and understand RPG applications with X-Analysis © Copyright Databorough Ltd. 2010 Page 50