How to Consolidate Projects and Packages during Stage 1 of the VisualAge Generator on Java to Enterprise Generation Language Migration Tool

Similar documents
Migrating Classifications with Migration Manager

Tivoli Access Manager for Enterprise Single Sign-On

iscsi Configuration Manager Version 2.0

Networking Bootstrap Protocol

Integrated use of IBM WebSphere Adapter for Siebel and SAP with WPS Relationship Service. Quick Start Scenarios

IBM WebSphere Sample Adapter for Enterprise Information System Simulator Deployment and Testing on WPS 7.0. Quick Start Scenarios

Platform LSF Version 9 Release 1.1. Migrating on Windows SC

Limitations and Workarounds Supplement

Development tools System i5 Debugger

IBM VisualAge for Java,Version3.5. External Version Control

IBM License Metric Tool Enablement Guide

IBM. IBM i2 Enterprise Insight Analysis Understanding the Deployment Patterns. Version 2 Release 1 BA

Platform LSF Version 9 Release 1.3. Migrating on Windows SC

Tivoli Access Manager for Enterprise Single Sign-On

Printing Systems Division. Infoprint Manager for AIX NLV Release Notes

IBM Security QRadar Version Customizing the Right-Click Menu Technical Note

IBM Tivoli Directory Server Version 5.2 Client Readme

System i. Networking RouteD. Version 5 Release 4

Version 2 Release 1. IBM i2 Enterprise Insight Analysis Understanding the Deployment Patterns IBM BA

Getting Started with InfoSphere Streams Quick Start Edition (VMware)

Tivoli Access Manager for Enterprise Single Sign-On

IBM Rational Synergy DCM-GUI

IBM emessage Version 8.x and higher. Account Startup Overview

IBM Integration Designer Version 8 Release 5. Hello World for WebSphere DataPower Appliance IBM

Build integration overview: Rational Team Concert and IBM UrbanCode Deploy

Installing Watson Content Analytics 3.5 Fix Pack 1 on WebSphere Application Server Network Deployment 8.5.5

IBM Security QRadar Version Forwarding Logs Using Tail2Syslog Technical Note

Using application properties in IBM Cúram Social Program Management JUnit tests

IBM Tivoli Monitoring for Databases. Release Notes. Version SC

IBM Cognos Dynamic Query Analyzer Version Installation and Configuration Guide IBM

Version 1.2 Tivoli Integrated Portal 2.2. Tivoli Integrated Portal Customization guide

Lotus Forms Designer 3. What s New

IBM Optim. Compare Introduction. Version7Release3

IBM Spectrum LSF Process Manager Version 10 Release 1. Release Notes IBM GI

CONFIGURING SSO FOR FILENET P8 DOCUMENTS

Version 9 Release 0. IBM i2 Analyst's Notebook Premium Configuration IBM

IBM Netcool/OMNIbus 8.1 Web GUI Event List: sending NodeClickedOn data using Netcool/Impact. Licensed Materials Property of IBM

Printing Systems Division. Infoprint Manager for Windows NLV Release Notes

Version 9 Release 0. IBM i2 Analyst's Notebook Configuration IBM

Release Notes. IBM Tivoli Identity Manager Rational ClearQuest Adapter for TDI 7.0. Version First Edition (January 15, 2011)

Rational Developer for IBM i (RDI) Distance Learning hands-on Labs IBM Rational Developer for i. Maintain an ILE RPG application using.

IBM LoadLeveler Version 5 Release 1. Documentation Update: IBM LoadLeveler Version 5 Release 1 IBM

IBM Storage Driver for OpenStack Version Release Notes

IBM Cloud Object Storage System Version Time Synchronization Configuration Guide IBM DSNCFG_ K

IBM Directory Integrator 5.1.2: Readme Addendum

IBM OpenPages GRC Platform Version 7.0 FP2. Enhancements

IBM Kenexa LCMS Premier on Cloud. Release Notes. Version 9.3

Best practices. Starting and stopping IBM Platform Symphony Developer Edition on a two-host Microsoft Windows cluster. IBM Platform Symphony

Installation and User s Guide

Release Notes. IBM Tivoli Identity Manager Universal Provisioning Adapter. Version First Edition (June 14, 2010)

Best practices. Reducing concurrent SIM connection requests to SSM for Windows IBM Platform Symphony

Limitations and Workarounds Supplement

IBM Storage Driver for OpenStack Version Installation Guide SC

IBM FlashSystem V MTM 9846-AC3, 9848-AC3, 9846-AE2, 9848-AE2, F, F. Quick Start Guide IBM GI

COBOL for AIX. Source conversion utility (scu)

Engineering and Scientific Subroutine Library for AIX, Version 4 Release 2. Installation GA

IBM Maximo Spatial Asset Management Version 7 Release 5. Installation Guide

Performance Toolbox for AIX Version 3.1

IBM Geographically Dispersed Resiliency for Power Systems. Version Release Notes IBM

IBM Maximo Calibration Version 7 Release 5. Installation Guide

IBM Maximo for Aviation MRO Version 7 Release 6. Installation Guide IBM

Release Notes. IBM Security Identity Manager GroupWise Adapter. Version First Edition (September 13, 2013)

Limitations and Workarounds Supplement

IBM i2 ibridge 8 for Oracle

IBM. Networking INETD. IBM i. Version 7.2

Netcool/Impact Version Release Notes GI

IBM Storage Management Pack for Microsoft System Center Operations Manager (SCOM) Version Release Notes

Release Notes. IBM Tivoli Identity Manager Oracle PeopleTools Adapter. Version First Edition (May 29, 2009)

Configuring IBM Rational Synergy to use HTTPS Protocol

IBM FlashSystem V Quick Start Guide IBM GI

Performance Tuning Guide

IBM Copy Services Manager Version 6 Release 1. Release Notes August 2016 IBM

A Quick Look at IBM SmartCloud Monitoring. Author: Larry McWilliams, IBM Tivoli Integration of Competency Document Version 1, Update:

Application and Database Protection in a VMware vsphere Environment

Version 4 Release 1. IBM i2 Enterprise Insight Analysis Data Model White Paper IBM

IBM OpenPages GRC Platform - Version Interim Fix 1. Interim Fix ReadMe

IBM Maximo for Service Providers Version 7 Release 6. Installation Guide

IBM. IBM i2 Analyze Windows Upgrade Guide. Version 4 Release 1 SC

IBM Storage Driver for OpenStack Version Installation Guide SC

ServeRAID-MR10i SAS/SATA Controller IBM System x at-a-glance guide

IBM Operational Decision Manager. Version Sample deployment for Operational Decision Manager for z/os artifact migration

IBM Operational Decision Manager Version 8 Release 5. Configuring Operational Decision Manager on Java SE

IBM Content Analytics with Enterprise Search Version 3.0. Expanding queries and influencing how documents are ranked in the results

IBM. Avoiding Inventory Synchronization Issues With UBA Technical Note

IBM Financial Transactions Repository Version IBM Financial Transactions Repository Guide IBM

IBM BladeCenter Chassis Management Pack for Microsoft System Center Operations Manager 2007 Release Notes

Tivoli Access Manager for Enterprise Single Sign-On

Migrating on UNIX and Linux

Tivoli Access Manager for Enterprise Single Sign-On

Tivoli Access Manager for Enterprise Single Sign-On

IBM Rational DOORS Installing and Using the RQM Interface Release 9.2

IBM i2 Analyze ibase Connector Deployment Guide. Version 4 Release 1 IBM

Release Notes. IBM Tivoli Identity Manager GroupWise Adapter. Version First Edition (September 13, 2013)

IBM XIV Provider for Microsoft Windows Volume Shadow Copy Service. Version 2.3.x. Installation Guide. Publication: GC (August 2011)

IBM Tivoli Access Manager for Enterprise Single Sign-On: Authentication Adapter Version 6.00 September, 2006

Workplace Designer. Installation and Upgrade Guide. Version 2.6 G

IBM UrbanCode Cloud Services Security Version 3.0 Revised 12/16/2016. IBM UrbanCode Cloud Services Security

Release 6.2 Installation Guide

IBM OpenPages GRC Platform Version Interim Fix 5. Interim Fix ReadMe

Rational Developer for Power Systems Software

Transcription:

How to Consolidate Projects and Packages during Stage 1 of the VisualAge Generator on Java to Enterprise Generation Language Migration Tool Publication History: Version 6.x - Jeri Petersen Version 7.1 Updates - Jeri Petersen Supports Stage 1 Migration Tool on Java, dated 20080228 on higher, shipped with: EGL Version 6.0.1.2 ifix001 EGL Version 7.1

Note: Before using this information and the product it supports, read the information in Notices on page 23. Copyright International Business Machines Corporation 2006, 2008. All rights reserved. US Government Users Restricted Rights Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 2

Contents Introduction... 4 How are EGL projects and packages currently determined?... 4 Why do I want to change the project and package structure?... 4 What project and package consolidation can I do?... 5 Using the standard renaming rules in the Stage 1 MigPreferences.xml file... 6 Splitting the common parts by part type and part name... 7 Where in the Java code are the project and package name determined?... 8 Scenario 1 Adding a prefix to project and package names... 9 Scenario 2 Consolidating projects... 11 Scenario 3 Consolidating some packages... 15 Scenario 4 Consolidating all packages... 18 Quick check of the project, package, and file names... 20 Summary... 21 Appendix A. How do I use VisualAge Java to change the algorithm?... 21 Appendix B. Summary of techniques... 22 Notices... 23 Trademarks... 24 3

Introduction This paper is intended for customers who are migrating from VisualAge Generator (VAGen) on Java to Enterprise Generation Language (EGL) and are interested in consolidating VAGen projects or packages into fewer EGL projects or packages. It discusses the Java method that needs to be changed and how the changes work. In addition, this paper provides samples of the modified Java code that you can use as a guide to help you understand and create your own modifications. This paper also provides a DB2 query that you can use to quickly check the results of your customization. How are EGL projects and packages currently determined? During the migration from VisualAge Generator to EGL the location where a part is placed in the EGL workspace must be determined. This includes determining the EGL project and package structure. By default, the VisualAge Generator to EGL Stage 1 Migration Tool preserves your VAGen project and package structure. The exception to this occurs if the maps in a map group are in different projects or packages. If the maps for a map group are in different packages within the same project, the Stage 1 Migration Tool uses your migration preferences to create a new package in the same project to contain the maps and the map group part. Similarly, if the maps for a map group are in different projects, the Stage 1 Migration Tool uses your migration preferences to create a new project to contain the maps and the map group part. In addition, the Stage 1 Migration Tool enables you to specify renaming rules to change the names of projects or packages. You can use the renaming rules to consolidate projects or packages. However, the Stage 1 Migration Tool does not support wild cards in the renaming rules. Therefore, if you have a large number of projects and packages to rename, using the renaming rules can be cumbersome. Why do I want to change the project and package structure? There are a number of reasons you might want to change the project and package structure. In VisualAge Generator, parts are stored in the ENVY repository. The repository provides control based on ownership and versioning. One common technique to exploit these controls is to store one program and its unique parts per package and store one package per project. This technique provides the ability to change the parts that are unique to each program and minimizes the risk of accidentally making changes to other programs. This technique also minimizes the chance of two developers needing to make changes to the same project or package at the same time. In EGL, parts are stored in a file. You can also choose your backend repository. If the repository you choose provides sufficient controls at the file level, you might want to store each program and its unique parts in a file and then consolidate your VAGen projects and packages into a smaller number of EGL projects and packages. 4

The advantages of consolidating projects and packages are: There is a maximum of approximately 1500 projects in an EGL workspace, so in some cases you must consolidate the projects to meet this restriction. There are fewer projects or packages to check out and check into the backend repository. There are fewer cycles for projects in the EGL Build Path. There are fewer cycles for packages in the import statements and fewer import statements in each file. There are fewer projects and packages to look at in the Project Explorer and other views. Depending on your backend repository, the performance might be unacceptable with the large number of projects that result from the one program per package and one package per project structure. There can be some disadvantages of consolidating the projects and packages. These are: The projects are bigger so that your workspace might be bigger. The packages are bigger so that an import statement of the form import mypackage.* results in more parts being included in the part name space. Depending on your backend repository, there can be a higher probability of collisions due to several developers needing to make changes at the same time in the same project or package. Before you decide to consolidate projects or packages, be sure to run a pilot project to ensure that the level of consolidation you select works well with your backend repository. What project and package consolidation can I do? In VisualAge Generator, you might have the project and package structure shown in Figure 1. Figure 1. VisualAge Generator Project and Package Structure SubsysAPgmA1Project subsysa.pgma1.pkg PGMA1 SubsysAPgmA2Project subsysa.pgma2.pkg PGMA2 SubsysAZZZCommonDataProject subsysa.zzzcommon.data.pkg SubsysAZZZCommonFnctsProject subsysa.zzzcommon.fncts.pkg SubsysAZZZCommonMessagesProject subsysa.zzzcommon.messages.pkg TBLAENU SubsysAZZZCommonPgmAZ1Project subsysa.zzzcommon.pgmaz1.pkg PGMAZ1 SubsysAZZZCommonPgmAZ2Project subsysa.zzzcommon.pgmaz2.pkg PGMAZ2 SubsysAZZZCommonTblAZT1Project subsysa.zzzcommon.tblazt1.pkg TBLAZT1 5

ZZZCorpCommonFnctsProject zzz.corpcommon.fncts.pkg ZZZCorpCommonItemsProject zzz.corpcommon.items.pkg ZZZCorpCommonPgmZZ1Project zzz.corpcommon.pgmzz1.pkg PGMZZ1 ZZZCorpCommonPgmZZ2Project zzz.corpcommon.pgmzz2.pkg PGMZZ2 ZZZCorpCommonRecordsProject zzz.corpcommon.records.pkg ZZZCorpCommonTblZZT1Project zzz.corpcommon.tblzzt1.pkg TBLZZT1 This paper contains sample code that shows how to modify the Stage 1 Migration Tool on Java to rename or consolidate the projects and packages. The samples show code for changing the VAGen project and package organization shown in Figure 1 in the following ways: Scenario 1 (see Figure 4) - Add a prefix to the project and package names. Scenario 2 (see Figure 6) - Consolidate the program projects for a subsystem into one project and the common projects for a subsystem into a different project. The package organization remains the same so that there is still one program per package. The packages are just located in a much smaller number of projects. Similarly, consolidate all the projects for corporate common into two projects (one for data and one for logic), but do not change the package organization. Scenario 3 (see Figure 8) - Consolidate the projects as in Scenario 2, but also consolidate the subsystem general programs into one package, the subsystem common programs into another package, and the subsystem common tables into a third package. Similarly, consolidate the corporate common programs into one package and the corporate common tables into a second package. Scenario 4 (see Figure 10) - Consolidate the projects as described in Scenario 2, but also consolidate all the packages so that there is only one package for each project. The sample code for each scenario is designed in such a way that you can combine it with the following techniques: Using the standard renaming rules in the Stage 1 MigPreferences.xml file. Splitting common parts by part type and part name. Using the standard renaming rules in the Stage 1 MigPreferences.xml file The standard renaming rules in the Stage 1 MigPreferences.xml file are specified in the renamerule entries. If you include your code at the recommended location in the Stage 1 Migration Tool, the standard renaming rules are applied first. All the figures that show the resulting project and package structure assume that renaming rules shown in Figure 2 are included in the MigPreferences.xml file. 6

Figure 2. Renaming rules in the MigPreferences.xml file <renamerule order="1"> <fromstring> </fromstring> <tostring></tostring> <stringcontext>any</stringcontext> <mappingcontext>project</mappingcontext> </renamerule> <renamerule order="2"> <fromstring>.pkg</fromstring> <tostring></tostring> <stringcontext>any</stringcontext> <mappingcontext>package</mappingcontext> </renamerule> The first renaming rule removes blanks from the project names. The second renaming rule strips.pkg from the package name. Splitting the common parts by part type and part name The sample code for the scenarios is designed in such a way that you can combine it with the following built-in customizations for the Stage 1 migration tool on Java: Move all data item parts to a new EGL project called ItemsProject. Split the common parts files by part type and, optionally, by part name. For details on how to enable the built-in customizations, refer to the VisualAge Generator to EGL Migration Guide Version 7.1, Chapter 4 Stage 1 Extracting from Java, section Customizing the Stage 1 migration tool. If you use the consolidation described in Scenarios 3 and 4 of this paper, it is particularly important to use the built-in customization to split the common parts files. Because packages are consolidated in these two scenarios, the common and unused parts from multiple packages are merged into a one common parts file and one unused parts file. Particularly for common parts, this can result in very large files. The built-in customization for splitting the common parts files provides an easy way to reduce the size of these files and thus helps avoid the very large file size that can result from the techniques described for Scenarios 3 and 4. The figures that show the resulting project and package structure for each scenario assume that the built-in customization is used to split the common parts files based on the part type. If you have a large number of common parts, you should split the common parts file based on both part type and part name. 7

Where in the Java code are the project and package name determined? The algorithm for determining the equivalent EGL project and package name for a VAGen project and package is located in the IBM VisualAge Generator EGL Migration project, under the com.ibm.vgj.mig package, in the Preferences class and applyrenamerulesto(string,string) method. This method processes all the standard renaming rules that you provide in your MigPreferences.xml file. The best place to modify this method is near the end of the method as shown in Figure 3. This ensures that all the standard renaming rules are applied first followed by any code that you write. The code shown in Figure 3 contains comments in the form /* Note n */ where n is a number. Each note number is explained after Figure 3. Figure 3. Where to change the applyrenamerulesto(string, String) method /* Note 1 */ public static String applyrenamerulesto(string value, String context) // lots of code // change any "Default package for..." to "Defaultpackagefor..." if (context.equalsignorecase("package")) fromstring = " "; tostring = new String(); index = mappedvalue.tolowercase().indexof(fromstring); while (index >= 0) firstsegment = mappedvalue.substring(0, index); lastsegment = mappedvalue.substring(index + fromstring.length(), mappedvalue.length()); mappedvalue = firstsegment + tostring + lastsegment; index = mappedvalue.indexof(fromstring); } } mappedvalue = mappedvalue.trim(); /* Note 2 */ // mappedvalue is result of applying the standard renaming rules // add your code here /* Note 3 */ return mappedvalue; // original return statement } // end of the method Note 1: The method signature and the section of code that changes the default package name are included in Figure 3 to help show where to place your code. The method receives the following two input parameters: value, which is the VAGen project or package name. context, which indicates whether it is a project or package name that is being processed. 8

Note 2: At the end of the applyrenamerulesto(string, String) method, mappedvalue is the result of applying all the standard renaming rules. Any code that you add in this area needs to refer to the project and package names after all the standard renaming rules have been applied. Note 3: This is the normal return statement for the method. Always leave this statement in place so that if the code you add does not change the name of a project or package, the method still returns a project or package name. Scenario 1 Adding a prefix to project and package names For Scenario 1, consider the situation in which the standards for your backend repository require that all projects and packages start with a specific prefix. For example, you might want to make the following changes shown in Figure 4: Change the project names to start with SC1 Change the package names to start with sc1 Remove.pkg from the end of the package names Change the package name that now ends in.data to.dataparts. This is necessary because data is an EGL reserved word and therefore cannot be used as a word in a package name. Figure 4. Scenario 1 Adding a Prefix SC1SubsysAPgmA1Project sc1subsysa.pgma1 PGMA1 SC1SubsysAPgmA2Project sc1subsysa.pgma2 PGMA2 SC1SubsysAZZZCommonDataProject sc1subsysa.zzzcommon.dataparts CommonItems CommonRecords SC1SubsysAZZZCommonFnctsProject sc1subsysa.zzzcommon.fncts CommonFunctions SC1SubsysAZZZCommonMessagesProject sc1subsysa.zzzcommon.messages TBLAENU SC1SubsysAZZZCommonPgmAZ1Project sc1subsysa.zzzcommon.pgmaz1 PGMAZ1 SC1SubsysAZZZCommonPgmAZ2Project sc1subsysa.zzzcommon.pgmaz2 PGMAZ2 SC1SubsysAZZZCommonTblAZT1Project sc1subsysa.zzzcommon.tblazt1 TBLAZT1 SC1ZZZCorpCommonFnctsProject sc1zzz.corpcommon.fncts CommonFunctions 9

SC1ZZZCorpCommonItemsProject sc1zzz.corpcommon.items CommonItems SC1ZZZCorpCommonPgmZZ1Project sc1zzz.corpcommon.pgmzz1 PGMZZ1 SC1ZZZCorpCommonPgmZZ2Project sc1zzz.corpcommon.pgmzz2 PGMZZ2 SC1ZZZCorpCommonRecordsProject sc1zzz.corpcommon.records CommonRecords SC1ZZZCorpCommonTblZZT1Project sc1zzz.corpcommon.tblzzt1 TBLZZT1 In Scenario 1, there is no restructuring of the projects and packages; there is just renaming to meet your new EGL naming conventions. You can accomplish this renaming with the standard renaming rules in the MigPreferences.xml file. As shown in Figure 2, it is very easy to remove.pkg from the end of the package names using the standard renaming rules. However, adding a prefix to the project and package names is more difficult because the standard renaming rules do not support wildcards. To use the standard renaming rules, you must write 4 rules one for subsystem projects, one for subsystem packages, one for corporate common projects, and one for corporate common packages. Alternatively, you can add the prefix by including the code shown in Figure 5 at the end of the applyrenamerulesto(string,string) method. This code also changes.data to.dataparts in the package name. Figure 5. Scenario 1 Sample Code for Adding a Prefix mappedvalue = mappedvalue.trim(); // mappedvalue is result of applying the standard renaming rules // add your code here /* Note 1 */ // modify the project names if (context.equalsignorecase("project")) /* Note 2 */ // concatenate SC1 to front of all project names return ("SC1" + mappedvalue); } // end project processing // modify the package names if (context.equalsignorecase("package")) /* Note 3 */ if (mappedvalue.endswith(".data")) mappedvalue = mappedvalue + "parts"; } 10

/* Note 4 */ // concatenate sc1 to front of all package names return ("sc1" + mappedvalue); } // end package processing return mappedvalue; // original return statement } // end of the method Note 1: context is the second input parameter to the applyrenamerulesto(string, String) method. context specifies whether it is a project or package name that is being processed. The equalsignorecase method checks the value of context without regard to upper, lower, or mixed case input. Note 2: The + operator can be used for string concatenation. This return statement concatenates SC1 at the front of all the project names. Note 3: The endswith method checks the mappedvalue string to see if it ends with.data. If so, then mappedvalue is concatenated with parts to form the new package name subsysa.zzzcommon.dataparts. This creates a valid package name which does not use the reserved word data. Note 4: This return statement uses the + string concatenation operator to concatenate sc1 at the front of all the package names. Scenario 2 Consolidating projects For Scenario 2, consider the situation in which you want to minimize the number of projects by consolidating the projects as shown in Figure 6. The projects are consolidated in the following way: All of the subsystem program projects are consolidated into a single project named SC2SubsysAProgramsProject. All of the subsystem common projects are consolidated into a single project named SC2SubsysAZZZCommonProject. All of the corporate common projects that contain data items, records, and tables are consolidated into a single project named SC2ZZZCorpCommonDataProject. All of the corporate common projects that contain programs or common functions are consolidated into a single project named SC2ZZZCorpCommmonLogicProject. The package organization remains the same so that there is still one program per package. However, the original packages are now located in just 4 projects. 11

Figure 6. Scenario 2 Consolidating Projects SC2SubsysAProgramsProject sc2subsysa.pgma1 PGMA1 sc2subsysa.pgma2 PGMA2 SC2SubsysAZZZCommonProject sc2subsysa.zzzcommon.dataparts CommonItems CommonRecords sc2subsysa.zzzcommon.fncts CommonFunctions sc2subsysa.zzzcommon.messages TBLAENU sc2subsysa.zzzcommon.pgmaz1 PGMAZ1 sc2subsysa.zzzcommon.pgmaz2 PGMAZ2 sc2subsysa.zzzcommon.tblazt1 TBLAZT1 SC2ZZZCorpCommonDataProject sc2zzz.corpcommon.items CommonItems sc2zzz.corpcommon.records CommonRecords sc2zzz.corpcommon.tblzzt1 TBLZZT1 SC2ZZZCorpCommonLogicProject sc2zzz.corpcommon.fncts CommonFunctions sc2zzz.corpcommon.pgmzz1 PGMZZ1 sc2zzz.corpcommon.pgmzz2 PGMZZ2 In Scenario 2, the projects are consolidated. You can accomplish this restructuring using the standard renaming rules in the MigPreferences.xml file. However, you must write one renaming rule for each project to obtain the necessary restructuring. For example, you must write a rule to rename PgmA to Programs and another rule to rename PgmB to Programs. Even with a small number of projects, this can become very tedious. Alternatively, you can include the code shown in Figure 7 at the end of the applyrenamerulesto(string,string) method. 12

Figure 7. Scenario 2 Sample Code for Consolidating Projects mappedvalue = mappedvalue.trim(); // mappedvalue is result of applying the standard renaming rules // add your code here /* Note 1 */ String subsysid = ""; // modify the project names if (context.equalsignorecase("project")) /* Note 2 */ // process subsystem projects if (mappedvalue.startswith("subsys")) /* Note 3 */ // get subsystem id subsysid = mappedvalue.substring(6,7); /* Note 4 */ if (mappedvalue.indexof("zzz") > -1) // handle subsystem common projects return("sc2subsys" + subsysid + "ZZZCommonProject"); } else // handle subsystem program projects return("sc2subsys" + subsysid + "ProgramsProject"); } } // end subsystem projects /* Note 5 */ // process corporate common projects if (mappedvalue.startswith("zzz")) if (mappedvalue.indexof("fncts") > -1 mappedvalue.indexof("pgm") > -1) return ("SC2ZZZCorpCommonLogicProject"); } else return ("SC2ZZZCorpCommonDataProject"); } } // end common projects } // end project processing // modify the package names if (context.equalsignorecase("package")) if (mappedvalue.endswith(".data")) mappedvalue = mappedvalue + "parts"; } // concatenate sc2 to front of all package names return ("sc2" + mappedvalue); } // end package processing /* Note 6 */ return mappedvalue; // original return statement } // end of the method 13

Note 1: subsysid defines a variable that is used to store the subsystem ID. Assuming that all subsystems follow a standard naming convention as shown for SubsystemA, then the new subsystem project names can be built from the subsystem ID and some fixed strings (SC2Subsys and either ZZZCommonProjects or ProgramsProject). Note 2: The startswith method checks the mappedvalue string to see if it begins with Subsys. If so, then mappedvalue is processed with the subsystem renaming logic. If not, then mappedvalue is checked again at Note 5 to ensure that it follows the naming conventions for your common projects. Note 3: The substring method enables you to extract a string beginning and ending at specific starting indices. The first character in a string is at position 0. In the example, the subsystem ID is the seventh character, so the substring operation starts at 6. The ending position (7) is the character after the last one you want to include. So mappedvalue.substring(6,7) returns the A at the seventh position in SubsysAProjectName. Note 4: The indexof method checks the mappedvalue string to determine if ZZZ is located anywhere within the string. If so, indexof returns the starting position of ZZZ. If not, indexof returns -1. For the example system, if the subsystem project name contains ZZZ, then the project is one of the subsystem common projects and the EGL project name is built from the concatenation of the constant SC2Subsys, the subsystem ID, and the constant ZZZCommonProject. If the subsystem project name does not contain ZZZ, then the project is one of the general programs for the subsystem and the EGL project name is built from the concatenation of the constant SC2Subsys, the subsystem ID, and the constant ProgramsProject. Issuing the return statement as soon as you have determined the new name for the project simplifies the logic and avoids having to consider that ZZZ is used in the subsystem common project names as well as in the corporate common project names. Note 5: The startswith method checks the beginning of the mappedvalue string to ensure that it is a corporate common project that starts with ZZZ. If so, the mappedvalue string is checked for either Fncts or Pgm for the projects that are consolidated into the SC2CorpCommonLogicProject. Any other projects that start with ZZZ are consolidated into the SC2CorpCommonDataProject. Note 6: Any projects that do not start with Subsys or ZZZ fall through to the original return statement. You should review the Stage 1 report to determine if any projects are not being renamed and then adjust your logic accordingly. 14

Scenario 3 Consolidating some packages For Scenario 3, consider the situation in which you want to consolidate the projects as shown in Scenario 2, but you also want to consolidate the subsystem general programs into one package, the subsystem common programs into another package, and the subsystem common tables into a third package. Similarly, you want to consolidate the corporate common programs into one package and the corporate common tables into a second package. Figure 8. Scenario 3 Consolidating Some Packages SC3SubsysAProgramsProject sc3subsysa.programs PGMA1 PGMA2 SC3SubsysAZZZCommonProject sc3subsysa.zzzcommon.dataparts CommonItems CommonRecords sc3subsysa.zzzcommon.fncts CommonFunctions sc3subsysa.zzzcommon.progams PGMAZ1 PGMAZ2 sc3subsysa.zzzcommon.tables TBLAENU TBLAZT1 SC3ZZZCorpCommonDataProject sc3zzz.corpcommon.items CommonItems sc3zzz.corpcommon.records CommonRecords sc3zzz.corpcommon.tables TBLZZT1 SC3ZZZCorpCommonLogicProject sc3zzz.corpcommon.fncts CommonFunctions sc3zzz.corpcommon.programs PGMZZ1 PGMZZ2 In Scenario 3, the project consolidation is the same as in Scenario 2, so the same project code can be used. The package consolidation code makes use of the example system naming conventions where the program package names all contain.pgm and most of the table package names contain.tbl. The code shown in Figure 9 includes the logic to consolidate the program and tables packages. 15

Figure 9. Scenario 3 Sample Code for Consolidating Some Packages mappedvalue = mappedvalue.trim(); // mappedvalue is result of applying the standard renaming rules // add your code here String subsysid = ""; // modify the project names if (context.equalsignorecase("project")) // process subsystem projects if (mappedvalue.startswith("subsys")) // get subsystem id subsysid = mappedvalue.substring(6,7); if (mappedvalue.indexof("zzz") > -1) // handle subsystem common projects return("sc3subsys" + subsysid + "ZZZCommonProject"); } else // handle subsystem program projects return("sc3subsys" + subsysid + "ProgramsProject"); } } // end subsystem projects // process corporate common projects if (mappedvalue.startswith("zzz")) if (mappedvalue.indexof("fncts") > -1 mappedvalue.indexof("pgm") > -1) return ("SC3ZZZCorpCommonLogicProject"); } else return ("SC3ZZZCorpCommonDataProject"); } } // end common projects } // end project processing // modify the package names if (context.equalsignorecase("package")) if (mappedvalue.endswith(".data")) mappedvalue = mappedvalue + "parts"; } /* Note 1 */ // concatenate sc3 to front of all package names mappedvalue = "sc3" + mappedvalue; /* Note 2 */ index = mappedvalue.indexof(".pgm"); if (index > -1) return(mappedvalue.substring(0,index) + ".programs"); } 16

/* Note 3 */ index = mappedvalue.indexof(".tbl"); if (index > -1) return(mappedvalue.substring(0,index) + ".tables"); } // consolidate message table package with other tables index = mappedvalue.indexof(".messages"); if (index > -1) return(mappedvalue.substring(0,index) + ".tables"); } /* Note 4 */ } // end package processing return mappedvalue; // original return statement } // end of the method Note 1: Concatenating the sc3 to the front of the package name at the start of the package logic avoids having to include this concatenation for every type of package. Note 2: Due to the program naming convention for the example system, all the packages that contain programs include.pgm in the package name. index is an integer variable declared at the beginning of the applyrenamerulesto(string,string) method that you can reuse here. index is set to the result of the indexof method, so it is either -1 (if.pgm does not occur in the package name) or the position of the period in.pgm. If index is > -1, you can use index as the ending position for the substring method to obtain everything from mappedvalue before.pgm and then concatenate this value with.programs to create the new package name. Note 3. The same basic logic that is used for programs in Note 2 can be used for tables because most of the packages that contain tables include.tbl in the package name. The subsysa.zzzcommon.messages package also contains a table and needs to be consolidated with the other subsystem tables. Note 4. All the other packages fall though to this point so the only change to their name is to concatenate sc3 at the front of the package name. The original return statement for the method returns these remaining package names. You should review the Stage 1 report to determine if packages are not being renamed correctly and then adjust your logic accordingly. 17

Scenario 4 Consolidating all packages For Scenario 4, consider the situation in which you want to consolidate the projects as shown in Scenario 2, but you also want to consolidate all the packages so that there is only one package in each project. Figure 10. Scenario 4 Consolidating All Packages SC4SubsysAProgramsProject sc4subsysa.programs PGMA1 PGMA2 SC4SubsysAZZZCommonProject sc4subsysa.zzzcommon CommonFunctions CommonItems CommonRecords PGMAZ1 PGMAZ2 TBLAENU TBLAZT1 SC4ZZZCorpCommonDataProject sc4zzz.corpcommon.dataparts CommonItems CommonRecords TBLZZT1 SC4ZZZCorpCommonLogicProject sc4zzz.corpcommon.logic CommonFunctions PGMZZ1 PGMZZ2 In Scenario 4, the project consolidation is the same as in Scenario 2, so the same project code can be used. The package consolidation code makes use of the example system naming conventions where the subsystem common package names all contain.zzz. The code shown in Figure 11 includes the logic to consolidate to a single package for each project. 18

Figure 11. Scenario 4 Sample Code for Consolidating All Packages mappedvalue = mappedvalue.trim(); // mappedvalue is result of applying the standard renaming rules // add your code here String subsysid = ""; // modify the project names if (context.equalsignorecase("project")) // process subsystem projects if (mappedvalue.startswith("subsys")) // get subsystem id subsysid = mappedvalue.substring(6,7); if (mappedvalue.indexof("zzz") > -1) // handle subsystem common projects return("sc4subsys" + subsysid + "ZZZCommonProject"); } else // handle subsystem program projects return("sc4subsys" + subsysid + "ProgramsProject"); } } // end subsystem projects // process corporate common projects if (mappedvalue.startswith("zzz")) if (mappedvalue.indexof("fncts") > -1 mappedvalue.indexof("pgm") > -1) return ("SC4ZZZCorpCommonLogicProject"); } else return ("SC4ZZZCorpCommonDataProject"); } } // end common projects } // end project processing // modify the package names if (context.equalsignorecase("package")) if (mappedvalue.endswith(".data")) mappedvalue = mappedvalue + "parts"; } // concatenate sc4 to front of all package names mappedvalue = "sc4" + mappedvalue; /* Note 1 */ // process subsystem packages if (mappedvalue.startswith("sc4subsys")) index = mappedvalue.indexof(".zzz"); if (index > -1) return(mappedvalue.substring(0,index) + ".zzzcommon"); } 19

index = mappedvalue.indexof(".pgm"); if (index > -1) return(mappedvalue.substring(0,index) + ".programs"); } } // end subsystem package processing /* Note 2 */ // process common packages if (mappedvalue.startswith("sc4zzz")) if (mappedvalue.indexof(".fncts") > -1 mappedvalue.indexof(".pgm") > -1) return ("sc4zzz.corpcommon.logic"); } else return ("sc4zzz.corpcommon.dataparts"); } } // end common package processing } // end package processing /* Note 3 */ return mappedvalue; // original return statement } // end of the method Note 1: For the example system, all the subsystem packages now start with sc4subsys. Both the subsystem general programs and subsystem common programs include.pgm in the package name, but the new package name is different for the two different types of programs. Checking mappedvalue first for.zzz, which only occurs in the subsystem common package names, ensures that the subsystem common programs are positioned in the subsystem common package. Any subsystem packages that remain in the example system should include.pgm in the package name and are converted to a package name that ends in.programs. If there are some subsystem packages that do not contain.zzz or.pgm in the package name, they fall through to the return statement at Note 3. Note 2: For the example system, all the corporate common packages now start with sc4zzz. If the package name includes.fncts or.pgm, then the package is consolidated into the sc4zzz.corpcommon.logic package. Otherwise, the package is consolidated to the sc4zzz.corpcommon.dataparts package. Note 3: Any subsystem packages that did not meet the criteria (none in the example system), fall through to the original return statement for the method. These packages keep their package name based on the standard renaming rules. This technique can help you find situations where a subsystem deviates from your normal naming conventions so that you can add logic to properly rename or consolidate those packages. Quick check of the project, package, and file names To see the file structure that results from your customization, run the following DB2 query (all on one line): 20

db2 select distinct(substr(eglfilename,1,130))from migschema.eglfile order by 1 >>MyFiles.txt Summary This paper has shown how to modify the VisualAge Generator to EGL Stage 1 Migration Tool on Java to consolidate VAGen projects or packages into fewer EGL projects or packages. It discussed the Java method that needs to be changed and how the changes work. In addition, this paper provided samples that you can use as a guide to help you understand and create your own modifications. This paper also provides a DB2 query that you can use to check the results of your customization. Appendix A. How do I use VisualAge Java to change the algorithm? If you have not worked with Java before, this appendix provides some details that might be helpful in making the modifications for the VisualAge Generator to EGL Stage 1 Migration Tool in VisualAge for Java. To find the methods you need to change, follow these steps: 1. From the VisualAge workspace, select the Projects tab. 2. Expand the IBM VisualAge Generator EGL Migration project. 3. Expand com.ibm.vgj.mig package 4. Select and expand Preferences class to see the list of methods. 5. Open the editor in one of the following ways: If you prefer to work in a separate window, double-click the class, and a new window should open up displaying class If you prefer to work in a single window, select the method you want to edit. The source code appears in the Source pane. To change an existing method, follow these steps: 1. Select the applyrenamerulesto(string,string) method. The source code appears in the Source pane. 2. Change the source code (for example, by adding the code shown in Figure 5). 3. Click File -> Save to save your changes. After you have made the code changes, remember to version the IBM VisualAge Generator EGL Migration project. Be sure to use a meaningful name because you will need to reference this version in the following situations: If you delete and then add the Stage 1 Migration Tool for any reason, you must reload your version of the tool. If you install a new version of the Stage 1 migration feature, you must apply your changes to the new version of the Stage 1 Migration Tool. 21

Appendix B. Summary of techniques Here are some examples of Java code and methods that can be useful in writing your algorithm to restructure your projects and packages: Each statement ends with a semi-colon ; The if statement. Enclose the condition in parenthesis (). Enclose the statements that you want to perform for the if or else in braces }. if (condition) statement1; statement2; } else statement3 ; } mystring1 + mystring2 results in the concatenation of the two strings. mystring.equalsignorecase( text ) tests the value of mystring for text without regard to whether the string is uppercase, lowercase, or mixed case. mystring.startswith( text ) tests the value of mystring to see if it begins with text. mystring.endswith( text ) tests the value of mystring to see if it ends with text. mystring.indexof( text ) returns the index of text within mystring. If text is not in mystring, returns -1. mystring(startingposition,endingposition) extracts a substring from mystring, beginning at startingposition and ending with the character before the position specified by endingposition. The first character in a string is considered to be position 0. Some additional Java methods that were not used in this paper, but which might be useful in your code are: mystring.tolowercase() converts mystring to lowercase characters. mystring.touppercase() converts mystring to uppercase characters. mystring.length() returns the length of mystring. Be sure to think about which projects or packages you want to process first. For example, if your subsystem naming convention is XXX for subsystem non-common projects and XXX Z for subsystem common projects and you are consolidating into just two projects for the subsystem, you should code the following: if (mappedvalue.startswith("xxx Z")) return("xxxzcommon"); } if (mappedvalue.startswith("xxx ")) return("xxx"); } This technique removes the common projects first and then focuses on the general projects for the subsystem. If you reverse the order of the if statements, then all the projects are processed by the first if statement so that all the subsystem projects consolidate into a single project. if (mappedvalue.startswith("xxx ")) return("xxx"); } if (mappedvalue.startswith("xxx Z")) return("xxxzcommon"); } Similarly, if you have a subsystem that does not follow your normal VAGen naming conventions for projects and packages, you might want to process that subsystem first so that it does not accidentally match some of your more general restructuring logic. 22

Notices This information was developed for products and services offered in the U.S.A. IBM may not offer the products, services, or features discussed in this document in other countries. Consult your local IBM representative for information on the products and services currently available in your area. Any reference to an IBM product, program, or service is not intended to state or imply that only that IBM product, program, or service may be used. Any functionally equivalent product, program, or service that does not infringe any IBM intellectual property right may be used instead. However, it is the user s responsibility to evaluate and verify the operation of any non-ibm product, program, or service. IBM may have patents or pending patent applications covering subject matter described in this document. The furnishing of this document does not grant you any license to these patents. You can send license inquiries, in writing, to: IBM Director of Licensing IBM Corporation North Castle Drive Armonk, NY 10504-1785 U.S.A. For license inquiries regarding double-byte (DBCS) information, contact the IBM Intellectual Property Department in your country or send inquiries, in writing, to: IBM World Trade Asia Corporation Licensing 2-31 Roppongi 3-chome, Minato-ku Tokyo 106-0032, Japan The following paragraph does not apply to the United Kingdom or any other country where such provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or implied warranties in certain transactions, therefore, this statement may not apply to you. This information could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein; these changes will be incorporated in new editions of the publication. IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this publication at any time without notice. IBM may use or distribute any of the information you supply in any way it believes appropriate without incurring any obligation to you. Licensees of this program who wish to have information about it for the purpose of enabling: (i) the exchange of information between independently created programs and other programs (including this one) and (ii) the mutual use of the information which has been exchanged, should contact: Intellectual Property Dept. for Rational Software IBM Corporation 3600 Steeles Avenue East Markham, ON Canada L3R 9Z7 23

Such information may be available, subject to appropriate terms and conditions, including in some cases, payment of a fee. The licensed program described in this document and all licensed material available for it are provided by IBM under terms of the IBM Customer Agreement, IBM International Program License Agreement or any equivalent agreement between us. Information concerning non-ibm products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products and cannot confirm the accuracy of performance, compatibility or any other claims related to non-ibm products. Questions on the capabilities of non-ibm products should be addressed to the suppliers of those products. All statements regarding IBM s future direction or intent are subject to change or withdrawal without notice, and represent goals and objectives only. This information contains examples of data and reports used in daily business operations. To illustrate them as completely as possible, the examples include the names of individuals, companies, brands, and products. All of these names are fictitious and any similarity to the names and addresses used by an actual business enterprise is entirely coincidental. COPYRIGHT LICENSE: This information contains sample application programs in source language, which illustrate programming techniques on various operating platforms. You may copy, modify, and distribute these sample programs in any form without payment to IBM, for the purposes of developing, using, marketing, or distributing application programs conforming to the application programming interface for the operating platform for which the sample programs are written. These examples have not been thoroughly tested under all conditions. IBM, therefore, cannot guarantee or imply reliability, serviceability, or function of these programs. If you are viewing this information softcopy, the photographs and color illustrations may not appear. Trademarks The following terms are trademarks of the IBM Corporation in the United States or other countries: DB2 IBM Rational VisualAge Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States, other countries or both. Other company, product or service names may be trademarks or service marks of others. 24