Sie sind auf Seite 1von 5

What is the Normalizer good for anyway?

January 5, 2009

Second Edition

What is the Normalizer good for anyway? by Matthias Urech

About interface - development.com is the source for data integration expertise that provides customers valuable, convenient and relevant experiences through a diversity of products and services. The main orientation of the project is to respond to the increased demand for applications and services to help successfully building data integration solutions and deliver the results developer and organization expects. Matthias Urech, founder of interface - development.com, has a proven track record of applying data integration solutions for several companies across the industry. He played a key role to implement projects in the area of data integration, data migration, data consolidation and data warehousing. Matthias contributed several articles about data integration best practices for Informatica Technology Network, resulting in nomination as member of Developer Wall of Fame and receiving an award as Contributor of the Year in 2008.

Copyright Copyright 2005 - 2009 interface - development.com. All Rights Reserved. No parts of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means electronic, mechanical, photocopying, or otherwise without the prior written permission of the author.

Limit of Liability / Disclaimer of Warranty While every precaution has been taken in the preparation of this article, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.

Trademarks Designations used by companies to distinguish their products are often claimed as trademarks or registered trademarks. In all instances in which interface-development.com, the author or publisher is aware of claim, the product names appear in initial capital or all capitall letters. Readers, however, should contact the appropriate companies for more complete information regarding trademarks and registration.

Article History January 14, 2005 January 5, 2009

First Edition. Second Edition.

Table of Contents About this Article ......................................................................................................................................... 1 Introduction ................................................................................................................................................ 1 How the Normalizer works .......................................................................................................................... 1 Example 1: Error Logging 2 Example 2: Dynamic Parameter Files 3

Copyright 2005 - 2009 interface - development.com. All Rights Reserved.

ii

What is the Normalizer good for anyway?

About this Article


This article will explain what the Normalizer does and provide two examples.

Introduction
What comes to your mind when thinking about a Normalizer transformation? COBOL Mainframe I dont know, I have never used it normalizing data Almost, but the Normalizer can do more than that. Once, you see its full potential you dont want to miss it in your interfaces.

How the Normalizer works


The Normalizer transformation is most often used in order to deal with VSAM or COBOL files. You can also use the Normalizer transformation with relational sources to create multiple rows from a single row of data. In other words: you can transpose data. Figure 1 outlines what the Normalizer does:

Figure 1: Normalizer Explanation


Four attributes Q1-Q4 (black arrows) are going into the Normalizer and one attribute (AMOUNT) is coming out. Data is grouped by attribute YEAR (blue arrows) and transformed from horizontal into vertical order. The Quarter attribute will be populated by a generated column id (green arrow). Now, lets turn theory into practice. On the following pages, there are two simple examples that outline the potential of the Normalizer transformation: Error Logging Dynamic Parameter Files

Copyright 2005 - 2009 interface - development.com. All Rights Reserved.

What is the Normalizer good for anyway?

Example 1: Error Logging Lets say you want to log errors for several reasons (data quality, monitoring, etc.). An Expression transformation has two attributes for error logging (ERROR_DATE, ERROR_MESSAGE). The attributes are marked as (O)utput ports and have the following logic: ERROR_DATE: ERROR_MESSAGE: IIF(ISNULL(i_WORK_DATE), TO_CHAR(SYSDATE, 'MM/DD/YYYY'), NULL) IIF(ISNULL(i_WORK_DATE), 'Error - Mandatory field WORK_DATE is null!', NULL)

Dependent on value of attribute WORK_DATE, both ports will generate data as outlined in figure 2:

Figure 2: Output of Expression transformation


Putting the output ports of the Expression into a Normalizer transformation will produce the following output:

Figure 3: Output of Normalizer transformation


It goes without saying that you should filter empty error messages first before putting them into the Normalizer. As shown in figure 3, each occurring error will generate two lines and could be written i.e. to a flat file.

Copyright 2005 - 2009 interface - development.com. All Rights Reserved.

What is the Normalizer good for anyway?

Example 2: Dynamic Parameter Files You can use two parameter file types with Informatica PowerCenter: Static Parameter Files Dynamic Parameter Files

Static Parameter Files are created once and are changed manually from time to time (i.e. once a month). Basically, you are using a tool (i.e. Parameter File Wizard) or text editor to modify the parameters and variables. Dynamic Parameter Files are changing permanently, so you cant or dont want to change them continuously (i.e. date values). This example describes how you can generate a dynamic parameter file that provides date values for file names. We use a Source File as specified in figure 4:

Figure 4: Source File storing Parameter File Metadata


We are putting the attributes together in an Expression transformation to define the rules for building a parameter file. The (O)utput and (V)ariable ports have the following logic: Port Name FOLDER_NAME v_TARGET_TIME OUTPUT_FILE Expression ' [' || FOLDER || '.WF:' || WORKFLOW || '.ST:' || SESSION || ']' IIF(ISNULL(TARGET_TIME_FORMAT), '', TO_CHAR(SYSDATE, TARGET_TIME_FORMAT)) '$OutputFile1=' || TARGET_DIR || TARGET_NAME || v_TARGET_TIME || TARGET_TYPE)

Table 1: Port Names and Expressions


Putting the output ports of the Expression into a Normalizer transformation will produce the following output:

Figure 5: Output of Normalizer transformation


Save the target as flat file somewhere on the Informatica server. Specify the parameter file location in any session that should use this parameter file. See the help file for more information.

Copyright 2005 - 2009 interface - development.com. All Rights Reserved.

Das könnte Ihnen auch gefallen