Home
Reengineering and Rebuild With X-Analysis
Contents
1. s gt UE only MTT Mark Treg Credit Limit 10012 IWD Neil Woodhames SEL DSO a s w we ROD Richard Downey STU Stuart Milligan 2003 06 14 OO3 08 14 These screens are fairly typical of thousands of System i applications which exist today Application Areas Having identified that the Work with customers area is what we are interested in the next thing to do is to identify which programs displays and files are required to make that area work This would not be a straightforward task if you didn t have good knowledge of the system Databorough Limited 2009 Page 41 of 52 Reengineering and Rebuild With X Analysis Fortunately X Analysis makes this process esasy for us by allowing us to easily set up multiple application areas which we can base on a program or programs and specify that we want to include all referenced files and programs S Application Area Rules for MVC Seq Selection Object Type Object Co Object Ma Libram Co Library Na Inel Ref Inel Red Incl 0 Incl D 10 Select Frogram E qual wWWCUSTS Ho Ho Seq No Selection f lect Object Comparison Equal v Object Hame WWCUSTS i Library Comparison Library Hame Incl Ref d Fgm All w Incl Ret d Files All we Incl Owning Files No Incl Dependent Files Mo w _ Once we have our application we can view the objects or programs it contains is Aip g Object List
2. extra and notes ad hoc fields The system has coped but it has been time consuming to retrieve these details when required for marketing purposes But there is now a budget to correct this and start to look at modernising the application and making the functionality available to more areas of the business You would probably first start by looking at the program and display files that handle the display and maintenance of the customer information from that you would discover the database tables files involved At this point from a simplistic point of view you have the necessary information to make the changes and they are probably not that difficult add new fields for email and mobile phone to the database tables or rename the existing ones then modify the program and display files accordingly but you re probably thinking what about the rest of the system What else uses that table Is the display file used anywhere Databorough Limited 2009 Page 8 of 52 Reengineering and Rebuild With X Analysis else So the change has more aspects than would first appear these are just a few of the questions we have to answer gt Scope and impact of the change how many programs and tables are effected gt Database changes do we add new fields or just rename the fields and preserve the status quo Do we know those fields were only used for email and mobile phone data gt Database integrity Fields destined for ad hoc data li
3. 3 CI Overview Structure Chart For XAN4CDXA gt El ie AACLISF AACUSF Shadow Program Lill FA CBC110 Order Entry System i FCBS06R Back out account M vG5CD Generate Code OTHCAL CB907R gt A CLET Build Customer Letter it WECUSL Customer Letter Databorough Limited 2009 Page 12 of 52 Reengineering and Rebuild With X Analysis Area Flow Diagram The Area Flow Diagram is a very useful interactive diagram that shows the linkages between files and programs within an application area by clicking on a program we can see the files and programs it references if we click on a file we see the programs that use it The screen shot below shows the programs that use the Purchases file the programs and files are colour coded to show whether they are Input Output Update or called or calling program GH Area Flow Diagram 22 E Area Flow Diagram for MYC Total Objects 30 WWCUSTS WCUSTP Whork with Point Customer Customers Detail CUSFSEL Customer Site Selection CUSGRSEL Customer group Selection DISTSSEL Distributor Selection RTNMSGTEST Retum message text STKMASEL Product waster Selection SLMENSEL Salespersons Selection STOMASEL Store blaster Selection Order status description TENTPSEL Transaction type Selection aD Selected Object ZBCCLMSG ORDSTSEL Input Clear a hessage Order sta
4. Analysis lets you see what the legacy screen looked like without having to run the application which is a great time saver for people who haven t been involved with the original application Figure 10 Screen Design Layout in X Analysis Screen Design Report Layout for CNTCMAINTD Screen designs of legacy applications are not just about look and feel there are attributes and logic embedded which from a design point of view is relevant no matter what technology being used to implement them These are Formats Layouts Some screens may benefit from amalgamation or redesign but table edits and non transaction type screens will largely remain the same if not identical in layout Actions whether from sub file options command keys or default enter actions these often represent an important part of the usefulness of an application design The mechanisms used to offer or invokes these calls may change but where they go logically and what parameters they pass will largely remain consistent Fields Files Attributes What fields are on what screens and where the data comes from is a requirement in any system development Attributes of a field can also help determine what type of controls might be used in a modern UI For example a Boolean type might be implemented with a check box a date with a date prompt Again these are simple enough to edit in modern IDE s but the volume associated with any large legacy application modernizatio
5. a server in the background without stopping the page displaying Google Maps Select one Announcements The New Power Equation videos Client New Power Equation videos Benchmark Center Benchmark performance information Blade servers Blogs Capacity Backup Capacity on Demand Compare Power servers Cluster servers Cluster software ordering guide Community forums blogs and wikis Contacts Executive Briefing Center Contacts Benchmark Center Contacts High Availability Center of Competency Customer success stories Customer new Power Equation videos Education and training Executive Briefing Center Hardware Power Systems Hardware System i Hardware System p Hardware Capacity Backup Hardware Capacity on Demand Hardware Facts amp features Hardware Systems performance High Availability Center of Competency and Google Suggest are good examples of Ajax in action and helped popularize the concept Google Maps uses Ajax to prefetch the map images around the area your Databorough Limited 2009 Page 49 of 52 Reengineering and Rebuild With X Analysis looking at which allows fast scrolling Google Suggest populates a list of search terms based on the letters you ve typed Ajax allows us to design a flexible system which can support both new and existing users For new users or anyone needing a reminder of keystroke we can have a help icon or question mark beside the field if clicked a win
6. all parts or just the area you ve clicked on and the areas it relates to Recovering an Application Design The concept of reusing existing code or logic is not a new one The challenge has always been to identify isolate and reuse only those designs that are relevant in the new context in which they are desirable The sheer volume of code its complexity and the general lack of resources to understand legacy languages specifically RPG represents a tragic potential waste of valuable business assets In many cases these expensive and well established legacy designs have little chance of even having their relevance assessed let alone being reused The Design Recovery Solution Set of X Analysis addresses this problem more directly by isolating indexing and documenting those design elements that could be relevant in a modern version of the application being assessed Modern applications are implemented with distributed architecture A popular standard used for this architecture is MVC or Model View Controller Figure 8 below shows a typical legacy and MVC architecture side by side MVC allows for independent implementation and development of each layer and facilitates OO techniques and code reusability rarely used in legacy applications All these characteristics of a modern application radically improve the maintainability and agile nature Legacy Historically some sites have built or applications do have these same elements modified the
7. eticcteecncsrtan cagscresntonelauace na niet ngs E espe salceauacedanansesdendouadseunntecraniwececenanses 4 o A sag sean eccan E E E E E E tagntaessinaseansoaeneeee 7 Why Desist Recovery 1s CIM C WN ssarescan secu tascenctee E E NEE 8 Analysis Documentation amp Application Subdivision ccccccccccccssssssessseeseeeeceeeeeeeeeeaaaaeesssssseeseeeeeeeeeseeeaaas 10 Understanding Design amp Function More Easily cccccccccccsssssssssssseeeecceceeeeeeseaeeaeeessssseeeeeeeess 10 Producing Static Documentation Automatically ccccccsssssssssseseeeecceeeeeeeeeeaeeaeeseseseeeeeeeeess 15 Dividing Systems into Applicaton At CAG aria see gots aer aaen eE EEEE RE EE RAEE AENEA 16 Recovering an Application MCS aa soc pcates ian tides sone ane sae A E ENEE RENE ESE EEEa 17 Recon aee Da gly oleic Caen a E TE E AEE 19 Recovermne the Uss r Mea E e E E EE AEAEE 19 RECO Vere Business Rule LOSIC sessir cs ieaeade lca EE EEEE E 21 DMI DASARI srete N RRE E EEEN E A 2l Using Design Recovery for Rebuilding cccccssssssssseeeeeeeeeeeeeeeeeaaaeseesssseeeeeeeeeeeeeeeeasaaeaesesseeeeeeeeeeeeeeeeaaaas 32 Database Modernization using the Data Model assets nnnnnssessssoeeeeeeeensssssssssssseererreereressssssssssseeeeeessssss 32 Re buddies the View srera e E N 38 Rebuilding the Controller ccccccccccssssssssssseeeeeccceeeeeeeeeeaaaeesssseseeeeeeeeeeeeeeseeaaaaassessseeseeeeeees 38 Re sing Business Rules areires anana a ea OEE AEE NENES
8. id gt lt Wany to one name camtractt ead er class Nandcdxat khbmbe agn Contractteader lt colunn name XUDO not nulls true unigues true lt Corment Customers comment gt lt column gt lt many to one gt lt property name xwedte type striang gt lt column name XG TAT length 40 not null true gt lt Connient Mames core nt gt lt column lt property gt lt Property name awhecad type striang gt lt column name AMBZCO lengths ii not null true gt lt COnMent gt Statement Account lt comment gt lt column gt lt property gt lt property name awhica type striang gt lt column name AMSICO length 2i not null true gt lt connent gt Related Account lt comment gt lt r column lt property gt Modern Business Intelligence Inquiries amp Reports There are many choices when it comes to BI or reporting tools Almost all of these automatically allow import of the database definition some provide for the relational or foreign key model of a database some even try and infer this from the physical implementation of the data base fields and file definitions themselves The problem with using the file and field names on a System i database is that they do not match and they have complex key structures as opposed to UID or sequence keys The benefits of having an explicitly defined relational and physical model of the database in any of these tools are si
9. implementation This instantly removes complexity caused by the idiosyncrasies of different language versions and coding practices typical in large legacy applications developed over many years Here is a brief description of some of these diagrammatic constructs and views Structure Chart Diagram A Structure Chart Diagram SCD Display gives a graphic representation of how the control passes from one program to another program within the application This follows the call structure down the complete stack The diagram Databorough Limited 2009 Page 10 of 52 Reengineering and Rebuild With X Analysis also reveals data input objects and also automatically derives a summarized description of each of the object in the diagram Color coding also reveals important functional aspects such as updates prints and displays which help the user to zone in on commonly sought after details Figure 1 Structure Chart Diagram for a Program T a Structure Chart Diagram 2s m Structure Chart for CLET I CLET Build Customer Letter QLETN1 Letter Prefix Generation OTHFIL QA WECUSL Customer Letter PRTFIL UPD J CUSLETSO Update Letter Sequence UPDFIL UPD WKCUS EF Find Fax Number OTHFIL WECUSSE Customer Release Letter UPDFIL UPE WECUSSP Customer Enquiry Letter PRTFIL Data Flow Diagram A Data Flow Diagram DFD is a graphical representation of a program object where used showing the files and progr
10. in a product like X Analysis to both recover the design of the application and provide highly productive Databorough Limited 2009 Page 4 of 52 Reengineering and Rebuild With X Analysis analysis tooling to compensate for the complexity of the application and the absence of the original development team Inconsistent programming standards and designs significant amounts of redundant and duplicated code and an increasingly costly demand for globally diminishing legacy development skills are the results of points 4 5 and 6 This concepts guide will illustrate how X Analysis carries out the Design Recovery process and how it can be used to build re engineered applications from that Recovered Design To fully understand and apreciate the problem domain just think for a minute of two approaches to the above problems namely screen scraping and code conversion Simply screen scraping the user interface with a GUI or web emulation product does not improve the situation the application may appear slightly more modern but the cosmetic changes still leave it with all the same maintenance and enhancement issues and it may be not much easier to use for new users The other common approach is code conversion i e line by line syntax conversion of a legacy application this will typically just transfer the same problems from one environment language to another Indeed it will often produce source code that is less maintainable effective
11. of M C ALLUSR ALL PGM ALL ALL ALL Total Objects 17 All Procedures Sk a A eel kee ese Wa Fe ech O O oe AN Crested _Chenged Function GS exportable Functions REXAN4RD CUSFSEL PGM RPGLE Customer Site Selection C 00 00 00 04 06 09 04 06 09 DSPFIL Source Files RE XAN4RD CUSGRSEL PGM RPGLE Customer group Selection C oofoo oo 04 06 09 04 06 09 DSPFIL beinaee plied Sikini Re XAN4RD CUSTMNT1 PGM RPGLE Customer Detail Maintenance B oofoo oo 04 06 09 04 06 09 EDTRCD E i x Rebuid Options RE XAN4RD CUSTSSEL PGM RPGLE Customer Selection C 00 00 00 04 06 09 04 06 09 DSPFIL RE XAN4RD DISTSSEL PGM RPGLE Distributor Selection C 00 00 00 04 06 09 04 06 09 DSPFIL BE A Accounting Main RE XAN4RD ORDSTSEL PGM RPGLE Order status Selection C oo oo oo 04 06 09 04 06 09 DSPFIL BEB myc mvc CLxAN4RD RTINMSGTEXT PGM CLP Return message text C 00 00 00 04 06 09 04 06 09 OTHCAL 24 Application Area Diagram RE XAN4RD SLMENSEL PGM RPGLE Salespersons Selection C 00 00 00 04 06 09 04 06 09 DSPFIL a Data Model Diagram RE XAN4RD STKMASEL PGM RPGLE Product Master Selection C 00 00 00 04 06 09 04 06 09 DSPFIL SZ Area Flow Diagram RE XAN4RD STOMASEL PGM RPGLE Store Master Selection C 00 00 00 04 06 09 04 06 09 DSPFIL a Overview Structure Chart Re XAN4RD TRNTPSEL PGM RPGLE Transaction type Selection C oofoo oo 04 06 09 04 06 09 DSPFIL Se shied RE XAN4RD WCUSTP PGM RPGLE Print Customer Detail C oofoo oo 04 06 09 04 06 09 PRTFIL RE XAN4RD WWCONDET
12. well structured industry standard code rather than messy syntax conversions with unmaintainable code Why Design Recovery is difficult From the point of view of the user of X Analysis this process of building the cross reference repository and deriving the models happens automagically i e Its just there and happens typically as part of the installation process though it can be triggered again later on if required However it is worth taking some time to understand this process and to see what happens how the model is constructed and the relationships inferred If you think of a typical System i application it is likely to consist of a mix of RPG programs DDS files and members for display files database files and logical views newer systems may have these interspersed with SQL scripts but the sum of knowledge in that system how it works and interacts amongst its various elements is contained within those source files and compiled objects the issue is retrieving that knowledge efficiently To understand and fully appreciate the problems X Analysis solves just consider the process you would have to undertake yourself if you wanted to discover how a system operates or make changes to it As a simple example for part of your application you have a customer details screen with no dedicated place for an email address and mobile phone numbers the system has adapted itself to the internet age as many System i apps have done by making use of
13. 40 Screen Design Report Layout PPSLE Customer Detail Mainten 4c RPGLE Customer Selection gi Annotate _ RPGLE Distributor Selection 40 pee rar Documente CLP Delayed Faxshot 4c RPG Distributor Report gi More Info _ RPGLE Display Distributor qi _ RPGLE Display Product qi Derive Business Rules RPG Faxshot Errors Part 1 4c Modernize Options to RPG Faxshot Errors Part 2 dy BBS menerake Fav Mumhersg 4i Generate UML Diagrams Generate Activity Diagram 4i o Generate Use Case Diagram 4c Application Area Options d Generate Class Diagram mgineered Functions 24 Development Functions Member Ref variable Databorough Limited 2009 Page 31 of 52 Reengineering and Rebuild With X Analysis Using Design Recovery for Rebuilding Whilst Design Recovery is very valuable for documentation and application support purposes the real benefits come when the recovered design can be used to modernize or re develop a system Reusing existing designs programmatically can provide a dramatic productivity gain in rebuilding an application While legacy application designs in their entirety might not suit a modern application implementation design components are often suitable as long they can be re used at a sufficiently high level without introducing complexity to the redeveloped application Therefore being able to select and enhance or ignore these at a granular level removes the inheritance of irrelevant or legacy specific code constructs and all
14. 52 of 52
15. 7F4015C7E 76A Customers Customer Detail Maintenance Databorough Ltd Customer Ho Customer Hame Bertwhistle amp Company Ltd amp C atement Account Related Account ACTZS ACCAS ax Reg Bank gt ank A c Forex OOUOUOO00001 0 a Full Name i bas iP E Johan Klaassen Mark Tregear Neil Woodhams Richard Downey stuart Milligan UI Bg lg i Cr Guar i Land Date Loaded 14 06 03 C3 Chg Pate Last Sale 14 07 03 4 14 08 03 4 Z And finally the customer maintenance page with a drop down selected Completing the Modernization Process Some mention should at least be made on some of the tasks remaining to complete the application rebuild Rather than explain how to do these in detail in this white paper the most relevant points have been summarized below There will be a subsequent white paper from Databorough that will elaborate on these points There is no shortage of articles and books on these aspects generally available to modern software architects Some useful articles listed in the Additional Resources amp Information section below cover some of these subjects Databorough Limited 2009 Page 47 of 52 Reengineering and Rebuild With X Analysis Surrounding Application Framework In most cases it will be desirable to replace some of the System i application constructs with JEE or other equivalents gt File Overrides gt LDA type constructs g
16. ADR ag 0547 00 gt BRT IN9S9 IFE ake BSSSSs BERR 0546 00 P BEC HOVE vz TH40 an 0549 00 P BRC HOVE Ya DE MSGID I 0550 00 gt ERC CALL RTMNMT ag 0551 00 gt BRC FARM MSGID 7 11 0552 00 gt BRC FAEM ERRMSG lie 11 0553 00 gt BRC LEAVE 11 0554 00 EP lB BRC ENDIF E sS cnas 03l U55500 T ENDIF a z 0556 00 C CUSTOMER 0556 96 ERL Retrieve the record for the field Debtor from the file Purchases I 0556 97 IBRT not found then it is invalid 0556 96 I BEC Business Rule No XAN4CDEM ORPGLESRC WWCONHDR S5S7 Validation 0556 99 HIBRO VWoooo CONHDR ZWECCD Invalid customer number 0557 00 B gt BRC AWETE CHAIN CUSTS m9 0558 00 gt BRC IN99 FEO va b z 0559 00 gt BRC MOVE i TNW41 o560 00 gt ERC MOVE OEMOOOS MSGID nsadi AN gt IARC GALL ETMMTE Databorough Limited 2009 Page 23 of 52 Reengineering and Rebuild With X Analysis As preparation for moving these rules elsewhere or EA 9 Ut isolating the rules as psuedocode we can select a Extracted Rules Normal Source Code Indented Source Code Embedded Rules Extracted Rules Extracted Rules for WWCONHDR in XAN4CDEM QRPGLESRC G IT 2 Bl Bee Ber E Extracted Rules WHEN ADDING CONTRACT MUST NOT BE ZERO if Tt the field Contract is zero then it is invalid C WHEN ADDING CONTRACT MUST NOT EXIST ic TH36 IFEQ macs SSS SSS 0 Be ff Verity the field Contract against t
17. CNAM String jj sdsdicdeSDSDCDE String Gj SfieldSFIELD String Eg spersonSPERSON String Eg swaocdSWAOCD String Eg swardtSWARDT String Eg swasdtSWASDT String Eg swbhadOSWBADO String Eg swbbcdSWeBBCD String Eg swbccdSWBCCD String Eg swbncdSWBNCD String Ea swbpdOSWBPDO String Eq swhqdtSWBQDT String 1 Eg swbtcdSWETCD String Eq swh2cdSWB2cD String Eg swb3cdSWB3CD String Ea swe stSWCPST String 1 Eg swdastSWDAST String Ea swdvcdSWDVCD String Eg sweOnbBank String 1 Ea swfOvaAmtLastSale String 1 GA swhOvOLastPay String gq swhlvaCurrPay String gq swflvOCurrClaim String Eg swf2vaCurrSls String Eg swf3vaCurrCost String Eg swf4vay tdSales String Ea swhivaLastYearSls String Ea swgavaCurrentAmt String Ea swobva030Days String Ea swgcval60Days String Ea swadva090Dayvs Strina H cusgrpCustomerGroups Eg xwbnedCusGrp String Eg xwkhtxDescription String H distsDistributors Ea dsdcdeCode String Eg dnameDescription String H slmenSalespersons Eg personPerson String Eg pnameFullName String Page 29 of 52 Reengineering and Rebuild With X Analysis Figure 14 Activity Diagram co WWCUSTS Work with Customers Work with Customers 51 Customer Maintenance Add Display Delete Change hn Work with Customers 52 Orders Customer Detail Maintenance 51 Trans Hist Ord
18. E 38 BS Ut Cte TT ample oee E EE E E E E ETE 40 Identify what you want to work WItD cccccccccccccccecccceeaeeeessseseeeeececeeeeeeeeeaauaassasseseeeeseeeeeess 40 Applicaton ATAS siorse taiese e e a EE EEEE O e AEE 41 Rebuild the ADP CAT OM ssassn aea e EE O O EEE EEE ETENEE 43 Completing the Modernization Process ccccccccccccsssssssssseseeeeeceeeeeeeeeeaaeeesssseeeeeeeeeeeeeeesessaaaaseseneeeeeeeeeeeeeeeaqags 47 Surrounding Application Framework c ssssssssssesseeeececeeeeeeeeaaesseeeseseeeeeeeeeeeeeeeeeaaaagaesaeesss 48 Look amp Feel amp UL Standards saitosscicsneasacosatonsstuntcenessatonssoannesseesadeonstanndeanqsatecseeantecsnesavessevanndisareart 48 OS UNIV A APARE EE TA A EAE A EA 51 Additional Resources amp INPOPMAMON 1 0205202s00sdenesbesnnentsomnneanesannnantinnnneanmecnnontsinonnbaneeannnantioanstuannecisiintioonneaneeooneant 52 Databorough Limited 2009 Page 3 of 52 Reengineering and Rebuild With X Analysis Executive Summary The knowledge and information contained in an organization s business software is vitally important and extremely valuable but often this information covering the operation metrics and design of the software is tantalizingly out of reach Without this knowledge maintenance and changes to the system are not as efficient or effective as they could be and the risk of failure or problems increases exponentially the larger the enhancement required This could lead to a
19. ENDIF CUSTOMER oa Retrieve the record for the field Debtor from the file Purchases If Ct STATUS if Retrieve the record for the field Status from the file Order status C SALE SPAN a ff Retrieve the record for the field Rep from the file Salespersons If Notice how the error code MOVE YSU0003 MSGID that was grayed out has been replaced with ERROR Y2U0003 Note that the restructured code view grays out the code that won t be carried over ie the code that is platform specific From this view we can press a button to view the restructured code side by side with the original code Restructured Code for WWCONHDR in X4N4CDEM QRPGLESRC Restructured Code Message Handling XWORDN Redundant Block C WHEN ADDING CONTRACT MUST NOT BE ZERO FE If the field Contract is zero then it is invalid C WHEN ADDING CONTRACT MUST NOT EXIST IF NOT FOUND CONHDR ff Verify the field Contract against the file Contract ff file then the field Contract is invalid ff Business Rule No XAN4CDXAT ORPGLESRC WWCONHDR 554 Vs ff yOOOO6 CONHDR XWORDN Record already exists c XWORDN SETLL CONHDR c IF EQUAL CONHDR OEMO010 RTNMTX WHEN ADDING CONTRACT MUST NOT EXIST IN36 IFEQ TI XWORDN SETLL CONHDR IN99 IFEQ vi MOVE TA MOVE y2u0003 CALL RTNMTX PARM PARM LEAVE ENDIF ENDIF Cc y2u0003 MOVE CALL RTNMTX PARM PARM LEAVE ENDIF XWBCCD CHAIN CUSTS ING IFEQ ee S MOVE ri MO
20. F Pesas oz 0544 00 C WHEN ADDING CONTRACT MUST NOT EXIST 0546 00 Z XWVORDN SETLL CONHDE gg 0547 00 c IN99 IFEQ ha O3 0548 00 Z MOVE 4 IN40 i 0549 00 E MOVE 2 U00003 MSGID Ii 0550 00 CALL RTNMTE BE 0551 00 Z FARM MSGID 7 ne 0552 00 Z FARM ERRMSG 132 i 0553 00 Z LEAVE Ii 0554 00 3 ENDIF Pesce 03 0555 00 g ENDIF a oz 0556 00 C CUSTOMER 0557 00 Z XWECCI CHAIN CUSTS 39 0558 00 E IN99 IFEQ 1 oz 0559 00 c HOVE 4 IN41 0560 00 p MOVE QEMOODOZ MSGID 0561 00 gt CALL RTNUTE 0562 00 Z FARM MSGID 7 0563 00 Z FARM ERRMSG 132 0564 00 Z MOVE KALL 1 XUG4TE E 0565 00 E LEAVE E 0566 00 ENDIF a oz 0567 00 Ct STATUS We can view the embedded rules ie what is really going on in the code as discovered by X Analysis Embedded Rules for WWCONHDR i SRC Lines 674 Yiew Level 4 H g UY h A E seq Mo vep uaren h area no Anaa aa cl an erie a en ioe mol a aaa a aara ae e onoarea na A aera aa Shae 0543 00 E gt ERC ENDIF b 6 z 0544 00 C WHEN aDDING CONTRACT MUST NOT EXIST 0545 96 ERC Verify the field Contract against the file Contract Header If on 0545 97 ERC file then the field Contract is invalid 0545 96 S 1BRC Business Rule No EAN4CDEM ORPGLESRC WWUCONHDR 546 Validation 0545 99 HIBRC VWoooos CoOoNHDR ZWORDEH Record already exists 0546 00 B gt BRC SWORD SETLL COMH
21. PGM RPGLE Work with Order Details B 00 00 00 04 06 09 04 06 09 EDTFIL Programs RE XAN4RD WIWCONHDR PGM RPGLE Work with Orders B 00 00 00 04 06 09 04 06 09 EDTFIL Files RE XAN4RD WWCUSTS PGM RPGLE Work with Customers A 00 00 00 04 06 09 04 06 09 EDTFIL Business Rules Summary RE XAN4RD WWTRNHST PGM RPGLE Work with transaction history B 00 00 00 04 06 09 04 06 09 EDTFIL H E x Rebuild Options CLXAN4RD XBCCLMSG PGM CLP Clear a Message Queue C 00 00 00 04 06 09 04 06 09 OTH E Be PRINT Printed documentation 0 SALES Sales System AE STOCK Stack System This is a very powerful technique and allows rapid prototyping and development without having to develop the whole system in one go The application areas you create can be integrated together into a larger structure and displayed using the application area diagram Databorough Limited 2009 Page 42 of 52 Reengineering and Rebuild With X Analysis A Accounting Main Rebuild the Application PRINT Printed documentation SMWORK TEST 1 Working with the application area that we have just created we can build a web application directly BI A Accounting Main pema H D GE E G ka Appl xt Date ott YEE Ove e alle re Prog B Files Fj Busil Re PRINT SALES STOLK eh XAN4CDXRF Application 4rea Options Derive Business Rules Export Options Annotate Document Application Area Generate Class Diagram UMIL Daka O
22. Recovering Business Rule Logic section of this document These functions combined with the ability to interactively select those rules from the legacy application for reuse in the modern version dramatically speed up the refactoring process Rules selected by the user are then placed automatically into the Java bean with the Pseudo code narrative describing the rule included as annotations in the bean The fact that we can easily verfiy that business rules from the legacy system have been built into the new system provides a high degree of confidence in the new system and is important from a compliance and audit standpoint Each legacy program can also be reengineered into a standardized RPG service program as a stored procedure for handling legacy batch services that need not be touched either temporarily or indefinitely A Java call bean is created automatically by X Analysis in this instance and acts as a wrapper class to this stored procedure thus greatly simplifying access to legacy services for Java developers Conversion to EGL is another option available for residual RPG based service logic Databorough Limited 2009 Page 39 of 52 Reengineering and Rebuild With X Analysis Rebuilding Example To illustrate how quickly you can begin the rebuilding process lets have a look at a typical iSeries application and rebuild part of it The key steps are 1 Identify the parts of the green screen that you want to work with 2 Use X A
23. Reengineering and Rebuild With X Analysis Authors Richard Downey and Stuart Milligan Databorough Limited May 2009 Reengineering and Rebuild With X Analysis Preface Developing tools and services for analyzing and reengineering applications for more than twenty years has given Databorough a unique perspective on the large and complex world of legacy applications running on System i iSeries and AS 400 In 2005 IBM and Databorough published an IBM Redbook Modernizing and Improving the Maintainability of RPG Applications Using X Analysis Version 5 6 This concepts guide you are reading now expands on the white paper Modernizing RPG COBOL 2E System i applications using X Analysis 8 incorporating new concepts and methods for design recovery and rebuilding of monolithic RPG COBOL 2E applications into modern application architectures Contact info databorough com for a copy of the white paper the Redbook and trial software We will show in this paper how automated component generation from recovered designs can dramatically reduce the costs and risks of an application rewrite and without inheriting the legacy code s redundancy and complexity Databorough Limited 2009 Page 2 of 52 Reengineering and Rebuild With X Analysis Table of Contents PPS FC EENEI IIE ES VENT A IE TIIE ES IAS eee ine TT ET OA MTI eden TTI ET O E A A TE T T 2 SEONG E E D E A A E A E N E EE A A E A T A cancuccsecmatiee 3 Pe UL Ie UIT MY ans
24. VE OEMOO02 CALL RTNMTX PARM C CUSTOMER ff Retrieve the record for the field Debtor from the fil C STATUS ff Retrieve the record for the field Status from the fil C SALESMAN v i D a aaqaanananaaanananaananaanaananaaanaanaann We can view the migrated logic which is the essence of the original code as expressed in a language independent psuedo code Databorough Limited 2009 Page 25 of 52 Reengineering and Rebuild With X Analysis Migrated Logic of 4CONHDR in X4N4CDEM QRPGLESRC Migrated Logic DELRECY DELRECW DSPRECE DSPRECY RESTOREDAT m8 BDA TA VALID DT tf Subroutine Walidation WHEN ADDING CONTRACT MUST NOT BE ZERO fo me the Eteld egma cett dle serm Enan Le dLa daela IF XWORDN ZEROS ERROR OFMOOLO END WHEN ADDING CONTRACT MUST NOT EXIST IF NOTFOUND ff Verify the field Contract against the file Contract Header If on file then Pi sche Ehala Conteaee ds aniadaic VALIDATE DATA FROM COMNHDR WHERE xWORDN ZWORDHM IF FOUND ERROR YAZU0O003 END EMD CUSTOMER fee H EH E Notice how the RPG SETLL code has been replaced with a VALIDATE statement to carry out the read against the table on the contract number key Databorough Limited 2009 Page 26 of 52 Reengineering and Rebuild With X Analysis The final view is the generated code view where we see the code generated to execute the instructions in the psuedo code here it is in Java Wy ORHDR Rg Restructur
25. XXTODA 60 J To Date 6 0 G PARM WWCHG 1 2 R Change Option 1 DELETE FLAG c Initialise Parameters Initialise Parameters 06360 SDPOO1 DOUEQ N Repeat until Redisplay Screen equal to N 0640C GEERTN DOUEQ E Repeat until Return Code equal to E j 0642C BCTL ANDEQ And i Mode equal to j Cc MOVE ACACFN WWACKN Move ACACFN to Account Type D7656 EXSR PVvVOO1 Perform Validate Screen c READ CBACPF View RPG as Read Accounts Master File lt 26 gt C INITIALISE SCREEN Pseudo INITIALISE SCREEN K WWACFN IFEQ ACT If Account Type equal to ACT C WWACSS OREO D Or Account Status equal to D C Z ADDO XXITAM Move numeric O to Int Amount C Z ADDO XXTRAM Move numeric O to Tax R1f Amount E END End K WWACFG IFEQ H If Account Flag equal to M C WWTATP IFEQ CLS If Transaction Type equal to CLS 4 C WMCHG TEEI Ts Tf Chance Ont inn eoal ta D T Databorough Limited 2009 Page 14 of 52 Reengineering and Rebuild With X Analysis 2E as Pseudo Code 2E action diagrams can also be displayed as pseudo code The information returned contains both the 2E variable names and contexts alongside the RPG COBOL mnemonic Producing Static Documentation Automatically Interactive analysis via a graphical client is generally the most intuitive manner in which to analyze a system but there is often a requirement for various types of sta
26. a SF CUStomercroups java 3 D Distributors java J OrderStatusDescription java 5 ProductMaster java D Purchases java D Salespersons java 3 D Sikes java J StoreMaster java 3 lt S TransactionHistory java D TransactionHistoryId jawa J TransactionTypeDescription java Fe ContractDetail hbr xml ay ContractHeader hbm ml a o ope an Customeraroups hbr ml ony Distributors hbm rml 3 ae CrderStatusDescription hbm ml 3 Fe ProductMaster Abm xml DT Purchases hbm xml 3 at Salespersons hbm xml o Al Sites hbr xml a a an StoreMaster hbr ml z PF TransactionHistory hbm 2ml fo iy TransactionTypeDescription hbm xml sandtcdxat jsfbean angcdzat logic Databorough Limited 2009 Page 36 of 52 Reengineering and Rebuild With X Analysis Hibernate mapping for purchases table enL wersions i 07 gt lt IDOCTYFE hibernate mapping PUBLIC r Hibernate Hibernate Mapping DTD 3 077 EN hetp hibernate sourceforge net hibernate mapping 3 0 dtd gt lt Generated 16 May 2009 17 06 29 by Hibernate Tools 3 4 1 GA gt lt Hibernate mapping gt lt class name Nandcdxat hbmbean Purchases table CUSTS gt lt Conmient gt Purchases lt coment gt zid name awhecad type string gt lt colunn narme xWECCo gt lt Qenerator class assigned gt lt
27. all of the specific attributes of that particular format X Analysis deduces the links between these classes using a combination of the derived data Reengineering and Rebuild With X Analysis model and call or action information extracted from each program Figure 13 Class Diagram for a Program H cusfSites eg cusnoCusNo String Eg cnameCompany String Eq dsdcdeDistributor String Eq statusSts String E telnaPhone String Ey extnExtn String Gq lctdatLastCntDate String Eh apdateNextCntDate String Eg usernmContact String Gq salutSalutation String EqititlelobTitle String Gy faxnoFaxNo String Ea emailEmail String Ea websitWebsite String Eh addiAddress1 String Gy add2Address2 String Eq add3Address3 String Eh add4 Address4 String fg cntryCountry String Ea pscdPostCade String Eg crmntLCommentLinet String Ea cmmnt2CommentLine2 String Ea crmnt3CommentLines String Ea docrcdDocSent String Eq doc2DocSent String Eg doc3DocSent String Eg doc4DocSent String Eg docSDocSent String Ea doc6DocSent String Eg oldmchMch String Ea procdeProductCode String Eq lsicdeOrigList String gq prefixDocPrf String Eq lletsqLastLet int Eg spreqspecReq String fea risrCisrRisrRnth Strinn Databorough Limited 2009 H custmntipf Eg cusnoProspectNo String Eg dnameFullName String Eg kwbecdk WBCCD String Ea pnameFullName String gj recnamRE
28. ams accessed by the subject object It is also color coded and shows both flow of data at a high object level and contextual information about the specific variables parameters passed between objects Figure 2 Data Flow Diagram for a Program Program Centered Data Flow Diagram for CUSFMAINT Total Objects 10 By 1 ag CUSFMAINT Customer Site Maintenance CUSFMAINTD CUSFSEL DSPDISTS Customer Site Display Distributor Selection Sites by Number Distributors Customer Site Maintenance WWCCONS WWRAREAS CUSFMAINTC WiWCUSF work with work with Rep Customer Site work with Customer Delivery Areas Maintainance Customer Sites Contacts Databorough Limited 2009 Page 11 of 52 Reengineering and Rebuild With X Analysis Program Structure Chart A Program Structure Chart graphically displays the sequence of calls in the program The call could be to execute a Subroutine Program Module Service Program For details refer to X Analysis User Manual Figure 3 Program Structure Chart for a Program Program Structure Chart for OE001 Total Objects 6 k Oo 7 CUSLET Customer Letter Stage 1 Overview Structure Chart The Overview Structure Chart gives a snapshot of an application It displays all the entry points to the application and then the structure chart for each of these entry points Figure 4 Overview Structure Chart for complete application E Overview Structure Chart 2
29. ational databases as it handles what s known as the persistence layer i e the bit that actually reads and writes data to the database Hibernate has been downloaded at least 3 million times and has gained widespread usage so there are now plenty of books and resources available for it Hibernate allows Java developers to treat the database as a set of objects like any other object they use thus dramatically simplifying the code they need to write For large complicated databases typical of system i applications this is naturally a big advantage It is this which makes Hibernate one of the most popular persistence frameworks used for enterprise Java applications today As a framework Hibernate naturally requires set up and configuration and the more information that can be supplied in the configuration the more effectively it can be utilized in development and production Though DDL Schemas can be imported directly into Hibernate DDL that describes only the tables and fields of the physical database is only part of the ORM requirement Relational or foreign key information naming without having to is obviously the next critical requirement for the use the file table names as Hibernate ORM to work effectively As explained earlier with pure JDBC the entire legacy relational model derived by X Analysis can be exported as DDL This DDL can then be imported directly into Hibernate thus producing an instant Object relational Map or ORM of the en
30. atus description 51 Salespersons 51 Product Master 51 Store Master 514 Transaction type description Work with Order Details 514 Work with Order Details 52 work with Order Details 53 Component x cancel When we press OK here a new Java Web application is generated for us As we can see in the screen shot to the left the application that is generated comes complete with the necessary script files to build it for different application servers eg Apache Tomcat and WebSphere The code is structured in a logical manner with hibernate beans or data beans according to whether we chose the ORM option or not Similarly if we opened up the classes and the JSF pages produced we would see that they have names which can clearly tie them back to the original application even though this is brand new code Once this application is built we can deploy it to the application server of our choice and start to use the application You can either go straight to a browser and navigate to a page but an easier way is to use the built in integration with X Analysis If we go back to the X Analysis view of our application area and bring up the programs if we select WWCUSIS and right click we have options to allow us to display the corresponding JSF page as can be seen in this screen shot Databorough Limited 2009 Page 44 of 52 Reengineering and Rebuild With X Analysis Me AGATE OLLI Ptal RPLLE Wore WIC WIPO
31. cumbersome if there are many values and unless you have only a few codes beginning with each number or letter in most browsers once the focus is on a drop down box typing a letter or number will position the cursor at the first matching entry in the list keyboard navigation is limited and can involve a lot of scrolling This example looks quite cumbersome but imagine if it had several hundred options and you had to repeat the same process many times on each page So how can we improve the usability and provide help for new users at the same time Most web applications that have been developed from older applications use technologies dating from the birth of the web Web 1 0 and are analogous to main frame technologies i e the browser is a dumb terminal you enter data then press enter then get feedback on errors etc Web 2 0 technologies which I shall address shortly are similar in principle to Mini computers like the iSeries the terminal or browser can communicate in real time with the computer as the data is being entered providing instant feedback For the purposes of this paper when addressing Web 2 0 we are referring to AJAX Asynchronous JavaScript and XML Ajax is a term that was coined in 2005 as a tipping point was reached where most web browsers in use had a lowest common denominator set of capabilities across CSS JavaScript XML and XHTML which enabled implementation of rich web applications that communicate with
32. d Leader in discovery analysis and modernization tools for System i http www databorough com Modernizing and Improving the Maintainability of RPG Applications Using X Analysis Version 5 6 IBM Redbook http www redbooks ibm com redpieces abstracts redp4046 html Architecture and Design Recovery Johannes Kepler University http www alexander egyed com research software architecture and design recovery html Crafting an Application Architecture with Java Frameworks by Don Denoncourt http systeminetwork com article crafting application architecture java frameworks Hibernate Your JDBC by Don Denoncourt http systeminetwork com article hibernate your jdbc Encore s Extreme Makeover from the Inside Out by Richard Shaler http svsteminetwork com article encores extreme makeover inside out A Field Guide to Encore s System i Software by Richard Shaler http svysteminetwork com article field guide encores system i software Asset modernization Discover and transform legacy assets for reuse IBM Rational Modernizing IBM eServer iSeries Application Data Access A Roadmap Cornerstone IBM Redbook http www redbooks ibm com redbooks SG246393 wwhelp wwhimpl java html wwhelp htm Eating the IT Elephant Moving from Greenfield Development to Brownfield by Richard Hopkins and Kevin Jenkins IBM Press http eatinetheitelephant com home html Databorough Limited 2009 Page
33. dows will appear allowing the user to choose the appropriate code depending on the complexity of your codes you may wish to add a wizard or step by step facility which asks questions that narrow the range of codes For the experienced users you have several choices including Let the user enter a code and validate it when they leave the field Let the user type in one or more characters of the code and then show a dynamic list for them to choose from based on the character s they have entered The best choice is likely to be to combine the two approaches with a variable delay on the dynamic list so we don t waste system time generating lists when the user knows the whole code only prompting when it looks like it would be useful Ajax has become widely used since 2005 and a number of frameworks exist to make their use easier and in some cases automatically for example JSON JavaScript Object Notation and GWT Google Web Toolkit Practical usability and look and feel designs go hand in hand and require knowledge and information about modern UI controls and legacy UI patterns which can also be extracted as part of the X Analysis documentation facilities Databorough Limited 2009 Page 50 of 52 Reengineering and Rebuild With X Analysis Summary Comprehensive accurate and current documentation of a legacy application improves quality productivity and reduces risk for any maintenance modernization or rebuild IT project The ris
34. e g Synon generated applications X Analysis can directly extract the details of the existing model providing an excellent base for efficient and effective design recovery and reengineering to JEE Jargon Explained JEE Java Extended Edition previously known as J2EE JSF JavaServer Faces a web application framework which uses a component based approach to simplify development of user interfaces for JEE applications EGL Enterprise Generation Language a new high level platform independent language from IBM which produces code which can be compiled into Java or COBOL Databorough Limited 2009 Page 6 of 52 Reengineering and Rebuild With X Analysis Introduction As we have seen gathering knowledge about System i applications is not a straightforward task for today s generation of business analysts and developers To illustrate that point and to fully understand the problem domain we will look at Why Design Recovery is difficult by working through the problems that X Analysis solves in building its repository of design recovery information In situations where developers are not familiar with a system or its documentation is inadequate the system s source code becomes the only reliable source of information Unfortunately source code has much more detail than is needed just to understand the system also it disperses or obscures high level constructs that would ease the system s understanding X Analysis aids system u
35. eErs RPGSLE Work with Customers RPGLE Work with transaction history CLP Clear a Message Queue RE ANg zoom Source CLyAM4 iii _ structure Chart Diagram pial Program Structure Chart EF Screen Flow Diagram ro Data Flow Diagram Object Where Used d Variable where Used Screen Design Report Layout Annotate Mark For Documenter More Info Derive Business Rules Rebuild Options Re engineer Programs Display Re engine ered Functions p 3 BR Sur Generate UML Diagrams Generate Web Application ID Details 57 Application Area Options Si Execute JSF me fl ele gram _a f IJ TTL Calling Pi When we click on the Execute JSF we get the rebuilt work with Customers page A Work with Customers Microsoft Internet Explorer File Edit View Favorites Tools Help Address 2 http ifi27 0 0 1 8080 xandcodxatmyc Faces azwweustss 1 xhtml readRec x tedispMode DISPLA afForm F Customer Name ACC Bertwhistle amp Company Ltd amp C ACE10 Customer ACC10 ACZ BOCK amp CO LTO Aes BESSON BROS ACEA TEDIA ENTERPRISES LTD xli ACCS Bays Engineering Ltd ACCE Gough Research ple AC Karst ple ACCS Bays Engineering Ltd ACEHI MEWT FOODS IJK LTO ALCS Prime Computer systems aL Le Le I E IRI Databorough Limited 2009 Page 45 of 52 Reengineering and Rebuild With X Analysis Following the screen flow we had earlier on the green screen side here s the W
36. ed Code Rs Migrated Logic n ff Verify the field Contract against the file Contract Header If on ff Eile then the field Contract is invalid i ADD eguala jactionj i if ConhdrF re ecord amp xists conhdrR xXWORDN setError AWORDN 2U0003 return false Di D e Hi 256 ff DSPRECY subroutine processing 2578 private hoolean dsprecy String selact throws SQLException 266 ff S LIWHES subroutine processing 2678 private boolean zlines throws SQLException i 274 ff VWALIDT subroutine processing 2 Pot Private boolean validt String action throws SOLException AT ff If the field Contract is zero then it is invalid ET if is zeros conhdrR xWORDN i 276 SectError SWORDN OEMOOL1O 279 return false 250 2 M L J wm w d oOo oO om A tn Tl oo ff Retrieve the record for the field Debtor from the file Purchases I ff not found then it is invalid if CustsF recordfixists conhdrR xWaCcCD SetError AWBCCD OGEMOOOZ conhdrR kWG4Ta 6 return false Im lo to lo oo i he OO lo om in ff Retrieve the record for the field Status from the file Order status ff description If not found then it is invalid if OrdstsF recordExists conhdrR zuSTiT setError 2WSTAaAT GEMOO19 conhdrR xWwaDbsc t Di Po Ta TY Di ob Poo Bo To Po a OB lo O 0 1E in D co J H mm mm Note that whilst this i
37. elational Mapping ORM software such as Hibernate for rapid application development in Java and other modern languages gt Because the database is defined in purely SQL terms rather than in a proprietary file format it becomes portable ie it is now an option to consider moving the database to another platform Databorough Limited 2009 Page 32 of 52 Reengineering and Rebuild With X Analysis gt Openness and Standards compliance using Industry standard SQL means that many different tools and applications on multiple platforms can easily access and use your modernized database gt Improved performance as IBM s data retrieval efforts have been concentrated on SQL access rather than file based access for many years now gt Reduced dependency on System i specific skills such as DDS which may led to cost savings and reduced risk gt Data Integrity Journaling is available for SQL access just as it has always been for file based access Constraints and referential integrity can be implemented directly at the database level where they are unavoidable rather than at the program level Databases triggers allow code to be run before or after records are added updated or deleted providing an easy way of enforcing compliance audits validations and applying business rules We ve now looked at some of the advantages of Database Modernization but how is it actually achieved and how can X Analysis help the process along As previously
38. enerated interactively by the client interface can be collated into a single document with contents and index This can be done for a single object an application area explained in the next section a list of objects or an entire system Any of these documents can then be edited and distributed as required Dividing Systems into Application Areas Entire legacy applications are often too large to effectively comprehend or effect wholesale change For this reason it is often necessary or helpful to sub divide a system into application areas The reasons and specifications for these may change with time too X Analysis provides facilities for subdividing an application area into groups of objects that meet user defined selection criteria These criteria might be based on function or even generic name X Analysis then uses the sophisticated cross reference information and Data Model relationships to include automatically all related elements such as programs displays or files in the application area Application areas filters can then be used through the X Analysis Solution Sets to view document or reengineer as opposed to individual objects Figure 7 Application Area Diagram for System Overviews Databorough Limited 2009 Page 16 of 52 Reengineering and Rebuild With X Analysis The Application Area diagram in X Analysis is interactive and by clicking on different parts of your system you can see the relationships between either
39. ers Submit s bmit EF Z JoinNode_O01 JoinNode_ote aes haf D Work with Customers 53 Customer Detail Maintenance 52 Sales Cond Work with transaction history 51 Work with Orders S1 Sales Conditions 51 Add Display Delete Charge Add Display Delete Charge I tines a Work with transaction history 52 Work with Orders 52 Submit Confirm Submit siiin laa l JoinNode_O00 Work with transaction history 53 Work with Orders 53 Work with Order Details 51 Add Display Delete Change Work with Order Details 52 Submit E Work with Order Details 53 Databorough Limited 2009 Page 30 of 52 Reengineering and Rebuild With X Analysis Producing any of these diagrams from within X Analysis is as simple as right clicking on an object and selecting the appropriate option from the menu Figure 15 Producing Diagrams in X Analysis PPLE Customer Site Maintena 4i EB oom Source CLP Customer Site Maintaina 4 28 Zoom In Lpex RPGLE Customer Site Maintena 4i _ RPGLE Customer Site Selection 4 S_ Structure Chart Diagram RPGLE Customer group Selectia H Program Structure Chart CLP Initialise Customer Reco 4i Screen Flow Diagram CLP Customer Letter Stage 4i RPG Update Letter Sequence 4i CLP Customer Letter Stage gi ga DAA FAW Mage CLP Customer Library Setting 4i Object Where Used i CLP Customer Menu gi RPG Update Maintenance Mo pane ENE Hsen RP ts Reorganize Customer Fil
40. final part of the process it supplies appropriate text narratives to describe these harvested rules More Info Derive Business Rules Modernize Options d Generate UML Diagrams Databorough Limited 2009 Page 21 of 52 Reengineering and Rebuild With X Analysis Once the rules are derived they can be viewed in summary form BR Summary 5 xt DMO Details SA Where Used BR Logic Functions TS AAD Details Business Rules Summary For MYC Mumber of Lines 42 Source Member Marration CUSTMNT 1 Call program WiCLISTP passing the Field SWECCD CUSTMNT 1 IF the Field SWBCCD is blank then it is invalid CUSTMNT 1 verify the Field SWECCD against the File Purchases IF on File then the field Customer is invali CUSTMNT 1 IF the Field SWio4Ts is blank then it is invalid CUSTMNT 1 Retrieve the record For the field SWBNCD From the file Customer Groups IF not Found then it is in CUSTMNT 1 Retrieve the record For the field SPERSON From the file Salespersons IF mot Found then it is inva CUSTMINT 1 Retrieve the record For the field SOSOCDE From the file Distributors IF mot Found then it is inva CUSTMET 1 Subtract the Field SWIDVO giving the Field SDIFF IF the Field SDIFF is less than zero set IN99 t CUSTMNT 1 IF the Field Prospect Mo is zero then it is invalid CUSTMNT 1 Retrieve the record For the field Prospect Mo From the File Sites by Number IF mot Found then i CUSTMNT 1 IF the Field SWBCCD is bla
41. g and modernizing System 1 _ibloggs798e0l com call 70058952365 li ti th th shernylc Eman corm 07568 456 321 appHications the Issues WIU HSMITH at SUN COM 447 800087 852 finding out the necessary email jbooth mac com mobile 0754699888 07676 678912 suzip btconnect com information and how Databorough Limited 2009 Page 9 of 52 Reengineering and Rebuild With X Analysis seemingly straightforward issues can be time consuming and problematic X Analysis is designed and optimized to make the design recovery process as straightforward as possible as the rest of this concepts guide will illustrate Analysis Documentation amp Application Subdivision X Analysis builds a very detailed repository over an entire application The repository maintains all information about application objects their relationships and all necessary information to obtain detailed information from each object across the entire system 20 years of ongoing development over thousands of AS 400 iSeries System i applications written in all variants of RPGII 400 IV COBOL 2E and CL has produced an unmatched capability to extract everything about an application from object right down to individual variables The repository is built automatically using a single command and initially 7 important to note that for 2E collects all object related information but then parses systems X Analysis looks every source member in the specified system and directly at the 2E
42. gnificant Almost all reports use some form of file joining information for displaying code descriptions or related information such as list prices on an order for example Drill down applications use join or foreign key information to build the navigation links into the reports or queries The DDL export of the relational and physical model derived by X Analysis provides a distinct productivity advantage to anyone building reports or BI Applications with any of these tools It is also possible to populate and build an entire BI application from the data model The application design is stored as meta data and then can be generated into reporting tools such as DB2 Web Query Databorough Limited 2009 Page 37 of 52 Reengineering and Rebuild With X Analysis Rebuilding the View In the section Recovering Screen Designs above we described how useful screen design information is extracted into Function Definitions in the X Analysis repository These function definitions are effectively input specifications for generating new UTs or Views The Modernization Tool Set of X Analysis actually uses the Function Definitions to automatically generate JSF Facelets and Java bean source for each recovered screen design The generated source code is structured annotated simple industry standard and ready for maintenance with any Java IDE Layouts and styles are implemented using CSS and certain field types implemented with appropriate HTML controls s
43. gt blanks 0171 00 Le 0123456789 check ztelno E1 0172 00 G IL found 0173 00 G eval in34 on 0174 00 G eval msgid OEMOO014 0176 00 G eval valid off 0177 00 Cc leavesr 0178 00 C endif 0179 00 G endif Note that the description of the business rules is automatically generated it is NOT lifted from existing comments All the lines in purple with BRC have been derived by X Analysis in the example above the comment simply stated Telephone number the derived rule comment looks at how the field is used and validated NB these Business rules comments are not added back to the rpg source but retained in the X Analysis repository This business rule repository can then either be used programmatically to generate new code enhance the built in documentation cross referencing where used and annotation capabilities it may be used by new developers as the necessary input for re specification exercises whether for new applications or for modifications to the current system Databorough Limited 2009 Page 22 of 52 Reengineering and Rebuild With X Analysis Once we have derived business rules we can now view the code in multiple ways normal source view the same as PDM in effect with color coding for the type of statement Source List of WVCONHDR in XAN SRC Lines 625 View Level 4 x EJ e o B AM a E Doo 4 ae fs ee en a Seep et e p eases hn Ol yan a a Leite 0S Soe inet hh eda Ee aT P 0543 00 c ENDI
44. hat gives the application its particular characteristics The generic term for such logic is Business Rules The challenge is to extract or harvest these rules from the legacy code Traditionally Business analysts or consultants find the rules for a new application by organizing workshops and interviews then manually writing use cases to describe the rules as text However for a legacy application all the rules are already there prescribed in the application code you just have be able to retrieve it The problem is that in the vast majority of legacy RPG and COBOL programs the business rule logic is mixed in with screen handling database I O and flow control So harvesting these business rules from legacy applications requires knowledge of the application and the language used to implement it both of which are steadily diminishing resource Once harvested these rules need to be narrated and indexed thus providing critical information for any analysts architect or developer charged with rebuilding a legacy application The task of harvesting business rules is therefore a highly skilled labor intensive and costly exercise for any organization X Analysis accomplishes this task by automatically scanning the RPG and COBOL programs and 2E model programmatically It then separates out rule code from the body of the application and identifies indexes narrates and stores business rule logic code into a structured usable repository In the
45. he file Contract Header If on Fi file then the field Contract is invalid ff Business Rule No XAN4CDEM ORPGLESAC WWCONHDR 546 Validation if VOOO06 CoONHDR ZWORDM Record already exists Cc ANORDD SETLL CONHDR 99 Z INGS IFEQ SLS Beas 03 i MOVE i TH40 Cc MOVE y2U0003 MSslD l Cc CALL RUNMT l i PARM MaASID 7 Cc PARM ERPMSG 132 c LEAVE Cc ENDIF Se 03 a ENDIF SS 0 C CUSTOMER Tr Retrieve the record for the field Debtor from the file Purchases If c STATUS i Retrieve the record for the field Status from the file Order status sat ra T TINATA BT The Extracted rules view shows us the code that will be restructured ready for rebuilding Databorough Limited 2009 Page 24 of 52 Reengineering and Rebuild With X Analysis Restructured Code for W WCONHDR in X4h4C0EM ORPGLESRC Restructured Code Ho Message Handling Redundant Block C WHEN ADDING CONTRACT MUST NOT BE ZERO rr Tt the field Contract is zero then it is invalid C WHEN ADDING CONTRACT MUST NOT EXIST Cc IF NOT FOUND CONHDR Ge ff Verity the field Contract against the file Contract Header If on if file then the field Contract is invalid Py Business Rule No ZXANICDEAT ORPGLESRC WWCONHDR 554 Validation i VOOOO06 CoONHDR XWORDM Record already exists Z XWORDH SETLL CONHDF 29 Z IF EQUAL CONHOR Z error Ye uita a MOVE yuga MAGII Z CALL RTHMTX 2 PARM MZGID T a PARM ERRMSG Lda c LEAVE Z ENDIF Z
46. iness rule logic into the Java as possible thus reducing the dependency on legacy languages The monolithic architecture of legacy applications produces significant amounts of redundant and duplicate validation and field or calculation logic type business rules These need to be re factored if the maintainability of the application maintenance is to be improved a primary objective of modernization in the first place Examples of this refactoring process are Databorough Limited 2009 Page 38 of 52 Reengineering and Rebuild With X Analysis gt Centralizing commonly used referential validation rules into the data persistence framework gt Date formatting logic can be centralized into reusable classes gt Centralizing commonly used field logic such as global tax calculations into reusable classes This means that code duplication amp redundancy can be almost completely avoided in the modern application Typically the only logic recreated in UI specific classes or beans will be context specific calculations field logic such as calculating the value of the order line being captured along with conditional display or navigation logic for some UI s These new beans classes should therefore be fairly simple and easy to maintain by comparison to their legacy counterparts X Analysis provides powerful features as described earlier for narrating annotating and carrying out where used analysis on Business Rules as described in the
47. iption hiaintenance Purchases WWiCONHDR Work with Orders Contract Detail Order status desenption Salespersons CUSTSSEL MWWTRANHST Work with Selection Selection Selection transaction history Customer Selection RPG as Pseudo Code With a single click RPG can be viewed as a form of structured English or Pseudo code Mnemonics are substituted with file field variable texts and constants or literals Figure 5 RPG to Pseudo Code with a Single Click Ba CB906R 53 FA Se object List feRgrereh tt ies a Source List of CB906R in ADE C Lines 145 iew Level 4 GA Pseudo Code of CB906R in ADE C Lines 138 iew Level 4 GA D itu vB B Bwll 9B ceetene 2 eecteeas amp weetene 8 wewrtess csctras S sectsve 6 is ENTRY PLIST Parameter List ENTRY c PARM WWACFN 3 E Account Type 3 Le PARM WWACTP 10 E 2 2 2 Work Account Type 1 0 a PARM WACSS 1 E Serer Account Status 1 G PARM WUDAPG 60 E Date Of Last Posting 6 0 G PARM WWPTIT 104 H Predicted Interest 10 4 C PARM WUPTTR 104 ne Pred Tax Relief 10 4 G PARM WUTATP 3 M Transaction Type 3 PARM WWV VLDA 60 gt W Value Date 6 0 G PARM WUTAAM 83 8 Transaction Amount 68 3 C PARM WACFG 1 aB Account Flag 1 G PARM
48. ir systems to separate the but they tend to be embedded in and mixed presentation layer from the business logic up in large monolithic programs with vast often called n tier or 3 tier applications amounts of redundancy and duplication these systems worked but delivered very throughout Implementing an RPG little bang for the buck as most of the application using MVC requires that the provements were hidden business logic be separate from the user interface and controller logic This can be implemented using 5250 and pure RPG see box right but its more likely and common implementation is using a web interface for the view with the controller logic written in a modern language that supports web interfaces such as Java EGL or C The optimum modernization result is to reduce dependency on legacy languages as much as is possible if not altogether To achieve this recovered design assets are reused as input to redevelop the appropriate layer Databorough Limited 2009 Page 17 of 52 Reengineering and Rebuild With X Analysis Figure 8 Legacy versus modern architecture Legacy 5250 Application Server Host Server Database F r F Business a h Logic s arene Database ite E a pes e Mode Figure 9 Modernized Code Architecture Business Rules Programs Java RPG Persistence Framework Hibernate DB 2 iSeries Databorough Limited 2009 Page 18
49. k associated with maintaining large complex legacy application with a rapidly diminishing set of legacy skills can be largely mitigated by access to such documentation Understanding and mapping the relevance of existing designs and quantifying the scope and metrics of an application is the first step in ANY modernization project even if the application is to be replaced Design constructs such as the data model can be used for support development and testing tasks such as test data extraction Source change management can be vastly improved by powerful cross referencing functionality Legacy design constructs can be used passively in the form of information they represent and programmatically to radically accelerate application rebuilds a requirement for achieving true long term application modernization A combination of both allows optimum use of internal and external resources and existing design assets X Analysis delivers against all of these concepts 20 years of development effort ensures that virtually any legacy application can be automatically reverse engineered onto a high level design Richard Downey and Stuart Milligan Databorough May 2009 Databorough Limited 2009 Page 51 of 52 Reengineering and Rebuild With X Analysis Additional Resources amp Information These are the few relevant references used in this white paper More information is available from the authors of this white paper upon request Worl
50. ke extra information and notes are unlikely to have any validation or to be even required so if migrating the existing values to new fields we can t simply copy it over some cleansing will be required The process of gaining the knowledge to answer these questions may not be all that straightforward particularly if the systems are complex or the people trying to answer them are new to the application system or platform To assess the scope and impact of the change you need to find out which programs use the files tables affected this can be very laborious v Go through all source files in PDM v option 25 to search v then F13 to repeat v press enter v type in your search term v review results and thats just the first enquiry Depending on the complexity and history of your systems you may have doubts that you were looking at all of the source or the latest version Looking into Database integrity may well throw up items like this screen shot Where we have a number of different formats of email address and some extraneous text similarly on the phone number list there is text and a variety of layouts Finally we have the inevitable result of using ad hoc fields with no validation or on screen guidance transposed data mobile in email and vice versa Hopefully this section raised awareness of the problems maben Field l Extra Info fused for email address fused for mobile phone number around changin
51. lication documentation can then be output to a variety of third party design tools such as Rational MS Visio MS Word etc indeed any tool capable of importing XML or DDL is supported Recovering an Application design This advanced level of analysis extracts model information from the existing application X Analysis uses its own analysis repository plus pattern searching algorithms to derive relational data models extract business rules build UML Activity Use Case Diagrams and logical screen flows Only relevant designs need be used as a base specification for new developers to rewrite the application The structured repository based format of these extracted designs make it possible to programmatically reuse them for rebuilding the core of a new application This can be done with purpose built tools with X Modernize or a combination of both Redeveloping Using a Recovered Application Design This starts with database modernization using the recovered data model The designs for the view controller and Databorough Limited 2009 Page 7 of 52 Reengineering and Rebuild With X Analysis business rule logic are also extracted and reused in modern frameworks such as Hibernate and with new JSF Facelets and Java bean components This option makes it possible to programmatically re factor the existing application into modern consumable assets and artifacts for developers to use for a system rebuild The objective is to produce clean
52. ly canceling out the benefit of using modern technologies and architectures in the first place Syntax conversions are still being done by some companies and are often promoted by vendors of proprietary development tools for obvious reasons This approach has never to our knowledge produced an optimum long term result despite many attempts over the last two decades Removing problems 4 through 6 and thus achieving sustainable and effective application modernization can only really be achieved with an application rewrite or rebuild which is well recognized of course but usually rejected as not feasible on cost and risk grounds We will show in this paper how Design Recovery and automated component generation can dramatically reduce the costs and risks of an application rewrite and without inheriting the legacy code s redundancy and complexity Whatever the approach to modernization design recovery is the first step With this understanding developers can quickly identify the business rules and reusable designs embedded in core business processes and restructure code remove dead code and create reusable components that can be enabled as services within a service oriented architecture SOA or any modern application architecture This is true even for companies adopting code generators technologies as their development environment The objective therefore is a true modernization exercise to extract the essence or design of the legacy ap
53. mentioned historically System i applications have used Data Description Specifications DDS to define physical files and associated logical files or access paths Whilst the files created can of course be accessed using SQL syntax from programs or via JDBC ODBC the actual definitions bear no relation to SQL What the process of X Analysis database modernization does is to replace the DDS definitions with SQL create scripts that build tables and indexes As we have seen X Analysis has a complete cross reference of all files and fields and their relationships and can build the table creation scripts together with the required indexes to optimize the system your existing programs all still work after this process and without any re compilation or alteration By using X Analysis to do this automatically no existing programs need be recompiled or impacted in any way With the data copying facilities built in to the tool the transition can be seamless From this point onwards legacy programs can continue to use native I O techniques or be automatically reengineered using Databorough s X Ternalize to use externalized SQL I O X Analysis can also generate an entire set of CRUD RPG stateless I O modules to be used as web services for any web or SOA type development For IBM s take on the relative merits of DDS and SQL and the advantages of an SQL created database over one created with DDS see the IBM Redbook Modernizing IBM eServer iSeries Applica
54. model and every source line mapping the contextual information of each variable in the system A certain amount of logical abstraction processing then takes place while building the repository to account for some of the idiosyncrasies typical in an RPG application This includes constructs such as variable program calls file overrides prefixing and renaming in RPG The repository thus represents a map of how the entire application functions right down to individual variables dervives its information from there ie not from the generated 2E code thus preserving the investment in the model Understanding Design amp Function More Easily For efficient familiarization of an application s structure and general function an abstraction above the source code combined with object to object relational information is required A few simple but rich types of color coded graphical diagrams can reveal the data flow and architecture of individual objects or parts of an entire system This is combined with automatically derived descriptions in the form of Pseudo narratives either in the diagrams or while browsing source code The drill down go anywhere from anywhere interactive nature of these interfaces in the X Analysis client provides a unique approach to information assimilation allowing an analyst to gather information at high level or very detailed in an efficient and intuitive manner The application abstraction is raised one level above
55. n can make this work prohibitive Data Model Mapping Validations and prompting mechanisms that ensure referential integrity in legacy applications can also be vital to extract This is both to implement referential integrity and to provide design information for building modern prompt or selection controls such as drop downs or lists Naturally it will be desirable to redesign some UT s completely For those programs and screens where this is not the case the design and mapping information can be used Databorough Limited 2009 Page 20 of 52 Reengineering and Rebuild With X Analysis directly in the new version of the application even though the UI code has been discarded X Analysis extracts User Interface design information as described above and stores it as meta data in the X Analysis repository This is used as reference documentation for rebuilding U s manually or for programmatically regenerating new View and Controller artifacts in the chosen new technology X Analysis currently generates a JSF Facelets UI version as described in the section Rebuilding the View section below The design meta data can also naturally be used to generate new interfaces using any technology such as EGL Ajax RCP C VB or even RPG Recovering Business Rule Logic Once the system UI data access amp data model has been recovered amp the application has been rebuilt or rewritten from this design it is then necessary to extract the logic t
56. nalysis Application Areas to break out this part of the system 3 Rebuild the Application Area into your chosen architecture 4 Run the rebuilt application 5 Refine the rebuilt application tailor to your requirements Identify what you want to work with Here s some screens from our application first the work with customers Work with Customers WilUSTS Position to Customer Mare ASCI Bertwhistle Ltdl ACCLO Customer ACCLO ACCA BOCE amp Co LTD ACCS BESSON BROS ACC4 1TEDITA ENTERPRISES LTD ACCS Bays Engineering Ltd ACE Gough Research ple p a e s aan nu I Fons ee ee I Karst ple Areg Bays Engineering Ltd ACC NEWT FOODS UF LTD ADCS Prime Computer Systems Bott ori Databorough Limited 2009 Page 40 of 52 Reengineering and Rebuild With X Analysis We can view Orders Customers Work with Orders Databorough Ltd Wit ONHDOR ol Ee Be JEL Johan Flaassen Telephone Number 04695 58 Current balance 2 256254 00 Credit Limit 1001235 00 Position to Enter options 2 Change 4 De CHSTLOMEE Referenca Date at Rep PORDOI344 2007 02 16 02 stu PORDOZ134 5 03 JAL 00053 PoORDOZ47TS 2007 02 25 U1 ATU Customers nance Databorough Ltd CUSTMN TL 17412406 Customer No a a ACCL Customer Name Bertwhistle Ltdl Account ACC Z3 Account AcC4dS TAXOL i ae Bank CUSGED a BY Takni Rep s 2 8 a n ek a JEL Johan K Johan Kla Distributor
57. nce InitialNode Cc Activity Diagram Partition Initial Activity Final Go Action Submit Sa Accept Event E Send Signal Pree a Structured Activity E Customer Detail Maintenance 52 2 Control Node E Customer Detail Maintenance 51 eas Object Node Sales Cond Object Flow Control Flow E Sales Conditions 51 ActivityFinalNode al Actions Geometric Shapes Use Case Diagram Use Case Diagrams model the functionality of system using actors and use cases Use cases are services or functions provided by the system to its users Auto generated from X Analysis this can be used as an alternative view to the Activity Diagram and also has drill down capabilities for viewing extracted Business Rules Figure 12 Use Case Diagram for a Program e Object List CUSTMNTL i CUSTMNTL_ usecase X aJ CUSTMNT 1 usecase xmi em fee Palette IS Select Zoom 5 Note s gt UML Common Customer Detail Maintenance 1 component Client Sales Cond Web Service Databorough Limited 2009 Page 28 of 52 Class Diagram Class diagrams are the backbone of all object oriented methods including UML They describe the static structure of a system Classes represent an abstraction of entities with common characteristics Associations represent the relationships between classes An extracted class in a class diagram corresponds to the individual screen formats and
58. nce to data records from the owning file In this way the automated reverse engineering can fully extract the data model from even the most complex legacy system Test Data for Modernization amp Maintenance Projects Creating and managing test data can be a labor intensive and costly task As a result of this many companies resort to creating copies of entire production systems This approach in itself can produce its own set of problems such as excessive storage demands longer test cycles and often a lack of current data for testing The relational data model is used to extract automatically records related to those specifically selected for testing In this way smaller accurate test subsets can be extracted quickly and respectively with additional functionality for scrambling sensitive production data and aging the dates in the database forwards or backwards after testing Recovering the User Interface The screens of a legacy application are a classic example where the design is useful in a modernization context and the code is not All modern IDE s provide powerful UI development tools Modern UI standards and preferences for style and technology also Databorough Limited 2009 Page 19 of 52 Reengineering and Rebuild With X Analysis vary from project to project The sheer number of screens in a legacy application presents a logistical problem in recreating them manually even with the cleverest developers and best tooling X
59. nderstanding by identifying recurring program features classifying the system modules based on their purpose and usage patterns and analyzing dependencies across the modules This analysis provides detailed design information about the entire system accessible to non RPG COBOL 2E experts and be easily updated to incorporate ongoing changes in the base system Whatever the business needs driving companies to modernize their applications most want to ensure that the business logic and functional design which are core assets to the company are preserved to varying degrees Design Recovery of an application can be broken down into a few logical steps or stages that represent a generic adaptable approach to any application modernization project Analysis Documentation Application Subdivision This type of analysis represents the most common use of the X Analysis tool across the world On top of very powerful cross referencing functionality graphical narratives or a combination of both are used to abstract and describe the system in a simple and intuitive way even for non RPG COBOL 2E experts The legacy application can be completely documented using modern diagramming standards such as UML Entity Relationship Diagrams System Flow Diagrams and Structure Charts etc Furthermore the legacy system can be automatically subdivided into application areas so that effective system overview amp interface diagrams can be generated The complete app
60. nk Otherwise CUSTMNT 1 Retrieve the record For the field SWBCCD From the file Purchases IF not Found then it is invalid CUSTMNT 1 IF the Field CUSPRM is not zero set the Field Prospect Wo to the Field CUSPRM WW COR DET Retrieve the record For the Field Product from the File Product Master IF not found then it is Wit OMDET Retrieve the record For the field Store From the file Store Master IF mot Found then it is inva WON DET Retrieve the record For the field Product the Field Store From the file Stock Balances IF na WON DET Retrieve the record For the field Trn Hst Trn Type From the file Transaction type description I Wt ON DET When the Field UIM is EAC it is invalid Wt OMDET Retrieve the record For the field Contract the Field Product From the File Contract Detail I Witt OBHDR Retrieve the record For the Field Contract From the File Contract Header IF not Found then it i Ww CORMHDR Retrieve the record For the Field Contract Fron the File Contract Header IF not Found then it i Or inline in the code from where they are derived 0169 00 C Telephone number 0169 01 BRC Business Rule No XAN4CDEM QRPGLESRC CNTCMAINT 170 Validation 0169 02 BRC yooo04 CNTacs TELNO The telephone no is invalid 0169 03 BRC If ztelno is not blank verify ztelno against 0123456789 If other 0169 04 BRC values found then the field Phone is invalid 0170 00 C if ztelno lt
61. nter data It might also be a lot slower for the user to drop down a list of 300 codes and select the required one with a mouse for each row as opposed to entering a two or three digit well known code into it this would also be very frustrating for existing users and as we know new systems can fail because of user resistance When we analyze this scenario we see that in the green screen application we have a system which can be operated quickly by the users using only the keyboard and is very responsive though it would appear intimidating and strange to new users used only to Windows or web applications the challenge is to build a new interface which is accessible intuitive and easy to use for new users whilst allowing the existing users to apply their knowledge of the system to get around it quickly and with good performance and responsiveness Databorough Limited 2009 Page 48 of 52 Reengineering and Rebuild With X Analysis Taking the example mentioned earlier where we wish to produce a new application where a user enters transactions involving entering codes in the green screen world this would typically just be an input field with possibly and F4 prompt option to show the allowable values As alluded to above in the web world the first thought is often to convert this type of construct to a drop down combo box like this example from the IBM Power site Find out more about Power Systems Select one This can be
62. of 52 Reengineering and Rebuild With X Analysis Recovering the Data Model The relational model of an enterprise application is an extremely powerful piece of information and potentially valuable asset to the organization Unlike 2E systems for almost all RPG or COBOL applications running on System i there is no explicit data model or schema defined By the term model we are referring to the foreign key or relational model not just the physical model of the database The relational model or architecture of the database can be reused in a number of scenarios including gt Understanding application architecture gt Data quality analysis referential integrity testing gt Automated test data extraction scrambling and aging gt Building BI applications or Data warehouses X Analysis has the unique capability of automatically deriving the explicit system data model from a legacy RPG COBOL or 2E application Let us have a look at this and the model reuse capability in a bit more detail Deriving the Legacy Data Model X Analysis accomplishes this by analyzing the data structures of the physical and logical files but it then programmatically traces these through all programs that use them to verify the existence of any cross file relationships or foreign keys These derived relationships can also be verified by the product by performing an integrity check on the actual data This ensures that the data of the dependent file makes a refere
63. ork with Customers screen The pages that have been generated are fully functional however you will probably want to alter the appearance to match your standard pages and perhaps add links and so on to integrate the pages with other systems The pages all use Cascading Style Sheets CSS to control their look and feel and positioning so changes are easy to make Regardless of your opinion on the aesthetics of the generated screens you will agree that the basic pages are not bad for zero coding and just a few clicks A Work with Orders Microsoft Internet Explorer Si File Edit View Favorites Tools Help Address 2 http 127 0 0 18080 ean4edsatrivcf Faces zzvuyconhdrs 1 xhtml jsessionid Fae 1 0603370559062097 F4015D7E764rpar gt 0 Links Customers Work with Orders Databorough Ltd Customer ACC Bertwhistle amp Company Ltd amp C Representative Telephone Humber Current balance 256254 00 Credit Limit 1001230 00 E Cntrac Customer Reference Date Value E 000002 PORDO02134 22 02 07 1 850 00 E 000153 PORDO2476 23 02 07 199 66 Following the screen flow we had earlier on the green screen side here s the Work with Orders screen Databorough Limited 2009 Page 46 of 52 Reengineering and Rebuild With X Analysis Purchases 1 Microsoft Internet Explorer File Edit View Favorites Tools Help Address Atta f127 0 0 18080 eantcodxatmyciFaces zzcustmntis1 xhtml jsessionid F8821060337055906209
64. ows direct access to elements that might have otherwise been deemed unusable in their current form NB This is an important point so worth stressing this lets us bring across what is useful leaving behind what isn t relevant and cuts down on duplication Another important factor in this scenario is the ability to choose an implementation technology or language that suits the technology constraints or resources specific to a region or organization The next sections cover how we can use the recovered application design in different ways to effect varying levels of modernization and re development up to and including a rebuilt system Database Modernization using the Data Model assets Whilst it has always been possible to access System i data in a relational database like fashion there was originally no way of defining your database in the traditional relational database form with a schema or model This has meant that most System i applications don t have an explicitly defined relational database schema or model The data model for a legacy application as deduced by X Analysis can be used to modernize the database and database access as well as providing valuable information for analysis and documentation Once you have a modernized database you gain a number of advantages gt Easier access to your data for reporting via Business Intelligence BI tools when they use the newly derived Data Model gt Ability to use modern Object R
65. paralysis where changes can t be made due to a lack of confidence in the outcome As many of the systems and software we are discussing here have had a long life and been marketed under various names it is worth making two orientation points For consistency throughout this document we will refer to System 1 as meaning the family of computers that grew out of IBM s System 38 over the last twenty one years namely the AS 400 iSeries and latterly the System 1 and IBM 1 on Power Similarly when we refer to the RPG language we will generally mean COBOL RPG and 2E When we refer to 2E we mean the CA product and the various incarnations of the Synon software that preceded it Accurate and current information about an entire system can greatly improve the productivity of your IT staff and reduce maintenance costs by eliminating the need to research catalog and assemble the information manually for each service request or modernization project Existing System i applications whether they are COBOL RPG or 2E have some fairly consistent and distinct characteristics that mark them out as costly and potentially high risk 1 Applications tend to be large and complex 2 Little or no documentation 3 Original Designers and Developers are no longer available 4 They have been developed over many years 5 Monolithic Programming Model 6 Written in obsolete languages Points 1 through 3 can largely be managed more effectively by investing
66. plication and reuse these designs as appropriate in rebuilding the application using modern languages development tools and techniques tapping into more widely available skills and resources Databorough Limited 2009 Page 5 of 52 Reengineering and Rebuild With X Analysis X Analysis provides analysts developers architects and operations teams with detailed analysis and interactive diagrammatic constructs that enable rich understanding of existing applications whether they were developed yesterday or 30 years ago Some companies may have a desire to keep a significant amount of design logic from the existing application design and move that to the modernized version of the application For those situations X Analysis provides design extraction functionality for automatically creating JEE amp RPG industry standard modern components and constructs as exports from the recovered designs themselves A legacy application component can be rewritten using a combination of the JSF EGL Facelets and persistence frameworks such as Hibernate all generated by top down automation from the recovered X Analysis model Because each customer situation is potentially different the X Analysis suite is available in different editions that suit the appropriate development stage or budget constraints of each company From even the most poorly structured application the X Analysis can recover the design logic Whereas for more structured applications
67. ptions Modernize Options Rebuild Options Audit Options Wh SAM4ATUT HA ed eo ee Tea Wh SCCEMOXA XCDEMOKA Wh XCM x Control Wh XRTESTHA Demo Resize Databorough Limited 2009 RE MAAR ULYAN4RD RE MAAR RE MAN4RD RE XAMRO RE ANRO RE MANARD RE MAN4RD RE MAAR RE MAN4RD RE MAAR GLSAN4RO Re engineer Programs Generate ORM Objects Generate Web Application View Generated Objects ORDSTSE RTNMSt SLMIENSE STEM ASE STOMA SE TRAIT PSE Wil USTE Ww ORL wr Ch Wa LIS w TRAN AB CLMS Page 43 of 52 Reengineering and Rebuild With X Analysis We can choose the programs to include the application architecture we want to use Java or EGL PHP and Net under development whether to include Business Rule logic or not and the type of data access mechanism we wish to use JDBC or ORM Hibernate Generate Web Application Select Function AL CUSFSELSI AZ USSR SELLS 1 ZEC CUSTMNTiS 2 lUSTMNT 152 4eCUSTSSELS1 SOS TSSELS1 4AORDSTSELS1 4 SLMENSELS1 AZSTKMASELSI AZSTOMASELS 4 TRATPSELS1 few OBDETS 1 few ONDE TS2 few OMDET SS Project Type Java EGL File USF CUSGRF CUSTS CUSTS CUSTS DISTS OROSTS SLMEM STKMAS STOMAS TRAIT YP ORIHDR CORIDET CORIDET Project Setting Include BR Logic Use ORM Objects Title Sites 51 Customer Groups 51 Customer Detail Maintenance Customer Detail Maintenance Purchases 514 Distributors 514 Order st
68. s Java code and thus conceptually far removed from RPG we can by means of naming and comments link this code back to the original system yet it is brand new Java code We ll return to Application rebuilding and code generation later in this document UML Diagramming The objective of UML diagrams in this context is to help sketch application designs and to make such sketches portable and reusable in other IDE s such as Rational Borland MyEclipse etc The three diagrams automatically generated by X Analysis are Activity Diagram Activity diagrams illustrate the dynamic nature of a system by modeling the flow of control from activity to activity An activity represents an operation on some class in the system that results in a change in the state of the system Typically activity diagrams are used to model workflow or business processes and internal operation X Analysis produces these automatically either from a single program with multiple screens or a group of programs Each activity in the diagram represents a usable screen format in the RPG program A user can also view the extracted Business Rules relevant to that particular activity format directly from within the diagram Databorough Limited 2009 Page 27 of 52 Reengineering and Rebuild With X Analysis Figure 11 Activity Diagram for a Program of CUSTMNT1 CUSTMNT 1 Customer Detail Maintenance CUSTMNT1_ActivityDiagram X cc CUSTMNT 1 Customer Detail Maintena
69. t Soft Security gt Commitment Control Look amp Feel amp Ul Standards Green screen applications have always been optimized for rapid data entry with such helpful features as tabbing between fields and Field exit field completion it is perfectly possible to make a web application work well for data entry but it requires effort and as was often the case with windows applications it isn t always done well as an example it is common to come across web applications where the tab order is not correctly set and tabbing can take you to images or almost anywhere but the field you were hoping for The task of designing new interfaces for the modernized applications should not be underestimated you can t simply rely on the cool factor of the web and the colorful and sophisticated look and feel that style sheets enable do not guarantee a usable interface To illustrate some of the issues consider the case of an updatable sub file grid that a user might enter a series of transactions into which there happen to be some transaction code fields included As a global UI standard the decision might be to replace code fields with drop down combo boxes using the descriptor rather than the code itself This might look good but cause big problems in performance both from preparation of the page and also the sheer size of the page being transmitted when populating the drop downs individually for each row in the grid before the user even starts to e
70. ter hbm xr resource an cdxat hbmbean CustomerGroups hbrn ml resource Xandcdxat hbmbeanContractDetail hbm resource antcdxat hbmbean StoreMaster hbr xml resource Xan4cdxat hbmbean TransactionTypeDes resource andcdsatfhbmbean ContractDetail hbr xml resource andcdsatfhbmbean Transaction ypeDescription hbr xml resource andcdsatfhbmbean Sites hbr xml resource andtcdsat hbmbean Purchases hbm xml 2 0 pesource Xan4cdxat hbmbean Sites hbm xml resource andcdxat hbmbean Purchases hbm xml resource Xan4 cdxat hbmbean OrderstatusDescript resource sandtcdxat hbmbean OrderStatusDescription hbm xml ay resource an4cdxat hbmbean ContractHeader hbr resource andcdat hbmbean ContractHeader hbm ml 9 pesource Xan4cdxat hbmbeanjProductMaster hbm resource andcdsatfhbmbean ProductMaster hbm xml resource andtcdsat hbmbean Salespersons hbm xml oS resource san4cdxat hbmbean Salespersons hbm x resource an4cdxat hbmbean Distributors hbm xml 2 resource andcdxat hbmbean Distributors hbm xml i Caches of Listeners Databorough Limited 2009 Page 35 of 52 Generated hibernate xml mappings and hibernate java beans Reengineering and Rebuild With X Analysis ae sanstcdxatorm Gl src 3 E com databorough utils n o Yandtcodzat data 3 isles sangedsat hbmbean D ContractDetail java J ContractDetailld java 3 J ContractHeader jav
71. tic information in the form of structured documentation Examples of this are project documentation auditing information testing instructions and customer support documentation such as with ISV supplied business software X Analysis produces a number of these outputs including Data Flow Chart in MS Visio Any interactive diagram produced by X Analysis 8 in the client can be automatically exported to MS Visio In addition to this an RPG COBOL program or 2E action diagram can be produced as a data flow chart interactively while browsing the source from within X Analysis If the RPG program is in Pseudo Code mode the Data Flow Chart will use the narratives from the Pseudo code This enables non system i technologists and analysts to assimilate information at a detailed level of the application without any dependency on RPG COBOL or 2E experts Figure 6 DFD Exported to MS Visio gt cep bi E b Taaa T j B b a ac mike eo isg Bee OT lee Lists and Results sets Any source object or impact analysis result list can be directly exported to formatted MS Excel or Word from the client MS Word Project Documentation Wizard With the use of a simple wizard documents that might take weeks to produce manually allow the user to select any of the graphical Databorough Limited 2009 Page 15 of 52 Reengineering and Rebuild With X Analysis diagrams lists flowcharts annotation and business rules summaries g
72. tion Data Access A Roadmap Cornerstone which is an excellent reference on this subject Modern Data I O amp Persistence Modern Object Oriented OO type development does not mean that relational databases need be abandoned Indeed it would be a fairly unwise strategy for a company to throw away its database and the information stored in it for the sake of OO development Java is an Object Oriented or OO language System i CRUD Create Read Update Delete a tongue in cheek acronym coined to cover the key table operations any system has have Databorough Limited 2009 Page 33 of 52 Reengineering and Rebuild With X Analysis databases are relational Though Java Database Connectivity or JOBC provides an easy method for accessing relational databases it is basically a low level API providing only a thin layer of abstraction Thus complex I O and data requirements typical of System i applications quickly become very complicated to develop and maintain JDBC is sufficient for small and medium projects but is not that well suited for enterprise level applications Therefore what is required is an Object Relational Mapping ORM framework that can act as a mediator between an OO design and a relational database The most widely used ORM framework for Java is Hibernate Hibernate www hibernate org is a free open source Java package originated and backed by JBoss and Red Hat that makes it easier for Java developers to work with rel
73. tire legacy application database Hibernate is a very good fit for 2E applications as it is flexible enough to work well with the mnemonic To illustrate Hibernate and X Analysis lets look at generating ORM objects with X Analysis this is accessed by a straight forward right click menu WW XAN4CDX regres E Rebuild Options ih YANACDY A ReEDUI prion bec Engineer tse a Generate ORM Objects ion Informat iii s Generate Web Application n Items Description Generate Web Service ame 66 209 50 136 View Generated Objects ysis Username RICHARD ee Databorough Limited 2009 Page 34 of 52 Reengineering and Rebuild With X Analysis Choose the files you d like to generate ORM objects for gt Generate ORM Objects C Select File Component TRAST fe TR AIAST USF CUSGRF CUSTS DISTS OROSTS SLMEM STKMAS STOR aS TRAIT YP COMHDR CORDET CI O CI O CI O CI O CI O CI O X Analysis generates hibernate mappings configurations and hibernate java beans everything required to access those tables from Java Hibernate Configuration 3 0 XML Editor F Session Factory E E Session Factory nisme f8 Properties S i 50 hibernate dialect de dees GA Mappings Mappings pesource an4 cdxat hbmbean TransactionHistory t biii E9 resource 4an4edxat hbmbean CustomerGroups hbr resource andcdxat hbmbean TransactionHistory hbm xml oc resource andcdxat hbmbean StoreMas
74. tus Queue Selection M Output M Update lt _STKBAL gt Stock Balances F Called Program Product Waster F Calling Program leaped kd WWCONDET Store Waster Work with Order Details CUSTMNT1L Transaction type Customer Detail description hiaintenance lt __CONDET gt WWCONHDR Contract Detail Work with Orders WWTRAHST Work with transaction history CUSTSSEL Customer Selection Databorough Limited 2009 Page 13 of 52 Reengineering and Rebuild With X Analysis In this example we ve clicked on a program and can see the files it uses as Input and also the program that calls it A Ta Grea Flow Diagram gt imi r sy oon Area Flow Diagram for MYC Total Objects 30 Al H ny g Selected Object ORDSTSEL I Input Witork with Store baster Clear a hWessage Order status SS Customers Selection Queue Selection E Output CUSFSEL lt CuUSF gt Distnbutors Product Waster i M Called Program M Update Customer Site Stock Balances Selection Calling Program CUSGRSEL Customer group Selection WWCONDET Store waster Work with Order Details Customer Groups Contract Header Transaction History DISTSSEL Distnbutor Selection RTNSMSGTEST Retum message text SLMENSEL STKMASEL TENTPSEL Salespersons Product Waster Transaction type CUSTMANT1 Transaction type Customer Detail descr
75. uch as date prompts drop downs check boxes with corresponding Java Scripting or logic in the Java Bean EGL versions are also available for view controller generation with future generation options for PHP C and XAML becoming available from Databorough and other Business Partners Actions from the Function definitions translate effectively into links on the generated JSF Facelets and these can be implemented with tab buttons or any appropriate UI standard demanded by a project The required logic to invoke these actions is placed in the appropriate methods of the generated Java Bean as described below Rebuilding the Controller The Java bean that drives the JSF Facelet has standard methods for Data I O navigational actions and for using any residual services that might remain on the legacy server in RPG COBOL or 2E This JSF bean has standardized exit points and a set of standard parameters making maintenance and development more efficient and consistent A separate call bean is implemented for each transaction group or legacy service program This call bean provides a standard interface to these reengineered legacy RPG services and therefore greatly simplifies the controller or JSF bean as it is often referred to In the case of a set multiple JSF s that make up a transaction the call bean also acts as a persistence manager for the transaction Reusing Business Rules The optimum design objective is to move as much of the bus
Download Pdf Manuals
Related Search
Related Contents
DEVIS POUR SOUMISSION Agence spatiale Owner`s Manual (General) Conexión de otros equipos sinus n - Santerno Scarica il Capitolato Speciale ConnectGuard ネットワーク管理ツール取扱説明書 0.動作環境 1 Scopri come sfruttare tutte le potenzialità del tuo abbonamento SKY. User Manual Le cancer colorectal est une maladie fréquente, puisque plus de Copyright © All rights reserved.
Failed to retrieve file