Lab 5. Using the Debugger

Lab 5

Using the Debugger

Lab at a Glance 2

Objectives 2

The Problem 2

Duration 3

Exercises 4

Exercise 1: Prepare Debugger 4

Exercise 2: Run the Debugger 8

Lab at a Glance

The exercises in this lab are designed to familiarize the student with the process of using the PowerCenter Debugger. In this lab, the student will troubleshoot a mapping that is not producing the correct data results.

Objectives

After completing the lab, the student will be able to:

q  Use the PowerCenter Debugger.

q  Start and stop the Debugger.

q  Set breakpoints in the Debugger.

The Problem

A mapping created by another developer produces the following target table, with some TYPE_CODE values NULL.

Duration

This lab should take approximately 30 minutes.

Exercises

Exercise 1: Prepare Debugger

This exercise sets up the Mapping Designer in preparation for debugging. Some of the steps may not be necessary if the Designer has remained open since the previous labs.

Step 1. Open the Designer.
/ q  Select Start | Programs | Informatica Platform 8.0 | Informatica PowerCenter Client 8.0 | Designer.
q  Connect to the PC_Course repository.
Step 2. Close the mapping.
q  Open the Mapping Designer by clicking the button in the toolbar:
q  Close the mapping by selecting Mappings | Close or by clicking the Close Mapping button in the Mappings toolbar (if visible).
Step 3. Copy the mapping to be debugged.
Simply selecting or expanding your folder does not actually open it. There are several ways to open it:
- Double-click on it.
- Right-click it and select Open from the popup menu.
- Left-click it and click control-O.
- Left-click it and select the folder-open icon in the toolbar.
When a mapping is copied, any associated targets and sources are also copied to the destination folder. / q  Ensure the Designer is in “workbook mode” by selecting View | Workbook.
When in “workbook mode”, the bottom of the Workspace will display tabs for all of the open folders.
q  Open the Studentxx folder.
q  Locate the Shared_Student folder in the Navigator window and expand it by clicking on the ‘+’ sign to the left of the folder name.
q  Continue to drill down to the Mappings node and select the m_ODS_EMPLOYEE_BAD mapping:
q  Select Edit | Copy, or Ctrl-C to copy the mapping.
q  Paste the mapping by selecting the Studentxx folder and selecting Edit | Paste, or Ctrl-V.
q  Click Yes.
q  If a conflict exists with an existing mapping of that name, the Copy Wizard opens. Select Replace.
q  Collapse the Shared_Student folder by clicking on the ‘-‘ to the left of the folder name in the Navigator window.
q  Save the repository.
Step 4. Open the mapping.
q  In the Navigator window, locate the m_ODS_EMPLOYEE_BAD mapping (just copied) in the Mappings node of the Studentxx folder.
q  Click and hold the mouse button, then drag-and-drop the mapping into the Workspace:
Step 5. Edit the mapping.
q  Select Mappings | Edit.
The Edit Mapping dialog box appears.
q  Change the mapping name to m_ODS_EMPLOYEE_BAD_xx (where xx represents the assigned student number).
q  Save the repository.
Step 6. Arrange the mapping.
q  Right-click in the Workspace and select Arrange All.
The mapping is arranged neatly in normal view.
q  Right-click in the Workspace and select Arrange All Iconic.
The mapping is now displayed in iconic view.

Exercise 2: Run the Debugger

Step 1. Activate the Debugger toolbar.
/ q  Select Tools | Customize and check the Debugger checkbox on the Toolbars tab:
q  The Debugger toolbar is added to the available toolbars:
q  Select Tools | Options.
q  Select the Debug tab.
q  Under Data Display, if Value is not in Selected, move it there.
Step 2. Start the Debugger.
Since no session has been created to represent this new mapping, the Debug Mapping Wizard has the ability to create one on the fly. This is especially useful - a developer can test complex expressions and logic before trying to create a workflow with a session task. / q  Click on the Start Debugger button, or select Mappings | Debugger | Start Debugger or click F9.
The Debug Mapping window appears.
q  Click on the Next button.
The next Debug Mapping wizard page appears.
q  Leave PC_Server as the Server to use for the debug session.
q  In the Session field, leave the default radio button (Create a debug session instance for this mapping) selected.
q  Click on the Next button.
q  Select the same native connections, for source and target, used to run the workflow in the previous lab.
q  Select the Properties tab and select Normal for the Target load type property:
q  Click on the Next button.
q  Leave the default settings on this page of the wizard and click on the Next> button.
q  On the last page of the wizard (not shown), leave the Discard target data checkbox selected.
q  Click on the Finish button and wait for the ‘spinning’ (initializing) of the Debugger icon to stop before proceeding. Assuming that the Informatica service is started, a debug session will start.
q  Click on the Debugger Log tab to watch the real-time log creation.
q  The Debugger toolbar becomes active in debug mode:
Step 3. Debug the mapping.
/ q  Select the sq_EMPLOYEE source qualifier in the mapping.
q  Click on the Next Instance button to start moving rows through the Debugger.
The small green arrow displays a flashing yellow indicator as long as rows are being read.
q  Continue click on the Next Instance button and notice the processing progress (indicated by yellow arrow) as each row moves from the sq_EMPLOYEE to the exp_EMPLOYEE.
Examine the data in the Instance window and notice the pull-down list can be used to see a row in either of the two transformations in the mapping.
q  Click the Step to Instance button and watch each row move through one transformation.
q  Compare the data from one transformation to the next and determine where the mapping errors are.
Step 4. Stop the Debugger.
/ q  Once the errors in the data mapping have been discovered, stop the Debugger by clicking on the Stop the Debugger button.
The Designer will ask for confirmation:
q  Click on Yes.
q  The Debugger Server will shut down and return to the normal Mapping Designer Workspace.
Step 5. Set Debugger breakpoints.
Best practice is to restart the Debugger, since Continue will miss breakpoints on rows that have already been processed.
Note that the defined breakpoint is still present. Breakpoints remain associated with a mapping until they are deleted. A breakpoint can be edited as long as the Debugger is not running. / q  Restart the Debugger.
q  Click on the Edit Breakpoint button.
The Edit Breakpoints dialog box appears.
q  Select sq_EMPLOYEE from the Instance Name pull-down list.
q  Click on the Add button in the Breakpoints: section of the dialog box.
q  Click on the Add a new column to this table button in the Condition section the dialog box.
q  Select <ANY-PORT> from the Port pull-down list.
q  Select ISNULL from the Operator pull-down list.
q  Click OK to save the breakpoint.
q  Click the Continue button on the Debugger toolbar.
The Debugger will run through all the rows until the first occurrence of a NULL. Note that two rows pass to the target, then the Debugger pauses.
Check the Instance window and note the presence of a NULL in the TYPE_CODE column.
q  Click the Continue button.
Ten rows enter the target and the Debugger pauses when it encounters a row where the TYPE_CODE column is NULL.
q  Click the Continue button.
A NULL is not found in any other rows. All rows continue to the target.
q  Click the Continue button.
The Debugger stops.
q  Add additional breakpoints and experiment.
q  To shut down the Debugger, click the Stop the Debugger button.

5 - 5