Previous Year 2000 Problems and Solutions Reporting on the Worksheet Next

Chapter 13: Fixing Date Problems

This chapter describes how to fix date problems using SmartFix. It is relevant only if you are remediating your application. If you are only verifying your application, you can disregard this chapter.

13.1 Introduction to SmartFix

SmartFix collects fix details in the worksheet in order to generate a new set of sources that will handle the century correctly. For each statement of interest, SmartFix inserts code that determines the century of the data items that represent years. These data items are expanded to include the century.

SmartFix examines each POI to determine the COBOL verb, the data items involved, and the statement's scope, such as whether the statement returns a date value that will need attention. SmartFix then generates a code fix that:

  1. Maps each POI data item to an expanded data item, using a macro appropriate for the type of year assigned to the data items and appropriate for the suspect statement.

  2. Replaces each POI data item in the statement with its expanded equivalent.

  3. As necessary, maps each expanded data item back to the original data item, using the complementary macro.

The exact code that you require to expand a data item depends, among other things, on the data item's date format (such as yymmdd) and the start year of the 100-year window in which the data item falls (such as 60, which implies 1960-2059). Consequently, you must specify the type of date in each data item of interest before SmartFix can expand the data item. You do this by allocating a year type to each data item of interest.

The year type defines how data items of that type are handled. Many of the year types represents date formats that do not have the century and so need fixing. Associated with each of these year types is a set of macros that expand and contract data items of that type. SmartFix defines a default set of over 130 year types, such as YYMMDD9 (a numeric data item that represents the date as yymmdd), and you can add your own year types or customize the default ones.

13.1.1 Process for Fixing Dates

The steps for Year 2000 investigation start with loading the application into the Revolve database, finding the POI and gathering them in a worksheet.

The date fixing process is centered on the worksheet. You start here to select the POI to work on and return here to select the next ones. Whenever you are in the worksheet, you can review the whole project, check the status of each fix and produce reports.

The fixing process involves:

  1. Examining dates and assigning year types

    Before you can fix the code, each date data item needs to be assigned a year type, which determines how the data item is to be handled. SmartFind Plus assigns year types using predefined assignment rules, but sometimes it is not clear which year type is appropriate and so in these cases no year types are assigned. You need to examine each unassigned data item and assign it a year type appropriate to its logical date format (such as yymmdd), its data type (such as PIC 99 or PIC X(6)), and the 100-year window from which to derive its century (such as 1960-2059). The year type defines, among other things, the macros to use to expand the two-digit years into four-digit years.

    Notice that the statement fixes are generated from the year type assignments. This means that the date data items in those statements must have the correct year types before you approve a fix.

  2. Choosing the appearance and position of the fixes

    You can customize various aspects of the fixes to be generated, such as the formatting and labeling of the code inserts. You can also choose whether to insert the fixes in-line with the program code being fixed, or out of line at the end of the program, and you can put data definitions and out-of-line fixes in copybooks.

  3. Establishing the fixes

    When you are ready to determine how to fix the code, you select statements from the worksheet and work through them one by one. SmartFix shows you what the generated code will look like, using the year types allocated and their corresponding macros. You then examine the automatically generated fix. If it is not quite right, you adjust the year types and macros used for each data item, which causes SmartFix to generate a different fix. If the fix is still not right, you can edit it manually.

    You do not apply the fixes to the source yet. Instead, you record the details for each fix in the worksheet. You can then change these details, such as the year type macros, as you work through the worksheet and gradually build up a consistent set of fixes, without committing them to the source.

  4. Applying the whole set of fixes

    When you have established a complete and consistent set of fixes, apply the whole set to a copy of the sources, using Apply Fixes.


Warning: Do not edit the original source code during the fixing process. If you do, you will need to restart the project from the beginning and reparse the projects and repopulate the worksheet.


13.1.2 Fixing Automatically

SmartFix can fix applications automatically and this is a quick remedy to the Year 2000 problem, although you will need to check each fix to confirm it is not a special case that needs adjustment.

SmartFix can automatically fix programs by:

To automatically fix an application that you have loaded into the project database:

  1. Click Open Worksheet on the Year 2000 menu to open the worksheet for the project or create a new empty worksheet if one does not exist already.

  2. Click Configure Assign Rules.

  3. Adjust the rules for assigning year types to data items, if necessary.

  4. Ensure that Assign year type when adding items to worksheet is checked, and click Close.

  5. Click Options.

  6. Go to the Fix Options tab, and in By default, mark these as set the status to Auto.

  7. Go to the Comments tab and change the comment in Auto fix comment as required, and click OK.

  8. Click Analysis Tools from the Year 2000 menu and run Verify - all research. This finds the potentially problematic date-related points in the code and adds them to the worksheet together with a category indicating why they are of interest.

  9. Click Apply Fixes.

A copy of the source is then produced with the appropriate fixes inserted using the year types assigned in the worksheet and their corresponding macros. The original code for each fixed statement is commented out and the fix is inserted. If a statement does not have any operands with year types, the original statement is left intact and the specified comment is added to the source.

13.2 Specifying Fix Types and Other Fix Options

You can customize various aspects of the fixes to be generated, using Options.

13.2.1 Options for Formatting and Labeling Fixes

You can customize the formatting and labeling of the code inserts, at the following tabs of Options:

For full details of each option, click Help in the top right corner of the Options window and click the option on which you want help.

13.2.2 Options for the Fix Code to Insert

You can customize the types of fixes that are inserted from the Fix Options tab of Options.

You can specify how to handle statements if their data items do not have any fix types allocated. When you add these statements to the worksheet, they are marked as:

You can specify the macro library from which to take the required year types and macros. You can specify one of the supplied Micro Focus libraries or one of your user-defined libraries.

You can choose the type of fix to insert, depending on the types available in the macros you are using. SmartFix supplies the following fix types:

You can specify the fix type in the following places:

Options. On the Fix Options tab, you can choose the default fix type.

Edit Year Type, where you can specify the fix type for the selected year type.

SmartFix, where you can specify the fix type to use for each data item in the Fix type column of the data item table.

For full details of each option, click Help in the top right corner of the Options window and click the option on which you want help.

13.2.3 Options for Data Definitions

The Data tab of Options enables you to customize the definitions of the expanded data items that SmartFix generates. Figure 13-1 shows an example of the Data Options.

Data tab

Figure 13-1: SmartFix Options, Data tab

You can specify the prefix or suffix for the names of the expanded data items. You can also specify where to put the data item definitions in the Working-Storage section, such as at the start or end of the Working-Storage section, or after a specified number of level 01 data items.

You also can put the generated data items in a copybook, by specifying this on the Copybooks tab of Options. If you do this, a COPY statement will be added to the specified place in Working Storage, instead of the data items.

For full details of each option, click Help in the top right corner of the Options window and click the option on which you want help.

13.2.4 Options for Inserting Fixes in Copybooks

The Copybooks tab of Options enables you to use copybooks for the fixes that SmartFix generates.

You can add any generated data items to a copybook, by default, and similarly you can add any generated out-of-line code to a copybook. You can generate the copybook filenames automatically. If you do, you can:

You can override these for individual programs when you apply the fixes to the source, using Apply Fixes.

For full details of each option, click Help in the top right corner of the Options window and click the option on which you want help.

13.3 Generating , Inspecting and Adjusting Fixes

Use SmartFix at the worksheet to examine the fixes for the selected statements. SmartFix displays the first fix and the information used to generate it in the SmartFix window. Figure 13-2 shows the SmartFix window.



Figure 13-2: SmartFix window

This window has four main parts:

Having inspected the fix that SmartFix generates, you can adjust the fix as follows:

  1. Change the status to Fixed.

  2. If the fix is generated for the wrong operands, you can skip the fix for some operands and generate a fix for others. To do this you tick or cross the appropriate operands in the statement at the top left.

  3. If the generated fix is not right, you can specify the year types and macros to use for each operand in the operand table at the top right. You can also change the operands that are fixed.

  4. If the fix still is not satisfactory, you can edit it manually in the New Code tab.

  5. When you are happy with the fixes for the selected statements, you save them in the worksheet.

13.3.1 The Suspect Statement

The statement at the top left marks the operands in blue. Any operands that have year types are marked with a green tick or a red cross. Any operands that do not have a year type are not ticked or crossed since they do not need fixing. Figure 13-3 shows an example statement in the SmartFix window



Figure 13-3: Statement in the SmartFix Window

A green tick means that a fix is automatically generated for the operand. A red cross means that a fix is not generated for this operand in this statement. An operand can be ticked in one statement and yet crossed in another, so that a fix is generated for the operand in the ticked statement but not in the crossed one.

When you first examine the fix for this statement, the operands with year types are marked with green ticks, and a fix is automatically generated for them. If you do not want to fix an operand in this statement, perhaps because you know that the operand does not hold a date at this point, you can skip the fix, which marks it with a red cross. To skip a fix, you point to the operand, right click it and then click Leave operand alone.

13.3.2 The Operand Table

The operand table at the top right shows each of the operands in the statement and the specification used to generate the fix for each one. Each operand's year type is shown, as well as the action to take before and after the statement. Figure 13-4 shows the operand table.



Figure 13-4: Operand Table

You can leave the fix to be generated as shown in the table. Alternatively, you can override any of the following for just an individual operand for this statement:

13.3.3 The Tabbed Pages for the Proposed Fix

The proposed fix is shown on the following tabbed pages:

13.3.4 The Tabbed Pages for the Existing Code

The existing code is shown on the following tabbed pages:

13.3.5 The Notes Tab

The Notes tab highlights issues relating to the suspect statement and its fix. You can display further information and suggestions by clicking the relevant note itself.

13.3.6 Status of the Fix

The status of a statement and its fix is shown in the worksheet. The status is updated when you change the fix using SmartFix.

A statement can have the following fix statuses:

Status
Meaning
Not fixed A fix is not generated for this statement, or SmartFix does not handle this statement.

The original statement is left intact without any fix or any comment.

Commented The original statement is left intact without any fix, and the comment specified in the Comment tab of Options is added.
Auto A fix is automatically generated, using the macros for the year types currently assigned to the date data items in the statement.

The code for the original statement is commented out.

Fixed Like Auto status, a fix is automatically generated, using the macros for the year types currently assigned to the date data items in the statement. You have not made any changes to the fix that SmartFix generates by default.

This status indicates that you have examined the statement and have manually changes its status to Fixed to indicate that you approve the fix.

The code for the original statement is commented out.

Fixed (generated from manual specification) The fix is generated according to the customized year types, actions and operand mapping. You manually changed some of these things, overriding the default behavior. You did not, however, edit the code in the New Code tab, but left it intact.

The code for the original statement is commented out.

Fixed (supplied manually) Neither a fix nor any Working Storage code is generated. You entered the whole fix in the New Code tab to be inserted as in-line code.

The code for the original statement is commented out.

Fixed (generated and manually edited) A fix is automatically generated and you edited the in-line code in the New Code tab. The Working Storage and any out-of-line code is been generated according to the information in the operand table.

The code for the original statement is commented out.

13.4 Applying the Fixes

When you have established fixes for all the statements, you apply them in one batch, generating a fixed version of the source files.

Use Apply Fixes to generate a copy of the source files and to fix that copy.

Figure 13-5 shows the Apply Fixes window, where the number of fixes to be applied to each program is shown, as well as the location of the fixed version of the sources and any copybooks generated.

Apply Fixes

Figure 13-5: Apply Fixes

You can specify the settings for applying the fixes, such as the names and locations of the copybooks that hold different types of fixes. We recommend that you generate a report when you apply the fixes, as this report contains details of any problems found when applying the fixes, together with a summary of the fixes. See the Reports chapter for details.

The settings that you specify for applying the fixes are saved in the worksheet. This means that this information is available for reports on the worksheet.

13.4.1 Placing the Fixes in Copybooks

The fixes to be applied comprise data item definitions and procedure division code. You can put the new data item definitions in copybooks rather than directly in the programs to which they apply. Similarly, you can put any out-of-line perform sections for a program in a copybook. You can also put all the data item definitions together in one shared copybook instead in one copybook for each program.

The fixes to be applied comprise data item definitions and procedure division code. You can use copybooks for:

If you decide to use copybooks, you can generate their filenames automatically according your file naming conventions. To change these naming conventions, go to the Copybooks tab of OptionsOptions and specify the required file naming. Alternatively, you can specify individual copybook names on the Apply Fixes dialog.

13.4.2 Applying Fixes According to Status

SmartFix takes each of the fixes established in the worksheet and applies them according to their fix statuses:

13.4.3 Returning to SmartFix after Applying Fixes

When you run Apply Fixes, you generate new fixed versions of the source files that needed changing.

We recommend that you keep the following files, in case you have problems with your fixed application and need to return to your SmartFind Plus project:

You might need the original files at any of the following stages, when you:

  1. Recompile the remediated programs, together with the original, unchanged source files. If you discover compilation errors perhaps from miskeying a fix within SmartFix, we recommend that you discard your remediated sources, return to your SmartFind Plus worksheet and correct any fixes before regenerating the remediated source files. Then repeat this process until all remediated programs compile cleanly.

  2. Confidence test the remediated application, which might uncover further errors in the detail of some fixes. Once again, discard the fixed sources, return to the worksheet and correct the fix details before regenerating the fixed programs. Repeat this cycle until you have completed your confidence testing.

  3. Produce final reports for the project and archive all files, original sources as well as all SmartFind Plus database files.

  4. Systems test the application and resolve and any necessary problems using the normal processes used within your organization.


Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.
Previous Year 2000 Problems and Solutions Reporting on the Worksheet Next