ERCIM News No.36 - January 1999
AnnoDomini: From Type Theory to a Year 2000 Conversion Tool
by Peter Harry Eidorff, Fritz Henglein, Christian Mossin, Henning Niss, Morten Heine Sørensen and Mads Tofte
AnnoDomini is a commercially available source-to-source conversion tool for making COBOL programs Year 2000 compliant. It was developed in the last two years by a group at DIKU (part of the ERCIM partner DANIT) and grew directly out of research in the theory of programming languages; it uses type-based specification, analysis, and transformation. These are combined into an integrated software reengineering tool and method for finding and fixing Year 2000 problems. AnnoDominis primary goals have been flexibility, completeness, correctness, and a high degree of safe automation.
The Year 2000 (Y2K) Problem refers to the inability of software and hardware systems to process dates in the 21st century correctly. The problem arises from representing calendar years by their last two digits and thus restricting the range of representable years to 1900-1999 A.D. Making programs Y2K compliant involves date field expansion or masking. Expansion refers to expanding unsafe 2-digit years to 4-digit years. Masking denotes a variety of methods for extending 2-byte year representations into the 21st Century. In windowing, for example, a pivot year determines whether a two-digit year belongs to the 20th or the 21st century. For example, with pivot 50, 59 represents 1959 A.D. and 41 represents 2041 A.D.
AnnoDomini (registered trademark of Hafnium ApS) is a method and source-to-source conversion tool, developed at DIKU, for making COBOL programs Year 2000 compliant. It runs on Windows NT 4.0 and Windows 9X, and is commercially available from Computer Generated Solutions, Inc. (an IBM business partner) - see http://www.cgsinc.com and http://www.hafnium.com. The converted programs do not require special compiler support, but compile and execute in their existing operating environment.
In COBOL programs, dates are represented using the data types and operations of the source language: numbers, strings of characters and flat records. Their intentional interpretation as representations of dates is not explicit. The AnnoDomini approach is based on reverse engineering the programmer-intended year interpretations, encapsulating them as abstract types, and replacing their implementation by safe, improved code with the same interface. This is done in three conceptual phases: seeding, type checking, and conversion.
In the first phase the user seeds chosen variable declarations of the program with year information; that is, some of the programs variables, eg file descriptions, are annotated with types that specify where years occur in them, if at all. AnnoDomini also has support for automatic seeding.
In the second phase AnnoDomini propagates the seeding information to other data by type inference. For example, if the program assigns the contents of one variable to another, AnnoDomini infers that they must have the same type. During propagation AnnoDomini also checks that the seeded and propagated types are consistent with each other. For example, if the program assigns the contents of one variable to another, and the variables have different types, AnnoDomini signals an error.
In general, type errors may stem from several sources. For instance, seeding might be wrong, or the program may actually contain a Year 2000 Problem. AnnoDomini does not attempt to guess what the real cause of a type error is and how to eliminate it. It suggests a number of plausible corrective actions, however, typically to change the declaration of a variable, or to insert a type coercion, eg a coercion between 2-digit years and 4-digit years. Like type declarations, such coercions are specified as annotations - the actual conversion code is inserted automatically in the conversion phase. AnnoDomini also provides point-and-click access to the statements causing type errors and to the declarations of the variables appearing in these statements for manual browsing and editing of the source code.
AnnoDomini issues warnings for all relational and arithmetic operations for which there is insufficient type information to determine whether their operands contain years or not. This is a case where seeding is incomplete, with potentially dangerous consequences. The user is expected to check the warnings to determine whether they cover over any potential Year 2000 problems.
The third and final phase consists of virtual conversion and actual conversion. During virtual conversion the user specifies Year-2000-safe types for each variable. For example the user might specify that some variable should be expanded from a six-digit to an eight-digit date representation. Actual conversion is then fully automatic: at the push of a button, data declarations are expanded as desired, calls to the specified coercions are inserted, and arithmetic and relational operations involving two-digit years are replaced by calls to Year-2000-safe library routines.
AnnoDomini consists of three components: the analysis and conversion engine (60,000 lines of Standard ML), the graphical user interface (10,000 lines of Visual Basic), and IBMs Live Parsing Editor (a syntax-sensitive program editor). The three components are tightly integrated; for instance, by a single click the user can have code implementing a suggested corrective action inserted into the program automatically by the editor.
The underlying software reengineering method in AnnoDomini consists of identifying and isolating potentially problematic data and their associated operations according to their intended use (here as calendar years),
encapsulating them as abstract types, and finally replacing their implementation by safe, improved code with the same interface. This method appears to be eminently applicable to other problems than Year 2000 remediation, such as reengineering financial systems for the introduction of the Euro or for the Dow Jones Index passing the 10,000 mark. To address such problems is one possible line of future work.Please contact:
Morten Heine Sørensen - DIKU and Hafnium ApS
Tel: +45 35321405
E-mail: rambo@diku.dk