Home
Modernization Concepts Guide
Contents
1. Transaction Amount 98 3 C PARM WWACFG 1 QR Account Flag 1 C PARM XXTODA 60 3 To Date 6 0 E PARM WWCHG 1 Ah gy 3 33 Change Option 1 DELETE FLAG C Initialise Parameters Initialise Parameters 0636C SDPOO1 DOUEQ N Repeat until Redisplay Screen equal to N 0640C BagRTN DOUEQ E Repeat until Return Code equal to E 0642C CTL ANDEQ And Mode equal to G MOVE ACACFN WWACFN Move ACACFN to Account Type 0765C EXSR PVOO1 Perform Validate Screen c READ CBACPF View RPG as Read Accounts Master File 26 C INITIALISE SCREEN Pseudo INITIALISE SCREEN C WWACFN EFEO ACT If Account Type equal to ACT G WWACSS OREQ D Or Account Status equal to D C Z2 ADDO XXITAM Move numeric O to Int Amount C Z2 ADDO XXTRAM Move numeric O to Tax Rlf Amount C END End E WWACFG EFEO M If Account Flag equal to M G WWTATP IFEQ CLS If Transaction Type equal to CLS 5 WWCHG TEE Th Tf Channe Ont inn enal to D xi Ei mm o gt Databorough Limited 2009 Page 14 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 mo
2. z 0544 00 C WHEN ADDING CONTRACT MUST NOT EXIST 0545 96 BRC Verify the field Contract against the file Contract Header If on 0S4 E CIBRC Tile then the field Contract is invalid 0545 95 amp BRC Business Rule No XANAJCDEM ORPGLESRC WUCOMHDR 546 Validation 0545 99 H BRC v OOODS6 CONHDE ZWORDE Record already exists 0546 00 B BRC ATIORDIN SETLL CONHDE ag 0547 00 BRC IN99 IFE E li B OS 0546 00 gt I ERC MOVE F3 TNW40 ae 0549 00 gt BEC HOVE Ya 0003 MSGID I 0550 00 BEL CALL RTHMTZX a 0551 00 BRC FARM MSGID 7 BEN 0552 00 BRC FARM ERRMSG 132 BEN 1553 TIE BRC LEAVE EN 0554 00 E BRC ENDIF E cs 0555 00 E ENDIF B Oz 0556 00 LT CUSTOMER 0556 96 IBRC Retriewe the record for the field Debtor from the file Purchases I 0556 97 CIBBC not found then it is invalid 0555 98 BRC Business Rule No XANA4CDEM QOBRPGLESRC WWCONHDR 55 7 Validation 0556 99 H BRC v OODOD7 CONHDE ZWBCCD Invalid customer number 0557 00 B BRC AZWBCCD CHAIN CUSTS ag 0558 00 gt ERG INASS IFE d Lp e Oz 0559 00 BRC MOVE oe IN431 o560 00 gt ERC MOVE OEMODOZ MSGID nNSA7 An gt ARC CATT ETMMTE I As preparation for moving these rules elsewhere or isolating the rules as psuedocode we can select x S gt B9 Ue Extracted Rules Normal Source Code Indented Source Code w Embedded Rules Extracted
3. 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 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 1 S_ Structure Chart Diagram 2 t Structure Chart for CLET RII NN NN SC seem ATI URB WKCUSSEF Find Fax Number OTHFIL WKCUS8E Customer Release Letter LIPDFIL WKCUS8P 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 programs 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 SD Be LM CUSFMAINT Customer Site Maintenance DISTS USH3 CUSFMAINTD CUSFSEL DSPDISTS D
4. or 30 years ago Some O Databorough Limited 2009 Page 5 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 JSE 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 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 i
5. Controler Database ti Model 2 Figure 9 Modernized Code Architecture Business Rules Programs Java RPG Persistence Framework Hibernate DB 2 iSeries Databorough Limited 2009 Page 19 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 Understanding application architecture gt Data quality analysis referential integrity testing gt Automated test data extraction scrambling and aging 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 tha
6. Rules Databorough Limited 2009 Page 24 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide Extracted Rules for WWC ONHDR in X4N4CDEM QRPGLESRC T G Ut D Bey Be E d Extracted Rules CcC WHEN ADDING CONTRACT MUST NOT BE ZERO ry If the field Contract is zero then it is invalid C WHEN ADDING CONTRACT MUST NOT EXIST T IN36 IFEGQ Bale BSS SS 0 oe Verify the field Contract against the file Contract Header If on y file then the field Contract is invalid ff Business Rule No XAN4CDEM QRPGLESRC WWCONHDR 546 Validation if VOOO06 CONHDR XWORDN Record already exists c AXWORBDN SETLL CONHDR 29 c INGS IFEGQ uL Bene 03 C MOVE ET TH40 c MOVE y2U0003 MaScILD C CALL RUNMT Cc PARM MaASID E l C PARM ERRMS oe C LEAVE C ENDIF Eee 03 C ENDIF a rl 0 C CUSTOMER fe Retrieve the record for the field Debtor from the file Purchases If p STATUS r Retrieve the record for the field Status from the file Order status sat ra T TOWN XM BT The Extracted rules view shows us the code that will be restructured ready for rebuilding Restructured Code for WWECONHDOR in XANACDEM RPGLESRC Restructured Code E Message Handling E Redundant Block C WHEN ADDING CONTRACT MUST NOT BE ZERO if If the field Contract is zero then it is invalid C WHEN ADDING CONTRACT MUST NOT EXIST C IF NOT amp FOUNDiICONHDERBE ff Verify the field Contract ag
7. Rules for MVC Seq Selection Object Type Object Co Object Na Library Co Library Na Inel Refd Incl Refd Incl 0 Incl D 10 Select Program Equal WWCUSTS All All No No Application Area Rules for MVC Seq No 10 Selection Y Object Type Program v Object Comparison Equal Object Name WWCUSTS Library Comparison Library Name Incl Ref d Pams Incl Ref d Files All Incl Owning Files Incl Dependent Files No Once we have our application we can view the objects or programs it contains is im m Object List of MVC ALLUSR ALL PGM ALL ALL ALL Total Objects 17 All Procedures 12 1 1 MERI EL III BD MU I 5153 Root RR ee NI SL EMIL 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 Oo 00 00 04 06 09 04 06 09 DSPFIL Guspese Rules Summary Rt XAN4RD CUSTMNT1 PGM RPGLE Customer Detail Maintenance B oofoo oo 04 06 09 04 06 09 EDTRCD i i x Rebuid Options RE XAN4RD CUSTSSEL PGM RPGLE Customer Selection C oofoo oo 04 06 09 04 06 09 DSPFIL i BD aad RE XAN4RD DISTSSEL PGM RPGLE Distributor Selection C Oo 00 00 04 06 09 04 06 09 DSPFIL amp DG A Accounting Main RE XAN4RD ORDSTSEL PGM RPGLE Order status Selection C 00 00 00 04 06 09 04 06 09 DSPFIL B B myc myc LXAN4RD RTNMSGTEXT PG
8. SLMEN 7 DRDSTS CUNDET WWCONHDR Retum mezsage text Salespersons Order status Contract Detail Work with Orders ee SLMENSEL STKMASEL TRNTPSEL CUSTSSEL WMITRNHST Salespersons Product Waster Transaction type Customer Selection Work with Selection Selection Selection transaction history Databorough Limited 2009 Page 13 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 SH Area Flow Diagram 55 Work with Customers CUSFSEL CUSF Customer Site Sites Selection CUSGRSEL CUSGRP gt Customer group Customer Groups Selection DISTSSEL E 4 CUSTS Distributor Selection Purchases RTNMSGTEXT Retum mezsage text 0 SLMEN Salespersons o E Jf SLMENSEL STKMASEL Salespersons Product Master Selection Selection RPG as Pseudo Code With a single click Area Flow Diagram for MYC Total Objects 30 STOMASEL XBCCLMSG Store Master Clear a Wessage Selection yeye DISTS STKMAS Distributors ps baster E STOMAS_ 7 Store Master p TRNTYP gt Transaction type description DRDSTS gt CONDET Order status Contract Detail eee TRNTPSEL CUSTSSEL Transaction type Customer Selection Selection m A Selected Object OR
9. XWORDH ZzEROS ERROR OFRMOOLO END WHEN ADDING CONTRACT MUST NOT EXIST IF NOTFOUND Verity the field Contract against the file Contract Header If on file then ff the field Contract is invalid VALIDATE DATA FROM CONHDR WHERE EXWORDN ZXWORDHN IF FOUND ERROR Yzuduu3 END END CUSTOMER 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 O Databorough Limited 2009 Page 26 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 a WM CONHDR IF Restructured Code Fla Migrated Logic WI wWorkwWithOrders java es LL ff DSPRECY subroutine processing private hoolean dsprecy String selact throws SQLException ff S LIWHES subroutine processing private boolean zlines throws SQLException ff VALIDT subroutine processing private boolean validt String action throws SOLException ff If the field Contract is zero then it is invalid it i iszeras conhdrE XWOBRDN i setErrori ZWORDM OEMODIO return false ff Verify the field Contract against the file Contract Header If on ff file then the field Contract is invalid it i iDbD edqualsiaction i if ConhdrF recordExists conhdrR XWORDN setError AWORDN 2U0003 return fal
10. 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 modernization 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 UI s completely For those programs and screens where this is not the case the design and mapping information can be used directly in the new version of the application even though the UI code has been discarded O Databorough Limited 2009 Page 21 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 Ul 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 natura
11. led to cost savings and reduced risk gt Data Integrity Journaling is available for SOL 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 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 SOL syntax from programs or via JDBC ODBC the actual definitions bear no relation to SOL What the process of X Analysis database modernization does is to replace the DDS definitions with SOL 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 exis
12. now view the code in multiple ways normal source view the same as PDM in effect with color coding for the type of statement Databorough Limited 2009 Page 23 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide Source List of WWCONHDR in XAN SRE Lines 525 View Level 4 BA P R A EA 5 5 SA Diss wu Ea p aeq Na YaaoTooo d veces oooTooo A oooTooo ut oooTfooo negem B T ps3 E ENDIF E Oe 0544 00 C WHEN ADDING CONTRACT MUST NOT EXIST 0546 00 C XWORDN SETLL CONHDR gg 0547 00 C INSS IFEQ 1 Bene O3 0548 00 c HOVE 4 IN40 EN 0549 00 i MOVE YzUDOD3 MSGID EE 0550 00 c CALL RTNMTX EE 0551 00 C FARM MSGID 7 EE 0552 00 Z FARM ERRMSG 132 EE 0553 00 E LEAVE EE 0554 00 C ENDIF ERE 03 0555 00 C ENDIF Eme oz 0556 00 C CUSTOMER 0557 00 C XWBCCD CHAIN CUSTS gg 0558 00 C INS9 IFEQ 1 Pessi oz 0559 00 Z MOVE 4 IN41 0560 00 Z MOVE OEMDODZ MSGID V 0561 00 C CALL RTNMTX 0562 00 C FARM MSGID 7 0563 00 C FARM ERRMSG 132 0564 00 E MOVE RTL XUG4TE 0565 00 k LEAVE 0566 00 C ENDIF Pe oz 0567 00 E 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 View Level 4 E Ge E T AMS hB A oTo oo ru aaa fle Meese muna T seq No cee cus eae e c A tuc S oh arin ORE oad cadre PME EIE 6 7 0543 00 ES lERC ENDIF LSS See
13. 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 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 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 O Databorough Limited 2009 Page 10 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide
14. 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 49 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 X Select one Find out more about Power Systems Announcements The New Power Equation videos Select one LI Q Client New Power Equation videos AIX Benchmark Center Benchmark performance information This can be cumbersome if there are many Blade servers values and unless you have only a few codes Blogs beginning with each number or letter in most browsers once the focus is on a drop Capacity Backup Capa
15. 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 svsteminetwork 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 svsteminetwork com article field euide encores svstem i software Asset modernization Discover and transform legacy assets for reuse IBM Rational http www 306 ibm com software info developer solutions em svstems i assets index jsp 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 eatingtheitelephant com home html O Databorough Limited 2009 Page 53 of 53
16. 9 Page 15 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 O Databorough Limited 2009 Page 16 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 The Application Area diagram in X Analysis is int
17. D0 000153 PORD O0Z4798 ZUDT UZ Z3 199 67 And maintain or change a customer record with F4 prompting me Customer Detail Maintenance Uci l CUSTMNTL 11 12 08 2009 05 01 Customer No ACC1 Customer Name Bertwhistle Ltdl Statement Account ACCZ3 Related Account ACC43 Tax Reg TAXOL Bank owo eo 235468 Bank A c CusGrp o PV Private Please select Rep 4 so w arw JKL Johan K JKL Johan Klaassen Distributor UK only MTT Mark Tregear Credit Limit i a 10012 NWD Neil Woodhams Stl Bee X 43 RJD Richard Downey Cr Guarantee STU Stuart Milligan B O gi im aai a Date Loaded 2003 06 14 Last Sale s 2003 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 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 5 Application Area
18. DSTSEL E Input Order status Selection IE Output Update STKBAL gt Called Program Stock Balances Calling Program WUWICONDET Work with Order Details CUSTMNTL Customer Detail vaintenance WWCOUNHDR Work with Orders WUWITRNHST Work with transaction history 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 a cB9D6R 3 A e object List BS06R mL Source List of CB9065R in ADE C Lines 145 View Level 4 JA Pseudo Code of CB906R in ADE C Lines 138 View Level 4 fA B 92 8 5 8 ye IH 829 8 0 El 0 majus L suotan A nar iru mm ditam ximus a ei mike na O minia eraru 6 CODE SENTIT TROT PRE Darcie et IOS ORI NE PHT Tn T SM E EE C PARM WWACFN 3 EE Account Type 3 C PARM WWACTP i0 Work Account Type 1 0 G PARM WWACSS 1 WM ee Account Status 1 C PARM WWDAPG 60 WM 3 Date Of Last Posting 6 0 C PARM WWPTIT 104 a 3 33c Predicted Interest 10 43 C PARM WWPTTR 104 3 Pred Tax Relief 10 43 c PARM WUTATP 3 Qf Transaction Type 3 C PARM WUVLDA 60 Value Date 65 0 C PARM WUTAAM G3 FR
19. IST ich aede ji bap px p 0540 00 c PARM MSGID c IF NOT FOUND CONHDR 0541 00 c DARM unns 3 7 Verify the field Contract against the file Contract 0542 00 c LEAVE ff file then the field Contract is invalid 0543 00 e ENDIF ff Business Rule No XANACDEXAT QRPGLESRC WUWCONHDR 554 Vs 0544 00 C WHEN ADDING CONTRACT MUST NOT EXIST if vOODO06 CONHDR XWORDN Record already exists 0545 00 C IN36 IFEQ 1 c XWORDN SETLL CONHDE 0546 00 C XWORDN SETLL CONHDR i n s CUTCONHDE 0547 00 c INS9 IFEQ ra m v2uD003 0548 00 e MOVE VET TN40 0549 00 MOVE YeSUO0003 MSGID 0550 00 cC CALL RTNMTX 0551 00 C PARM MSGID 0552 00 c PARM ERRMSG 0553 00 c LEAVE G LEAVE 0554 00 ENDIF c ENDIF 0555 00 C ENDIF c ENDIF 0556 00 C CUSTOMER cusronen 0557 00 c Pec ciam cuers Retrieve the record for the field Debtor from the fil a 0559 0 C MOVE be IN41 Pal edis 0560 00 c MOVE OEMO002 MSGID ff Retrieve the record for the field Status from the fil 0561 00 c CALL pTNMTX C SALESMAN y 0562 00 c PARM MSGID y lt gt lt gt We can view the migrated logic which is the essence of the original code as expressed in a language independent psuedo code Migrated Logic of WWC ONHDR in X4N4CDEM QRPGLESRC Migrated Logic l DELRECY DELEECH ES DSPRECH E DSPRECY ES RESTOREDAT ES HA VE DATA El VALIDT Subroutine Validation WHEN ADDING CONTRACT MUST NOT BE ZERO E If the field Contract is zero then it is invalid IF
20. M CLP Return message text C OO 00 00 04 06 09 04 06 09 OTHCAL V5 Application Area Diagram RE XAN4RD SLMENSEL PGM RPGLE Salespersons Selection C 00 00 00 04 06 09 04 06 09 DSPFIL x Data Model Diagram RE XANARD STKMASEL PGM RPGLE Product Master Selection C OO 00 00 04 06 09 04 06 09 DSPFIL BP Area Flow Diagram Ri XAN4RD STOMASEL PGM RPGLE Store Master Selection C Oo 00 00 04 06 09 04 06 09 DSPFIL Poe Overviei Struct re Chart Ri XAN4RD TRNTPSEL PGM RPGLE Transaction type Selection C Oo 00 00 04 06 09 04 06 09 DSPFIL E dcin RE XAN4RD WCUSTP PGM RPGLE Print Customer Detail C OO 00 00 04 06 09 04 06 09 PRTFIL RE XANARD WWCONDET PGM RPGLE Work with Order Details B OO 00 00 04 06 09 04 06 09 EDTFIL Programs RE XAN4RD WWCONHDR PGM RPGLE Work with Orders B 00 00 00 04 06 09 04 06 09 EDTFIL Files RE XAN4RD WWCLISTS PGM RPGLE Work with Customers A Oo 00 00 04 06 09 04 06 09 EDTFIL Business Rules Summary RE XANARD WWTRNHST PGM RPGLE Work with transaction history B Oo 00 00 04 06 09 04 06 09 EDTFIL GE X Rebuild Options LXAN4RD XBCCLMSG PGM CLP Clear a Message Queue C Oo 00 00 04 06 09 04 06 09 OTH BE PRINT Printed documentation HG SALES Sales System HG STOCK Stock 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 d
21. USTMNTI usecase X 7 CUSTMNT 1 usecase xmi emx Palette h Select Zoom Client Note UML Common gt Instance Customer Detail Maintenance S1 Component 1 gt Deployment Use Case gt Class Composite Structure Geometric Shapes Sales Cond Databorough Limited 2009 Page 28 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 all of the specific attributes of that particular format X Analysis deduces the links between these classes using a combination of the derived data model and call or action information extracted from each program H cusfSites cg cusnoCusNo String Eg cnameCompany String cg dsdcdeDistributor String cg statusSts String E telnoPhone String cg extnExtn String cg lctdatLastCntDate String Eg apdateNextCntDate String cg usernmContact String cg salutSalutation String cg jtitleJobTitle String cg faxnoFaxNo String cg emailEmail String Eq websit Website String cg add1Address1 String Eh add2 Address String add3Address3 String cg add4Add
22. X Analysis 8 Application Modernization and Rebuilding Concepts Guide Authors Richard Downey and Stuart Milligan Databorough Limited May 2009 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 O Databorough Limited 2009 Page 2 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide Table of Contents jy eo uiis le T 4 Lrineielurtiie e M 7 Why De
23. ainst the file Contract Header If on oF file then the field Contract is invalid fi Business Rule No XANJCDXAT QRPGLESRC WWCONHDR 554 Validation ff VOOOO6 CONHDR XWORDN Record already exista C XWORDN SETLL CONHDRE a C IF EQUAL CONHDR i error yuta C LEAVE C ENDIF C ENDIF C CUSTOMER Tr Retrieve the record for the field Debtor from the file Purchases If t STATUS PS Retrieve the record for the field Status from the file Order status C BALESMANM ie Retrieve the record for the field Bep from the file Salespersons If Notice how the error code MOVE Y8U0003 MSGID that was grayed out has been replaced with ERROR Y2U0003 ES Databorough Limited 2009 Page 25 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 XANA4CDEM QRPGLESRC Ay m J v Restructured Code Seq No Pro arte e m EROR M I RR C ERR E ebete E a E cevereiine iver fol levees che Ol 3 Message Handling 0535 00 c XWORDN IFEQ ZEROS Redundant Block 0536 00 c MOVE 1 IN29 C WHEN ADDING CONTRACT MUST NOT BE ZERO niei s gt iden is M ocn T If the field Contract is zero then it is invalid pi E TENE UEM ii C WHEN ADDING CONTRACT MUST NOT EX
24. alysis 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 O Databorough Limited 2009 Page 39 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 Z 3 4 D Identify the parts of the green screen that you want to work with Use X Analysis Application Areas to break out this part of the system Rebuild the Application Area into your chosen architecture Run the rebuilt application 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 Bottom O Databorough Limited 2009 Page 40 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide We can view Orders Work with Orders ita m WiCONHDR 11 13 08 2009 05 01 Customer Bertwhistle Ltdl Representative JKL Johan Klaassen Telephone Number 04895 580099 Current balance 256254 00 Credit Limit 1001235 00 Position to Cntrac Customer Reference Date Oo00001 PORDO1344 2007 02 16 a R A a PRT 000002 PORD0Z134 ZUUT UZ 2ZZ 1 850 DB
25. andard 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 business 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 O Databorough Limited 2009 Page 38 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide Centralizing commonly used referential validation rules into the data persistence framework gt Date formatting logic can be centralized into reusable classes Centralizing commonly used field logic such as global tax calculations into reusable classes This means that code duplication amp redundancy can
26. ar Stuart Milligan 3 lt gt Lang Date Loaded 14 06 03 9 Chg Date Last Sale 14 07 03 3 14 08 03 9 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 48 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 LDAtype constructs SoftSecurity 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 w
27. avaCurrentArmt String Ea swobva030Days String cg swgcvaD60Days String c swadva090Davs Strina 1 Li cusgrpCustomerGroups xwbncdCusGrp String xwkhtxDescription String H distsDistributors cg dsdcdeCode String Eg dnameDescription String H slImenSalespersons Eg personPerson String Eg pnameFullName String O Databorough Limited 2009 Page 29 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide Figure 14 Activity Diagram oo WYWCUSTS Work with Customers e Work with Customers 51 Customer Maintenance Add Display Delete Change Work with Customers 52 Orders s Customer Detail Maintenance 51 Trans Hist i Orders Submit Submit Trans History JoinNode_O01 JoinNode Ce eu Work with Customers 53 Customer Detail Maintenance 52 Sales Cond Work with transaction history 51 Work with Orders 51 Sales Conditions 51 Add Display Delete Change Add Display Delete Change i Lines Work with transaction history 52 sam Work with Orders 52 Detail li Submit Confirm Submit iin ida JoinNode OQ a Work with transaction history 53 Work with Orders 53 E Work with Order Details 51 Add Display Delete Change s Work with Order Details 52 Submit e Work with Order Details 53 O Databorough Limited 2009 Page 30 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide Producing any of these diagrams from within X Analysis is as simple as r
28. 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 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 An
29. cations All these characteristics of a modern application radically improve the maintainability and agile nature Legacy applications do have these same elements but they tend to be embedded in and mixed up in large monolithic programs with vast amounts of redundancy and duplication throughout Implementing an RPG application using MVC requires that the business logic be Historically some sites have built or separate from the user interface and modified their systems to separate the controller logic This can be implemented Presentation layer from the business logic using 5250 and pure RPG see box right but often called n tier or 3 tier applications these systems worked but delivered very little bang for the buck as most of the improvements were hidden 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 O Databorough Limited 2009 Page 18 of 53 X Analvsis 8 Application Modernization and Rebuilding Concepts Guide Figure 8 Legacy versus modern architecture Legacy 5250 Aoptcaljor Server Host Server View _Dspay ze ld Data E Database Business Logic
30. city on Demand down box typing a letter or number will Compare Power servers position the cursor at the first matching 2 ur entry in the list keyboard navigation is Cluster software ordering guide limited and can involve a lot of scrolling Community forums blogs and wikis This example looks quite cumbersome but Contacts Executive Briefing Center Man Contacts Benchmark Center imagine if it had several hundred options Contacts High Availability Center of Competency and you had to repeat the same process Customer success stories many times on each page So how can we Customer new Power Equation videos improve the usability and provide help for Education and training Executive Briefing Center Eat applications that have been developed from new users at the same time Most web Forums older applications use technologies dating Hardware Power Systems e from the birth of the web Web 1 0 and are Hardware System p analogous to main frame technologies i e Hardware Capacity Backup Hardware Capacity on Demand the browser is a dumb terminal you enter Hardware Facts amp features Hardware Systems performance data then press enter then get feedback on errors etc Web 2 0 technologies which I shall address shortly are similar in principle to High Availability Center of Competency v Mini computers like the iSeries the termi
31. eractive and by clicking on different parts of your system you can see the relationships between either all parts or just the area you ve clicked on and the areas it relates to O Databorough Limited 2009 Page 17 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 appli
32. es 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 allows 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 yo
33. ft Internet Explorer Ba d File Edit view Favorites Tools Help a Address http 127 0 0 1 8080 xantcdxatmyc Faces zzwwconhdrs 1 xhtml jsessionid F8821D60337D559DB2097F4015D7E76A par Y Go Links Customers Work with Orders Databorough Ltd Customer Bertwhistle amp Company Ltd amp C Representative STU Stuart Milligan Telephone Number Current balance E 256254 00 Cr edit Limit 1001230 00 a Cntrac Customer Reference Value E 000002 PORDO02134 1 850 00 000153 PORDO24 8 198 55 Cancel Change Delete Display Lines Add Following the screen flow we had earlier on the green screen side here s the Work with Orders screen O Databorough Limited 2009 Page 47 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide E Purchases 51 Microsoft Internet Explorer File Edit view Favorites Tools Help Address c http 127 0 0 1 8080 xan4cdxatmvc Faces zzcuskmnt15s1 xhtml jsessionid2F8821D60337D559DB2097F4015D7E76A Customers Customer Detail Maintenance Databorough Ltd Customer Ho Customer Hame ACCT Bertwhistle amp Company Ltd amp C Statement Account Related Account ACUZ3 ACCA3 Tax Reg Bank tax 000235468 Bank Ac Forex DOOOOOOOODOODOC 10 N CusGr p e PV Private X A JE DGL V Please Full Name Credit L END Johan Klaassen 1 1 MIT Mark Tregear Stl Dsc Jk Co NWD Neil Woodhams C RJD Richard Downey IN au
34. h Limited 2009 Page 12 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 S Area Flow Diagram mE Area Flow Dia f Obj a I 3 gram for M C Total Objects 30 a IE Selected Object wWCUSTS WCUSTP STOMASEL XBCCLMSG ORDSTSEL B Input Work with Print Customer Store Waster Clear a liessage Order status Customers Detail Selection Queue Selection Output Update CUSFSEL tUs DISTS STKMAS _ STKBAL Customer Site Sites Distributors Product baster Stock Balances me Called Program Select is Calling Program CUSGRSEL CUSGRP gt CONHDR STOMAS WMICONDET Customer group Customer Groups Contract Header Store Waster Work with Order Selection Details DISTSSEL Distributor Selection description hiaintenance E TRNHST bn i TRNTYP CUSTMNTI CUSTMNT1 Transaction History Customer Detail RTNMSGTEXT
35. her from a single program with multiple screens or a group of programs Each activity in the diagram represents a O Databorough Limited 2009 Page 27 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 Figure 11 Activity Diagram for a Program pA CUSTMNT1 CLISTMNT1 Customer Detail Maintenance CUSTMNT1_ActivityDiagram i CLISTMNT1 activiby xni emx 55 CUSTMNT1 Customer Detail Maintenance AIR eit elec InitialNode Zoom B Note UML Common Partition Initial Activity Final Action Submit 54 Accept Event i Send Signal ae Customer Detail Maintenance 51 azz eee 9 Structured Activity E Customer Detail Maintenance 8S2 m lc ontrol Node Object Node Object Flow Control Flow Sales Cond c Sales Conditions 51 ActivityFinalNade gt 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 He Object List b CUSTMNT1 C
36. iagram O Databorough Limited 2009 Page 42 of 53 X Analvsis 8 Application Modernization and Rebuilding Concepts Guide XANACDXAT PRINT Printed documentation SMWORK TEST21 4 Accounting Main Rebuild the Application Working with the application area that we have just created we can build a web application directly BE A Accounting Main RE YAN4RD ORDSTSE LUI C MERE T CLXAN4RD RTNMSGI is Appl eee REXAN4RD SLMENSE X1 Dati Derive Business Rules RE XANARD STKMASE 3M Area RE XAN4RD STOMASE Tea Oye Export Options Re XAN4RD TRNTPSE Alc meu RE AANARD WCUSTP s i m Hr XAN4RD WAWCORNI Document Application Area RE XAN4RD W WCONE Files Generate Class Diagram UML RE XAN4RD WWCLIST Busit RE XAN4RD WMWTRNF x Re Data Options B CL XANARD XBCCLMS BG PRINT s Madernize Options gt BIG SALES pe STOCK X Rebuild Options Re engineer Programs Generate ORM Objects Wh XAN4CDXRF Audit Options b Wh XANATLITXA amp mer irr sarrrrorortipr TEIT Wh XCDEMOXA XCDEMOXA Wh xCXA x Control Wh XRTESTXA Demo XResize ee m inns m Generate Web Application View Generated Objects J E Ge Ge Ee Databorough Limited 2009 Page 43 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 Bus
37. ication Modernization and Rebuilding Concepts Guide Hibernate mapping for purchases table amp z2xml version 1 0 7 z DOCTYPE hibernate mapping PUBLIC Hibernate Hibernate Mapping DTD 3 077 EN http hibernate sourceforge net hibernate mapping 3 0 dtd lt Generated 15 May 2009 17 06 29 bv Hibernate Tools 3 4 1 G4 f ide nha aga a a eee ee lt Hibernate mapping gt lt class name Nandcdxat hhbmbean Purchases tables CUSTS gt zcoamment Purchasesc camment zid name zwbccd tyvpe string lt column name XWECCD zgenerator class assidgned f gt lt id gt xmany to one name contractHeader class Xandcdxat hbmbean ContractHeader zZpogolumn name XWBCCP nor null trus wnigue true gt lt CoMmment gt Customer lt comment gt z column z many to one lt property name xwgdtrz type string column name KAGA IK length 40 not null trus lt comment gt Name lt comment gt lt r Column lt property gt lt property name xwbzZzcd twype 2 string zecolumn name XWBZCD lengrh 11 not null truse zecamment Statement Account lt comment gt lt r Column lt property gt lt property name xwb3cd twyvpe string 4coglummn memue XWBJCE length 2 mot null tru se zecaomment Relarted Account lt comment gt z column lt property gt Modern Business Intelligence Inquiries amp Reports There are many choices when it comes to BI or reporting tools Almost al
38. ight clicking on an object and selecting the appropriate option from the menu Figure 15 Producing Diagrams in X Analysis 4c Zoom Source CLP Customer Site Maintainat 4 2 Zoom In Lpex RPGLE Customer Site Maintenar 4c RPGLE Customer Site Selection 4 Structure Chart Diagram RPGLE Customer group Selectio 4 Program Structure Chart CLP Initialise Customer Recor 4c E screen How Disgram CLP Customer Letter Stage 4c RPG Update Letter Sequence 4i CLP Customer Letter Stage 4c g Data Flow Diagram CLP Customer Library Setting 4i Object Where Used gt cP Customer Menu 4i l RPG Update Maintenance Mot 4c variable Where Used RPG Reorganize Customer Fil 4c Screen Design Report Layout RPGLE Customer Detail Mainten 4C RPGLE Customer Selection 4 Annotate RPGLE Distributor Selection 4c Nl for en CLP Delayed Faxshot RPG Distributor Report 4 More Info RPGLE Display Distributor 4c RPGLE Display Product 4c Derive Business Rules RPG Faxshot Errors Part 1 4 x Modernize Options gt RPG Faxshot Errors Part 2 4i BP senerake Fay Mumhers qc Generate Use Case Diagram 4c Application Area Options Generate Class Diagram ngineered Functions 25 Development Functions Member X Ref Variable v O Databorough Limited 2009 Page 31 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide Using Design Recovery for Rebuilding Whilst Design Recovery is very valuable for documentation and application support purpos
39. indows 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 enter 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
40. iness Rule logic or not and the type of data access mechanism we wish to use JDBC or ORM Hibernate Generate Web Application Select Function AZCUSFSELS1 AZCUSGRSELS1 ZZCLUSTMNT151 ZZCUSTMNT152 AZCUSTSSELS1 AZDISTSSELS1 AZORDSTSELS1 AZSLMENSELS1 AZSTKMASELS1 AZSTOMASELS1 AZTRNTPSELS1 ZZWNNVCONDETS1 ZZ CONDETS2 ZZ CONDETS3 Projeck Type Java EGL File CUSF CLISGRP CUI CLISTS CLISTS DISTS ORDSTS SLMEN STKMAS STOMAS TRNTYP CONHDR CONDET CONDET Project Setting Include BR Logic v LIse ORM Objects Title Sites 51 Customer Groups 51 Customer Detail Maintenance Customer Detail Maintenance Purchases 51 Distributors 51 Order status description 51 Salespersons 51 Product Master 51 Store Master 51 Transaction type description Work with Order Details 51 Work with Order Details 52 Work with Order Details 53 Component 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
41. ing Letthe user enter a code and validate it when they leave the field Letthe 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 O Databorough Limited 2009 Page 51 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 risk 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 quantify
42. ing 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 ODataborough May 2009 O Databorough Limited 2009 Page 52 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 World 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
43. into Function Definitions in the X Analysis repository These function definitions are effectively input specifications for generating new UI s 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 such 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 st
44. istributors Sites by Number Customer Site Customer Site Display Distributor Maintenance Selection WWCCONS WWRAREAS CUSFMAINTC wwCUSF Work with Work with Rep Customer Site Work with Customer Delivery Areas Maintainance Customer Sites Contacts Databorough Limited 2009 Page 11 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 I M Program Structure Chart for OE001 Total Objects 6 OE001 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 Overview Structure Chart 2 5 Overview Structure Chart For XAN4CDXA E A J AACUSF AACUSF Shadow Program OTHFIL XASYSOPR XA Test Alert OTH OTH CBC110 Order Entry System OTHFIL CB906R Back out account EDTFIL X GSCD Generate Code OTHCAL CB9Q7R gt CLET Build Customer Letter OTH LETNI Letter Prefix Generation OTHFIL T FWKCUSL Customer Letter PRTFIL UPD Databoroug
45. l 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 significant 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 O Databorough Limited 2009 Page 37 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide Rebuilding the View In the section Recovering Screen Designs above we described how useful screen design information is extracted
46. lied in the configuration the Hibernate is a very good more effectively it can be utilized in development and ol fit for 2E applications as it 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 is is flexible enough to work well with the mnemonic naming without having to use the file table names as obviously the next critical requirement for the Hibernate with pure JDBC ORM to work effectively As explained earlier 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 entire legacy application database 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 Wh XANACDX ee ee Y n m mM Hebuild Options ReE engineer Programs WA XAN4CDX atis iin ca Generate ORM Objects wi i F ion Informat Audit Options Generate Web Application 1 uc ee Generate Web Service r a View Generated Objects i ysis Username RICHARD Databorough Limited 2009 Page 34 of 53 X Analvsis 8 Application Modernization and Rebuilding Concepts Guide Choose the files you d like to generate ORM object
47. lly 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 that 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 a
48. 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 O Databorough Limited 2009 Page 8 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 else So the change has more aspects than would first appear these are just a few of the questions we have to answer Scope and impact of the change how many programs and tables are effected 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 Database integrity Fields destined for ad hoc data like 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 system
49. m xml resaurce xandcdxathbmbeanjDistribubors hbm xml oo resaurce xXandtcdxatlhbmbean Sites hbm xml oo resource andtcdsat hbmbean Purchases hbr xml oY resaurce Xandcdxat hbmbean PraduckMaster hbm resaurce Xandcdxat hbmbean Salespersaens hbm xi resource andtcdsat hbmbean Distributors hbm xml H3 Caches A Events H Listeners Databorough Limited 2009 Page 35 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide Generated hibernate xml mappings and hibernate java beans zi i AandcdxabkOrm E 8 src E cam databoraugh utils H Xandcdxat data E E E El Er Ec Ee Ee E El Er E EH angcdsat hbmbean J ContractDetail java J ContractDetailid java J CankrackHeader java J usktamer raups java J Distributors java J CrderStatusDescription java J ProductMaster java J Purchases java J Salespersons java J Sikes java J StoreMaster java D TransactionHistory java J TransackionHiskaryId java J Transaction ypeDescription java 4 ContractDetail hbm xml ContractHeader hbm xml Customersroups hbr xml Distributors hbm xml CrderStatusDescription hbm ml ProductMaster hbr ml Purchases hbm ml Salespersons hbr ml Sites hbm xml StoreMaster hbm xml TransackionHiskars bri rml Transaction ypeDescription hbm xml jsfbean H g uud eats O Databorough Limited 2009 Page 36 of 53 X Analysis 8 Appl
50. n 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 effectively 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 sustai
51. nable 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 application 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 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
52. nal 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 a server in the Databorough Limited 2009 Page 50 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide background without stopping the page displaying Google Maps 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 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 windows 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 includ
53. nd latterly the System i 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 in a product like X Analysis to both recover the design of the application and provide highly productive analysis tooling to compensate for the complexity of the application and the absence of the original development team Databorough Limited 2009 Page 4 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide Inconsistent programming standards and designs significant amounts of redundant and duplicated code and a
54. ng the Modernization Process ccce eee e eee ee eee eee eene eene eee etae tette 48 Surrounding Application Framework eene 49 Eoo e Teel S DIES Unc a dS aeiaai DIETER TT Rt Nae UI ter 49 vilinintiade mr 52 Additional Resources amp Information ccce ee eee ecce eee eee eee ee eee eene enano 53 O Databorough Limited 2009 Page 3 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 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 i 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 a
55. nization and Rebuilding Concepts Guide 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 relational 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 supp
56. nterfaces 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 O Databorough Limited 2009 Page 6 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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 understanding 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 bu
57. ny 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 final part of the process it supplies appropriate text narratives to describe these harvested rules More Info Derive Business Rules Modernize Options gt Generate UML Diagrams Once the rules are derived they can be viewed in summary form Databorough Limited 2009 Page 22 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide BR Summary 3 gt lt DMD Details gA Where Used fig BR Logic S3 Functions 1 5 AAD Details Business Rules Summary For MYC Number of Lines 42 Source Member Narration CLISTMNT 1 Call program CLISTP passing the field SWBCCD CUSTMNT 1 IF the Field SWBCCD is blank then it is invalid CUSTMNT 1 Verify the Field SWBCCD against the File Purchases IF on File then the Field Customer is invali CUSTMNT 1 If the Field SWG4TX is blank then it is invalid CLISTMNT1 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 not Found then it is inva CLISTMNT1 Retrieve the record For the Field SDSDCDE From the File Distributors IF not F
58. oject The sheer number of screens in a legacy application O Databorough Limited 2009 Page 20 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide presents a logistical problem in recreating them manually even with the cleverest developers and best tooling X 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
59. on Modernization and Rebuilding Concepts Guide E Work with Customers Microsoft Internet Explorer File Edit wiew Favorites Tools Help Address http 127 0 0 1 8080 xand4cdxatmvc Facesjazwwcustss1 xhtml readRec x t amp dispMode DISPLAY amp form f n Customer Name v ACC Bertwhistle amp Company Ltd amp C ACC10 Customer ACCTD ACC2 BOCK amp CO LTD ACC3 BESSON BROS ACCA 1EDIA ENTERPRISES LTD ACCS Bays Engineering Ltd ACCE Gough Research plc ACC Karst plc ACCS Bays Engineering Ltd ACCS NEWT FOODS UK LTD ACCS Prime Computer Systems Cancel l Change Delete Display Customer Maintenance Orders Trans Hist Add Following the screen flow we had earlier on the green screen side here s the Work 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 Databorough Limited 2009 Page 46 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide E Work with Orders Microso
60. ound then it is inva CUSTMNT 1 Subtract the Field SWIDYO giving the Field SDIFF IF the Field SDIFF is less than zero set IN99 t CUSTMNT 1 IF the Field Prospect No is zero then it is invalid CUSTMNT 1 Retrieve the record For the Field Prospect No From the file Sites by Number IF not Found then i CUSTMNT 1 IF the Field SWBCCD is blank Otherwise CLISTMNT1 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 No to the Field CUSPRM W WCONDET Retrieve the record For the Field Product From the File Product Master IF not Found then it is W WCONDET Retrieve the record For the Field Store from the File Store Master IF mot Found then it is inva W WCONDET Retrieve the record For the Field Product the Field Store From the File Stock Balances IF no W WCONDET Retrieve the record For the Field Trn Hst Trn Type From the File Transaction type description I W WCONDET When the Field UJM is EAC it is invalid W WCONDET Retrieve the record For the Field Contract the Field Product From the File Contract Detail I W WCONHDR Retrieve the record For the Field Contract From the File Contract Header IF not Found then it i W WCONHDR Retrieve the record For the Field Contract From the File Contract Header IF not Found then it i iniii vs m in ims rnm m s it ifr it fo fi i i i oc it rl ie D EN E I ior
61. rching 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 O Databorough Limited 2009 Page 7 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide Redeveloping Using a Recovered Application Design This starts with database modernization using the recovered data model The designs for the view controller and 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 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
62. ress4 String Ea entryCountry String Ea pscdPostCode String Eg cmmnt1CommentLine1 String g cmmnt2CommentLine 2 String Ea cmmntSCommentLine3 String E docrcdDocSent String Eg doc2DocSent String E doc3DocSent String Eg doc4DocSent String Eg docSDocSent String E doc6DocSent String cg oldmchMch String Ea prpcdeProductCode String cg lelcdeOrigList String cg prefixDocPrf String cg letsqLastLet int Ea spreqspecReq String ica risrCisrRiscRnth Strinn Figure 13 Class Diagram for a Program H custmntipf cusnoProspectNo String Eg dnameFullName String Eg kwbecdk WBCCD String C pnameFullName String cg recnamRECNAM String Eh sdsdcdeSDSDCDE String cg sfieldSFIELD String cg spersonSPERSON String Eg swaocdSWAOCD String cg swardtSWARDT String swasdtSWASDT String cg swbadDSWBADO String swbbcdSWBBCD String Eg swbccdSWBCCD String Eg swbncdSWBNCD String Eg swbpdOSWBPDO String cg swbqdtSWBODT String 1 gq swbtcdSWBTCD String cg swb2cdSWBaCD String cg swb3cdSWB3CD String cg SwC7StSWC7ST String 1 Ea swdastSWDAST String cg swdvcdSWDVCD String Eg swe nbBank String cg swf vaAmtLastSale String l gswf vOLastPay String Eg swflvaCurrPay String cg swflv CurrClaim String Eg swf2vaCurrSls String Eg swf3vaCurrCost String Ea swfdvaYtdSales String cg swfevaLast YearSls String c swg
63. s Bon tal uot Or inline in the code from where they are derived 0169 00 C Telephone number 0169 01 5 BRC Business Rule No XAN4CDEM QRPGLESRC CNTCMAINT 170 Validation 0169 02 BRC vOOOO04 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 LE ztelno lt gt blanks 0171 00 C D123456789 check ztelno zi 0172 00 C if 5found 0173 00 C eval in34 ton 0174 00 C eval msgid OEMOO143 0176 00 C eval valid off 0177 00 C leavesr 0178 00 C endif 0179 00 C 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 Once we have derived business rules we can
64. s 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 Y Go through all source files in PDM Y option 25 to search Y then F13 to repeat Y press enter Y type in your search term Y 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 Notes Field Extra Info Field address and some extraneous used for email address used for mobile phone number text similarly on the phone jbloggs78 aol com cell 7005896236 h Ice 07568 456 321 number list there is text and a 5 9 9 msn com Um HSMITH at SUN COM 447890987852 variety of layouts Finally We email jbooth mac com mobile 0754699888 07678 678912 suzip amp btconnect com have the inevitable result of nn D using ad hoc fields with no validation or on screen guidance transposed data mobile in email and vice versa O Databorough Limited 2009 Page 9 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide Hopefully this section raised awareness of the problems around changing and modernizing Sys
65. s for EE Generate ORM Objects Select File Component TRMHST ZOAMWAWTRINHST USF CUSGRP CUSTS DISTS ORDSTS SLMIEN STEMAS STOMAS TRAIT YP t ONWBDPE CONDET CI CI CI CI CI CI CI CI CI CI CI L1 X Analysis generates hibernate mappings configurations and hibernate java beans everything required to access those tables from Java Hibernate Configuration 3 0 XML Editor T Session Factory Session Factory Name o E HH Properties hibernate dialect l Properties E ss Mappings Mappings resource an cdsatihbmbeaniTransactionHistory F tem 1 resource andcdxat hbmbean CustemerGroups hbr resaurce xandcdxat hbmbean TransackionHiskary hbm xml c resource xandcdxatihbmbean StoreMaster hbm xrr resource Xandcdxat hbmbean Custamer iraups hbm xml 7 resnurce Xandcdxat hbmbean ContractDetail hbr resaurce xandcdxathbmbean StareMaster hbm xrnl resaurce Xandcdxat hbmbean TransactianTypeDes resource xandcdxat hbmbean CantrackDetail hbm xml resaurce xandcdxat hbmbean TransackionTvpeDescription hbr xml resaurce xandcdxatlhbmbean Sites hbr xml resaurce xandcdxatlhbmbean Purchases hbm xml respurce xandcdxat hbmbean OrderStatusDescript resource andcdxat hbmbean OrderStatusDescription Abr sml resnurce Xandcdxat hbmbean ContracEHeader hbrr resaurce xandcdxat hbmbean CantracEHeader hbm xml resaurce xandcdxat hbmbean PraduckMaster hbm xml resaurce xandcdxatlhbmbean Salespersans hb
66. se ff Retrieve the record for the field Debtor from the file Purchases I ff not found then it is invalid if CustsF recordExists conhdrR XWBCCD setErrori ZUBOCD OEHMODUS conhdr E HDMIIXE return false 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 XWSTAT sertErrori zWSTAT GEMNOO19 conhdrR XWSbDSc M m da m m m d I4 e m T ID i 4 Note that whilst this is 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 eit
67. sign Recovery is OHnlfIcult uiiuuo secos ovas dvor oos Faso ELE oV VE Vae a boa aepo S aaa aon e ssa ee pvOs de 8 Analysis Documentation amp Application Subdivision 10 Understanding Design amp Function More Easily sess 10 Producing Static Documentation Automatically eese 15 Dividing Systems into Application Areas ec ecce eere eee ee ee eere eee eene eene sano onus 17 Recovering an Application Design e ecce creen eee e e e e eere ee eene eee een eaaet eee ee 18 Isecovenue Ihe DaculyIodeloss s esencstesa festes HU ee ee eer 20 Recovering the User Interface eese eeeee eerte tnnt e tnnt nnne 20 Recovering Business Rule DO assetto uoi ucitondiorqe ibn tes E DUM ER LUE 22 UMED Gir a ER 27 Using Design Recovery for Rebuilding eeccocsossssseeccccccsssssseceococssssseeccecosssssssesee 32 Database Modernization using the Data Model assets 32 IR ve AS BETSY io n 38 Repuidi the C Onto E RP c 38 Reusing DUSIHesc RUIE E ioi oett deu Ime eee E eer ee eee 38 Iu niinppds ciini Y 40 Identify what you want to work with eere 40 Se E 6 0 bw a Ui crs T 4 Icebudld thes PICA OBL aconistio urne talus iss bau Rn E A AE IE arene 43 Completi
68. siness 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 application 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 sea
69. st intuitive manner in which to analyze a system but there is often a requirement for various types of static 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 DFD Exported to MS Visio 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 diagrams lists flowcharts annotation and business rules summaries generated O Databorough Limited 200
70. t 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 reference 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 vary from project to pr
71. tem i applications the issues with finding out the necessary information and how 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 It s important to note that for 2E variants of RPGII 400 IV COBOL 2E and CL has systems X Analysis looks directly produced an unmatched capability to extract at the 2E model and dervives its everything about an application from object right information from there ie not down to individual variables The repository is built from the generated 2E code thus automatically using a single command and initially Preserving the investment in the collects all object related information but then parses model every source member in the specified system 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
72. 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 SOL 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 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
73. 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 O Databorough Limited 2009 Page 44 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide If we go back to the X Analysis view of our application area and bring up the programs if we select WWCUSTS and right click we have options to allow us to display the corresponding JSF page as can be seen in this screen shot Re AMAINSHLLUEIYE WW UDIHIDIR Pall KFL Work wicn Urders E RPGLE work with Customers RE XAN4C ER Zoom Source RPGLE Work with transaction history CL XANAC CLP Clear a Message Queue Structure Chart Diagram Program Structure Chart E Screen Flow Diagram a Data Flow Diagram Object Where Used d Variable Where Used b Screen Design Report Layout Annotate Mark For Documenter More Info Derive Business Rules X Rebuild Options d Re engineer Programs Display Re engineered Functions r BR Sur Generate UML Diagrams Generate Web Application gt Execute JSF D Details 2s Calling Pi Application Area Options When we click on the Execute JSF we get the rebuilt work with Customers page O Databorough Limited 2009 Page 45 of 53 X Analysis 8 Applicati
74. ting 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 SOL 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 SOL and the advantages of an SOL created database over one created with DDS see the IBM Redbook Modernizing IBM eServer iSeries Application 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 databases are relational Though Java Database Connectivity or JDBC provides an easy method for accessing relational databases it is basically a low level API providing only a CRUD Create Read Update Delete a tongue in cheek acronym coined to cover the key table operations any system has have O Databorough Limited 2009 Page 33 of 53 X Analysis 8 Application Moder
75. ur 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 Relational Mapping ORM software such as Hibernate for rapid application development in Java and other modern languages gt Because the database is defined in purely SOL terms rather than in a proprietary file format it becomes portable i e it is now an option to consider moving the database to another platform gt Openness and Standards compliance using Industry standard SOL means that many different tools and applications on multiple platforms can easily access and use your modernized database O Databorough Limited 2009 Page 32 of 53 X Analysis 8 Application Modernization and Rebuilding Concepts Guide 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
Download Pdf Manuals
Related Search
Related Contents
LED LCD TV - Manual und bedienungsanleitung. 2012 Nissan Altima n° 1/89 SBI-7426T-SH Blade Module User`s Manual Copyright © All rights reserved.
Failed to retrieve file