PreviousRegression and Conformance Testing Session RecordingNext"

Chapter 28: Year 2000 Testing

This chapter guides you, step by step, through the process of creating a regression test for an application (CICSDB2) that uses CICS and DB2 and needs to be updated to cope with the year 2000.


You need to have read the chapter Start Here for the Tutorials and worked through the first session, Using Mainframe Express, and the session Regression and Conformance Testing, before you do this session.

You need to have installed CICS Option and either SQL Option or Host Compatibility Option to do this session. This chapter contains alternative sections depending on whether you installed SQL Option or Host Compatibility Option (HCO). If you are using HCO you must also have IBM's DB2 database system installed.

Note: If you have already worked through the WinRunner 2000 tutorial, Testing Application Output, you do not need to carry out the steps described in the Preparation section. Instead, start Mainframe Express, open the cicsdb2 project and go straight to the section entitled Before Running the Application.


28.1 Preparation

You need to complete the following preparatory tasks before using TouchPoint:

28.1.1 Creating a Project

To create the project:

  1. Start Mainframe Express, click New on the File menu, select Project on the New dialog box and click OK.

  2. Enter cicsdb2 as the name of the project and change the name of the Project Folder to drive:\mfuser\projects\gsdemo\cicsdb2, then click Next.

  3. Select Using this wizard as your chosen method of creating the project and click Next.

  4. Leave the default folder for the catalog (drive:\mfuser\projects\gsdemo\cicsdb2) unchanged and click Next.

  5. A dialog box is displayed asking which Mainframe Express options this project uses. It uses CICS and SQL so ensure that both these check boxes contain check marks and click Next.

  6. Leave the default CICS region name (CICSDB2) unchanged and click Next.

  7. Leave the default folder for the resource definition file (drive:\mfe\config) unchanged and click Next.

  8. From the pulldown list, select MCOSIT (Micro Focus CICS option SIT) for the System Initialization Table (SIT) and click Next.

  9. If you installed HCO, a dialog box is displayed asking for the name of the DB2 database. Enter SAMPLE and click Next.

  10. If you installed SQL Option, a dialog box is displayed asking whether the project uses a local server and whether that server should be looked for when the project is opened and whether you should be prompted before the server is started. Ensure that all three options are checked and click Next.

  11. A summary is displayed of all the information that you have entered. Click Finish to create the project.

If you installed SQL Option, Mainframe Express checks that an SQL server is running on your computer. If no SQL server is running, it displays a dialog box asking if you want to start one now. Ensure Start local server now is checked and click OK.

28.1.2 Adding Files to the Project

To add your files to the project:

  1. Click Add Files on the Project menu.

  2. In the Add Files to Project dialog box, open the folder \mfuser\projects\gsdemo\cicsdb2\source.

  3. Ensure the Files of Type field is set to All Files (*.*) (at the end of the pulldown list), select all the files in the folder, then click Add.

    The files are added to the project.

  4. Click Done. The files that you have added are parsed.

28.1.3 Creating a DB2 Database (HCO)

If you're using SQL Option, the database used in this session is installed with Mainframe Express, so you should skip this section. If you're using HCO you need to create the database:

  1. Click HCO on the Tools menu, then click Create Database.

    The Create Database dialog box appears.

  2. Type SAMPLE in the Database field and Sample database in the Description field, then click on the dialog box.

  3. When it finishes, click OK on the message saying "Request completed", and then close the Create Database dialog box using its button.

28.1.4 Adding a Table and Data (SQL Option)

If you're using HCO, skip this section. If you're using SQL Option, you run the SQL Wizard with the supplied DDL file to add the table and data.


Note: You only need to create this table once. If you are re-creating this project for any reason, the table will already exist and an error message similar to the following is displayed: Table/View "EMP_SALARY" already exists. If this happens, click OK and then Cancel and move on to the next section.


  1. Select the SQL DDL/DML folder in the left-hand pane and then click EMPSALA.SQL in the right-hand pane.

  2. Click SQL For DB2 on the Tools menu, then click Execute SQL EMPSALA.SQL.

    Guided by the .sql file, the SQL Wizard creates a new table and index, inserts data, and then exits.

28.1.5 Adding a Table and Data (HCO)

If you're using SQL Option, skip this section. If you're using HCO, you use the supplied DDL file to add the table and data.

  1. Click HCO on the Tools menu, then click Configuration.

    The Set Defaults dialog box appears. By default HCO assumes the DDL has an extension of .ddl, but the one supplied has an extension of .sql. So you need to reconfigure HCO first.

  2. Click DDL FILE EXTENSION in the Settings list. You may have to pull the slider down to see it.

  3. Type SQL in the Value field, then click Save, click OK on the Save Changes message, then click Cancel.

    You can now run the DDL.

  4. Click HCO on the Tools menu, then click DDL Processor.

    The DDL Processor Tool appears.

  5. Type SAMPLE in the Database field.

  6. Click Select DDL on the File menu of the DDL Processor Tool

  7. In the Select DDL File dialog box, open the folder \mfuser\projects\cicsdb2\source. Ensure the Files of Type field is set to sql Files (*.sql).

  8. Select EMPSALA.SQL and click Open.

    This sets the DDL File field to the name of this file.

  9. Click g           on the DDL Processor Tool.

  10. When it finishes, close the DDL Processor Tool using its button.

28.1.6 Modifying the Build Settings

You need to change the COBOL dialect to COBOL for MVS and the BMS compiler needs to recognize certain features recognized by the SDF BMS compiler on the mainframe, so:

  1. Click Project in the left-hand pane, then click Build settings for project on the Project menu.

  2. Click the BMS tab, then click Enable SDF features to put a check mark there.

    SDF features are used in the BMS mapset used in this session.

  3. Now click the COBOL tab and select COBOL for MVS as the COBOL dialect.

  4. Click OK.

28.1.7 Building the Project

To build the project:

  1. Click Build on the Build menu, or click the Build button on the toolbar.

When the build has finished, the message Build finished with no errors is displayed in the Mainframe Express Output window. (If you cannot see the Output window, select Output Window from the View menu.)

28.1.8 Setting up CICS FCT and PCT Entries

Before you can run this tutorial, you need to create a number of CICS FCT and PCT entries.

28.1.8.1 Adding FCT Entries


Note: You only need to do this once. If you are re-creating the project for any reason, the FCT entries will already exist. To check, click the CICS tab, right-click on CICS System and select Viewable Groups. Select CICSDB2 as the only viewable group and click OK. Now click File Control Table (FCT) - you should see CONV and EMPL listed under File Name.


To add File Control Table entries:

  1. Click the CICS tab at the bottom of the Project View.

  2. Click File Control Table (FCT). (If you are prompted to change the groups being viewed, click No.) Now, right-click on File Control Table (FCT) and select Add new FCT entry.

  3. Use the Browse button, , to select the file mfuser\projects\gsdemo\cicsdb2\data\conv.dat. Click Open and then OK. Now use the same process to select mfuser\projects\gsdemo\cicsdb2\data\empl.dat.

28.1.8.2 Adding PCT Entries


Note: You only need to do this once. If you are re-creating the project for any reason, the PCT entries will already exist. To check, click on the CICS tab, right-click on CICS System and select Viewable Groups. Select CICSDB2 as the only viewable group and click OK. Now click Program Control Table (PCT) - you should see CDB1, CDB4, CDB5, and CDB6 listed under Transaction ID.


To define CICS transactions for the project's programs:

  1. Click the CICS tab at the bottom of the Project View.

  2. Click Program Control Table (PCT). (If you are prompted to change the groups being viewed, click No.) Now, right-click on Program Control Table (PCT) and select Add new PCT entry.

  3. Use Add new PCT entry four times, to add the following transactions (remember the Transaction ID is case sensitive):
    Transaction ID Program Description
    CDB1 CDB2PRG1 Program to handle the menu
    CDB4 CDB2PRG4 Program to handle listings
    CDB5 CDB2PRG5 Program to handle updates
    CDB6 CDB2PRG6 Program to handle displays

28.2 Before Running the Application

Before you run the application, check the following:

28.2.1 Adding CICSDB2 to the Startup List

Ensure that CICSDB2 is in the startup list:

  1. Click the CICS tab.

  2. Right-click on CICS System.

  3. Select Startup List.

  4. If CICSDB2 is not displayed in the start-up list, select it in the right-hand pane and click Add.

  5. Click OK to close the Startup List Configuration dialog box.

28.2.2 Application Output Window

For the purposes of this tutorial, it is important that the Application Output Window is floating on the desktop:

  1. Select Dockable Windows from the View menu, ensure that Application Output is checked and click Close.

  2. Right-click within the Application Output window and ensure that Float on desktop is checked. (You may have to rearrange your desktop to be able to see the Application Output window.)

  3. Close the Application Output window using its button.

28.2.3 Debug Options

Check that your debug options are set correctly for running this tutorial:

  1. Select Debug from the Options menu.

  2. Ensure that Step/Run displays Start Debugging dialog is checked.

  3. Ensure that Show system programs in call stack is unchecked.

  4. Click OK.

28.3 Running the Application

You are now ready to run the application. It is worth spending a few minutes becoming familiar with the application and what it does:

  1. Click the Run button on the toolbar. The Start Debugging dialog box is displayed.

  2. Click the CICS tab, enter an Initial TRANSID of CDB1 and click OK.

  3. A number of messages are displayed as the application logs on to the CICS region and then the application's main menu, as shown in Figure 28-1, is displayed.



    Figure 28-1: Main Menu

  4. Press the F4 key to display a list of employees. Note the details that are displayed: name, social security number, office location and date of hire. (If you have already run the WinRunner 2000 tutorial, Testing Application Output, the day of the year on which the employee was hired is also displayed, to the right of the date of hire.)

  5. Press the F5 key to display the EMPLOYEE INFORMATION CHANGE screen. From here you can change any of the employee details. Note the YEARS EMPLOYED field on this screen.

  6. Press the Tab key to move to the DATE OF HIRE field and change the date of hire to 01/01/99 (if you have already run the WinRunner 2000 tutorial, Testing Application Output, you will not need to make this change). Press Enter (right-hand Ctrl) to save the change.

  7. Press the F3 key to return to the main menu.

  8. Press F3 again to terminate the application.

  9. Press the Esc key to clear the screen.

  10. Type EXIT and press Enter (right-hand Ctrl).

  11. Close the Application Output window using its button.

28.3.1 The 050-COMPUTE-EMP-YEARS Section

Now that you have a general idea about the type of information that this application processes, it will be useful to focus on the section to be changed, 050-COMPUTE-EMP-YEARS.

  1. Click the Files tab in the Project View and then double-click on the COBOL program, Cdb2prg5.cbl.

  2. Use the Find option on the Search menu to locate the 050-COMPUTE-EMP-YEARS section.

  3. Set a breakpoint at the first executable line in that section:
    MOVE ZEROS TO NO-OF-MONTHS YEARS-EMPLOYED UPDATE-EMP-YEARO

    (right-click anywhere on that statement and select Set Breakpoint). Notice that the symbol appears alongside the line. Click the Run button on the toolbar.

  4. On the Start debugging dialog box, select the CICS tab, enter an Initial TRANSID of CDB1 and click OK.

  5. From the main menu, press F4.

  6. From the EMPLOYEE LIST screen, press F5. The debugger gains focus when the breakpoint is hit.

  7. When the debugger is active for Cdb2prg5.cbl unset the breakpoint (right-click anywhere on the statement and select Clear Breakpoint) and step through the section (using the F10 key or the Step button on the toolbar) so that you can see what this section of code is doing:

  8. Now zoom through the rest of the code by clicking the Run button on the toolbar.

  9. When the EMPLOYEE INFORMATION CHANGE screen is displayed, press the F3 key to display the main menu.

  10. Press F3 to terminate the application.

  11. Clear the screen by pressing the Esc key.

  12. Type EXIT and press the Enter (right-hand Ctrl) key.

  13. Close the Application Output and editor windows using their buttons.

28.4 Year 2000 Test

DateWarp is a feature of Mainframe Express which enables you to set the system date to the Year 2000 (or any other date) and then run your application to see how it behaves. Note that DateWarp only affects Micro Focus applications; it does not affect any other software on your PC.

  1. Select Run from the Debug menu, click the CICS tab, enter CDB1 as the Initial TRANSID and click OK to start the application.

  2. Press the F4 key to display the list of employees.

  3. Press the F5 key.

    This displays the EMPLOYEE INFORMATION CHANGE screen which contains the first employee's details. Note the value in the YEARS EMPLOYED field on this screen. This is the number of years that this employee has been with the company, calculated by subtracting the date of hire from the system date.

  4. Select Break from the Debug menu and then press the F3 key on the EMPLOYEE INFORMATION CHANGE screen. (You may have to click the Application Output window again first.)

    This invokes the debugger for the cdb2prg5 module. You may have to rearrange the Mainframe Express desktop to be able to see the cdb2prg5.cbl source code.

  5. Select DateWarp from the Debug menu and, if it is not already selected, select January 1st 2000 as the execution date (click the down-arrow on the list box and then click on the year to enable the spin control. Use the spin control to move the date forward).

    When you have set the date to January 1st 2000, press Return and then click OK. This sets the system date to January 1st 2000 and enables you to test how the application will behave on that date.

  6. Now press the F5 key to zoom through the program and return to the main menu.

  7. Press the F4 key and then the F5 key and look at the YEARS EMPLOYED field. The value shown is the result obtained by subtracting the date of hire from the system date (now set to the year 2000).

Clearly, this application needs to be fixed before it will work with Year 2000 dates.

28.5 Reset the Date

Before going any further, reset the date and terminate the application as follows:

  1. Select Break from the Debug menu and then press the F3 key on the EMPLOYEE INFORMATION CHANGE screen to invoke the debugger for cdb2prg5. (You may have to click on the Application Output window again first.)

  2. Select DateWarp from the Debug menu and uncheck the execution date by clicking on the check mark. This resets the system date to today's date. The execution date is greyed out. Click OK.

  3. Press the F5 key to run through the program.

  4. From the main menu, press the F3 key to exit the application.

  5. Clear the screen by pressing the Esc key.

  6. Type EXIT and then press 3270 Enter (right-hand Ctrl) to terminate CICS.

  7. Close the Application Output window using its button.

28.6 Create a Fragment

Now that you have established that your application needs fixing, the next stage is to isolate the code that needs to be changed and, subsequently, tested. You also need to identify the input variables (these are data items that affect the execution of the code fragment) and the output variables (the contents of these can be analyzed to determine success or failure when the fragment is executed).

  1. The cdb2prg5.cbl program should still be open in the editor (you may have to rearrange your Mainframe Express desktop in order to see it). Using the mouse, select the code in the 050-COMPUTE-EMP-YEARS section, as shown in Figure 28-2.

    Note: When you are selecting the lines of code that comprise a fragment, you should not select any of the following at either the start or the end of the fragment:

    If you do select any of the above, TouchPoint displays a warning message and prompts you to redefine the scope of the fragment.




    Figure 28-2: Creating a Fragment

  2. Select New from the Fragment menu.

  3. Enter a description of COMPUTE-EMP-YEARS and click Next

  4. Select CURR-YYN (the data item that holds the current year, taken from the system date, that is used by the 050-COMPUTE-EMP-YEARS section to calculate the employee's length of service) and define it as an input variable (click Add beneath the text Input Variables).

  5. Select UPDATE-EMP-YEARO (the data item which holds the result of the calculation performed by 050-COMPUTE-EMP-YEARS) and define it as an output variable (click Add beneath the text Output Variables) and then click Next. It is possible to define multiple input and output variables, but for the purposes of this example only the two defined above are required.

  6. Select Defer the creation of initial values and click Finish.

  7. Close the editor using its button.

28.7 Generate Initial Values

Initial values are used, when a fragment test is run, to supply values for all the data items used within the fragment, other than the input variable values that you supply explicitly when you create the fragment test (see the next section for details on how to create a fragment test).

Initial values can be generated by running the application from within Mainframe Express and recording data item values as the fragment is encountered. (You can also create initial values manually and this may be necessary if, for example, the execution environment or application data is not available.)

In this example, the initial values are generated by running the application:

  1. From the Project View, select the Tests tab.

  2. Select Initial Values from the Fragment menu and then select Generate By Execution from the sub-menu.

  3. Change the name to COMPUTE-EMP-YEARS, select the fragment that you have just created (Cdb2Prg5_1) and click OK.

  4. From the Testcase Parameters dialog box, click the CICS tab and make sure CDB1 is entered as the Initial TRANSID and then click OK to run the application. To generate initial values for it, you need to ensure that the 050-COMPUTE-EMP-YEARS section (that you defined as the code fragment, Cdb2Prg5_1) is executed during this run of the application. You can do this by following these instructions (watch the TouchPoint Output window):

    1. From the main menu, press the F4 key to list all the employees.

    2. Press the F5 key to display the EMPLOYEE INFORMATION CHANGE screen (and execute the 050-COMPUTE-EMP-YEARS section).

    3. Now press F3 to return to the main menu.

    4. Press F3 again to exit the application.

    5. Press Esc to clear the screen.

    6. Type EXIT and press right-hand Ctrl to exit the CICS region.

A message box is displayed informing you that the Cdb2prg5_1 fragment has been encountered (and therefore the initial values for it have been generated). Click OK to close the message box.

28.7.1 Checking the Initial Values

When you generate initial values for a fragment, a value is stored for each data item within the fragment. These values are used, when a fragment test is run, for every data item for which you have not explicitly supplied a value (see below for details on creating a fragment test).

To check the intial values that have been generated by running the application:

  1. In the left-hand pane, right-click on COMPUTE-EMP-YEARS and select Edit from the context menu. The Initial Values dialog box, shown in Figure 28-3 is displayed.



    Figure 28-3: Checking the Initial Values

  2. Initial values are captured immediately before the fragment is executed. A fragment may be executed several times when an application is run but the initial values are captured only once, the first time the fragment is encountered. Note the values of CURR-DATE (the system date), CURR-YYN (this has been defined as an input variable and so the initial value shown here will be overwritten by the value(s) that you supply when you create the fragment test) and EMPFILE-DOH-YYN (this is the employee's date of hire). Note that because initial values are captured immediately before the fragment is executed for the first time, EMPFILE-DOH-YYN holds the date of hire of the first employee to appear on the EMPLOYEE INFORMATION CHANGE screen. Because EMPFILE-DOH-YYN has not been defined as an input variable, this initial value will be used each time the fragment is executed when the fragment test is run. (You can alter the value of an initial value by double-clicking on it and entering the new value.)

  3. Close the Initial Values dialog box by clicking OK.

28.8 Create a Fragment Test

When you create a fragment test, you can supply one or more values for each of the input variables that you defined for the code fragment. The fragment is executed once for each value that you supply. All values other than those that you supply are taken from the nominated set of initial values. Each iteration is executed independently of the others as the initial values are reloaded each time, refreshing the values of the data items in the fragment.

You can supply a date, or a range of dates, as input variable values. TouchPoint's date feature is particularly powerful as it allows you to roll a range of dates over the Year 2000 (whereas a standard range would not work, for example, for values of 95 to 05).

As well as input variable values, you can specify baseline values by editing the baseline and switching on baseline comparison. This enables you to supply "correct" values that each iteration is tested against. You can use this feature to perform compliance testing, as this example shows:

  1. Select New from the Test Case menu.

  2. Select Fragment and click OK.

  3. Accept the default name (FragmentTest_1) for the test, select the Cdb2prg5_1 fragment and click Next.

  4. Select COMPUTE-EMP-YEARS as the initial values to be used for the test and click Finish. The fragment test worksheet is displayed, with the initial value of the input variable shown in the first row.

  5. Right-click on the cell which represents CURR-YYN for iteration 1 and click Date to display the Date Entry dialog box (illustrated in Figure 28-4).

    Select the following:

    Type:       Range
    Format:     YY
    Start date: 01 January 1999
    End date:   01 January 2005
    Step size:  1 year

    Notes:




    Figure 28-4: Specifying a Range of Dates

  6. Click OK.

    This specifies that the test will be run 7 times - once for each year between 1999 and 2005. The values that you have specified will be used for the input variable CURR-YYN, but all the other data items within the fragment (including EMPFILE-DOH-YYN) will use the same initial value each time.

  7. Right-click in the Compare Baseline column and select Edit baseline. The dialog box shown in Figure 28-5 is displayed.



    Figure 28-5: Editing Baseline Values

  8. Double-click in the UPDATE-EMP-YEARO column for iteration 1, enter 00 and press Return. Repeat the process for iterations 2 to 7, entering values of 01 to 06. When you have entered a value for each iteration, click OK.

  9. To close the fragment test worksheet, click OK on the Define Fragment Test Iteration Values dialog box.

28.9 Run the Test

Now that you have created your test, you can run it. The fragment will be executed once for each input variable value that you have supplied:

So, in this example, cdb2prg5.cbl is tested to see whether, given current year values of 1999 to 2005, and a consistent employee date of hire of 1999, the value output in UPDATE-EMP-YEARO matches the "expected" baseline values of 0 to 6.

Because you have supplied baseline values manually you do not need to use the Record function to record a baseline.

To run the test:

  1. Select the test in the right-hand pane. (You may have to click Project in the left-hand pane before you can see the test.)

  2. Select Run from the Test Case menu.

In the Mainframe Express Output window (click the Build tab), a message is displayed for each iteration of the test. Finally, a message is displayed informing you that the test has been executed successfully. The status of the test is shown as Fail.

28.10 Analyze the Results

You can use TouchPoint to analyze the test results:

  1. Select Analyze from the Test Case menu. (Make sure the test is selected in the right-hand pane.)

  2. The status of each iteration is displayed in the left-hand pane:

  3. You can select each iteration in turn by clicking on it and view the value used for the input variable in the top right-hand pane and the values recorded for the output variable (or in this case, supplied by using the Edit Baseline feature) and generated by running the test in the bottom right-hand pane.

  4. As you can see, all iterations that use a current year of 2000 or later have failed. When you have finished analyzing the results, click the Close button.

28.11 Change the Code

The next stage is to fix the code. In this example, this is done by adding some Year 2000 windowing code:

  1. Click the Files tab and then double-click on cdb2prg5.cbl to open the editor.

  2. In the 050-COMPUTE-EMP-YEARS section, comment out the first COMPUTE statement (note that this statement runs over three lines, comment them all out) and then uncomment the PERFORM Y2K-WINDOW statement.

  3. Click the Compile button on the toolbar to compile the program.

  4. Close the editor window using its button.

28.12 Run the Test Again

You can run a test many times (with more fixes applied as necessary), and analyze the results each time.

  1. Click the Tests tab.

  2. In the right-hand pane, select the test, FragmentTest_1.

  3. Select Run from the Test Case menu.

In the Mainframe Express Output window (click the Build tab), a message is displayed as each iteration is executed. Finally, the message Test FragmentTest_1 completed is displayed. Notice that the status of the test is now shown as Pass.

28.13 Analyze the Results

You can use the Analyze option to analyze the new results.

  1. Right-click on the test and select Analyze from the context menu.

  2. Select each iteration in turn (from the left-hand pane) and analyze how each input value (top right-hand pane) affects the output variable value (bottom right-hand pane). Note that each iteration now has a status of Pass.

  3. Click the Close button.

28.14 Run the Application again to Confirm the Fix

Now run the application once more, just to confirm that everything still works as it did before.

  1. Select Start Debugging from the Debug menu.

  2. Click the CICS tab, enter an Initial TRANSID of CDB1 and click OK.

  3. Select Run from the Debug menu.

  4. From the main menu, press F4.

  5. Press F5.

The YEARS EMPLOYED field should contain the correct value.

You have now completed this tutorial. Press F3 to return to the main menu and then again to exit the application. Press Esc to clear the screen, type EXIT and press right-hand Ctrl to terminate CICS. To stop the SQL server, press the Esc key from the XDB-SERVER main menu.

28.15 Before Continuing

Close the project. If you want to take a break before going on to the next session, you can close Mainframe Express.

Return to the Tutorials Map in the chapter Start Here for the Tutorials and choose which session to go on to next, depending on your interests.


Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousRegression and Conformance Testing Session RecordingNext"