Presentation is loading. Please wait.

Presentation is loading. Please wait.

Using program transformations to add structure to a legacy data model Mariano Ceccato (1), Thomas Roy Dean (2), Paolo Tonella (1) (1) FBK-IRST, Trento,

Similar presentations


Presentation on theme: "Using program transformations to add structure to a legacy data model Mariano Ceccato (1), Thomas Roy Dean (2), Paolo Tonella (1) (1) FBK-IRST, Trento,"— Presentation transcript:

1 Using program transformations to add structure to a legacy data model Mariano Ceccato (1), Thomas Roy Dean (2), Paolo Tonella (1) (1) FBK-IRST, Trento, Italy (2) Queen’s University, Kingston, Canada

2 Migration project Data ISAM tables Business logic BAL language User interface Character oriented Data Relational database Business logic Java language User interface Graphical Reverse engineering Restructuring Automated code transformation Information and models Migrated code

3 Primitive types in BAL DCL a# // byte DCL b% // short DCL c& = 5 // BCD, 5 bytes long DCL d$ = 100 // string, 100 bytes long DCL e$ // string, 16 bytes long DCL f$ = 10(20) // array of 20 strings, // each 10 bytes long DCL g&=8(10,10) // 10x10 matrix of BCDs, // each 8 bytes long

4 Variable declarations #ifdef A DCL a$ = 9 FIELD = M, a DCL b$ = 5 DCL c$ = 5 FIELD = M, b DCL d# DCL e# DCL f$ = 4 FIELD = M, c DCL g% FIELD = M #endif a bc def 1.Fields do not introduce any additional lexical scope. 2.Sizes may be incorrect (no compile time check). 3.The same layout in memory can be expressed in many different ways. g

5 Approach  Adding structure  Square brackets […]: boundaries of each redefinition  Square-angle brackets [ ]: redefinitions of each declaration  Translating to Java  Square brackets […]: boundaries of classes (nesting represents composition)  Square-angle brackets [ ]: unions, when >1 redefinition (copy on read/write)

6 Square bracketing DCL a$ = 9 FIELD = M, a DCL b$ = 5 FIELD = M, b DCL d# DCL e# DCL f$ = 3 DCL c$ = 3 DCL a$ = 9 FIELD = M, a 9 [ ] DCL b$ = 5 FIELD = M, b 5 [ ] DCL d# DCL e# DCL f$ = 3 DCL c$ = 3

7 Folding declarations DCL a$ = 9 FIELD = M, a 9 [ ] DCL b$ = 5 FIELD = M, b 5 [ ] DCL d# DCL e# DCL f$ = 3 DCL c$ = 3 DCL a$ = 9 FIELD = M, a 4 [ DCL b$ = 5 ] FIELD = M, b 5 [ ] DCL d# DCL e# DCL f$ = 3 DCL c$ = 3 DCL a$ = 9 FIELD = M, a 4 [ DCL b$ = 5 ] FIELD = M, b 4 [ DCL d# ] DCL e# DCL f$ = 3 DCL c$ = 3 DCL a$ = 9 FIELD = M, a 4 [ DCL b$ = 5 ] FIELD = M, b 3 [ DCL d# DCL e# ] DCL f$ = 3 DCL c$ = 3 DCL a$ = 9 FIELD = M, a 4 [ DCL b$ = 5 ] FIELD = M, b 0 [ DCL d# DCL e# DCL f$ = 3 ] DCL c$ = 3

8 Folding redefinitions DCL a$ = 9 FIELD = M, a 4 [ DCL b$ = 5 ] FIELD = M, b 0 [ DCL d# DCL e# DCL f$ = 3 ] DCL c$ = 3 DCL a$ = 9 FIELD = M, a 4 [ DCL b$ = 5 FIELD = M, b 0 [ DCL d# DCL e# DCL f$ = 3 ] DCL c$ = 3

9 Iterating (fold declarations) DCL a$ = 9 FIELD = M, a 4 [ DCL b$ = 5 ] FIELD = M, b 0 [ DCL d# DCL e# DCL f$ = 3 ] DCL c$ = 3 DCL a$ = 9 FIELD = M, a 1 [ DCL b$ = 5 FIELD = M, b 0 [ DCL d# DCL e# DCL f$ = 3 ] DCL c$ = 3 ]

10 Size mismatches Heuristic stopping conditions : 1.Redefinition explicitly closed by FIELD=M 2.Another redefinition of the same field starts 3.A redefinition of another field starts 4.End of declarations is reached in the code

11 Square-angle bracketing DCL a$ = 9 FIELD = M, a 1 [ DCL b$ = 5 FIELD = M, b 0 [ DCL d# DCL e# DCL f$ = 3 ] DCL c$ = 3 ] FIELD = M, a 0 [ DCL g$ = 2 DCL h$ = 2 DCL i$ = 5 ] DCL a$ = 9 [< >] FIELD = M, a 1 [ DCL b$ = 5 [< >] DCL c$ = 3 ] FIELD = M, a 0 [ DCL g$ = 2 DCL h$ = 2 DCL i$ = 5 ] FIELD = M, b 0 [ DCL d# DCL e# DCL f$ = 3 ]

12 Move redefinitions DCL a$ = 9 [< FIELD = M, a 1 [ DCL b$ = 5 [< FIELD = M, b 0 [ DCL d# DCL e# DCL f$ = 3 ] >] DCL c$ = 3 ] FIELD = M, a 0 [ DCL g$ = 2 DCL h$ = 2 DCL i$ = 5 ] >] DCL a$ = 9 [< >] FIELD = M, a 1 [ DCL b$ = 5 [< >] DCL c$ = 3 ] FIELD = M, a 0 [ DCL g$ = 2 DCL h$ = 2 DCL i$ = 5 ] FIELD = M, b 0 [ DCL d# DCL e# DCL f$ = 3 ]

13 Results  510,108 variable declarations have been structured  29,394 unions have been recognized  81,900 redefinitions managed automatically  A few size mismatches not managed automatically (fixed manually in < 1 working week)  Java classes generated for all structured declarations, including unions


Download ppt "Using program transformations to add structure to a legacy data model Mariano Ceccato (1), Thomas Roy Dean (2), Paolo Tonella (1) (1) FBK-IRST, Trento,"

Similar presentations


Ads by Google