Information Integration Solutions Center of Excellence

Parallel Framework Standard Practices
Investigate, Design, Develop: Data Flow Job Development
Prepared by IBM Information Integration Solutions Center of Excellence July 17, 2006

CONFIDENTIAL, PROPRIETARY, AND TRADE SECRET NATURE OF ATTACHED DOCUMENTS
This document is Confidential, Proprietary and Trade Secret Information (“Confidential Information”) of IBM, Inc. and is provided solely for the purpose of evaluating IBM products with the understanding that such Confidential Information will be disclosed only to those who have a “need to know.” The attached documents constitute Confidential Information as they include information relating to the business and/or products of IBM (including, without limitation, trade secrets, technical, business, and financial information) and are trade secret under the laws of the State of Massachusetts and the United States. Copyrights © 2006 IBM Information Integration Solutions All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language in any form by any means without the written permission of IBM. While every precaution has been taken in the preparation of this document to reflect current information, IBM assumes no responsibility for errors or omissions or for damages resulting from the use of information contained herein.

Information Integration Solutions Center of Excellence

Document Goals
Intended Use This document presents a set of standard practices, methodologies, and examples for IBM WebSphere® DataStage Enterprise Edition™ (“DS/EE”) on UNIX, Windows, and USS. Except where noted, this document is intended to supplement, not replace the installation documentation. The primary audience for this document is DataStage developers who have been trained in Enterprise Edition. Information in certain sections may also be relevant for Technical Architects, System Administrators, and Developers This document is intended for the following product releases: - WebSphere DataStage Enterprise Edition 7.5.1 (UNIX, USS) - WebSphere DataStage Enterprise Edition 7.5x2 (Windows)

Target Audience Product Version

Document Revision History
Date
April 16, 2004 June 30, 2005 December 9, 2005 January 31, 2006 February 17, 2006 March 10, 2006 March 31, 2006

Rev.
1.0 2.0 3.0 3.1 4.0 4.1 4.2

Description
Initial Services release First version based on separation of EE BP into four separate documents, merged new material on Remote DB2, configuring DS for multiple users. Significant updates, additional material Updates based on review feedback. Added patch install checklist item (7.10) and Windows 7.5x2 patch list. Significant updates, new material on ETL overview, data types, naming standards, USS, design standards, database stage usage, database data type mappings, updated styles and use of cross-references. Corrected missing Figure 9. Added new material on establishing job boundaries, balancing job resource requirements / startup time with required data volume and processing windows, and minimizing number of runtime processes. Moved Baselining Performance discussion to Performance Tuniing BP. Expanded performance tuning section. Removed Architecture Overview (now a separate document). Expanded file stage recommendations. Updated directory naming standards for consistency with DS/EE Automation Standards and Toolkit. Segmented content into “Red Book” and “Standards”. Clarified terminology (“Best Practices”). Incorporated additional field feedback.

May 08, 2006 July 17, 2006

4.3 5.0

Document Conventions
This document uses the following conventions: Convention Usage Bold In syntax, bold indicates commands, function names, keywords, and options that must be input exactly as shown. In text, bold indicates keys to press, function names, and menu selections. Italic In syntax, italic indicates information that you supply. In text, italic also indicates UNIX commands and options, file names, and pathnames. Plain In text, plain indicates Windows NT commands and options, file names, and pathnames. Bold Italic Indicates: important information.
Parallel Framework Red Book: Data Flow Job Design July 17, 2006 2 of 179

© 2006 IBM Information Integration Solutions. All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language in any form by any means without the written permission of IBM.

Information Integration Solutions Center of Excellence Lucida Console Lucida Bold

Lucida Console text indicates examples of source code and system output. In examples, Lucida Console bold indicates characters that the user types or keys the user presses (for example, <Return>). In examples, Lucida Blue will be used to illustrate operating system command line prompt. A right arrow between menu commands indicates you should choose each command in sequence. For example, “Choose File Exit” means you should choose File from the menu bar, and then choose Exit from the File pull-down menu. The continuation character  is used in source code examples to indicate a line that is too long to fit on the page, but must be entered as a single line on screen.

Lucida Blue

This line  continues

The following are also used: • Syntax definitions and examples are indented for ease in reading. • All punctuation marks included in the syntax—for example, commas, parentheses, or quotation marks—are required unless otherwise indicated. • Syntax lines that do not fit on one line in this manual are continued on subsequent lines. The continuation lines are indented. When entering syntax, type the entire syntax entry, including the continuation lines, on the same input line. • Text enclosed in parenthesis and underlined (like this) following the first use of proper terms will be used instead of the proper term. Interaction with our example system will usually include the system prompt (in blue) and the command, most often on 2 or more lines. If appropriate, the system prompt will include the user name and directory for context. For example:
%etl_node%:dsadm /usr/dsadm/Ascential/DataStage > /bin/tar –cvf /dev/rmt0 /usr/dsadm/Ascential/DataStage/Projects

Parallel Framework Red Book: Data Flow Job Design

July 17, 2006

3 of 179

© 2006 IBM Information Integration Solutions. All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language in any form by any means without the written permission of IBM.

..............1 WHICH FILE STAGE TO USE............68 5.............................................6 AUTOMATICALLY-INSERTED SORTS................................................................18 2................................................................................................4 COMPLEX FLAT FILE STAGE......... transmitted..............................................................4 WORKING WITH SOURCE CODE CONTROL SYSTEMS.........................................................................43 3.................67 5..........1 PARTITION TYPES...........................2 COMPLETE (TOTAL) SORT........................................59 5.........................................................39 3.....................................6 PARALLEL SHARED CONTAINERS....................................................................................3 RUNTIME COLUMN PROPAGATION..................................................8 2 STANDARDS.....................5 COLLECTOR TYPES..............................................3 PARTITION METHODOLOGY...................................81 7...............................................74 6......2 NULL HANDLING......7 ERROR AND REJECT RECORD HANDLING.....................................4 STABLE SORT............................................................................... ...................................................................................4 DEFAULT JOB DESIGN..................................................................................................................................................................................................................................................5 JOB PARAMETERS...................................39 3..................................................................................................................54 4..................................................................................................................................................72 5...........................................................................13 2................................................75 6...78 6................................................................................................................................................................................81 7....................59 5............73 6 SORTING.................................................................................................................................. or translated into any language in any form by any means without the written permission of IBM....85 8 TRANSFORMATION LANGUAGES...........................................6 COLLECTING METHODOLOGY...............................................................................................................................................................................................................................................................................................................................6 1...............................................................................................Information Integration Solutions Center of Excellence Table of Contents 1 DATA INTEGRATION OVERVIEW..............................................................................................................................................................................................................................................................................79 7 FILE STAGE USAGE....................2 DATA SET USAGE............................................................................................................................................................................................................................1 MODULAR DEVELOPMENT .....................................................................................................................................................................13 2.................................................................................................................................................................................................................................................................................................................................77 6....58 5 PARTITIONING AND COLLECTING.................................................................................................................................................................................................................35 3 DEVELOPMENT GUIDELINES................................................................................4 PARTITIONING EXAMPLES.....................77 6........................................................................1 PARTITION AND SORT KEYS...........................................42 3................................................................1 DIRECTORY STRUCTURES................................................................................................................................................................................. 2006 4 of 179 © 2006 IBM Information Integration Solutions........5 SUB-SORTS......................................................................... transcribed.............................................................................74 6......................................................................................................................................................81 7.............................1 JOB SEQUENCES............39 3....................8 TUNING SORT..........2 NAMING CONVENTIONS...............................................................................................................................................................................................................................40 3.............................................................................. No part of this publication may be reproduced.............................................7 SORT METHODOLOGY...........................29 2...............................................................................................................................................................................................................................7 1......................................................................................2 MONITORING PARTITIONS.......3 LINK SORT AND SORT STAGE...............................................................................................................2 ESTABLISHING JOB BOUNDARIES............................................8 COMPONENT USAGE.......82 7................................................51 4 DATASTAGE DATA TYPES...... stored in a retrieval system..........................3 SEQUENTIAL FILE STAGES (IMPORT AND EXPORT)..................................................................................................................................................................................................................3 JOB DESIGN TEMPLATES......................................................... All rights reserved................................................41 3..........70 5................5 UNDERSTANDING A JOB’S ENVIRONMENT.....................56 4..................76 6....................................2 JOB TYPES..........................43 3.........................................................................................79 6..........................87 Parallel Framework Red Book: Data Flow Job Design July 17................................................................................................3 DOCUMENTATION AND ANNOTATION.....................................31 2..............................................................................................................

..............5 ORACLE DATABASE GUIDELINES.......................................................................................................................................................................................................................................1 HOW TO DESIGN A JOB FOR OPTIMAL PERFORMANCE...................Information Integration Solutions Center of Excellence 8....................................103 10........................ JOIN VS..........................................................................................................146 APPENDIX C: UNDERSTANDING THE PARALLEL JOB SCORE...94 9.............................................................................160 Parallel Framework Red Book: Data Flow Job Design July 17.1 DATABASE DEVELOPMENT OVERVIEW........................................ ............4 ODBC ENTERPRISE GUIDELINES...........................................................2 MODIFY STAGE..............................................................................................................................2 DEBUGGING ENVIRONMENT VARIABLES...............................................................................124 11............................................3 INFORMIX DATABASE GUIDELINES.94 9.............................................. stored in a retrieval system.........................................148 APPENDIX D: ESTIMATING THE SIZE OF A PARALLEL DATA SET.............129 12.............................................................................................................................1 TRANSFORMER STAGE................................................127 12 PERFORMANCE TUNING JOB DESIGNS......................................................124 11...............................................................................................96 10..........................133 12.............2 CAPTURING UNMATCHED RECORDS FROM A JOIN...................................4 UNDERSTANDING BUFFERING................................................................... transmitted....................................................................................................129 12..........................87 8............................................................................................. All rights reserved.......................................................................119 10.......................................................................................................................................................... or translated into any language in any form by any means without the written permission of IBM....................114 10..................................124 11.......3 HOW TO ISOLATE AND DEBUG A PARALLEL JOB.................................117 10.154 APPENDIX F: SORTING AND HASHING ADVANCED EXAMPLE.........................3 THE AGGREGATOR STAGE....................................... No part of this publication may be reproduced.............................................6 SYBASE ENTERPRISE GUIDELINES.............................................................................................................................................................................................................................................................................................. transcribed..................................................................................96 10........................................................................................................................................131 12..................................5 INTERPRETING THE PARALLEL JOB SCORE........................................................................................................... MERGE................................... 2006 5 of 179 © 2006 IBM Information Integration Solutions.......................1 WARNING ON SINGLE-NODE CONFIGURATION FILES..........................126 11..................................................2 DB2 GUIDELINES....................113 10.....................................................................................................................91 9 COMBINING DATA...................................................................................................................153 APPENDIX E: ENVIRONMENT VARIABLE REFERENCE..3 MINIMIZING RUNTIME PROCESSES AND RESOURCE REQUIREMENTS....95 10 DATABASE STAGE GUIDELINES.........7 TERADATA DATABASE GUIDELINES........................................134 APPENDIX A: STANDARD PRACTICES SUMMARY..................125 11...................140 APPENDIX B: DATASTAGE NAMING REFERENCE..........................................................4 VIEWING THE GENERATED OSH....................................................................................120 11 TROUBLESHOOTING AND MONITORING.....................2 UNDERSTANDING OPERATOR COMBINATION..........................................94 9.............1 LOOKUP VS................................................................................................................................................................

. Here is the general flow diagram for Data Stage Enterprise Edition jobs: Before Job Subroutine Halt on Error ? Yes Exit Failure No Create Reject Files (Limited) Read Input Data Halt on Error ? Yes Exit Failure No Create Error and Reject Files Perform Validations Errors and Warnings Halt on Error ? Yes Exit Failure No Create Error and Reject Files Perform Transformations Halt on Error ? Yes Exit Failure No Create Reject Files (Limited) Perform Load and/or Create Intermediate Datasets Over Job W arning Threshold? Yes Exit Failure No Parallel Framework Red Book: Data Flow Job Design July 17. stored in a Subroutine retrieval system. No part of this publication may be reproduced. transmitted.Information Integration Solutions Center of Excellence 1 Data Integration Overview Work performed by Data Integration jobs fall into 4 general categories: • • • Reading input data including sequential files. or translated into any language in any form by any means without the written permission of IBM. databases and DS/EE Data Sets. Performing row validation to support data quality. Performing transformation from data sources to data targets. 2006 6 of 179 After Job © 2006 IBM Information Integration Solutions. and • Provisioning data targets. All rights reserved. transcribed.

ETL development is intended to be modular. or translated into any language in any form by any means without the written permission of IBM. This provides a level of granularity and control that is easy to manage and maintain. and together form a single end-to-end module within a DataStage application. CA7. and Production Automation. . transcribed. These topics are discussed in Parallel Framework Standard Practices: Administration. All rights reserved. auditing/capture. built from individual Parallel jobs assembled in DataStage Enterprise Edition (“DS/EE”) controlled as modules from master DataStage Sequence jobs. 2006 7 of 179 © 2006 IBM Information Integration Solutions. In most production deployments. etc). No part of this publication may be reproduced.1 Job Sequences As shown in the previous diagram. transmitted. Cron. Management. stored in a retrieval system. as illustrated in the example below: These job Sequences control the interaction and error handling between individual DataStage jobs.Information Integration Solutions Center of Excellence 1. etc). Job Sequences require a level of integration with various production automation technologies (scheduling. Job sequences also provide the recommended level of integration with external schedulers (such as AutoSys. Parallel Framework Red Book: Data Flow Job Design July 17. error logging. and provides an appropriate leveraging of the respective technologies.

transcribed. No part of this publication may be reproduced. stored in a retrieval system. Any target where either all sources have been successfully transformed or where the resources required to transform the data must be preserved in the event of a load failure or where the provisioning will take so long that it increases the probability of job failure if the job includes transformation and provisioning. and preserves the compute effort of long running transformation jobs. or where the resource requirements for data transformation are very large. All rights reserved. Hybrid. The following table defines when each type should be used: Type Transformatio n Data Requirements Data must NOT be changed by any method unless jobs transforming an entire subject area have successfully completed. . Example Reference tables upon which all subsequent jobs and/or the current data target (usually a database) will depend.2 - Job Types Nearly all data integration jobs fall into three major types: Transformation. and Provisioning. Parallel Framework Red Book: Data Flow Job Design July 17. and Hybrid jobs do both. 2006 8 of 179 © 2006 IBM Information Integration Solutions. Data can be changed regardless of success or failure. The data target (usually a database) must allow subsequent processing of error or reject rows and tolerate partial or complete non-update of targets. This prevents partial replacement of reference data in the event of transformation failure. or where the resource requirements for data provisioning are very large. or long running provisioning processes. Transformation jobs prepare data for provisioning jobs Provisioning jobs load transformed data. Neither the transformation nor provisioning requirements are large. or translated into any language in any form by any means without the written permission of IBM. Non-reference data or independent data are candidates. Hybrid Provisioning Data must NOT be changed by any method unless jobs transforming an entire subject area have successfully completed.Information Integration Solutions Center of Excellence 1. transmitted.

transmitted. Parallel Framework Red Book: Data Flow Job Design July 17.Information Integration Solutions Center of Excellence 1. transcribed. 2006 9 of 179 © 2006 IBM Information Integration Solutions. that Data Set qualifies as write-through cache and may be used as source data instead of the target table.1 Transformation Jobs In transformation jobs. some of which may be write-through cache Data Sets. . or translated into any language in any form by any means without the written permission of IBM.2. data sources. are processed to produce a load-ready Data Set that represents either the entire target table or new records to be appended to the target table. All rights reserved. The following example transformation job demonstrates the use of write-through cache DS/EE Data Sets: The target table is among the inputs. If the entire target table is held in the load-ready Data Set. No part of this publication may be reproduced. stored in a retrieval system.

Parallel Framework Red Book: Data Flow Job Design July 17. stored in a retrieval system. No part of this publication may be reproduced. transmitted. transcribed. . 2006 10 of 179 © 2006 IBM Information Integration Solutions. or translated into any language in any form by any means without the written permission of IBM. All rights reserved.Information Integration Solutions Center of Excellence The following example transformation job does NOT produce write-through cache – its sources do NOT include the target table.

it is rejected by the transformer to a reject port and the validation is not performed for those records. we replicated the Oracle structure (lower input) for each country found in the write-through cache country dataset (upper input). By specifying a full-outer join we produce a Cartesian product dataset. the cache is deleted. The non-validated records. In this case. the validated records. forcing other jobs that might depend on this data to access the existing (not updated) target database table. transcribed. The de-duplicated records are re-grouped and ordered before calculation of the terminating keys. and the write-through cache records from the last load of the target database are merged. producing an ordered and linked associative table. Some of the more interesting solutions in this job are circled.2. 2006 11 of 179 © 2006 IBM Information Integration Solutions.2 Hybrid Jobs The following example hybrid job demonstrates several interesting techniques that might be used in more complex jobs. transmitted. or translated into any language in any form by any means without the written permission of IBM. This enforces a coherent view of the subject area from either cache (current state if all jobs complete successfully) or target tables (previous state if any job fails). Parallel Framework Red Book: Data Flow Job Design July 17. This job also loads the target database table and creates write-through cache. and described below following the highlighted areas from Left to Right: A column generator inserts the key column for a join and generates a single value guaranteed to never appear in the other input(s) to the join. If the key column is NULL. if the load fails. stored in a retrieval system. All rights reserved. The key column for a Referential Integrity check is validated by a Transformer stage. In this case. No part of this publication may be reproduced.Information Integration Solutions Center of Excellence 1. The merged records are grouped and ordered before being de-duplicated to remove obsolete records. .

Information Integration Solutions Center of Excellence 1. No part of this publication may be reproduced. . or translated into any language in any form by any means without the written permission of IBM. 2006 12 of 179 © 2006 IBM Information Integration Solutions. transcribed. stored in a retrieval system. All rights reserved.2. transmitted.3 Provisioning Jobs This example provisioning job demonstrates the straightforward approach to simple provisioning tasks. Parallel Framework Red Book: Data Flow Job Design July 17.

... and Data Directories /Project_Z Parallel Framework Red Book: Data Flow Job Design July 17. Figure 1: RecommendedGigabyte 1 DataStage Install.Information Integration Solutions Center of Excellence 2 Standards Establishing consistent development standards helps to improve developer productivity and reduce ongoing maintenance costs...1 Data.. transcribed.. transmitted. Install.. and Project Directory Structures The following diagrams depict the IBM WebSphere DataStage software directory structures and the support directory structures. or translated into any language in any form by any means without the written permission of IBM. 2006 13 of 179 /Projects / /Project_A © 2006 IBM Information Integration Solutions. Scratch. All rights reserved.1. stored in a retrieval system. These directories are configured during product installation.. 2.1 Directory Structures 2. File systems are highlighted in blue /Project_Z .. Install FS Install File System Scratch File Systems . / /DSEngine Data File Systems /PXEngine /Data0 /Configurations /Project_A . and to build technical and support documentation. /Ascential /Scratch0 /ScratchN /Project_A /patches /P /DataStage /Project_Z . . No part of this publication may be reproduced. Development standards can also make it easier to integrate external processes such as automated auditing and reporting. /DataN /P .

To scale I/O performance within DataStage. as a separate file system for the Projects sub directory within the DataStage installation. stored in a retrieval system. the administrator should consider creating separate file systems for each Scratch and Resource partition.. consider creating separate file systems for each Scratch and Data resource partition. Parallel Framework Red Book: Data Flow Job Design July 17. Scratch is used by the EE framework for temporary files such as buffer overflow. or translated into any language in any form by any means without the written permission of IBM. In general. No part of this publication may be reproduced. transcribed. All rights reserved. It is a bad practice to share the DataStage project file system and conductor file system with volatile files like scratch files and Parallel data set part files.Information Integration Solutions Center of Excellence By default. This is illustrated in the above diagram./Scratch $DSHOME/./Datasets The DataStage Administrator should ensure that these default directories are never used by any parallel configuration files. For this reason. projects should be installed in their own file system. sort memory overflow. 2006 14 of 179 © 2006 IBM Information Integration Solutions. . NOTE: On some operating systems. it is a bad practice to create DataStage projects in the default directory. as disk space is typically limited in production install directories. In order to scale I/O for DataStage. because they increase the risk of filling the DataStage project file systems. transmitted. This best practice advocates creating subdirectories for each project for each scratch and disk partition.. the DataStage Administrator client creates its projects (repositories) in the Projects directory of the DataStage installation directory. As a standard practice. The DataStage installation creates the following two directories: $DSHOME/. it is possible to create separate file systems at non-root levels. Consider naming the file systems in accordance with partition numbers in your DataStage EE Configuration file.

files are separated by Project name as shown below. If the file system is not /archive /archive /archive shared across multiple servers. error and reject files./archive of these development phases may be present on a local file not all system. /Staging /dev Top-Level Directory development data tree. /Project_Z July 17. 2006 15 of 179 .. and production) as appropriate.. or translated into any language in any form by any means without the written permission of IBM... target data files.. transmitted. location of source data files.. qa. stored in a retrieval system. No part of this publication may be reproduced. All rights reserved. subdirectory created for each project location of compressed archives created by archive process of previously processed files System Integration (also known as “test”) data tree Quality Assurance data tree Production data tree . /Project_A /archive /si /qa /prod Parallel Framework Red Book: Data Flow Job Design Figure 2: DataStage Staging Directories /Project_Z /Project_Z © 2006 IBM Information Integration Solutions. transcribed. . data directories are implemented for each deployment phase of a job (development.Information Integration Solutions Center of Excellence /Staging /dev /si /qa /prod /Project_A /Project_A /Project_A /Project_A /archive /archive /archive /archive ... /Project_Z Within the separate Staging file system. system integration. Within each deployment directory. .

.. transmitted. .2 Extending the DataStage Project for External Entities It is quite common for a DataStage application to be integrated with external entities. stored in a No part of this /Project_Z /Project_Z retrieval system. Project_Plus Project_Plus Directory Hierar /si /qa /prod /dev /Project_A /bin /src /doc /datasets /logs /params /schemas /scripts /sql /Project_A /bin /src /doc /datasets /logs /params /schemas /scripts /Project_A /bin /src /doc /datasets /logs /params /schemas /scripts /sql /Project_A /bin /s /d /datase /logs /param /schema /scripts /sql Figure 3: Project_Plus/sql Directory Structure Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions. 16 of 179 .1. another application or middle ware. which will enable DataStage applications to move through the life cycle without any code changes. or it could require scripts for example integrating with an Enterprise Scheduler. such as the operating system. All rights reserved. A directory structure should be created that organizes external entities and is directly associated with 1 and only 1 DataStage project.. or translated into any language in any form by any means without the written permission of IBM./Project_Z publication may be reproduced. through the use of environment variables... July 17. 2006 . /Project_Z ... To completely integrate all aspects of a DataStage application the directory structure that is used for integration with external entities should be defined in a way that provides a complete and separate structure in the same spirit as a DataStage project. Environment variables are a critical portability tool. The integration can be as simple as a file system for housing source files. The directory structure will be made transparent to the DataStage application. transcribed. .. This will provide a convenient vehicle to group and manage resources used by a project.Information Integration Solutions Center of Excellence 2.

directories are created for each deployment phase of a job (development. If the file system is not shared across multiple servers. transmitted. or translated into any language in any form by any means without the written permission of IBM. system integration. BuildOps.$ProjectName project files location of Orchestrate schema files location of operating system (shell) script files location of maintenance or template SQL system integration (aka “test”) code tree quality assurance code tree production code tree /datasets /logs /params /schemas /scripts /sql /si /qa /prod In support of a Project_Plus directory structure environment variable parameters should be configured. for example the following diagram shows Project_Plus variables as defined in the DataStage Administrator. stored in a retrieval system.Information Integration Solutions Center of Excellence Within the Project_Plus hierarchy. and shells location of documentation for programs found in /bin subdirectory location of source code and makefiles for items found in /bin subdirectory (Note: depending on change management policies. transcribed. 2006 17 of 179 © 2006 IBM Information Integration Solutions. No part of this publication may be reproduced. not all of these development phases may be present on a local file system. All rights reserved. . utilities. Parallel Framework Red Book: Data Flow Job Design July 17. Project_Plus /dev /Project_A /bin /doc /src Top-Level of Directory Hierarchy development code tree subdirectory created for each project location of custom programs. qa. DataStage routines. a copy of dsenv and copies of DSParams. and production) as appropriate.ds file) location of custom job logs and reports location of parameter files for automated program control. this directory may only be present in the /dev development code tree) location of DataSet header files (.

for example all jobs are invoked with the same Script. they do not facilitate ease of maintenance over time. or an XML extract Parallel Framework Red Book: Data Flow Job Design July 17. stored in a retrieval system. the Designer tool assigns default names based on the object type. While the default names may create a functional data flow.Information Integration Solutions Center of Excellence Figure 4: Project_Plus Environment Variables In some implementations. and the order the item is placed on the design canvas. A similar directory structure to the Project_Plus structure could be configured and referred to as DataStage_Plus. transmitted. transcribed. DataStage offers (within certain restrictions) flexibility to developers when naming various objects and components used to build a data flow.2 Naming Conventions As a graphical development environment. nor do they adequately document the business rules or subject areas. 2. All rights reserved. . No part of this publication may be reproduced. A consistent naming standard is essential to • maximize the speed of development • minimize the effort and cost of downstream maintenance • enable consistency across multiple teams and projects • facilitate concurrent development • maximize the quality of the developed application • increase the readability of the objects in the visual display medium • increase the understanding of components when seen in external systems. for example in WebSphere MetaStage. By default. or translated into any language in any form by any means without the written permission of IBM. 2006 18 of 179 © 2006 IBM Information Integration Solutions. there may be external entities that are shared with other DataStage projects.

the term “Standard” refers to those principles that are required. and so forth. Table. more readable names. All rights reserved. Where there is no sub classification required then the class word will simply refer to the object. Throughout this section. objects can be sub-typed (for example. in the case of a link object. the moving of a message).1 Key Attributes of the Naming Convention This naming convention is based on a three-part convention: Subject. transmitted. to be tuned according to needs. transcribed. In some cases where appropriate. Subject Modifier. In the case of a data store the class word will refer to the type of data store. Moving or Writing data (or within a Sequence Job. enabling a greater understanding of the requirements and greater control over how they are delivered. In these cases the class word represents the subtype. but not required. more effort can be put into analysis and design. while the term “Guideline” refers to recommended. while maintaining quality. Any set of standards needs to take on the culture of an organization. There are a number of benefits from using a graphical development tool like DataStage. • There can be a much tighter link between design and development. and Class Word In the context of DataStage. As an example. the class word is used to identify either a type of object or the function that a particular type of object will perform. 2. a Left Outer Join).2. principles.Information Integration Solutions Center of Excellence This section presents a set of standards and guidelines to apply to developing data integration applications using DataStage Enterprise Edition. the class word refers to the functions of Reading. View. Sequential File. stored in a retrieval system. the Class Word is represented as a two. drag and drop paradigm there is less typing involved hence the opportunity to use longer more meaningful. For example. . three or four letter abbreviation. and many of these benefits were used to establish this naming standard: • With rapid development. • Since much of the development work is done using a click. Where it is a two letter abbreviation both letters should be capitalized. Where it is a three or four letter abbreviation then it should be word capitalized. for example: Data Set. No part of this publication may be reproduced. Reference (Lookup). or translated into any language in any form by any means without the written permission of IBM. Parallel Framework Red Book: Data Flow Job Design July 17. so it is envisaged that these standards will develop and will adapt over time to suit both the organization and the purpose. a transformer might be named: Data_Block_Split_Tfm As a guideline. 2006 19 of 179 © 2006 IBM Information Integration Solutions.

2.Information Integration Solutions Center of Excellence A list of frequently-used Class Word abbreviations is provided in 12. is to enable two levels of sorting or grouping.there is a field that denotes whether the object is a column. All rights reserved. however. the abbreviated form is used. This can help make them more productive and makes their work more easily read. One benefit of using the Subject. The “Snap to Grid” feature of Designer can help improve development speed. For the purposes of documentation. a derivation. is maintaining documentation. Class Word approach. This type of approach takes extra effort at first. attention should be given to the layout to enhance readability before it is handed over to versioning. Secondly the class word approach enables sub-classification by object type to provide additional information. will be to separate words by an Underscore which will allow clear identification of each work in a name. No part of this publication may be reproduced. whatever tool you use. Like a logical name. stored in a retrieval system. the standard. over using the Prefix approach. when creating the object. and so forth. Establishing standards also eases use of external tools and Parallel Framework Red Book: Data Flow Job Design July 17.4. allowing sort either by subject matter or by object type.3 Documentation and Metadata Capture One of the major problems with any development effort. This should be enhanced by also using Word Capitalization.2. so a pattern of work needs to be identified and adopted to help development. documentation is often something that is left until later. For stages with multiple links. The key issue is readability. inadequately carried out.2 DataStage Naming Reference. all word abbreviations should be referenced by the long form to get used to saying the name in full even if reading the abbreviation. consideration should be made to provide DataStage developers with higher resolution screens as this provides them with more screen display real-estate. 2. 2. Though DataStage imposes some limitations on the type of characters and length of various object names. or translated into any language in any form by any means without the written permission of IBM. a link. Where possible. a stage. for example. When development is more or less complete. expanding the icon border can significantly improve readability. transmitted. This will help re-enforce wider understanding of the subjects. 2006 20 of 179 © 2006 IBM Information Integration Solutions. DataStage provides the ability to document during development with the use of meaningful naming standards (as outlined in this section). transcribed. the object type is defined in a separate field. where possible. Carrying this information as a separate attributes enables the first word of the name to be used as the subject matter. Subject Modifier. In WebSphere MetaStage. the first letter of each Word should be capitalized. a job design.2 Designer Object Layout The effective use of naming conventions means that objects need to be spaced appropriately on the DataStage Designer canvas. . Though best intentions are always apparent. This is the same or similar information that would be carried in a prefix approach.

2 Category Hierarchy DataStage organizes objects in its repository by Categories. The name of a DataStage Project may only be 18 characters in length. .4 Naming Conventions by Object Type 2. developers have the flexibility to define their own Directory or Category hierarchy. the structure “A Test\Lower\Lower Still” is shown below: Parallel Framework Red Book: Data Flow Job Design July 17. Table definitions…). and Production (“Prod”).2. Routines.4. 2. Therefore Directory names should be Word Capitalized and separated by either an underscore or a space.4. it can contain alpha-numeric characters and it can contain underscores. as well as documentation and auditing. are Alpha Numeric and can also contain both Spaces and Underscores.4. This factor often can cause terminology issues especially in teamwork where both business and developers are involved. 2. allowing related objects to be grouped together.Information Integration Solutions Center of Excellence processes such as WebSphere MetaStage. or translated into any language in any form by any means without the written permission of IBM. It may or may not have a one to one relationship with an organizations’ project of work. stored in a retrieval system. For example. 2006 21 of 179 © 2006 IBM Information Integration Solutions.3 Job Category Naming Within Designer. transmitted.2. However with the limit of 18 characters the name is most often composed of abbreviations. Shared Containers.2.1 Projects Each DataStage Project is a standalone repository. transcribed.2. Examples of Project naming where the project is single application focused are: • “Accounting Engine NAB Development” would be named: Acct_Eng_NAB_Dev • “Accounting Engine NAB Production” would be named: Acct_Eng_NAB_Prod Examples of Project naming where the project is multi-application focused are: • Accounting Engine Development or Acct_Engine_Dev • Accounting Engine Production or Acct_Engine_Prod 2. dialog box fields that specify a new category have only one input area for defining the Category name. No part of this publication may be reproduced. DataStage enforces the top level Directory Structure for different types of Objects (for example. Category Names can be long. Multiple levels of Hierarchy are named by specifying the Hierarchy levels separated by a backslash (“\”). Test (“Test”). The suffix of a Project name should be used to identify Development (“Dev”). Jobs. Below this level. which can provide impact analysis. All rights reserved.

not within a category. Within each functional module category.Information Integration Solutions Center of Excellence Figure 5: Creating Category Hierarchies The main reason for having Categories is to group related objects. Where possible. . Note that Job names must be unique within a DataStage project. 2006 22 of 179 © 2006 IBM Information Integration Solutions. a Category level should only contain objects that are directly related. For example. a job category might contain a Job Sequence and all the jobs and only those jobs that are contained in that sequence. For example. jobs that read write-through cache for a ECRP subset in the ECRDEV project that cleanse and load multi-family mortgage data and are driven by a sequencer might have a hierarchy that looks like the following example: Parallel Framework Red Book: Data Flow Job Design July 17. with sub-levels for individual functional modules. transmitted. No part of this publication may be reproduced. stored in a retrieval system. All rights reserved. Organizing related DataStage objects within categories also facilitates backup/export/import/change control strategies for projects since Manager can import/export objects by category grouping. Jobs and Job Sequences are grouped together in the same scope as the technical design documents. all Jobs and Job Sequences will be grouped in a single parent Category. transcribed. Categorization by Functional Module For a given application. or translated into any language in any form by any means without the written permission of IBM.

DataStage assigns the level names based on the source of the metadata import (for example. Table Definitions are always categorized using two level names. ECRP and Templates. establishing a Table Definition categorization that matches project development organization is recommended. but this can be overridden during import. All rights reserved. and there are 2 additional high-level categories.4 Table Definition Categories Unlike other types of DataStage objects. Once created.).. or translated into any language in any form by any means without the written permission of IBM. When implementing a customized Table Definition categorization. and the responsibility of the development manager assigned the DataStage Manager role to ensure that projects are not obese with unused jobs. categories and metadata. stored in a retrieval system. No part of this publication may be reproduced. two developers have private categories for sandbox and development activities. Remembering that Job names must be unique within a given project. two developers cannot save a copy of the same job with the same name within their individual “sandbox” categories – a unique Job name must be given. The placement of these fields varies with the method of metadata import. PlugIn. Orchestrate.4.Information Integration Solutions Center of Excellence Figure 6: Categorization by Functional Module Categorization by Developer In development projects. care must be taken to override the default choices for category names during Table Definition import. TableDefs that remain in the Saved category Parallel Framework Red Book: Data Flow Job Design July 17. they must be moved to the appropriate category and re-imported from that category in every job where they are used. It is the responsibility of each developer to delete unused or obsolete code. Temporary TableDefs created by developers to assist with job creation appear under the Saved category by default. transmitted. On import. 2. . Although the default table definition categories are useful from a functional perspective. etc.. 2006 23 of 179 © 2006 IBM Information Integration Solutions.2. transcribed. By default. In the previous illustration. if these TableDefs are to be used by other jobs. project manager. Saved. the first level Table Definition category is identified as the “Data Source Type” and the second level categorization is referred to as the “Data Source Name” as shown in the example on the below. New Table Definition categories can be created within the repository by right-clicking within the Table Definitions area of the DataStage project repository and choosing the “New Category” command. categories will be created for each developer as their personal sandbox and place they perform unit test activities on jobs they are developing.

Parallel Framework Red Book: Data Flow Job Design July 17. Figure 7: Table Definition Categories 2. and underscores only. transmitted. transcribed. e. This will be discussed further in Section 2.g: DWPH1 or ECRP. Job and Job Sequence names should be descriptive and should use word capitalization to make them readable. stored in a retrieval system.Information Integration Solutions Center of Excellence should be deleted as soon as possible. Examples of Job naming are: • CodeBlockAggregationJob • CodeBlockProcessingSeq Jobs should be organized under Category Directories to provide grouping such that a Directory should contain a Sequence Job and all the Jobs that are contained within that sequence. numbers.2. 2006 24 of 179 © 2006 IBM Information Integration Solutions. with sub-categories intended to identify the type of the source.5 Jobs and Job Sequences Job names must begin with a letter and can contain letters. A Job will be suffixed with the class word “Job” and a Job Sequence will be suffixed with the class word “Seq”. An alternative implementation is to set the “Data source name” to that of the source system or schema.2.: Datasets. All rights reserved. No part of this publication may be reproduced. Jobs and Job Sequences are all held under the Category Directory Structure of which the top level is the category “Jobs”.2 Category Hierarchy. In this example. e. The following is one of the TableDefs from this project showing how to correctly specify the category and sub-category. Each subject area will have a master category.4. the TableDefs have been grouped into a master category of Custom. or translated into any language in any form by any means without the written permission of IBM.g.4. Because the name of can be long. .

during Link Ordering).4. transcribed. when sharing data with external applications (for Parallel Framework Red Book: Data Flow Job Design July 17. 2006 25 of 179 © 2006 IBM Information Integration Solutions.2.7 Parameters A Parameter can be a long name consisting of alphanumeric characters and underscores. having a descriptive link name reduces the chance for errors (for example. Furthermore. It is optional as to whether you decide to change this code to something meaningful.4.4. 2. so word capitalization should be used for readability.Information Integration Solutions Center of Excellence 2. . stored in a retrieval system. Examples of Parameter naming are: • Audit_Trail_Output_Path_Parm • Note where this is used in a stage property. Therefore the parameter name must be made readable using Capitalized words separated by underscores.2. links represent the flow of a message from one activity / step to the next. stage editors identify links by name. instead of using the default “DSLink#” (where “#” is an assigned number). or translated into any language in any form by any means without the written permission of IBM. a character code is automatically added to that instance of its use throughout the project. links are objects that represent the flow of data from one stage to the next. Examples of Shared Container naming are: • AuditTrailPsc (this is the original as seen in the Category Directory) • AuditTrailPscC1 (This is an instance of use of the above shared container) • AuditTrailPscC2 (This is another instance of use of the same shared container) In the above examples the characters “C1” and the “C2” are automatically applied to the Shared Container Stage by DataStage Designer when dragged onto the design canvas. The class word suffix is “Parm”.2. No part of this publication may be reproduced. Within a Job Sequence. All rights reserved. transmitted. To differentiate between Parallel Shared Containers and Server Shared Containers. When a Shared Container is used. the following Class Word naming is recommended: • Psc = Parallel (Enterprise Edition) Shared Container • Ssc = Server Edition Shared Container IMPORTANT: Use of Server Edition Shared Containers is discouraged within a parallel job. Shared containers have their own Category Directory and consideration should be given to a meaningful Directory Hierarchy. It is particularly important to establish a consistent naming convention for link names.8 Links Within a DataStage Job. Within the graphical Designer environment. the parameter name is delimited by the # sign: #Audit_Trail_Output_Path_Parm# 2.6 Shared Containers Shared containers have the same naming constraints as jobs in that the name can be long but can not contain underscores.

through Job reporting). No part of this publication may be reproduced.9 Stage Names DataStage assigns default names to stages as they are dragged onto the Designer canvas. stored in a retrieval system. etc) • The type of movement may optionally be part of the Class Word. for example: o “In” for input o “Out” for output o “Upd” for updates o “Ins” for inserts o “Del” for deletes o “Get” for shared container inputs o “Put” for shared container output As data is enriched through stages. . (The DataStage Designer does not require link names on different stages to be unique. a 2. transmitted. All rights reserved. These names are based on the type of stage (object) and a unique number. or translated into any language in any form by any means without the written permission of IBM. after the subject name and subject modifier. Instead of using the full object name. Transformer. reject) to reinforce the visual cues of the Designer canvas: o “Ref” for reference links (Lookup) o “Rej” for reject links (Lookup.2 DataStage Naming Reference. Parallel Framework Red Book: Data Flow Job Design July 17. the same name may be appropriate for multiple links.) • Examples Link names: • Input Transactions: “lnk_Txn_In” • Reference Account Numbers: “lnk_Account_Ref” • Customer File Rejects: “lnk_Customer_Rej” • Reception Succeeded Message or “lnk_Reception_Succeeded_Msg” 2.4. In this case. or 4 character abbreviation should be used for the Class Word suffix. A list of frequently-used stages and their corresponding Class Word abbreviation may be found in 12. Within a Job or Job Sequence.4. Merge. 2006 26 of 179 © 2006 IBM Information Integration Solutions. based on the order the object was added to the flow. Sequential File. always specify a unique link name within a particular Job or Job Sequence by including a number. transcribed.Information Integration Solutions Center of Excellence example. stage names must be unique. Database.2. establishing standardized link names makes it easier to understand results and audit counts. 3. The following rules can be used to establish a link name: • Use the prefix “lnk_” before the subject name to differentiate with stage objects • The link name should define the subject of the data that is being moved • For non-stream links. the link name should include the link type (reference.

Information Integration Solutions Center of Excellence

2.2.4.10 Data Stores For the purposes of this section, a data store is a physical piece of disk storage where data is held for some period of time. In DataStage terms, this can be either a table in a database structure or a file contained within a disk directory or catalog structure. Data held in a database structure is referred to as either a Table or a View. In data warehousing, two additional subclasses of table might be used: Dimension and Fact. Data held in a file in a directory structure will be classified according to its type, for example: Sequential File, Parallel Data Set, Lookup File Set, etc. The concept of source and target can be applied in a couple of ways. Every job in a series of jobs could consider the data it gets in to be a source and the data it writes out as being a target. However for the sake of this naming convention a Source will only be data that is extracted from an original system and Target will be the data structures that are produced or loaded as the final result of a particular series of jobs. This is based on the purpose of the project – to move some data from a source to a target. Data Stores used as temporary structures to land data between jobs, supporting restart and modularity, should use the same names in the originating job and any downstream jobs reading the structure. Examples of Data Store naming are: • Transaction Header Sequential File or Txn_Header_SF • Customer Dimension or Cust_Dim (This optionally could be further qualified as Cust_Dim_Tgt if you wish to qualify it as a final target) • Customer Table or Cust_Tab • General Ledger Account Number View or GL_Acctno_View 2.2.4.11 Transformer Stage and Stage Variables A Transformer Stage name can be long – over 50 characters and can contain underscores. Therefore the name can be descriptive and readable through word capitalization and underscores. DataStage Enterprise Edition supports two types of Transformers: • “Tfm”: Parallel (Enterprise Edition) Transformer • “BTfm”: BASIC (Server Edition) Transformer IMPORTANT: For maximum performance and scalability, BASIC Transformers should be avoided in Enterprise Edition data flows. A Transformer Stage Variable can have a long name consisting of alphanumeric characters but not underscores. Therefore the Stage Variable name must be made readable only by using Capitalized words. The Class Word suffix is Stage Variable or “SV”. Stage Variables should be named according to their purpose.

Parallel Framework Red Book: Data Flow Job Design

July 17, 2006

27 of 179

© 2006 IBM Information Integration Solutions. All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language in any form by any means without the written permission of IBM.

Information Integration Solutions Center of Excellence

When developing Transformer derivation expressions, it is important to remember Stage variable names are case sensitive. 2.2.4.12 DataStage Routines DataStage BASIC routine names will indicate their function and they will be grouped in sub-categories by function under a main category of Custom, for example.: Routines/Custom/SetDSParamsFromFile. A How-To document describing the appropriate use of the routine must be provided by the author of the routine, and placed in a documentation repository. DataStage Custom Transformer routine names will indicate their function and they will be grouped in sub-categories by function under a main category of Custom, for example: Routines/Custom/DetectTeradataUnicode. Source code, a makefile, and the resulting object for each Custom Transformer routine must be placed in the project phase source directory, e.g.: /home/dsadm/dev/bin/source. 2.2.4.13 File Names Source file names should include the name of the source database or system and the source table name or copybook name. The goal is to connect the name of the file with the name of the storage object on the source system. Source flat files will have a unique serial number composed of the date, “_ETL_” and time, for example: Client_Relationship_File1_In_20060104_ETL_184325.psv. Intermediate datasets are created between modules. Their names will include the name of the module that created the dataset OR the contents of the dataset in that more than one module may use the dataset after it is written, for example: BUSN_RCR_CUST.ds Target output files will include the name of the target database or system, the target table name or copybook name. The goal is the same as with source files – to connect the name of the file with the name of the file on the target system. Target flat files will have a unique serial number composed of the date, “_ETL_” and time, for example: Client_Relationship_File1_Out_20060104_ETL_184325.psv Files and datasets will have suffixes that allow easy identification of the content and type. DataStage proprietary format files have required suffixes and are identified in italics in the table below which defines the types of files and their suffixes. File Type
Parallel Framework Red Book: Data Flow Job Design

Suffix
July 17, 2006 28 of 179

© 2006 IBM Information Integration Solutions. All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language in any form by any means without the written permission of IBM.

Information Integration Solutions Center of Excellence

Flat delimited and non-delimited files Flat pipe (|) delimited files Flat comma-and-quote delimited files DataStage datasets DataStage filesets DataStage hash files Orchestrate schema files Flat delimited or non-delimited REJECT files DataStage REJECT datasets Flat delimited or non-delimited ERROR files DataStage ERROR datasets Flat delimited or non-delimited LOG files .dat. .psv .csv. .ds. .fs .hash. .schema. .rej. _rej.ds. .err. _err.ds. .log.

2.3

Documentation and Annotation

DataStage Designer provides description fields for each object type. These fields allow the developer to provide additional descriptions that can be captured and used by administrators and other developers. The Short Description field is also displayed on summary lines within the Director and Manager clients. At a minimum, description annotations must be provided in the Job Properties Short Description field for each job and job sequence, as shown below:

Figure 8: Job Level Short Description Within a job, the Annotation tool should be used to highlight steps in a given job flow. Note that by changing the vertical alignment properties (for example, Bottom) the annotation can be drawn around the referenced stage(s), as shown in the following example.
Parallel Framework Red Book: Data Flow Job Design July 17, 2006 29 of 179
© 2006 IBM Information Integration Solutions. All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language in any form by any means without the written permission of IBM.

These descriptions will appear in the job documentation automatically generated from jobs and sequencers adhering to the standards in this document.Information Integration Solutions Center of Excellence Figure 9: Example Job Annotation DataStage also allows descriptions to be attached to each stage within the General tab of the stage properties. Parallel Framework Red Book: Data Flow Job Design July 17.RcR_GLOBAL_BUSN_CAT_TYP table from jpORACLE_SERVER using the ODBC driver. transmitted. No part of this publication may be reproduced. Each stage should have a short description of its function specified within the stage properties. There are no selection criteria in the WHERE clause. Oracle Enterprise stage read: Read the GLOBAL. transcribed. 2006 30 of 179 © 2006 IBM Information Integration Solutions. Examples of such annotations include: Job “short” description: This Job takes the data from GBL Oracle Table AD_TYP and does a truncate load into Teradata Table AD_TYP. ODBC Enterprise stage read: Read the GLO. There are no selection criteria in the WHERE clause. All rights reserved. .GLOBAL_REST_CHAR table from jpORACLE_SERVER using the Oracle Enterprise operator. or translated into any language in any form by any means without the written permission of IBM. stored in a retrieval system. More complex operators or operations should have correspondingly longer and more complex explanations on this tab.

This stage renames and/or drops columns and is NOT optimized out. Transformer stage: This stage generates sequence numbers that have a less-than file scope. table definitions. job scheduler configurations. This stage identifies changes and drops records not matched (not updated). custom components) during job development. Teradata MultiLoad stage: Load the RcR_GLOBAL_LCAT_TYP table. transmitted. Modify stage: This stage performs data conversions not requiring a transformer. . or translated into any language in any form by any means without the written permission of IBM. However. sequences. environment files. transcribed. Copy stage This stage sends data to the TDMLoadPX stage for loading into Teradata. Parallel Framework Red Book: Data Flow Job Design July 17. which is used as write-through cache to avoid the use of Teradata.Information Integration Solutions Center of Excellence Remove Duplicates stage This stage removes all but one record with duplicate BUSN_OWN_TYP_ID keys. Data Set stage: This stage writes the GLOBAL_Ad_Typ dataset which is used as write-through cache to avoid the use of Teradata in subsequent jobs.) that may be part of a completed application. stored in a retrieval system. This stage validates the input and continues. Sequential file stage: This is the source file for the LANG table. and to a dataset for use as write-through cache. No part of this publication may be reproduced. UNIX shell scripts. All rights reserved. This stage reads the GLOBAL_Lcat dataset. routines. etc.4 Working with Source Code Control Systems DataStage’s built-in repository manages objects (jobs. 2. this repository is not capable of managing nonDataStage components (for example. This stage converts null dates. This stage is cosmetic and is optimized out. This is the target file for business qualification process rejects. 2006 31 of 179 © 2006 IBM Information Integration Solutions. Lookup stage This stage validates the input and writes rejects.

SCCS) are useful for managing the development lifecycle of all components of an application. This object grouping also helps establish a manageable “middle ground” between an entire project exports and individual object exports.DSX is the recommended export format. it is important that an identified individual maintains backup copies of the important job designs using .for example.DSX (DataStage eXport format) or . 2.) from the repository as clear-text format files. you can export objects (job designs. Grouping related objects by folder can simplify the process of exchanging information with the external source code control system. The export file format for DataStage objects can be either . Both formats contain the same information. No part of this publication may be reproduced. PVCS. but it does offer the ability to exchange information with these systems. Furthermore. rules should be defined for when this transfer should take place. b) Define rules for exchange with source code control As a graphical development environment. . organized into specific releases for version control.DSX file exports to a local or (preferably) shared file system. and cannot be used to restore individual objects. transmitted. transcribed. It is the responsibility of the DataStage developer to maintain DataStage objects within the source code system. they would not be an effective backup strategy. etc. Parallel Framework Red Book: Data Flow Job Design July 17. unit test. Rather. It would be cumbersome to require the developer to check-in every change to a DataStage object in the external source code control system. stored in a retrieval system.4. Designer facilitates iterative job design. operating system backups of the project repository files only establish a “point in time”. For these reasons. table definitions. Using Manager. DataStage does not directly integrate with source code control systems. milestone points on the development lifecycle are a good point for transferring objects to the source code control system . although the XML file is generally much larger. Unless there is a need to parse information in the export file. when a set of objects has completed initial development. These files can then be checked into the external source code control system. The Manager client is the primary interface to the DataStage object repository. or translated into any language in any form by any means without the written permission of IBM. custom stage types.XML. c) Don’t rely on the source code control system for backups Because the rules defined for transfer to the source code control system will typically be only at milestones in the development cycle.Information Integration Solutions Center of Excellence Source code control systems (such as ClearCase. 2006 32 of 179 © 2006 IBM Information Integration Solutions. . and so on. user-defined routines.1 Source Code Control Standards The first step to effective integration with source code control systems is to establish standards and rules for managing this process: a) Establish Category naming and organization standard DataStage objects can be exported individually or by category (folder hierarchy). Typically. All rights reserved.

4. 2006 33 of 179 Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions. the developer should create a local backup prior to implementing any extensive changes. No part of this publication may be reproduced. • Select the object or category in the Manager browser. Figure 10: Manager Category browser • Choose “Export DataStage Components” from the “Export” menu. These utilities (dsexport and dscmdexport) are documented in the DataStage Manager Guide.3 Export to Source Code Control System The process of exporting DataStage objects to a source code control system is a straightforward process. The DataStage client includes Windows command-line utilities for automating the export process.4. July 17. There is no server-side project export facility. It can be done interactively by the developer or project manager using the Manager client. All exports from the DataStage repository are performed on the Windows workstation.2 Using Object Categorization Standards As discussed in Section 2. or by the individual DataStage developer. stored in a retrieval system. The DataStage Manager can export at the Project. or translated into any language in any form by any means without the written permission of IBM. . Assigning related objects to the same category provides a balanced level of granularity when exporting and importing objects with external source code control systems. In either case.4.2. All rights reserved. transcribed. 2.Information Integration Solutions Center of Excellence These backups can be done on a scheduled basis by an Operations support group. transmitted. establishing and following a consistent naming and categorization standard is essential to the change management process.2 Category Hierarchy. and individual Object levels. as explained in this section. 2. Category.

• Using your source code control utilities. If you wish to include compiled Transformer objects for a selected job. or automated through command-line utilities. or translated into any language in any form by any means without the written permission of IBM. .4. All rights reserved.4 Import from Source Code Control System In a similar manner. make sure the “Job Executables” category is checked. transmitted. Figure 11: Manager Export Options To export a group of objects to a single export file. the import of objects from an external source code control system is a straightforward process. the option “Selection: By category” should be specified in the “Options” tab. Make sure all objects are saved and closed before exporting. Import can be interactive through the Manager client (as described in this section). check-in the exported .DSX file 2. Parallel Framework Red Book: Data Flow Job Design July 17. stored in a retrieval system. 2006 34 of 179 © 2006 IBM Information Integration Solutions. The filename for export is specified in the “Export to file:” field at the top of the Export dialog. No part of this publication may be reproduced.Information Integration Solutions Center of Excellence NOTE: Objects cannot be exported from DataStage if they are open in Designer. transcribed.

No part of this publication may be reproduced.Information Integration Solutions Center of Excellence Unlike the export process.DSX file using Manager. as documented in the DataStage Development Kit chapter of the Parallel Job Advanced Developer’s Guide.5 Understanding a Job’s Environment DataStage Enterprise Edition provides a number of environment variables to enable / disable product features and to fine-tune job performance. Figure 12: Manager Import options • • The import of the . • • Use the source code control system to check-out (or export) the . This means that if necessary it will create the Job Category if it doesn't already exits. . then compile the imported objects from Designer. it is possible to import the job executables from the DataStage server host using the dsjob command-line. The Windows workstation utilities (dsimport and dscmdimport) are documented in the DataStage Manager Guide. transcribed. Note that using dsjob will only import job executables job designs can only be imported using the Manager client or the dsimport or dscmdimport client tools. Although operating system environment variables can be set in multiple places.DSX file will place the object in the same DataStage category it originated from. After selecting your file. By default (in a root installation). there is a defined order of precedence that is evaluated when a job’s actual environment is established at runtime: 1) The daemon for managing client connections to the DataStage server engine is called dsrpcd. click OK to import. Select the file you checked out of your source code control system by clicking on the ellipsis (“…”) next to the filename field in the import dialog. 2006 35 of 179 © 2006 IBM Information Integration Solutions. 2. dsrpcd is started when the server installed. Import objects in the . stored in a retrieval system.DSX file to your client workstation. command-line import utilities are available for both Windows workstation and DataStage server platforms. All rights reserved. For test and production environments. or translated into any language in any form by any means without the written permission of IBM. transmitted. Choose “Import DataStage Components” from the “Import” menu. and should start Parallel Framework Red Book: Data Flow Job Design July 17. or using the Multi-Job Compile tool. If the objects were not exported with the “Job Executables”.

Information Integration Solutions Center of Excellence whenever the machine is restarted.profile script. transmitted. the dsrpc environment is not inherited since DataStage jobs do not execute on the conductor node. 2006 36 of 179 © 2006 IBM Information Integration Solutions. or translated into any language in any form by any means without the written permission of IBM. $PROJDEF Parallel Framework Red Book: Data Flow Job Design July 17. and Production Automation Best Practice for additional details. on UNIX platforms is set in the etc/profile and $DSHOME/dsenv scripts. Any project-level environment variables must be set for new projects using the Administrator client. Refer to the DataStage Administration. environment variables may be defined for a particular job using the Job Properties dialog box. (For more information. 3) Within Designer. Typically this is used to pickup values set in the operating system outside of DataStage. Any job-level settings for a specific environment variable will override any settings inherited from dsrpcd or from project-level defaults. On Windows. On USS environments. the Designer parses the corresponding parallel configuration file to obtain a list of node maps and constraints (advanced stage properties). • causes the project default value for the environment variable (as shown on the Administrator client) to be picked up and used to set the environment variable and job parameter for the job.) By default. stored in a retrieval system. To avoid hard-coding default values for job parameters. transcribed. . there are three special values that can be used for environment variables within job parameters: • causes the value of the named environment variable to be retrieved from the operating system of the job environment. or by carefully editing the DSPARAMS file within the project. 2) Environment variable settings for particular projects can be set in the DataStage Administrator client. dsrpcd can also be manually started and stopped using the $DSHOME/uv – admin command. $ENV NOTE: $ENV should not be used for specifying the default $APT_CONFIG_FILE value because. Management. it is important to note that project-level environment variable settings are not exported when a project is exported. All rights reserved. Note that client connections DO NOT pick up per-user environment settings from their $HOME/. see the DataStage Administrator Guide. These settings are stored in a file named DSPARAMS in the project directory. during job development. No part of this publication may be reproduced. Any project-level settings for a specific environment variable will override any settings inherited from dsrpcd. the default DataStage environment is defined in the registry. DataStage jobs inherit the dsrpcd environment. which. IMPORTANT: When migrating projects between machines or environments.

2 Understanding the Parallel Job Score) Includes a copy of the generated osh in the job’s DataStage log Outputs record counts to the DataStage job log as each operator completes processing.5. 2. and to document a few that are not part of the documentation. Places entries in DataStage job log showing UNIX process ID (PID) for each process started by a job. This setting should be disabled by default.1 Environment Variable Settings for All Jobs IBM recommends the following environment variable settings for all DataStage Enterprise Edition jobs.Information Integration Solutions Center of Excellence • causes the environment variable to be removed completely from the runtime environment. This variable should be included in all job parameters so that it can be easily changed at runtime. or may be set on an individual basis within the properties for each job. Environment Variable $APT_CONFIG_FILE Setting filepath 1 $APT_DUMP_SCORE $OSH_ECHO $APT_RECORD_COUNTS 1 0 Description Specifies the full pathname to the EE configuration file.4. All rights reserved. This setting should be disabled by default. Maximum buffer delay in seconds $OSH_PRINT_SCHEMA 0 $APT_PM_SHOW_PIDS 1 $APT_BUFFER_MAXIMUM_TIMEOUT 1 Parallel Framework Red Book: Data Flow Job Design July 17. $UNSET 2. Several environment variables are evaluated only for their presence in the environment (for example. 2006 37 of 179 © 2006 IBM Information Integration Solutions. It may be helpful to create a Job Template and include these environment variables in the parameter settings. processes. stored in a retrieval system. or translated into any language in any form by any means without the written permission of IBM. but part of every job design so that it can be easily enabled for debugging purposes.5. This section is intended to call attention to some specific environment variables. (see 12. and Data Sets. transmitted. Outputs actual runtime metadata (schema) to DataStage job log. No part of this publication may be reproduced. providing detailed information about actual job flow including operators. transcribed. The count is per operator per partition.1 Environment Variable Settings An extensive list of environment variables is documented in the DataStage Parallel Job Advanced Developer’s Guide. Does not report PIDs of DataStage “phantom” processes started by Server shared containers. Outputs EE score dump to the DataStage job log. Extremely useful for understanding how a job actually ran in the environment.1. but part of every job design so that it can be easily enabled for debugging purposes. These settings can be made at the project level. APT_SORT_INSERTION_CHECK_ONLY). .

or translated into any language in any form by any means without the written permission of IBM. or changing the default behavior of specific Enterprise Edition stages. Parallel Framework Red Book: Data Flow Job Design July 17.1.5.2 Additional Environment Variable Settings Throughout this document. you must define the environment variable $APT_IO_NOMAP On Tru64 5.Information Integration Solutions Center of Excellence On Solaris platforms only: When working with very large parallel Data Sets (where the individual data segment files are larger than 2GB). This setting instructs EE to use named pipes rather than shared memory for local data transport. the environment variable $APT_PM_NO_SHARED_MEMORY should be set to 1 to work around a performance issue with shared memory MMAP operations. transmitted. 2. All rights reserved. stored in a retrieval system. a number of environment variables will be mentioned for tuning the performance of a particular job flow. . The environment variables mentioned in this document are summarized in Appendix D: Environment Variable Reference. No part of this publication may be reproduced. An extensive list of environment variables is documented in the DataStage Parallel Job Advanced Developer’s Guide.1A platforms only: On Tru64 platforms. transcribed. 2006 38 of 179 © 2006 IBM Information Integration Solutions. assisting in debugging.

1 Modular Development Modular development techniques should be used to maximize re-use of DataStage jobs and components: • Job parameterization allows a single job design to process similar logic instead of creating multiple copies of the same job. o For example. if the extract of source data takes a long time (such as an FTP transfer over a wide area network) it would be good to land the extracted source data to a parallel data set before processing. transcribed. intermediate work files. Factors to consider when establishing job boundaries include:  Establishing job boundaries through intermediate Data Sets creates “checkpoints” that can be used in the event of a failure when processing must be restarted. and so forth. password. For example. or translated into any language in any form by any means without the written permission of IBM. this may not be appropriate. While it may be possible to construct a large. user. No part of this publication may be reproduced. processing must be restarted from the beginning of the job flow. transmitted. complex job that satisfies given functional requirements. Without these checkpoints. stored in a retrieval system. o As another example. functional requirements may dictate job boundaries. A set of standard job parameters should be used in DataStage jobs for source and target database parameters (DSN. . it is generally a good idea to land data to a parallel Data Set before loading to a target database unless the data volume is small or the overall time to process the data is minimal.Information Integration Solutions Center of Excellence 3 Development Guidelines 3. To ease re-use. It is for these reasons that long-running tasks are often segmented into separate jobs in an overall sequence. create re-usable components such as parallel shared containers to encapsulate frequently-used logic. All rights reserved. In some cases. these standard parameters and settings should be made part of a Designer Job Template. it may be appropriate to update all dimension values before inserting new entries in a data warehousing fact table.2 Establishing Job Boundaries It is important to establish appropriate job boundaries when developing with DS/EE. Parallel Framework Red Book: Data Flow Job Design July 17. Create a standard directory structure outside of the DataStage project directory for source and target files. etc) and directories where files are stored. Where possible. The Multiple-Instance job property allows multiple invocations of the same job to run simultaneously. 2006 39 of 179 © 2006 IBM Information Integration Solutions. But functional requirements may not be the only factor driving the size of a given DataStage job. • • • 3.

Information Integration Solutions Center of Excellence

Larger, more complex jobs require more system resources (CPU, memory, swap) than a series of smaller jobs, sequenced together through intermediate Data Sets. Resource requirements are further increased when running with a greater degree of parallelism specified by a given configuration file. However, the sequence of smaller jobs generally requires more disk space to hold intermediate data, and the speed of the I/O subsystem can impact overall end-to-end throughput. Section 12.3: Minimizing Runtime Processes and Resource Requirements provides some recommendations for minimizing resource requirements of a given job design, especially when the volume of data does not dictate parallel processing.

Breaking large job flows into smaller jobs may further facilitate modular development and reuse if business requirements for more than one process depend on intermediate data created by an earlier job. The size of a job directly impacts the speed of development tasks such as opening, saving, and compiling. These factors may be amplified when developing across a wide-area or high-latency network connection. In extreme circumstances this can significantly impact developer productivity and ongoing maintenance costs. The startup time of a given job is directly related to the number of stages and links in the job flow. Larger more complex jobs require more time to startup before actual data processing can begin. Job startup time is further impacted by the degree of parallelism specified by the parallel configuration file. Remember that the number of stages in a parallel job includes the number of stages within each shared container used in a particular job flow.

As a rule of thumb, keeping job designs to less than 50 stages may be a good starting point. But this is not a hard-and-fast rule. The proper job boundaries are ultimately dictated by functional / restart / performance requirements, expected throughput and data volumes, degree of parallelism, number of simultaneous jobs and their corresponding complexity, and the capacity and capabilities of the target hardware environment. Combining or splitting jobs is relatively easy, so don't be afraid to experiment and see what works best for your jobs in your environment.

3.3

Job Design Templates

DataStage Designer provides the developer with re-usable Job Templates, which can be created from an existing Parallel Job or Job Sequence using the “New Template from Job” command.

Parallel Framework Red Book: Data Flow Job Design

July 17, 2006

40 of 179

© 2006 IBM Information Integration Solutions. All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language in any form by any means without the written permission of IBM.

Information Integration Solutions Center of Excellence

Template jobs should be created with: - standard parameters (for example, source and target file paths, database login properties…) - environment variables and their default settings (as outlined in Section 2.5.1 Environment Variable Settings) - annotation blocks In addition, template jobs may contain any number of stages and pre-built logic, allowing multiple templates to be created for different types of “standardized” processing. By default, the Designer client stores all job templates in the local “Templates” directory within the DataStage client install directory, for example, C:\Program Files\Ascential\DataStage751\Templates To facilitate greater re-use of job templates, especially in a team-based development, the template directory can be changed using the Windows Registry Editor. This change must be made on each client workstation, by altering the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Ascential Software\DataStage Client\CurrentVersion\Intelligent Assistant\Templates

3.4

Default Job Design

Default job designs include all of the capabilities detailed Section 2: Standards. Template jobs should contain all the default characteristics and parameters the project requires. These defaults provide at a minimum: 1. 2. 3. 4. 5. Development phase neutral storage (e.g.: dev, si, qa and prod); Support for Teradata, Oracle, DB2/UDB and SQL Server login requirements; Enforced project standards; Optional operational metadata (runtime statistics) suitable for loading into a database; and Optional auditing capabilities.

The default job design specifically will support the creation of write-through cache in which data in load-ready format is stored in DS/EE Data Sets for use in the load process or in the event the target table becomes unavailable. The default job design incorporates several features and components of DataStage that are used together to support tactical and strategic job deployment. These features include: 1. Re-start-able job sequencers which manage one or more jobs, detect and report failure conditions, provide monitoring and alert capabilities and support checkpoint restart functionality. 2. Custom routines written in DataStage BASIC (DS Basic) that detect external events, manage and manipulate external resources, provide enhanced notification and alert capabilities and interface to the UNIX operating system. 3. DataStage Enterprise Edition (DS/EE) ETL jobs that exploit job parameterization, runtime UNIX environment variables, and conditional execution.
Parallel Framework Red Book: Data Flow Job Design July 17, 2006 41 of 179
© 2006 IBM Information Integration Solutions. All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language in any form by any means without the written permission of IBM.

Information Integration Solutions Center of Excellence

Each subject area is broken into sub-areas and each sub-area may be further subdivided. These sub-areas are populated by a DataStage job sequencer utilizing 2 types of DataStage jobs at a minimum: 1. A job that reads source data and • Transforms it to load-ready format • Optionally stores its results in a write-through cache DataStage Data Set or loads the data to the target table. 2. A job that reads the DataStage dataset and loads it to the target table. Other sections will discuss in detail each of the components and give examples of their use in a working example job sequencer.

3.5

Job Parameters

Parameters are passed to a job as either DataStage job parameters or as environment variables. Job parameters can be set from a file and are distinguished by the presence of a ‘jp’ prefix to the variable name. This prefix is part of the DataStage development standard. The names of environment variables have no prefix when they are set (UNIX_VAR=”some value”) and a prefix of “$” when used (myval=$UNIX_VAR). Job parameters are passed from a job sequencer to the jobs in its control as if a user were answering the runtime dialog questions displayed in the DataStage Director job-run dialogue. Default environment variables cannot be reset during this dialog unless explicitly specified in the job. The scope of a parameter depends on their type. Essentially: o The scope of a job parameter is specific to the job in which it is defined and used. Job parameters are stored internally within DataStage for the duration of the job, and are not accessible outside that job. o The scope of a job parameter can be extended by the use of job sequencer, which can manage and pass job parameters among jobs. o The scope of an environment variable is wider, as it is defined at operating system level, though conversely the use of environment variables is limited within this exercise. Job parameters are required for the following DataStage programming elements: 1. File name entries in stages that use files or Data Sets must NEVER use a hard-coded operating system pathname. a. Staging area files must ALWAYS have pathnames as follows: /jpSTAGING/jpENVIRON/jpSUBJECT_AREA[filename.suffix] b. DataStage datasets ALWAYS have pathnames as follows: /jpDSTAGE_ROOT/jpENVIRON/datasets/[filename.suffix]

Parallel Framework Red Book: Data Flow Job Design

July 17, 2006

42 of 179

© 2006 IBM Information Integration Solutions. All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language in any form by any means without the written permission of IBM.

all jobs that use a shared container must be recompiled when the container is changed. schema (if appropriate). The exact policy for each reject is specified in the job design document. For maximum component re-use. This allows the container input and output links to contain only the columns relevant to the container processing. Database stages must ALWAYS use variables for the server name.7 Error and Reject Record Handling Reject rows are those rows that fail active or passive business rule driven validation as specified in the job design document. Specification of this action is the responsibility of the Business Analyst and will be published in the design document. . stored in a retrieval system. or translated into any language in any form by any means without the written permission of IBM. The Usage Analysis and Multi-Job Compile tools can be used to recompile jobs that use a shared container. Specification of this action is the responsibility of the Business Analyst and will be published in the design document. 2006 43 of 179 © 2006 IBM Information Integration Solutions. Use and management of job parameters. and Production Automation. data rule violations or other reasons that would disqualify a row from processing. No part of this publication may be reproduced. Management. Reject files will include those records rejected from the ETL stream due to Referential Integrity failures. and further. Both rejects and errors will be archived and placed in a special directory for evaluation or other action by support staff. Using RCP. The presence of errors may not prevent further processing. These activities are the responsibility of job sequencers used to group jobs by some reasonable grain or by a federated scheduler. any additional columns are passed through the container at runtime without the need to separate and remerge. Error files will include those records from sources that fail quality tests. transcribed. The presence of rejects may indicate that a job has failed and prevent further processing. enable RCP at the project level and for every stage within the parallel shared container. transmitted. Parallel Framework Red Book: Data Flow Job Design July 17. 3.6 Parallel Shared Containers Parallel Shared Containers allow common logic to be shared across multiple jobs. Because Parallel Shared Containers are inserted when a job is compiled. The presence of rejects and errors will be detected and notification sent by email to selected staff. as well as standardized routines for use in Job Sequencers are discussed further in Parallel Framework Standard Practices: Administration. userid and password. whether the job or ETL processing is to continue is specified on a per-job and/or per-sequence and/or per-script basis based on business requirements. 3. All rights reserved. Error rows are those rows caused by unforeseen data events such as values too large for a column or text in an unsupported language.Information Integration Solutions Center of Excellence 2.

Pass successful reads to the output stream. (Reject link exists) The reject option should be used in all cases where active management of the rejects is required. 2. and should be reviewed by the Data Steward. Only records that match the given table definition and format are output. 3. 3.rej file. A message is always written to the Director log which details the count of rows successfully read and rows rejected. Ignore – some process or event downstream of the ETL process is responsible for handling the error.Information Integration Solutions Center of Excellence ETL actions to be taken for each record type is specified for each stage in the job design document. Use the Output option. Pass successful reads to the output stream. 2006 44 of 179 © 2006 IBM Information Integration Solutions. which outputs rows that do not match the given table definition and format specifications. The Sequential File stage offers the following reject options: Option Description Continue Drop read failures from input stream.rej file extension. or translated into any language in any form by any means without the written permission of IBM. stored in a retrieval system. (No reject link exists) Fail Abort job on read format failure (No reject link exists) Output Reject switch failures to the reject stream. Send the reject stream to a *. it must have a *. Rejects should not exist and should stop the job. These actions include: 1. If a file is created by this option. 2 3 Rejects should not exist but should not stop the job. Rejects are tracked by count only.7. No part of this publication may be reproduced. transcribed. Parallel Framework Red Book: Data Flow Job Design July 17. a shared container error handler can be used. Push back – rows are sent to a Data Steward for corrective action. By default. .1 Reject Handling with the Sequential File Stage The Sequential File stage can optionally include a reject link. The default action is to push back reject and error rows to a Data Steward. Alternatively. Reprocess – rows are reprocessed and re-enter the data stream. Rejects are categorized in the ETL job design document using the following ranking: Category 1 Description Rejects are expected and can be ignored Sequential File Stage Option Use the Continue option. All rights reserved. Use the Fail option. transmitted. rows that cannot be read are dropped by the Sequential File stage.

All rights reserved. Furthermore. Pass successful lookups to the output stream. DS/EE offers the following options within a Lookup stage: Option Description Continue Ignore lookup failures and pass lookup fields as nulls to the output stream. Pass successful lookups to the output stream. Use the Fail option. No part of this publication may be reproduced. Drop Drop lookup failures from the input stream. This behavior makes the Lookup stage very valuable for positive (reference is found) and negative (reference is NOT found) business rule validation.rej extension is used when rejects require investigation after a job run. .7.err file extension. or translated into any language in any form by any means without the written permission of IBM.7. they only need to be recorded but not acted on. the *. Send the reject stream to an *.Information Integration Solutions Center of Excellence 3. transcribed. If there are multiple validations to perform. Pass successful lookups to the output stream. Rejects are categorized in the ETL job design document using the following ranking: Category 1 Description Rejects are expected and can be ignored Rejects can exist in the data.rej or *. Alternatively. The *. it must have a *.rej file or tag and merge with the output stream.err extension when rejects can be ignored but need to be recorded. and rejects can occur if the key fields are not found in the reference data. each must be done in its own Lookup. 2006 45 of 179 © 2006 IBM Information Integration Solutions. 2 3 4 3. Rejects should not exist but should not stop the job. transmitted. however. The reject option should be used in all cases where active management of the rejects is required. If a file is created by this option. to enforce error management ONLY ONE REFERENCE LINK is allowed on a Lookup stage. stored in a retrieval system.3 Reject Handling with the Transformer Stage Rejects occur when a transformer stage is used and a row: Parallel Framework Red Book: Data Flow Job Design July 17.2 Reject Handling with the Lookup Stage The Lookup stage compares a single input stream to one or more reference streams using keys. Lookup Stage Option Drop if lookup fields are necessary down stream or Continue if lookup fields are optional Send the reject stream to an *. a local error handler based on a shared container can be used. Fail Abort job on lookup failure Reject Reject lookup failures to the reject stream. Rejects should not exist and should stop the job.err file or tag and merge with the output stream. and should be reviewed by the Data Steward.

and be reviewed by the Data Steward. a shared container error handler can be used. If a file is created from the reject stream. Otherwise. Rejects should not exist and should stop the job.rej file extension. To capture rejects from a target database. Cannot satisfy requirements of any conditional output stream and is rejected by the default output stream. The *. Alternatively. transcribed. Satisfies requirements for a reject conditional output stream. reject rows will not be captured. they only need to be recorded but not acted on. it must have a *. No part of this publication may be reproduced. Transformer Stage Option Funnel the reject stream back to the output stream(s). . a reject link must exist on that stage. 3. If a file is created by this option.err extension when rejects can be ignored but need to be recorded.rej extension is used when rejects require investigation after a job run. Alternatively. and Oracle Enterprise) offer an optional reject link that can be used to capture rows that cannot be written to the target database. OR 2. The reject option should be used in all cases where active management of the rejects is required.Information Integration Solutions Center of Excellence 1.err file extension. All rights reserved.7. Rejects should not exist but should not stop the job. 2006 46 of 179 © 2006 IBM Information Integration Solutions. Send the reject stream to an *. stored in a retrieval system.rej or *. Rejects are categorized in the ETL job design document using the following ranking: Category 1 2 3 4 Description Rejects are expected and can be ignored.rej file or tag and merge with the output stream. however. transmitted. Send the reject stream to a reject file and halt the job. or translated into any language in any form by any means without the written permission of IBM. Target database stages offer the following reject options: Option No reject link exists Reject link exists Description Do not capture rows that fail to be written. Parallel Framework Red Book: Data Flow Job Design July 17. A message is always written to the Director log which details the count of rows successfully read and rows rejected. Send the reject stream to an *.4 Reject Handling with target database stages Some database stages (such as DB2/UDB Enterprise.err file or tag and merge with the output stream. Pass rows that fail to be written to the reject stream. it must have a *. Rejects can exist in the data. the *. ODBC Enterprise. a shared container error handler is used.

2006 47 of 179 Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions. job DECRP_N_XformClients in the ECR_FACTS project in the development environment with a serial number of 20060201-ETL-091504 would have these reject and error file names: ECR_FACTS_DECRP_N_XformClients_dev_20060201-ETL-091504. All rights reserved. 2 Rejects should not exist but should not stop the job. The standard columns for error and reject processing are: Column Name HOST_NAME Key? Yes Data Source DSHostName transformer macro in the error handler July 17. The job name (jpJOB_NAME) and a underscore “_”. 3. Reject link exists.1 Processing Errors and Rejects to a Flat File Each job will produce a flat file for errors and a flat file for rejects with a specific naming convention: 1.7. transmitted. stored in a retrieval system. 3. and should be reviewed by the Data Steward. and 5. transcribed. This section deals with both methods of handling errors. Send the reject stream to a *. one of “rej” or “err”.Rejects are tracked by count only.rej ECR_FACTS_DECRP_N_XformClients_dev_20060201-ETL-091504. For example. The project phase (jpENVIRON) and a underscore “_”. and gathered using a Funnel stage that feeds a Sequential File stage.err Rows will be converted to the common file record format with 9 columns (below) using Column Export and Transformer stages for each reject port. 3.Information Integration Solutions Center of Excellence Rejects are categorized in the ETL job design document using the following ranking: Category 1 Description Rejects are expected and can be ignored Target Database Stage Option No reject link exists.5.5 Error Processing Requirements Jobs will produce flat files containing reject and errors and may alternatively process rows on reject ports and merge these rows with the normal output stream. 4.”. . or translated into any language in any form by any means without the written permission of IBM. The appropriate file type. The job serial number (jpJOBSERIALNO) and a period “. No part of this publication may be reproduced.rej file. The project name (jpPROJECT_NAME) and a underscore “_”. 2. Only records that match the given table definition and database constraints are written.7. The Column Export and Transformer stages may be kept in a template Shared Container the developer will make local in each job.

The Transformer stage adds the required key columns. 2006 48 of 179 © 2006 IBM Information Integration Solutions. stored in a retrieval system. All rights reserved. No part of this publication may be reproduced. transmitted.Information Integration Solutions Center of Excellence PROJECT_NAME JOB_NAME STAGE_NAME DATA_OBJ_NAME JOB_SERIALNO ETL_ROW_NUM ETL_BAT_ID ROW_DATA Yes Yes Yes Yes Yes Yes Yes No DSProjectName transformer macro in the error handler DSJobName transformer macro in the error handler The name of the stage from which the error came The source table or file data object name jpJOBSERIALNO Data stream coming in to the error handler Data stream coming in to the error handler The columns from the upstream stages reject port exported to a single pipe-delimited “|” varchar(2000) column using the Column Export stage in the error handler In this example. transcribed. or translated into any language in any form by any means without the written permission of IBM. the following stages process the only errors produced by a job: The Column Export stage maps the unique columns to the single standard column. . Figure 13: Error Processing Components Parallel Framework Red Book: Data Flow Job Design July 17.

transmitted. transcribed. No part of this publication may be reproduced. stored in a retrieval system. ROW_DATA: Figure 14: Error Processing Column Export stage And the downstream Transformer stage builds the standard output record by creating the required keys: Parallel Framework Red Book: Data Flow Job Design July 17. . All rights reserved. or translated into any language in any form by any means without the written permission of IBM. Track*) to a single output column. 2006 49 of 179 © 2006 IBM Information Integration Solutions.Information Integration Solutions Center of Excellence The input to the Column Export stage explicitly converts the data unique to the reject stream (in this case.

transcribed. A failed switch will reject an intact input row show key fails to resolve to one of the Switch output stream. rows rejected by the Lookup stage are processed by a corrective Transformer stage where the failed references as set to a specific value and then merged with the output of the Lookup stage: Parallel Framework Red Book: Data Flow Job Design July 17. One or more columns may have been selected for replacement when a reference key is found. In either case. A Transformer will reject an intact input row that cannot pass conditions specified on the output streams. Connect the reject port to a Transformer stage where columns are set to specific values. Method Connect the reject port to a Transformer stage where those columns selected for replacement are set to specific values. Switch Transformer In this example. Stage Lookup Description A failed lookup will reject an intact input row whose key fails to match the reference link key. transmitted. attaching a nonspecific reject stream (referred to as the stealth reject stream) will gather rows from either condition to the reject stream. or translated into any language in any form by any means without the written permission of IBM. The following table identifies the tagging method to be used for the previously cited operators. No part of this publication may be reproduced. 2006 50 of 179 © 2006 IBM Information Integration Solutions.Information Integration Solutions Center of Excellence Figure 15: Error Processing Transformer stage 3.2 Processing Errors and Rejects and Merging with an Output Stream There may be processing requirements that specify that rejected or error rows be tagged as having failed a validation and merged back into the output stream. OR with columns contain illegal values for some operation performed on said columns. Connect the output stream of the corrective Transformer stage and one or more output streams of the original Transformer stage to a Funnel stage to merge the two (or more) streams. This is done by processing the rows from the reject ports and setting the value of a specific column with a value specified by the design document. stored in a retrieval system. All rights reserved. Connect the reject port to a Transformer stage where columns are set to specific values. Connect the output stream of the Transformer and Lookup stages to a Funnel stage to merge the two streams. . Connect the output stream of the Transformer stage and one or more output streams of the Switch stage to a Funnel stage to merge the two (or more) streams.7.5.

In clustered an MPP environments Server Edition components only run on the primary (conductor) node.Information Integration Solutions Center of Excellence Figure 16: Error Processing Lookup example 3. 2006 51 of 179 © 2006 IBM Information Integration Solutions. or translated into any language in any form by any means without the written permission of IBM. All rights reserved. Parallel Framework Red Book: Data Flow Job Design July 17. 3. Server Edition components limit overall performance of large-volume job flows since many components such as the BASIC Transformer use interpreted psuedo-code. . transcribed. This section provides guidelines appropriate use of various stages when building a parallel job flows. stored in a retrieval system.1 Server Edition Components Avoid the use of Server Edition components in parallel job flows. The ability to use a Server Edition component within a parallel job is intended only as a migration option for existing Server Edition applications that might benefit by leveraging some parallel capabilities on SMP platforms. transmitted.8 Component Usage DataStage Enterprise Edition offers a wealth of component types for building ETL flows. No part of this publication may be reproduced.8. severely impacting scalability and network resources.

and in Enterprise Edition native format. All rights reserved. transcribed.Server shared containers Note that BASIC Routines are still appropriate.Dropping Columns July 17. for the job control components of a DataStage Job Sequence and Before/After Job Subroutines for parallel jobs.8. Used in this manner. it is best to develop a job iteratively using the Copy stage as a “placeholder”. Management. it is important to minimize the number of transformers. NOTE: Because parallel Data Sets are platform and configuration-specific.8. 3. Since the Copy stage does not require an output link.Job Design placeholder between stages (unless the Force option =true.8. No part of this publication may be reproduced. they should not be used for long-term archive of source data. . 2006 52 of 179 Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions. Data Sets achieve end-to-end parallelism across job boundaries by writing data in partitioned form. • The Copy stage should be used instead of a Transformer for simple operations including: . and Production Automation. 3. Data Sets offer parallel I/O on read and write operations. a Copy stage with a single input link and a single output link will be optimized out of the final job flow at runtime. and to use other stages (such as Copy) when derivations are not needed. or translated into any language in any form by any means without the written permission of IBM. transmitted.Renaming Columns .4 Parallel Transformer stages The DataStage Enterprise Edition parallel Transformer stage generates “C” code which is then compiled into a parallel component. o Unless the Force property is set to “True”.2 Copy Stage For complex data flows. always write to parallel Data Sets. 3. This is discussed in more detail in Parallel Framework Standard Practices: Administration.BASIC Routines . without overhead for format or data type conversions.BASIC Transformers . For this reason. Enterprise Edition will optimize this out at runtime) . in sort order.Information Integration Solutions Center of Excellence Server Edition Components that should be avoided within parallel job flows include: . and necessary. stored in a retrieval system.3 Parallel Data Sets When writing intermediate results between DS/EE parallel jobs. it can be used at the end of a data flow o For simple jobs with only two stages. parallel Data Sets effectively establish restart points in the event that a job (or sequence) needs to be re-run. the Copy stage should be used as a placeholder so that new stages can be inserted easily should future requirements change.

Parallel Framework Red Book: Data Flow Job Design July 17. For example. Instead.3 Then B=”X” If A=4.Complex reusable logic cannot be implemented using the Transformer or .2.Information Integration Solutions Center of Excellence - Default Type Conversions [see Section 4.2: Modify Stage. • NEVER use the “BASIC Transformer” stage in large-volume job flows. user-defined functions and routines can expand parallel Transformer capabilities.7 Then B=”C” • could also be implemented with a lookup table containing values for column A and corresponding values of column B.1. it is faster than the interpreted Filter and Switch stages. • Because the parallel Transformer is compiled. No part of this publication may be reproduced. stored in a retrieval system. See Section 8. implementing complex derivation expressions using regular patterns by Lookup tables instead of using a Transformer with nested derivations.5 BuildOp stages BuildOps should only be used when: .6. and default type conversion can also be performed by the output mapping tab of any stage.5. null handling.1. transmitted. The BASIC Transformer is intended as a “stop-gap” migration choice for existing Server Edition jobs containing complex routines. Consider.8. or translated into any language in any form by any means without the written permission of IBM. performance should this should be tested in isolation to identify specific cause of bottlenecks. drop (if Runtime Column Propagation is disabled). the derivation expression: If A=0. Even then its use should be restricted and the routines should be converted as soon as possible. • Optimize the overall job flow design to combine derivations from multiple Transformers into a single Transformer stage when possible.2: Default and Explicit Type Conversions] Note that rename. and character string trimming. All rights reserved. transcribed. if possible. • The Modify stage can be used for non-default type conversions. 2006 53 of 179 © 2006 IBM Information Integration Solutions.Existing Transformers do not meet performance requirements As always. The only time that Filter or Switch should be used is when the selection clauses need to be parameterized at runtime. . 3.

or translated into any language in any form by any means without the written permission of IBM. LongVarChar. NVarChar. Parallel Framework Red Book: Data Flow Job Design July 17. . The internal Enterprise Edition data types are used in schema files and are displayed when viewing generated OSH or viewing the output from $OSH_PRINT_SCHEMAS. day. unit64 raw 4 bytes (roundup(p)+1)/2 4 bytes 8 bytes 1 byte 2 bytes 4 bytes 8 bytes 1 byte per character Date with month. uint16 int32. transmitted. The following table summarizes the underlying data types of DataStage Enterprise Edition: SQL Type Internal Type Size Description Date Decimal. uint8 int16. Real Double TinyInt SmallInt Integer BigInt1 Binary. LongVarChar. LongNVarChar Char. LongVarBinary. with resolution to seconds Time of day. (Specify microseconds Extended option) string 1 byte per character ustring ustring time time(microseconds) timestamp timestamp(microseconds) multiple bytes per character multiple bytes per character 5 bytes 5 bytes 9 bytes 9 bytes 1 BigInt values map to long long integers on all supported platforms except Tru64 where they map to longer integer values. consisting of a fixed or variable number of contiguous bytes and an optional alignment value ASCII character string of fixed or variable length (Unicode Extended option NOT selected) ASCII character string of fixed or variable length (Unicode Extended option NOT selected) ASCII character string of fixed or variable length (Unicode Extended option IS selected) Time of day. No part of this publication may be reproduced. Numeric Float. IEEE single-precision (32-bit) floating point value IEEE double-precision (64-bit) floating point value Signed or unsigned integer of 8 bits (Specify unsigned Extended option for unsigned) Signed or unsigned integer of 16 bits (Specify unsigned Extended option for unsigned) Signed or unsigned integer of 32 bits (Specify unsigned Extended option for unsigned) Signed or unsigned integer of 64 bits (Specify unsigned Extended option for unsigned) Untyped collection. transcribed. 2006 54 of 179 © 2006 IBM Information Integration Solutions. VarChar NChar. VarBinary Unknown. All rights reserved. Char. with resolution of microseconds (Specify microseconds Extended option) Single field containing both date and time value with resolution to seconds. Each SQL data type maps to an underlying data type in the Enterprise Edition engine. compatible with IBM packed decimal format. VarChar Time Time Timestamp Timestamp date decimal sfloat dfloat int8.Information Integration Solutions Center of Excellence 4 DataStage Data Types The DataStage Designer and Manager represent column data types using SQL notation. Single field containing both date and time value with resolution to microseconds. Bit. and year Packed decimal. unit32 int64. stored in a retrieval system.

VarChar. The NChar. You can. stored in a retrieval system.1. 4.Information Integration Solutions Center of Excellence 4. The Char. and extended Char. e = You can use a Modify or a Transformer conversion function to explicitly convert from the source field type to the destination field type.) An Extended field appears in the columns grid. however. . All rights reserved. specify that these data types are extended. parallel jobs support two types of underlying character data types: strings and ustrings. NVarChar. String data represents unmapped bytes. date uint8 sfloat uint16 uint32 uint64 dfloat int16 int32 int64 string ustring time e e e int8 timestamp e e e e 55 of 179 decimal raw Int8 uint8 Int16 uint16 Int32 uint32 Int64 uint64 sfloat dfloat decimal string d de d de d de d de de de de d d d d d d d d d d d d d d d d d d d d d de d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d de d d d d d d d d de de d d d d d d d d d d e d d d d d d d d d d d d d d de d d d d d d de d d d de d d d de d d e d d e d e d e d e d d d d e d e de d de de de de d d d de de d e e e e Parallel Framework Red Book: Data Flow Job Design July 17. 2006 © 2006 IBM Information Integration Solutions.2 Default and Explicit Type Conversions DataStage Enterprise Edition provides a number of default conversions and conversion functions when mapping from a source to a target data type. in which case they are taken as ustrings and do require mapping. and LongVarChar SQL types relate to underlying string types where each character is 8-bits and does not require mapping because it represents an ASCII character. The following table summarizes Data Type conversions: Source Field Target Field d = There is a default type conversion from source field type to destination field type. VarChar.1. A blank cell indicates that no conversion is provided. Default type conversions take place across the stage output mappings of any Enterprise Edition stage. or translated into any language in any form by any means without the written permission of IBM. transmitted. ustring data represents full Unicode (UTF-16) data. transcribed. or LongVarChar columns have ‘Unicode’ in this field. No part of this publication may be reproduced. and LongNVarChar types relate to underlying ustring types so do not need to be explicitly extended. (They are specified as such by selecting the Extended check box for the column in the Edit Meta Data dialog box.1 Strings and Ustrings If NLS is enabled on your DataStage server.

In-band null representation can be disadvantageous because you must reserve a field value for nulls and this value cannot be treated as valid data elsewhere. Enterprise Edition pads the remaining length with NULL (ASCII zero) characters by default. You must first convert a Char string type to a Varchar type before using PadString. . the specified pad character will override the default for that stage only. This type of representation is called an in-band null. transcribed. The Transformer and Modify stages can change a null representation from an out-of-band null to an inband null and from an in-band null to an out-of-band null. In these instances.It allocates a single bit to mark a field as null.It designates a specific field value to indicate a null. or translated into any language in any form by any means without the written permission of IBM. an ASCII space (0x20) or a Unicode space (U+0020). for example. . Parallel Framework Red Book: Data Flow Job Design July 17. • 4. transmitted. All rights reserved. the PadString Transformer function can be used to pad a variablelength (Varchar) string to a specified length using a specified pad character. for example a numeric field’s most negative possible value. Some stages (for example. Enterprise Edition displays a warning message in the job log. • As an alternate solution. • The environment variable APT_STRING_PADCHAR can be used to change the default pad character from an ASCII NULL (0x0) to another character. depending on the source and result data types. This type of representation is called an out-of-band null. When converting from variable-length to fixed-length strings. When entering a space for the value of APT_STRING_PADCHAR do note enclose the space character in quotes. When used in these stages. Note that PadString does not work with fixed-length (CHAR) string types. 2006 56 of 179 © 2006 IBM Information Integration Solutions.Information Integration Solutions Center of Excellence ustring raw date time timesta mp de e e e e d de e d d e e e e de e d d d de e d e d e e e e e e e e e de e e e e The conversion of numeric data types may result in a loss of precision and cause incorrect results. stored in a retrieval system. Sequential File and DB2/UDB Enterprise targets) allow the pad character to be specified in their stage or column definition properties. No part of this publication may be reproduced.2 Null Handling DataStage Enterprise Edition represents nulls in two ways: .

out-of-band null representation for NULL values. . 2006 57 of 179 Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions. the source value propagates. transmitted. Source Field not Nullable Nullable not Nullable Nullable Destination Field not Nullable Nullable Nullable not Nullable Result Source value propagates to destination. destination value is never null. as shown in Figure 17: Figure 17: Extended Column Metadata (Nullable properties) The Table Definition of a stage’s input or output data set can contain columns defined to support outof-band nulls (Nullable attribute is checked).Information Integration Solutions Center of Excellence IMPORTANT: When processing nullable columns in a Transformer stage. July 17.1: Transformer NULL Handling and Reject Link. the in-band (value) must be explicitly defined in the extended column attributes for each Nullable column. No part of this publication may be reproduced. stored in a retrieval system.1. All rights reserved. When reading from Data Set and database sources with nullable columns. See Section 8. or translated into any language in any form by any means without the written permission of IBM. transcribed. care must be taken to avoid data rejects. Source value or null propagates. Enterprise Edition uses the internal. When reading from or writing to Sequential Files or File Sets. The next table lists the rules for handling nullable fields when a stage takes a Data Set as input or writes to a Data Set as output. If the source value is not null. Source value propagates.

All rights reserved. . No part of this publication may be reproduced. allow their runtime schema to be parameterized further extending re-use through RCP. Some stages.Information Integration Solutions Center of Excellence If the source value is null. Furthermore. or translated into any language in any form by any means without the written permission of IBM. stored in a retrieval system. rather than using a large number of jobs with hard-coded table definitions to perform the same tasks. Before a DataStage developer can use RCP. for example the Sequential File stage. Parallel Framework Red Book: Data Flow Job Design July 17.3 Runtime Column Propagation Runtime column propagation (“RCP”) allows job designs to accommodate additional columns beyond those defined by the job developer. Using RCP judiciously in a job design facilitates re-usable job designs based on input metadata. only the columns explicitly referenced within the shared container logic need to be defined. the remaining columns pass through at runtime. it must be enabled at the project level through the Administrator client. Using RCP. RCP facilitates re-use through parallel shared containers. 4. a fatal error occurs. 2006 58 of 179 © 2006 IBM Information Integration Solutions. transcribed. transmitted. as long as each stage in the shared container has RCP enabled on their stage Output properties.

All rights reserved. Different types of keyless partitioning methods define the method of data distribution. Partitioning methods are separated into keyless and keyed classes: . or translated into any language in any form by any means without the written permission of IBM. transmitted. No part of this publication may be reproduced. transcribed. It also provides tips for monitoring jobs running in parallel. .1 Partition Types While partitioning allows data to be distributed across multiple processes running in parallel. Collectors only exist before stages running sequentially and when the previous stage is running in parallel. different types of partitioning are provided for the parallel job developer. If the prior stage was running sequentially. For this reason. Partitioners distribute rows of a single link into smaller segments that can be processed independently in parallel. Keyed partitioning is used when business rules (for example. a “fan-out” icon is drawn on the link within the Designer canvas. stored in a retrieval system. ensuring that records with the same values in those key column(s) are assigned to the same partition. Join) require processing on groups of related records. Parallel Framework Red Book: Data Flow Job Design July 17. 2006 59 of 179 © 2006 IBM Information Integration Solutions. and are indicated by a “fan-in” icon as shown in this example: Stage running in parallel Figure 19: Collector icon This section provides an overview of partitioning and collecting methods. and provides guidelines for appropriate use in job designs.Keyless partitioning distributes rows without regard to the actual data values. as shown in this example: Stage running sequentially Figure 18: “fan-out” icon Collectors combine parallel partitions of a single link for sequential processing. Remove Duplicates) or stage requirements (for example. Stage running sequentially Stage running in parallel 5.Information Integration Solutions Center of Excellence 5 Partitioning and Collecting Partition parallelism is a key to establishing scalable performance of DataStage Enterprise Edition. Keyed partitioning examines the data values in one or more key columns. Partitioners exist before any stage that is running in parallel. it is important that this distribution does not violate business requirements for accurate data processing.

the ability for the Enterprise Edition engine to determine the appropriate partitioning method depends on the information available to it. links with Auto partitioning are drawn with the following link icon: Figure 21: Auto partitioning icon Auto partitioning is designed to allow the beginning DataStage developer to construct simple data flows without having to understand the details of parallel design principles. Auto partitioning specifies that the Enterprise Edition engine will attempt to select the appropriate partitioning method at runtime. All rights reserved. on the output of a parallel Sort). No part of this publication may be reproduced. However. in some cases. Furthermore. to improve performance. Data Sets. transmitted. For example. then a keyed partitioning method must be specified to achieve correct results. This flag is set automatically by Parallel Framework Red Book: Data Flow Job Design July 17. In general. Based on the configuration file. and job design (stage requirements and properties). However. stored in a retrieval system. or translated into any language in any form by any means without the written permission of IBM. . the partitioning method may not necessarily be the most efficient from an overall job perspective. since the Enterprise Edition engine has no visibility into user-specified logic (such as Transformer or BuildOp stages) it may be necessary to explicitly specify a partitioning method for some stages. Auto partitioning will select between keyless (Same.Information Integration Solutions Center of Excellence The default partitioning method for newly-drawn links is Auto partitioning. transcribed. if the logic defined in a Transformer stage is based on a group of related records. Round Robin. Auto partitioning will ensure correct results when using built-in stages. Entire) and keyed (Hash) partitioning methods to produce functionally correct results and.1. The “Preserve Partitioning” flag is an internal “hint” that Auto partitioning uses to attempt to preserve carefully ordered data (for example. The partitioning method is specified in the Input stage properties using the “Partitioning” option as shown on the right: Figure 20: Specifying Partition method 5. 2006 60 of 179 © 2006 IBM Information Integration Solutions. Within the Designer canvas.1 Auto Partitioning The default partitioning method for newly-drawn links.

1. a parallel Sort). links that have been specified with Same partitioning are drawn with a “horizontal line” partitioning icon: Figure 23: Same partitioning icon It is important to understand the impact of Same partitioning in a given data flow. 5. in the case of a cluster or Grid.2. stored in a retrieval system. transcribed. 2006 61 of 179 © 2006 IBM Information Integration Solutions. and its state is stored in persistent Data Sets. transmitted. it retains the partitioning from the output of the upstream stage. Because Same does not redistribute existing partitions.2 Keyless Partitioning Keyless partitioning methods distribute rows without examining the contents of the data: Keyless Partition Method Same Round Robin Random Entire Description Retains existing partitioning from previous stage. the degree of parallelism remains unchanged: Parallel Framework Red Book: Data Flow Job Design July 17. Each partition receives the entire Data Set. although it can be explicitly set or cleared in the “Advanced” stage properties of a given stage. if the Preserve Partitioning flag was set. between servers). . as illustrated on the right: Same partitioning doesn’t move data between partitions (or. in a round robin partition assignment.1 Same Partitioning Same partitioning in fact performs no partitioning to the input Data Set. Row ID's 0 3 6 1 4 7 2 5 8 0 3 6 1 4 7 2 5 8 Within the Designer canvas. There are some cases when the input stage requirements prevent partitioning from being preserved. and is appropriate when trying to preserve the grouping of a previous operation (for example. for example). In these instances. a warning will be placed in the Director log indicating that Enterprise Edition was unable to preserve partitioning for a specified stage. All rights reserved. as shown in on the right: Figure 22: Preserve Partitioning option The Preserve Partitioning flag is part of the Data Set structure. No part of this publication may be reproduced. Distributes rows evenly across partitions in a random partition assignment.Information Integration Solutions Center of Excellence some stages (Sort. Distributes rows evenly across partitions. Instead.1. 5. or translated into any language in any form by any means without the written permission of IBM.

All rights reserved.2. 3 2 1 0 . . No part of this publication may be reproduced. . …8 7 6 5 4 3 2 1 0 ENTIRE . the downstream stage runs with the degree of parallelism used to create the Data Set. 2006 62 of 179 © 2006 IBM Information Integration Solutions.2. Random partitioning evenly distributes rows across partitions.2.2 Round Robin Partitioning Round Robin partitioning evenly distributes rows across partitions in a round-robin assignment. or translated into any language in any form by any means without the written permission of IBM. Round Robin partitioning is useful for redistributing data that is highly skewed (there are an unequal number of rows in each partition). regardless of the current $APT_CONFIG_FILE 5. 3 2 1 0 Parallel Framework Red Book: Data Flow Job Design July 17.1. Since optimal parallel processing occurs when all partitions have the same workload. Random partitioning has a slightly higher overhead than Round Robin partitioning. While in theory Random partitioning is not subject to regular data patterns that might exist in the source data. transmitted. but using a random assignment. 3 2 1 0 . Entire partitioning may have a performance impact. .4 Entire Partitioning Entire partitioning distributes a complete copy of the entire Data Set to each partition. similar to dealing cards: Round robin partitioning has a fairly low overhead.1. transcribed.3 Random Partitioning Like Round Robin. As a result. On clustered and Grid implementations. the order that rows are assigned to a particular partition will differ between job runs. as illustrated on right: Entire partitioning is useful for distributing the reference data of a Lookup task (this may or may not involve the Lookup stage). Same partitioning will effectively cause a downstream parallel stage to also run sequentially If you read a parallel Data Set with Same partitioning. it is rarely used in real-world data flows.1. 5. …8 7 6 5 4 3 2 1 0 Round Robin 6 3 0 7 4 1 8 5 2 5. Since the random partition number must be calculated. . as the complete Data Set must be distributed across the network to each node.Information Integration Solutions Center of Excellence If the upstream stage is running sequentially. stored in a retrieval system.

3. or translated into any language in any form by any means without the written permission of IBM. As an example of hashing. Join) require processing on groups of related records. Assigns rows with the same values in one or more key column(s) to the same partition using a specified range map generated by pre-reading the Data Set.Information Integration Solutions Center of Excellence 5. Remove Duplicates) or stage requirements (for example. All rights reserved.3 Keyed Partitioning Keyed partitioning examines the data values in one or more key columns. transmitted. ensuring that records with the same values in those key column(s) are assigned to the same partition. and there are a large number of unique values. Keyed partitioning is used when business rules (for example. 2006 63 of 179 © 2006 IBM Information Integration Solutions.1 Hash Partitioning Hash partitioning assigns rows with the same values in one or more key column(s) to the same partition using an internal hashing algorithm. . consider the following sample Data Set: ID 1 2 3 4 5 6 7 8 9 10 LName Ford Ford Ford Ford Dodge Dodge Ford Ford Ford Ford FName Henry Clara Edsel Eleanor Horace John Henry Clara Edsel Eleanor Address 66 Edison Avenue 66 Edison Avenue 7900 Jefferson 7900 Jefferson 17840 Jefferson 75 Boston Boulevard 4901 Evergreen 4901 Evergreen 1100 Lakeshore 1100 Lakeshore Values of key column …0 3 2 1 0 2 3 2 1 1 HASH 0 3 0 3 1 1 1 2 2 2 Parallel Framework Red Book: Data Flow Job Design July 17. Keyed Partition Method Hash Modulus Range DB2 Description Assigns rows with the same values in one or more key column(s) to the same partition using an internal hashing algorithm.1. then the resulting partitions will be of relatively equal size. Assigns rows with the same values in a single integer key column to the same partition using a simple modulus calculation. transcribed. No part of this publication may be reproduced. If the source data values are evenly distributed within these key column(s). 5. For DB2 Enterprise Server Edition with DPF (DB2/UDB) only – matches the internal partitioning of the specified source or target table. stored in a retrieval system.1.

All rights reserved. transcribed. .Information Integration Solutions Center of Excellence Hashing on key column LName would produce the following results: Partition 0: ID 5 6 LName Dodge Dodge FName Horace John Address 17840 Jefferson 75 Boston Boulevard Partition 1: ID 1 2 3 4 7 8 9 10 LName Ford Ford Ford Ford Ford Ford Ford Ford FName Henry Clara Edsel Eleanor Henry Clara Edsel Eleanor Address 66 Edison Avenue 66 Edison Avenue 7900 Jefferson 7900 Jefferson 4901 Evergreen 4901 Evergreen 1100 Lakeshore 1100 Lakeshore Parallel Framework Red Book: Data Flow Job Design July 17. or translated into any language in any form by any means without the written permission of IBM. No part of this publication may be reproduced. stored in a retrieval system. 2006 64 of 179 © 2006 IBM Information Integration Solutions. transmitted.

transcribed. the key column combination of LName and FName yields improved data distribution and a greater degree of parallelism.Information Integration Solutions Center of Excellence In this case.1. 2006 65 of 179 © 2006 IBM Information Integration Solutions. the partition size of modulus partitioning will be equally distributed as long as the data values in the key column are equally distributed. All rights reserved. regardless of the actual number of nodes in the parallel configuration file. individual key column values have no significance for partition assignment. Also note that only the unique combination of key column values appear in the same partition when used for hash partitioning. It performs a modulus operation on the data value using the number of partitions as the divisor. transmitted.2 Modulus Partitioning Modulus partitioning uses a simplified algorithm for assigning related records based on a single integer key column. . When using hash partitioning on a composite key (more than one key column). producing partition skew. Using the same source Data Set. which would impact performance. No part of this publication may be reproduced. or translated into any language in any form by any means without the written permission of IBM. Also note that in this example the number of unique values will limit the degree of parallelism.3. hash partitioning on the key columns LName and FName yields the following distribution with a 4-node configuration file: Partition 0: I D 2 8 LName Ford Ford FName Clara Clara Address 66 Edison Avenue 4901 Evergreen I D 4 6 10 LName Ford Dodge Ford Partition 2: FName Eleanor John Eleanor Address 7900 Jefferson 75 Boston Boulevard 1100 Lakeshore Partition 1: I D 3 5 9 LName Ford Dodge Ford FName Edsel Horace Edsel Address 7900 Jefferson 17840 Jefferson 1100 Lakeshore I D 1 7 LName Ford Ford Partition 3: FName Henry Henry Address 66 Edison Avenue 4901 Evergreen In this example. 5. stored in a retrieval system. The remainder is used to assign the value to a given partition: partition = MOD (key_value / number of partitions) Like hash. Parallel Framework Red Book: Data Flow Job Design July 17. there are more instances of “Ford” than “Dodge”.

unlike Hash and Modulus partitioning where partition skew is dependent on the actual data distribution. 5. In another scenario to avoid. data is read in parallel from each DB2 node. if the incoming Data Set is sequential and ordered on the key column(s). stored in a retrieval system. Range partitioning assigns rows with the same values in one or more key column(s) to the same partition. it should be used if you have a single integer key column. depending on the value. if new data values are processed outside of the range of a given Range Map. Also. Range partitioning will result in sequential processing. In these instances. data is partitioned to match the internal partitioning of the target DB2 table using the DB2 partitioning method. . these rows will be assigned to either the first or the last partition. partition balance will be skewed. or for a non-integer key column. A Range Map file is specific to a given parallel configuration file. 2006 66 of 179 © 2006 IBM Information Integration Solutions. and the second to actually partition the data within a flow using the Range Map.3 Range Partitioning As a keyed partitioning method. Values of key column 4 0 5 1 6 0 5 4 3 RANGE Rang e Map fi le 0 1 0 4 4 3 The “read twice” penalty of Range partitioning limits its use to specific scenarios. use Same partitioning on the input to downstream stages.3. Range partitioning ensures balanced workload by assigning an approximately equal number of rows to each partition. Modulus partitioning cannot be used for composite keys. the Range Map file can be re-used.Information Integration Solutions Center of Excellence Since modulus partitioning is simpler and faster than hash. To maintain partitioning on data read from a DB2/UDB Enterprise stage.1. 5.4 DB2 Partitioning The DB2/UDB Enterprise stage matches the internal database partitioning of the source or target DB2 Enterprise Server Edition with Data Partitioning Facility database (previously called “DB2/UDB EEE”). No part of this publication may be reproduced. by default. or translated into any language in any form by any means without the written permission of IBM. DB2 partitioning can only be specified for target DB2/UDB Enterprise stages. transcribed. It is important to note that if the data distribution changes without recreating the Range Map. Parallel Framework Red Book: Data Flow Job Design July 17. Range partitioning must read the Data Set twice: once to create a Range Map file.3. To achieve this balanced distribution. transmitted. when writing data to a target DB2 database using the DB2/UDB Enterprise stage. All rights reserved.1. Using the DB2/UDB Enterprise stage. Given a sufficient number of unique values. defeating the intention of Range partitioning. And. typically where the incoming data values and distribution are consistent over time.

which is output to the Director job log when the environment variable APT_DUMP_SCORE is set to True. transcribed.500) of rows for an optimal balanced workload. stored in a retrieval system. All rights reserved. No part of this publication may be reproduced.4. Figure 25: Director Job Monitor row counts by partition Setting the environment variable APT_RECORD_COUNTS will output the row count per link per partition to the Director log as each stage/node completes processing. transmitted. DataStage Enterprise Edition determines the degree of parallelism for each stage using: a) the parallel configuration file (APT_CONFIG_FILE) b) the degree of parallelism of existing source and target Data Sets (and. databases) c) and. The partition number is appended to the stage name for messages written to the Director log. This is very useful in determining the distribution across parallel partitions (skew). or translated into any language in any form by any means without the written permission of IBM. as illustrated below. 2006 67 of 179 © 2006 IBM Information Integration Solutions. Specific details on interpreting the parallel job score can be found in 12. if specified. . right-click anywhere in the window. In this instance.2Understanding the Parallel Job Score.2 Monitoring Partitions At runtime. starting at zero. as shown in the example log below where the stage named “Peek” is running with four degrees of parallelism (partition numbers zero through 3): Figure 24: Partition numbers as shown in Director log To display row counts per partition in the Director Job Monitor window.Information Integration Solutions Center of Excellence 5. and select the “Show Instances” option. a stage’s node pool (Stage/Advanced properties) This information is detailed in the parallel job score. and each stage is processing an equal number (12. Partitions are assigned numbers. the stage named “Sort_3” is running across four partitions (“x 4” next to the stage name). in some cases. as illustrated below: Parallel Framework Red Book: Data Flow Job Design July 17.

2006 68 of 179 © 2006 IBM Information Integration Solutions. 5. . All rights reserved. Parallel Framework Red Book: Data Flow Job Design July 17. transcribed. as shown below: Figure 27: Data Set Management Tool In a non-graphical way. while minimizing overhead. the orchadmin command line utility on the DataStage server can also be used to examine a given parallel Data Set. or translated into any language in any form by any means without the written permission of IBM.Information Integration Solutions Center of Excellence Figure 26: Output of APT_RECORD_COUNTS in Director log Finally. Director. the “Data Set Management” tool (available in the Tools menu of Designer. This ensures that the processing workload is evenly balanced. minimizing overall run time. No part of this publication may be reproduced. the following objectives help to form a methodology for assigning partitioning: Objective 1: Choose a partitioning method that gives close to an equal number of rows in each partition.3 Partition Methodology Given the numerous options for keyless and keyed partitioning. or Manager) can be used to identify the degree of parallelism and number of rows per partition for an existing persistent Data Set. transmitted. stored in a retrieval system.

Join. persistent Data Sets can be used to retain the partitioning and sort order. No part of this publication may be reproduced. This is particularly useful if downstream jobs are run with the same degree of parallelism (configuration file) and require the same partition and sort order. Objective 4: Partition method should not be overly complex The simplest method that meets the above objectives will generally be the most efficient and yield the best performance. examine up-stream partitioning and sort order and attempt to preserve for down-stream processing. Parallel Framework Red Book: Data Flow Job Design July 17. use Round Robin partitioning to redistribute data equally across all partitions o Especially useful if the input Data Set is highly skewed or sequential d) Use Same partitioning to optimize end-to-end partitioning and to minimize repartitioning o Being mindful that Same partitioning retains the degree of parallelism of the upstream stage o Within a flow. It may also be necessary for Transformers and BuildOps that process groups of related records. assigning related records to the same partition if required Any stage that processes groups of related records (generally using one or more key columns) must be partitioned using a keyed partition method. This may require re-examining key column usage within stages and re-ordering stages within a flow (if business requirements permit). 2006 69 of 179 © 2006 IBM Information Integration Solutions. . or translated into any language in any form by any means without the written permission of IBM. but is not limited to: Aggregator. Change Apply.Information Integration Solutions Center of Excellence Objective 2: The partition method must match the business requirements and stage functional requirements. All rights reserved. minimize repartitioning. transcribed. Note that in satisfying the requirements of this second objective. Remove Duplicates. Using the above objectives as a guide. and Sort stages. o Across jobs. stored in a retrieval system. Change Capture. Merge. the following methodology can be applied: a) Start with Auto partitioning (the default) b) Specify Hash partitioning for stages that require groups of related records o Specify only the key column(s) that are necessary for correct grouping as long as the number of unique values is sufficient o Use Modulus partitioning if the grouping is on a single integer key column o Use Range partitioning if the data is highly skewed and the key column values and distribution do not change significantly over time (Range Map can be reused) c) If grouping is not required. This includes. it may not be possible to choose a partitioning method that gives close to an equal number of rows in each partition. Objective 3: Unless partition distribution is highly skewed. especially in cluster or Grid configurations Repartitioning data in a cluster or Grid configuration incurs the overhead of network transport. transmitted.

we’ll apply the partitioning methodology defined earlier to several example job flows. or through Auto partitioning): Parallel Framework Red Book: Data Flow Job Design July 17. transmitted.1 Partitioning Example 1 – Optimized Partitioning The Aggregator stage only outputs key column and aggregate result columns. Using a “standard” solution. both inputs to the Join would be Hash partitioned and sorted on this single join column (either explicitly.2 Partitioning Example 2 – Use of Entire Partitioning In this example. 5. stored in a retrieval system. the partitioning and sorting of this scenario can be optimized. Within the Transformer. and apply Same partitioning to the downstream links. To add aggregate columns to every detail row.4. a Transformer is used to extract data from a single header row of an input file. a Copy stage is used to send the detail rows to an Inner Join and an Aggregator. or translated into any language in any form by any means without the written permission of IBM. Because the Join and Aggregator use the same partition keys and sort order. Additional.4. 5. 2006 70 of 179 © 2006 IBM Information Integration Solutions. The output of the Aggregator is then sent to the second input of the Join.4 Partitioning Examples In this section. transcribed.2Sorting and Hashing Advanced Example. as shown below: Figure 29: Optimized Partitioning assignment This example will be revisited in the Sorting discussion because there is one final step necessary to optimize the sorting in this example. The standard solution would be to Hash partition (and Sort) the inputs to the Join and Aggregator stages as shown below: Figure 28: “Standard” Partitioning assignment However.4.Information Integration Solutions Center of Excellence 5. on closer inspection. more advanced partitioning and sorting examples are given in 12. This column is used as the key for a subsequent Inner Join to attach the header values to every detail row. All rights reserved. a new output column is defined on the header and detail links using a single constant value derivation. . we can move the Hash partition and Sort before the Copy stage. No part of this publication may be reproduced.

The Join stage operates by reading a single row from the Left input and reading all rows from the Right input that match the key value(s).Information Integration Solutions Center of Excellence Figure 30: “Standard” Partitioning assignment for a Join stage Although Hash partitioning guarantees correct results for stages that require groupings of related records.Use Entire partitioning on the header input to copy the single header row to all partitions Figure 31: Optimized Partitioning assignment based on business requirements Because we are joining on a single value. transcribed. All rights reserved.Use Round Robin partitioning on the detail input to evenly distribute rows across all partitions . there is no need to pre-sort the input to the Join. Although functionally correct. stored in a retrieval system. 2006 71 of 179 © 2006 IBM Information Integration Solutions. No part of this publication may be reproduced. or translated into any language in any form by any means without the written permission of IBM. transmitted. For this reason. and the detail rows are assigned to the Left input as shown in the following illustration: Figure 32: Specifying Link Order in Join stage Parallel Framework Red Book: Data Flow Job Design July 17. To optimize partitioning. Remembering that the degree of parallel operation is limited by the number of distinct values. consider that the single header row is really a form of reference data. depending on the business requirements. An optimized solution would be to alter the partitioning for the input links to the Join stage: . the link order in this example should be set so that the single header row is assigned to the Right input. In order to process a large number of detail records. it is not always the most efficient solution. . the above solution has one serious limitation. so we will revisit this in the Sorting discussion. resulting in sequential processing. the single value join column will assign all rows to a single partition. the link order of the Inner Join is significant.

No part of this publication may be reproduced. 5. and may vary between job runs on the same Data Set. the Join will attempt to read all detail rows from the right input (since they have the same key column value) into memory. there is a specialized example where the Round Robin collector may be appropriate.5.3: Minimizing Runtime Processes and Resource Requirements). 5. 2006 72 of 179 © 2006 IBM Information Integration Solutions. All rights reserved. Changing the output derivation on the header row to a series of numbers instead of a constant value will establish the End of Group and prevent buffering to disk.1 Auto Collector The Auto collector eagerly reads rows from partitions in the input Data Set without blocking if a row is unavailable on a particular partition.5. Like partitioning methods. . However. The Round Robin collector is generally slower than an Auto collector because it must wait for a row to appear in a particular partition. transmitted.2 Round Robin Collector The Round Robin collector patiently reads rows from partitions in the input Data Set by reading input partitions in round robin order. Because the Join will wait until it receives an End of Group (new key value) or End of Data (no more rows on the input Data Set) from the Right input.Information Integration Solutions Center of Excellence If defined in reverse of this order. the collector method is defined in the stage Input/Partitioning properties for any stage running sequentially. there is one further detail in this example. Consider an example where data is read sequentially and passed to a Round Robin partitioner: Parallel Framework Red Book: Data Flow Job Design July 17. the order of rows in an Auto collector is undefined. For this reason. For advanced users. transcribed. (See Section 12. stored in a retrieval system. when the previous stage is running in parallel as shown on the right: Figure 33: Specifying Collector method 5. Auto is the default collector method. or translated into any language in any form by any means without the written permission of IBM. the detail rows in the Left input will buffer to disk to prevent a deadlock.5 Collector Types Collectors combine parallel partitions of an input Data Set (single link) into a single input stream to a stage running sequentially.

Parallel Framework Red Book: Data Flow Job Design July 17. the following guidelines form a methodology for choosing the appropriate collector type: a) When output order does not matter. the Ordered collector may be more efficient c) Use a Round Robin collector to reconstruct rows in input order for round-robin partitioned input Data Sets. Ordered collectors are generally only useful if the input Data Set has been Sorted and Range partitioned on the same key column(s). an Ordered collector will generate a sequential stream in sort order. through aggregation).6 Collecting Methodology Given the options for collecting data into a sequential stream. in the same order. In this scenario. 5.5. use Auto partitioning (the default) b) When the input Data Set has been sorted in parallel.5. transmitted. as used to sort the input Data Set in parallel. then a Round Robin collector can be used before the final Sequential output to reconstruct a sequential output stream in the same order as the input data stream. 5. No part of this publication may be reproduced. transcribed. or translated into any language in any form by any means without the written permission of IBM. Row order is undefined for non-key columns. globally sorted stream of rows o When the input Data Set has been sorted in parallel and Range partitioned.Information Integration Solutions Center of Excellence Round Robin partitioner Round Robin collector Sequential input Stage running in parallel Sequential output Figure 34: RoundRobin Collector example Assuming the data is not repartitioned within the job flow and that the number of rows is not reduced (for example. the Sort Merge collector will generate a sequential stream of rows in globally sorted order.4 Sort Merge Collector If the input Data Set is sorted in parallel. All rights reserved. as long as the Data Set has not been repartitioned or reduced. 5. This is because Round Robin collector reads from partitions using the same partition order that a Round Robin partitioner assigns rows to parallel partitions. . use Sort Merge collector to produce a single. The Sort Merge collector requires one or more key column(s) to be defined. and these should be the same columns.3 Ordered Collector An Ordered collector reads all rows from the first partition. stored in a retrieval system. 2006 73 of 179 © 2006 IBM Information Integration Solutions. then reads all rows from the next partition until all rows in the Data Set have been collected.

The order of key columns determines the sequence and groupings in the result set. sorting is most often needed to establish order within specified groups of data. This is the method the SQL databases use for an ORDER BY clause. All rights reserved. 6. as illustrated in the following example. FName: LName Dodge Dodge Ford Ford Ford Ford Ford Ford Ford Ford FName John Horace Henry Henry Eleanor Eleanor Edsel Edsel Clara Clara Address 75 Boston Boulevard 17840 Jefferson 66 Edison Avenue 4901 Evergreen 7900 Jefferson 1100 Lakeshore 7900 Jefferson 1100 Lakeshore 66 Edison Avenue 4901 Evergreen However. This sort can be done in parallel. or translated into any language in any form by any means without the written permission of IBM. a sort is required after repartitioning. in most cases there is no need to globally sort data to produce a single sequence of rows. based on one or more key column(s) NOTE: By definition. In the following example. Instead. one or more secondary key column(s) to generate a sequential. we would see the following results: Parallel Framework Red Book: Data Flow Job Design July 17. ordered result set. the process of sorting data uses one primary key column and. the Remove Duplicates stage selects either the first or last row from each group of an input Data Set sorted by one or more key columns. . when data is re-partitioned. the previous input Data Set is partitioned on LName and FName columns. Each column is specified with an ascending or descending sort order.Sorting: is used to establish group order within each partition. 2006 74 of 179 © 2006 IBM Information Integration Solutions. sort order is not maintained. sorting on primary key LName (ascending). Sort Aggregator. Other stages (for example.1 Partition and Sort Keys Using the parallel Sort within DataStage Enterprise Edition: . For example.Partitioning: is used to gather related records. Join. Change Apply. transcribed. stored in a retrieval system. transmitted. optionally. No part of this publication may be reproduced. assigning rows with the same key column values to the same partition . secondary key FName (descending): Input Data: I D 1 2 3 4 5 6 7 8 9 10 LName Ford Ford Ford Ford Dodge Dodge Ford Ford Ford Ford FName Henry Clara Edsel Eleanor Horace John Henry Clara Edsel Eleanor Address 66 Edison Avenue 66 Edison Avenue 7900 Jefferson 7900 Jefferson 17840 Jefferson 75 Boston Boulevard 4901 Evergreen 4901 Evergreen 1100 Lakeshore 1100 Lakeshore I D 6 5 1 7 4 10 3 9 2 8 After Sorting by LName.Information Integration Solutions Center of Excellence 6 Sorting Traditionally. Change Capture. Merge) require pre-sorted groups of related records. Given a 4-node configuration file. To restore row order and groupings.

4. we want to select the most recent order for a given customer. transcribed. secondary sort keys can be used to establish order within a group for selection with the Remove Duplicates stage (which can specify First or Last duplicate to retain).2 Complete (Total) Sort If a single. Using Remove Duplicates. No part of this publication may be reproduced. or translated into any language in any form by any means without the written permission of IBM.2 Sorting and Hashing Advanced Example provides a more detailed discussion and example of partitioning and sorting. stored in a retrieval system.Information Integration Solutions Center of Excellence Partition 0 ID 2 8 LName Ford Ford FName Clara Clara Address 66 Edison Avenue 4901 Evergreen ID 4 6 10 LName Ford Dodge Ford Partition 2 FName Eleanor John Eleanor Address 7900 Jefferson 75 Boston Boulevard 1100 Lakeshore Partition 1 ID 3 5 9 LName Ford Dodge Ford FName Edsel Horace Edsel Address 7900 Jefferson 17840 Jefferson 1100 Lakeshore Partition 3 ID 1 7 LName Ford Ford FName Henry Henry Address 66 Edison Avenue 4901 Evergreen Applying a parallel sort to this partitioned input Data Set.partition and parallel Sort on key column(s) Parallel Framework Red Book: Data Flow Job Design July 17. For example. 6. transmitted. All rights reserved. Let’s say that an input Data Set consists of order history based on CustID and Order Date. 2006 75 of 179 © 2006 IBM Information Integration Solutions. To satisfy these requirements we could:  Partition on CustID to group related records  Sort on OrderDate in Descending order  Remove Duplicates on CustID. with Duplicate To Retain=First 12. . in general it is best to use a two step process: . using the primary key column LName (ascending) and secondary key column FName (descending) would generate the resulting Data Set: Partition 0 ID 2 8 LName Ford Ford FName Clara Clara Address 66 Edison Avenue 4901 Evergreen ID 6 4 10 LName Dodge Ford Ford Partition 2 FName John Eleanor Eleanor Address 75 Boston Boulevard 7900 Jefferson 1100 Lakeshore Partition 1 ID 5 3 9 LName Dodge Ford Ford FName Horace Edsel Edsel Address 17840 Jefferson 7900 Jefferson 1100 Lakeshore ID 1 7 LName Ford Ford Partition 3 FName Henry Henry Address 66 Edison Avenue 4901 Evergreen Note that the partition and sort keys do not always have to match. sequential ordered result is needed.

partitioning. but as a separate stage makes job maintenance slightly more complicated.key column usage: sorting. No part of this publication may be reproduced. By default. as there are fewer stages on the design canvas. or translated into any language in any form by any means without the written permission of IBM. use the Link sort unless a specific option is needed on the stand-alone Stage. stored in a retrieval system.Information Integration Solutions Center of Excellence - use a Sort Merge collector on these same key column(s) to generate a sequential.sort direction: Ascending or Descending . the standalone Sort stage is used to specify the Sort Key mode for partial sorts. ordered result set This is similar to the way parallel database engines perform their parallel sort operations.Sorting character set: ASCII (default) or EBCDIC (strings) Parallel Framework Red Book: Data Flow Job Design July 17. The Link sort offers fewer options. transmitted. the “Perform Sort” option is checked. All rights reserved. (Sorting on a link is not available with Auto partitioning.3. The stand-alone sort offers more options.1 Link Sort Sorting on a link is specified on the Input/Partitioning stage options. When specifying key column(s) for partitioning. . although the Enterprise Edition engine may insert a sort if required).case sensitivity (strings) . Within the Designer canvas. Most often. but is easier to maintain in a DataStage job. or both . as shown below: Figure 35: Link Sort icon Additional properties can be specified by right-clicking on the key column as shown in the following illustration: Key column options let the developer specify: . both methods use the same internal sort package (the tsort operator). links that have sort defined will have a Sort icon in addition to the partitioning icon. In general. 2006 76 of 179 © 2006 IBM Information Integration Solutions. 6.3 Link Sort and Sort Stage DataStage Enterprise Edition provides two methods for parallel sorts – the standalone sort stage (when execution mode is set to Parallel) and sort on a link (when using a keyed input partitioning method). when specifying a keyed partitioning method. transcribed. 6.

transmitted. stored in a retrieval system. 6.4 Stable Sort Stable sorts preserve the order of non-key columns within each sort group. the following properties are not available when sorting on a link: Sort Key Mode (a particularly important performance optimization) Create Cluster Key Change Column Create Key Change Column Output Statistics Sort Utility (don’t change this!) Restrict Memory Usage Figure 37: Sort Stage options Of the options only available in the standalone Sort stage. . and thus a stable sort is generally slower than a non-stable sort for the same input Data Set and sort keys. instead of performing a complete Sort. This “subsort” uses significantly less disk space and CPU resource. It is important to note that by default the Stable sort option is disabled for sorts on a link and Enabled with the standalone Sort stage. disable Stable sort unless needed.Information Integration Solutions Center of Excellence - Position of nulls in the result set (for nullable columns) Figure 36: Specifying Link Sort options 6. NOTE: The Sort Utility option is an artifact of previous releases. the Sort Key Mode is most frequently used. Specifically. This requires some additional overhead in the sort algorithm. and can often be performed in memory (depending on the size of the new subsort groups). the key column property “Sort Key Mode” is a particularly powerful feature and a significant performance optimization. Parallel Framework Red Book: Data Flow Job Design July 17. which is significantly faster than a “UNIX” sort. or translated into any language in any form by any means without the written permission of IBM.3. All rights reserved.5 Sub-Sorts Within the standalone Sort stage.2 Sort Stage The standalone Sort stage offers more options than the sort on a link. No part of this publication may be reproduced. - 6. 2006 77 of 179 © 2006 IBM Information Integration Solutions. It is used when resorting a sub-grouping of a previously sorted input Data Set. Always specify “DataStage” Sort Utility. transcribed. For this reason.

key={value=FirstName}}(0)) on nodes ( node1[op2.Information Integration Solutions Center of Excellence To resort based on a sub-grouping. The parallel job score (see 12. while new sort keys are specified with the “Sort” key mode property. as shown in the following example: Figure 38: Sort Key Mode property To successfully perform a subsort. Remove Duplicates. And. No part of this publication may be reproduced. Enterprise Edition inserts sorts before any stage that requires matched key values or ordered groupings of (Join. keys with “Don’t Sort (Previously Sorted)” property must be at the top of the list. Re-used sort keys are specified with the “Don’t Sort (Previously Sorted)” property.p3] )} Typically. 2006 78 of 179 © 2006 IBM Information Integration Solutions. Parallel Framework Red Book: Data Flow Job Design July 17. the job will abort. All rights reserved. as shown in this score fragment: op1[4p] {(parallel inserted tsort operator {key={value=LastName}.p1] node3[op2. If the input data does not match the key column definition for a subsort. all key columns must still be defined in the Sort stage.2 Understanding the Parallel Job Score) can be used to identify automatically-inserted sorts. . DataStage Enterprise Edition inserts sort operators as necessary to ensure correct results. transmitted.4.6 Automatically-Inserted Sorts By default. the key column order for these keys must match the key columns and order defined in the previously-sorted input Data Set. stored in a retrieval system.p2] node4[op2. without gaps between them. or translated into any language in any form by any means without the written permission of IBM.p0] node2[op2. Merge. 6. Sort Aggregator). Sorts are only inserted automatically when the flow developer has not explicitly defined an input sort. transcribed.

To perform a sort. By default. inserted sorts can be a significant performance impact if they are not necessary. stored in a retrieval system. If the sort operation can be performed in memory (as is often the case with a subsort) then no disk I/O is performed.4: Partitioning Examples. On a global basis. each sort uses 20MB of memory per partition for its memory buffer.8 Tuning Sort Sort is a particularly expensive task within DataStage Enterprise Edition which requires CPU. the environment variable APT_TSORT_STRESS_BLOCKSIZE can be Parallel Framework Red Book: Data Flow Job Design July 17. No part of this publication may be reproduced. 2006 79 of 179 © 2006 IBM Information Integration Solutions. This value can be changed for each standalone Sort stage using the “Restrict Memory Usage” option (the minimum is 1MB/partition). and disk resources. Output Statistics  Always specify “DataStage” Sort Utility for standalone Sort stages  Use the “Sort Key Mode=Don’t Sort (Previously Sorted)” to resort a sub-grouping of a previously-sorted input Data Set e) Be aware of automatically-inserted sorts  Set $APT_SORT_INSERTION_CHECK_ONLY to verify but not establish required sort order f) Minimize the use of sorts within a job flow g) To generate a single. This will verify sort order but not actually perform a sort. All rights reserved. .Information Integration Solutions Center of Excellence While ensuring correct results. 6. sequential ordered result set use a parallel Sort and a Sort Merge collector 6. or translated into any language in any form by any means without the written permission of IBM. transcribed. define all sort key columns with the Sort Mode key property “Don’t Sort (Previously Sorted)” b) Set the environment variable APT_SORT_INSERTION_CHECK_ONLY. transmitted. the following methodology should be applied when sorting in a DataStage Enterprise Edition data flow: a) b) c) d) Start with a link sort Specify only necessary key column(s) Don’t use Stable Sort unless needed Use a stand-alone Sort stage instead of a Link sort for options that not available on a Link sort:  Sort Key Mode. memory. the environment variable $APT_SORT_INSERTION_CHECK_ONLY should be set to prevent Enterprise Edition from inserting un-necessary sorts before the Join stage. Create Cluster Key Change Column. There are two ways to prevent Enterprise Edition from inserting an un-necessary sort: a) Insert an upstream Sort stage on each link. Create Key Change Column. aborting the job if data is not in the required sort order. Revisiting the partitioning examples in Section 5. rows in the input Data Set are read into a memory buffer on each partition.7 Sort Methodology Using the rules and behavior outlined in the previous section.

stored in a retrieval system. transcribed. or translated into any language in any form by any means without the written permission of IBM.the directory “/tmp” (on UNIX) or “C:/TMP” (on Windows) if available The file system configuration and number of scratch disks defined in parallel configuration file can greatly impact the I/O performance of a parallel sort. 2006 80 of 179 © 2006 IBM Information Integration Solutions. . in MB. Parallel Framework Red Book: Data Flow Job Design July 17.scratch disks defined in the current configuration file (APT_CONFIG_FILE) in the “sort” named disk pool .scratch disks defined in the current configuration file default disk pool . transmitted. Having a greater number of scratch disks for each node allows the sort to spread I/O across multiple file systems. No part of this publication may be reproduced. for all sort operators (link and standalone). overriding any per-sort specifications.the default directory specified by the environment variable TMPDIR .Information Integration Solutions Center of Excellence use to specify the size of the memory buffer. If the input Data Set cannot fit into the sort memory buffer. All rights reserved. then results are temporarily spooled to disk in the following order: .

7. Intermediate storage between DataStage parallel jobs. Need to share data with an external Parallel SAS application. and any limitations. However. Sequential File Need to read source data in complex (hierarchical) format. Can only be used as reference link on a Lookup stage. but this is not recommended as it imposes risks for failure recovery. As such. In general. using the internal format of the parallel engine.2 Data Set Usage Parallel Data Sets are the persistent (on-disk) representation of the in-memory data structures of DS/EE.1 Which File Stage to Use DataStage/EE offers various stages for reading from and writing to files. such as mainframe sources with COBOL copybook file definitions. transmitted. transcribed. Limitations Cannot write to a single file in parallel. Requires Parallel SAS. No part of this publication may be reproduced. are summarized below: File Stage Recommended Usage Read and write standard files in a single format. can only be read from / written to by DS/EE or Parallel SAS. All rights reserved. Can only be written – contents cannot be read or verified. Data Sets provide maximum performance for reading and writing data from disk. Data Sets store data in partitioned form. Complex Flat File Data Set File Set SAS Parallel Data Set Lookup File Set No DS/EE file stage supports “update” of existing records. Some stages (parallel Data Set) support “Append” to add new records to an existing file.Information Integration Solutions Center of Excellence 7 File Stage Usage 7. as no overhead is needed to translate data to the internal DS/EE representation. stored in a retrieval system. Slightly higher overhead than Data Set. or translated into any language in any form by any means without the written permission of IBM. Cannot write in parallel. If data is Parallel Framework Red Book: Data Flow Job Design July 17. Can only be read from and written to by DataStage parallel jobs or orchadmin command. performance penalty of conversion. can write in parallel (generates multiple segment files).) Rare instances where lookup reference data is required by multiple jobs and is not updated frequently. does not support hierarchical data files. 2006 81 of 179 © 2006 IBM Information Integration Solutions. performance penalty of format conversion. Recommendations for when to use a particular stage. (Requires SAS connectivity license for DataStage. . Data Sets can only be read from and written to using a DataStage parallel job. Need to share information with external applications.

set environment variable $APT_IMPORT_PATTERN_USES_FILESET Read Method: Specific Files. As shown in the following Job fragment. . 2006 82 of 179 © 2006 IBM Information Integration Solutions.Information Integration Solutions Center of Excellence 7. All rights reserved.3. 7.file may be either fixed or variable-width Read Method: Specific Files. the Sequential File stage can only read and write data that is in flattened (row/column) format. In these instances. 7. transmitted. define a single large string column for the non-parallel Sequential File read. 7. or translated into any language in any form by any means without the written permission of IBM. stored in a retrieval system. performance can still be improved by separating the file I/O from the column parsing operation. transcribed. Parallel Framework Red Book: Data Flow Job Design July 17. only one file specified. A better option for writing to a set of Sequential Files in parallel is to use the FileSet stage. The formatting and column properties of the Column Import stage match those of the Sequential File stage. Readers Per Node option greater than 1 useful for SMP configurations . input row order is not maintained across readers. in parallel.1 Reading from a Sequential File in Parallel The ability to read Sequential File(s) in parallel within Enterprise Edition depends on the Read Method and the options specified: Sequential File – options to read sequentially: Read Method: Specific Files.file may only be fixed-width Note that when reading in parallel.3. The FileSet stage will write in parallel. the degree of parallelism of the write will correspond to the number of file names specified.3. only one file specified may be a file or named pipe Read Method: File Pattern Sequential File – options to read in parallel: Read Method: Specific Files. more than one file specified each file specified within a single Sequential File stage must be of the same format Read Method: File Pattern.3 Sequential File Stages (Import and Export) The Sequential File stage can be used to read from or write to one or more flat files of the same format. This will create a single header file (in text format) and corresponding data files. Unlike the Complex Flat File stage. and then pass this to a Column Import stage to parse the file in parallel.3 Separating I/O from Column Import If the Sequential File input cannot be read in parallel. Read From Multiple Nodes option is set to Yes useful for cluster and Grid configurations . No part of this publication may be reproduced. using the format options specified in the FileSet stage.2 Writing to a Sequential File in Parallel It is only possible to write in parallel from a Sequential File stage when more than one output file is specified.

4 Partitioning Sequential File Reads Care must be taken to choose the appropriate partitioning method from a Sequential File read: • Don’t read from Sequential File using SAME partitioning in the downstream stage! Unless more than one source file is specified.3. stored in a retrieval system. The format of the Schema File. but there is a small performance penalty associated with increased I/O. Note that this document is required. SAME will read the entire file into a single partition. It is also important to remember that this setting will apply to all Sequential File stages in the data flow. Setting this value to a low number (such as 1) is useful for realtime applications. transcribed. since the Import / Export properties used by the Sequential File and Column Import stages are not documented in the DataStage Parallel Job Developer’s Guide. No part of this publication may be reproduced.6 Parameterized Sequential File Format The Sequential File stage supports a Schema File option to specify the column definitions and file format of the source file. • 7. All rights reserved. instead of statically through Table Definitions. 7. When a job completes successfully. or by using a File Pattern). the in-band (value) must be explicitly defined in the extended column attributes for each Nullable column. 7. 2006 83 of 179 © 2006 IBM Information Integration Solutions.5 Sequential File (Export) Buffering By default. each file’s data is read into a separate partition. the buffers are always flushed to disk. It is important to use ROUNDROBIN partitioning (or other partitioning appropriate to downstream components) to evenly distribute the data in the flow. the Sequential File (export operator) stage buffers its writes to optimize performance. as shown below: Parallel Framework Red Book: Data Flow Job Design July 17. . When multiple files are read by a single Sequential File stage (using multiple files.3.3. or translated into any language in any form by any means without the written permission of IBM. Using the Schema File option allows the format of the source file to be specified at runtime.Information Integration Solutions Center of Excellence Figure 39: Column Import example Note that this method is also useful for External Source and FTP sequential source stages. making the entire downstream flow run sequentially (unless it is later repartitioned).3. transmitted.7 Reading and Writing Nullable Columns When reading from or writing to Sequential Files or File Sets. The environment variable $APT_EXPORT_FLUSH_COUNT allows the job developer to specify how frequently (in number of rows) that the Sequential File stage flushes its internal buffer on writes. including Sequential File import / export format properties is documented in the Orchestrate Record Schema manual. 7.

or translated into any language in any form by any means without the written permission of IBM. All rights reserved. All import and export properties are listed in the Import/Export Properties chapter of the Orchestrate Operators Reference. • • 7. the field width column property must be set to match the fixed-width of the input column. Varchar). Decimal.3. 2006 84 of 179 © 2006 IBM Information Integration Solutions. Double-click on the column number in the grid dialog to set this column property. Varchar). you must define the null field value and length in the Nullable section of the column property. Integer. use the print_field import property. By default. stored in a retrieval system.Information Integration Solutions Center of Excellence Figure 40: Extended Column Metadata (Nullable properties) 7. . Double-click on the column number in the grid dialog or right mouse click on the column and select edit column to set these properties.9 Reading Bounded-Length VARCHAR Columns Care must be taken when reading delimited. Integer.3. To display each field value. • If a field is nullable. transcribed. transmitted. if the source file has fields with values longer than the maximum Parallel Framework Red Book: Data Flow Job Design July 17. When writing fixed-length files from variable-length fields (eg. the field width and pad string column properties must be set to match the fixed-width of the output column. Double-click on the column number in the grid dialog to set this column property. Decimal.8 Reading from and Writing to Fixed-Length Files Particular attention must be taken when processing fixed-length fields using the Sequential File stage: • If the incoming columns are variable-length data types (for example. No part of this publication may be reproduced. bounded-length Varchar columns (Varchars with the length option set). Use caution when specifying this option as it can generate an enormous amount of detail in the job log.

2006 85 of 179 © 2006 IBM Information Integration Solutions.) When used as a target. these extra characters will be silently truncated. or translated into any language in any form by any means without the written permission of IBM. including MVS datasets with QSAM and VSAM files.4 Complex Flat File Stage The Complex Flat File (CFF) stage can be used to read or write one or more files in the same hierarchical format. When used as a source. stored in a retrieval system. . It does not write to MVS datasets.Information Integration Solutions Center of Excellence Varchar length.10 Tuning Sequential File Performance On heavily-loaded file servers or some RAID/SAN array configurations. No part of this publication may be reproduced. A complex flat file may contain one or more GROUPs. (This is an error in the DataStage documentation. the stage allows you to write data to one or more complex flat files. or OCCURS clauses. Complex Flat File source stages execute in parallel mode when they are used to read multiple files. 7. with a default of 128 (128K). setting the environment variable $APT_CONSISTENT_BUFFERIO_SIZE to a value equal to the read/write size in bytes can significantly improve performance of Sequential File operations. the environment variables $APT_IMPORT_BUFFER_SIZE and $APT_EXPORT_BUFFER_SIZE can be used to improve I/O performance. REDEFINES.3. All rights reserved. NOTE: The Complex Flat File stage cannot read from sources with OCCURS DEPENDING ON clauses. the stage allows you to read data from one or more complex flat files. Increasing this size may improve performance. but you can configure the stage to execute sequentially if it is only reading one file with a single reader. transmitted. transcribed. Finally. These settings specify the size of the read (import) and write (export) buffer size in Kbytes. Parallel Framework Red Book: Data Flow Job Design July 17. The environment variable $APT_IMPORT_REJECT_STRING_FIELD_OVERRUNS will direct Enterprise Edition to reject records with strings longer than their declared maximum column length. 7. in some disk array configurations.

native binary binary.y] or string[x+y] decimal[x+y.y] sfloat dfloat ustring[n] ustring[max=n] subrec Internal Options packed packed zoned zoned. All rights reserved. native binary binary. stored in a retrieval system. native binary binary.y] or string[x+y] decimal[x+y. leading separate.y] decimal[x+y.y] decimal[x+y. transmitted.Information Integration Solutions Center of Excellence 7. or translated into any language in any form by any means without the written permission of IBM. native binary character character for filler varchar decimal decimal display_numeric display_numeric display_numeric display_numeric display_numeric display_numeric float float graphic_n. transcribed.1 CFF Stage Data Type Mapping When you work with mainframe data using the CFF stage.4. native binary binary. No part of this publication may be reproduced. 2006 86 of 179 © 2006 IBM Information Integration Solutions. native binary binary. trailing separate. trailing zoned.y] decimal[x+y.y] decimal[x+y.y] decimal[x+y. graphic_g vargraphic_g/n Size 2 bytes 4 bytes 2 bytes 2 bytes 4 bytes 8 bytes n bytes n bytes n bytes (x+y)/2+1 bytes (x+y)/2+1 bytes x+y bytes x+y bytes x+y bytes x+y bytes x+y+1 bytes x+y+1 bytes 4 bytes 8 bytes n*2 bytes n*2 bytes Internal Type int16 int32 int64 uint16 uint32 uint64 string(n) raw(n) string(max=n) decimal[x+y. the data types are mapped to internal Enterprise Edition data types as follows: COBOL Type S9(1-4) COMP/COMP-5 S9(5-9) COMP/COMP-5 S9(10-18) COMP/COMP-5 9(1-4) COMP/COMP-5 9(5-9) COMP/COMP-5 9(10-18) COMP/COMP-5 X(n) X(n) X(n) 9(x)V9(y)COMP-3 S9(x)V9(y)COMP-3 9(x)V9(y) S9(x)V9(y) S9(x)V9(y) SIGN IS TRAILING S9(x)V9(y) SIGN IS LEADING S9(x)V9(y) SIGN IS TRAILING SEPARATE S9(x)V9(y) SIGN IS LEADING SEPARATE COMP-1 COMP-2 N(n) or G(n) DISPLAY-1 N(n) or G(n) DISPLAY-1 Group Description binary. trailing zoned. . leading Parallel Framework Red Book: Data Flow Job Design July 17.

When rows are rejected by a Transformer. and to use other stages (such as Copy) when derivations are not needed. entries are placed in the Director job log. it is important to minimize the number of transformers. This makes it easy to identify reject conditions (by row counts). the Transformer will reject (through the reject link indicated by a dashed line) any row that has a NULL value used in the expression. Always include reject links in a parallel Transformer.2 Parallel Transformer System Variables The system variable @ROWNUM behaves differently in the Enterprise Edition Transformer stage than in the Server Edition Transformer.1 Transformer Stage The DataStage Enterprise Edition parallel Transformer stage generates “C” code which is then compiled into a parallel component. For this reason. it should be converted from its out-of-band (internal) null representation to an in-band (specific value) null representation using stage variables or the Modify stage. undefined.1 Transformer NULL Handling and Reject Link When evaluating expressions for output derivations or link constraints. 2006 87 of 179 © 2006 IBM Information Integration Solutions. stored in a retrieval system. right-click on an output link and choose “Convert to Reject: Figure 41: Transformer Reject link The parallel Transformer rejects NULL derivation results (including output link constraints) because the rules for arithmetic and string handling of NULL values are.col) Then “” Else link.4: Parallel Transformer stages for guidelines on Transformer stage usage. Because the DS/EE Transformer runs in parallel. or translated into any language in any form by any means without the written permission of IBM. . 8. the following stage variable expression would convert a null value to a specific empty string: If ISNULL(link. To create a Transformer reject link in Designer. Even if the target column in an output derivation allows nullable results. No part of this publication may be reproduced. See Section 3. For this reason. @ROWNUM is Parallel Framework Red Book: Data Flow Job Design July 17. by definition. the Transformer will reject the row instead of sending it to the output link(s). For example. if you intend to use a nullable column within a Transformer derivation or output link constraint. transcribed.8.col Note that if an incoming column is only used in an output column mapping.Information Integration Solutions Center of Excellence 8 Transformation Languages 8. 8. transmitted. All rights reserved.1. the Transformer will allow this row to be sent to the output link without being rejected.1.

1. . Examples: 1. these internal decimal variables will have a precision and scale of 38 and 10.4 -> 2. apply the abort rule to this output link. -1. the environment variables APT_DECIMAL_INTERM_PRECISION and APT_DECIMAL_INTERM_SCALE can be set to the desired range. internal decimal results are rounded to the nearest applicable value. By default.5-> 2. 8. not the target. Examples: 1.Information Integration Solutions Center of Excellence assigned to incoming rows for each partition. TrimLeadingTrailing(string) works only if string is a VarChar field. the incoming column must be type VarChar before it is evaluated in the Transformer. For example. Within the link constraints dialog box. -1. transmitted. Since the Transformer will abort the entire job flow immediately. No part of this publication may be reproduced. When generating a sequence of numbers in parallel. or committed to database tables. 1. By default. 8.1. the system variables @NUMPARTITIONS and @PARTITIONNUM should be used.4 -> -1. -1. Therefore.1.5: Sequential File (Export) Buffering). or translated into any language in any form by any means without the written permission of IBM. the PadString function uses the length of the source type.4 -> 1.6 ->1. If more precision is required. 8. -1. 1).3 Transformer Derivation Evaluation Output derivations are evaluated before any type conversions on the assignment.6 -> -1 floor Rounds towards negative infinity. All rights reserved. and set the “Abort After Rows” count to the number of rows allowed before the job should be aborted (for example.4 Conditionally Aborting Jobs The Transformer can be used to conditionally abort a job when incoming data matches a specific rule. there are times when internal decimal variables need to be generated in order to perform the evaluation. stored in a retrieval system. Create a new output link that will handle rows that match the abort rule. up to a maximum precision of 255 and scale of 125.5 Transformer Decimal Arithmetic When decimal data is evaluated by the Transformer stage. breaking ties by rounding positive values toward positive infinity and negative values toward negative infinity. Thus. transcribed.4 -> -2 round_inf Rounds or truncates towards nearest representable value. or performing parallel derivations.3.5 -> -2 Parallel Framework Red Book: Data Flow Job Design July 17. it is possible that valid rows will not have been flushed from Sequential File (export) buffers. it is important to make sure the type conversion is done before a row reaches the Transformer. It is important to set the database commit parameters or adjust the Sequential File buffer settings (see Section 7. The environment variable APT_DECIMAL_INTERM_ROUND_MODE can be used to change the rounding behavior using one of the following keywords: ceil Rounds towards positive infinity. For example. 2006 88 of 179 © 2006 IBM Information Integration Solutions. Examples: 1.

or translated into any language in any form by any means without the written permission of IBM. unless the derivation is empty For each output link: Evaluate the link constraint. Similarly. the stage variable definition would be: Parallel Framework Red Book: Data Flow Job Design July 17. 2006 89 of 179 © 2006 IBM Information Integration Solutions. if true Evaluate each column derivation value Write the output record Else skip the link Next output link Next input row The stage variables and the columns within a link are evaluated in the order in which they are displayed in the Transformer editor. . as they would be evaluated once for every output column that uses them. Examples: 1. Such constructs are: • Where the same part of an expression is used in multiple column derivations For example.1. it can be seen that there are certain constructs that would be inefficient to include in output column derivations.5. No part of this publication may be reproduced. the substring is evaluated just once for every input row.. The evaluation sequence is as follows: Evaluate each stage variable initial value For each input row to process: Evaluate each stage variable derivation value. From this sequence. For example.. 8.3] = “001”) THEN . This can be made more efficient by moving the substring calculation into a stage variable. round or truncate to the scale size.col[1.56 ->-1. if $APT_DECIMAL_INTERM_SCALE is smaller than the results of the internal calculation.6 Optimizing Transformer Expressions and Stage Variables In order to write efficient Transformer stage derivations. suppose multiple columns in output links want to use the same substring of an input column. the output links are also evaluated in the order in which they are displayed. stored in a retrieval system. By doing this. -1. transcribed. then the following test may appear in a number of output columns derivations: IF (DSLINK1. it is useful to understand what items get evaluated and when. All rights reserved.5.3] is evaluated for each column that uses it. In this case.Information Integration Solutions Center of Excellence trunc_zero Discard any fractional digits to the right of the rightmost fractional digit supported regardless of sign. In this case. the evaluation of the substring of DSLINK1.col[1.56 -> 1. transmitted.

. It would be more efficient to calculate the constant value just once for the whole Transformer. In this case. it is not reevaluated for each input row. In addition to a function value returning a constant value. This can be achieved using stage variables. In fact. because the derivation expression of the stage variable is empty.20) This returns a string of 20 spaces. All rights reserved. but in this case. transcribed. The solution here is to move the function evaluation into the initial value of a stage variable. • Where an expression includes calculated constant values For example. such as: Str(“ “. The stage variable would be: IF (DSLink1. its value for the whole Transformer processing is unchanged from the initial value. transmitted.. stored in a retrieval system. or translated into any language in any form by any means without the written permission of IBM. the function would be evaluated every time the column derivation is evaluated. Any expression that previously used this function would be changed to use the stage variable instead. this example could be improved further by also moving the string comparison into the stage variable. The initial value of the stage variable is evaluated just once. 2006 90 of 179 © 2006 IBM Information Integration Solutions.20) You would then leave the derivation of the stage variable on the main Transformer page empty. This function could be moved into a stage variable derivation. the function would still be evaluated once for every input row.col1[1. No part of this publication may be reproduced. another example would be part of an expression such as: Parallel Framework Red Book: Data Flow Job Design July 17. A stage variable can be assigned an initial value from the Stage Properties dialog/Variables tab in the Transformer stage editor.3] and each column derivation would start with: IF (StageVar1 = “001” THEN .Information Integration Solutions Center of Excellence DSLINK1. In this case. before any input rows are processed. the variable would have its initial value set to: Str(“ “. . Therefore.col[1. a column definition may include a function call that returns a constant value.3] = “001” THEN 1 ELSE 0 and each column derivation would start with: IF (StageVar1) THEN This reduces both the number of substring functions evaluated and string comparisons made in the Transformer. Then.

an integer stage variable. However. 8. then it would be more efficient to use a stage variable to perform the conversion once. dropping and renaming columns. this would be fine. specify its derivation to be DSLINK1. transcribed. for example. since it uses low-level functionality that is part of every DataStage Enterprise Edition component. and then use the stage variable in place of DSLink1. Parallel Framework Red Book: Data Flow Job Design July 17. transmitted. 2006 91 of 179 © 2006 IBM Information Integration Solutions. if DSLINK1. and string trim. again. In this case. No part of this publication may be reproduced. this concatenation is evaluated every time the column derivation is evaluated. . needless conversions are required wherever that variable is used. the Output Mapping properties for any parallel stage will generate an underlying modify for default data type conversions. • Where an expression requiring a type conversion is used as a constant. and so. in order to be able to add it to DSLink1. If this just appeared once in one output column expression. using the initial value setting to perform the concatenation just once. The standalone Modify stage can be used for non-default type conversions (nearly all date and time conversions are non-default). The solution in this case is just to change the constant from a string to an integer: DSLink1. a conversion would be required every time the expression is evaluated. It should be noted that when using stage variables to evaluate parts of expressions. an expression may include something like this: DSLink1. you would create. As noted in the previous section.col1. Otherwise. Since the subpart of the expression is actually constant. or it is used in multiple places. For example.col1+"1" In this case.col1+1 In this example. null conversion. then. where it requires the same type conversion in each expression. stored in a retrieval system. or translated into any language in any form by any means without the written permission of IBM.Information Integration Solutions Center of Excellence "abc" : "def" As with the function-call example. where that conversion would have been required. the data type of the stage variable should be set correctly for that context. this constant part of the expression could again be moved into a stage variable.col1. if an input column is used in more than one expression. All rights reserved. it must be converted from a string to an integer each time the expression is evaluated. documented in the Parallel Job Developers Guide as well as the Orchestrate Operators Reference.col1.col1 were a string field. The Modify stage uses the syntax of the underlying modify operator. the "1" is a string constant.2 Modify Stage The Modify stage is the most efficient “stage” available.

string. use it if you are also converting types. NOTE: The DataStage Parallel Job Developers Guide gives incorrect syntax for converting an out-of-band null to an in-band null (value) representation. and justify defaults to begin. To convert from an out-of-band null to an in-band null (value) representation within Modify. stored in a retrieval system.1 Modify and Null Handling The Modify stage can be used to convert an out-of-band null value to an in-band null representation and vice-versa. Justify has no affect when the target string has variable length. for decimal. and timestamp fields.2. To convert from an in-band null to an out-of-band null. 2006 92 of 179 © 2006 IBM Information Integration Solutions. with the following syntax: stringField=string_trim[character.destField is the destination field’s name. .sourceField is the source field’s name . . 8. By default.destField is the destination field’s name. All rights reserved.value is the value of the source field when it is null. or translated into any language in any form by any means without the written permission of IBM. date. justify] (string) You can use this function to remove the characters used to pad variable-length strings when they are converted to fixed-length strings of greater length.sourceField is the source field’s name.value) where: .value) where: .Information Integration Solutions Center of Excellence 8. For a numeric field value can be a numeric value. . transcribed. use it if you are also converting types. . the syntax is: destField[:dataType] = make_null(sourceField. . direction. the syntax is: destField[:dataType] = handle_null (sourceField. By default. The character argument is the character to remove. direction defaults to end. time.dataType is its optional data type. value can be a string. . The following example removes all leading ASCII NULL characters from the beginning of name and places the remaining characters in an output variable-length string with the same name: Parallel Framework Red Book: Data Flow Job Design July 17.dataType is its optional data type. The value of the direction and justify arguments can be either begin or end.2. No part of this publication may be reproduced. this is NULL.2 Modify and String Trim The function string_trim has been added to Modify. these characters are retained when the fixed-length string is then converted back to a variable-length string.value is the value you wish to represent a null in the output. transmitted. The destField is converted from an Orchestrate out-of-band null to a value of the field’s data type.

. transmitted. stored in a retrieval system. All rights reserved. 2006 93 of 179 © 2006 IBM Information Integration Solutions.Information Integration Solutions Center of Excellence name:string = string_trim[NULL. No part of this publication may be reproduced. begin](color) Parallel Framework Red Book: Data Flow Job Design July 17. or translated into any language in any form by any means without the written permission of IBM. begin](name) The following example removes all trailing Z characters from color. end. transcribed. and left-justifies the resulting hue fixed-length string: hue:string[10] = string_trim[‘Z’.

care must be taken to change the column properties to allow NULL values before the Join. For this reason. transcribed. Oracle Enterprise.1. then Enterprise Edition inserts “default” values based on the data type. Left Outer. A Transformer stage can be used to test for NULL values in unmatched columns. Sparse Lookups may also be appropriate for exception-based processing when the number of exceptions is a small fraction of the main input data. In an OUTER join scenario. Right Outer. stored in a retrieval system. 2006 94 of 179 © 2006 IBM Information Integration Solutions. the Join stage inserts values into the unmatched non-key column(s) using the following rules: a) If the non-key column is defined as nullable (on the Join input links) then Enterprise Edition will insert NULL values in the unmatched columns b) If the non-key column is defined as not-nullable. Join vs. This is also handy with Lookups that have multiple reference links. For example. the JOIN or MERGE stage should be used. This is most easily done by inserting a Copy stage and mapping a column from NON-NULLABLE to NULLABLE. This isolates your match/no-match logic from any changes in the metadata. to each of the inner links and test that column for the constant after you have performed the join. transmitted. In most cases. All rights reserved. with a constant value.7: Database Sparse Lookup vs. If un-matched rows must be captured or logged. when a match does not occur. it is best to use a Column Generator to add an ‘indicator’ column.1 Lookup vs. the default value for a Varchar is an empty string (“”). and to retest if the relative volumes of data change dramatically. 9. and ODBC Enterprise stages) to scenarios where the number of input rows is significantly smaller (for example. (see Section 10. and the default value for a Char is a string of padchar characters equal to the length of the Char column. Join). During an Outer Join. No part of this publication may be reproduced. Merge The Lookup stage is most appropriate when the reference data for all lookup stages in a job is small enough to fit into available physical memory. the default value for an Integer is zero. . Parallel Framework Red Book: Data Flow Job Design July 17. Each lookup reference requires a contiguous block of shared memory.Information Integration Solutions Center of Excellence 9 Combining Data 9. an OUTER join operation must be performed. Limit the use of database Sparse Lookups (available in the DB2 Enterprise.2 Capturing Unmatched Records from a Join The Join stage does not provide reject handling for unmatched records (such as in an InnerJoin scenario). If the Data Sets are larger than available memory resources. 1:100 or more) than the number of reference rows. or translated into any language in any form by any means without the written permission of IBM. or both links in the case of Full Outer) are output regardless of match on key values. It is best to test both the Sparse and Normal to see which actually performs best. all rows on an outer link (for example.

All rights reserved. use the stages shown on the right to: generate a single constant-value key column using the Column Generator or an upstream Transformer aggregate in parallel on the generated column (partition Round Robin. You can also specify that the result of an individual calculation or recalculation is decimal by using the optional “Decimal Output” sub-property. No part of this publication may be reproduced. the output data type of a parallel Aggregator stage calculation or recalculation column is floating point (Double). or translated into any language in any form by any means without the written permission of IBM.3 Performing Total Aggregations The Aggregator counts and calculates based on distinct key value groupings. 9. the Hash Aggregator should only be used when the number of distinct key values is small and finite. Note that performance is typically better if you let calculations occur in floating point (Double) data type and convert the results to decimal downstream in the flow.3. but only maintains the calculations for the current group in memory. The Sort Aggregation Method should be used when the number of key values is unknown or very large. Because each key value/aggregation requires approximately 2K of memory. . Unlike the Hash Aggregator. the default Aggregation Method is set to Hash. which maintains the results of each keycolumn value/aggregation pair in memory. transmitted. To aggregate in decimal precision.3. the Sort Aggregator requires presorted data. stored in a retrieval system.3. set the optional property “Aggregations/Default to Decimal Output” within the Aggregator stage.3 The Aggregator Stage 9. aggregate on generated key column) there is no need to sort or hash-partition the input data with only one key column value aggregate Sequentially on the generated column - - Note that in this example use two Aggregators are used to prevent the sequential aggregation from disrupting upstream processing.Information Integration Solutions Center of Excellence 9. An exception to this is financial calculations which should be done in decimal to preserve appropriate precision. To perform a total aggregation. transcribed.2 Aggregation Data Type By default.1 Aggregation Method By default. Parallel Framework Red Book: Data Flow Job Design July 17. 9. 2006 95 of 179 © 2006 IBM Information Integration Solutions.

Subsequent sections provide database-specific tips and guidelines.1 Database development overview This section is intended to provide guidelines appropriate to accessing any database within DataStage Enterprise Edition. Oracle. transmitted. stored in a retrieval system. multiple stage types are available: Teradata MultiLoad (TPump) Native Parallel Database Stages DB2/UDB Enterprise Informix Enterprise ODBC Enterprise Oracle Enterprise SQL Server Enterprise Teradata Enterprise NOTE: Not all database stages (for example. Teradata API) are visible in the default DataStage Designer palette. .Information Integration Solutions Center of Excellence 10 Database Stage Guidelines 10. No part of this publication may be reproduced. For some databases (DB2. or translated into any language in any form by any means without the written permission of IBM. 10.1. You may need to customize the palette to add hidden stages. 2006 96 of 179 © 2006 IBM Information Integration Solutions. Plug-In Database Stages Dynamic RDBMS DB2/UDB API DB2/UDB Load Informix CLI Informix Load Informix XPS Load Oracle OCI Load RedBrick Load Sybase IQ12 Load Sybase OC Teradata API Teradata MultiLoad (MultiLoad) Parallel Framework Red Book: Data Flow Job Design July 17. Informix.1 Database stage types DataStage Enterprise Edition offers database connectivity through native parallel and plug-in stage types. All rights reserved. transcribed. and Teradata).

Furthermore. native database components (such as the Oracle Enterprise stage) are preferable to ODBC connectivity if both are supported on the database platform. Native parallel stages always pre-query the database for actual runtime metadata (column names.1. and features it is best to use the native parallel database stages in a job design if connectivity requirements can be satisfied. “Wire Protocol” ODBC Drivers generally do not require database client software to be installed on the server platform. care must be taken to assign the correct data types in the job design. Because of their tight integration with database technologies. transcribed. transmitted. However. Because there are exceptions to this rule (especially with Teradata). For example. No part of this publication may be reproduced.Information Integration Solutions Center of Excellence 10. the DB2/UDB Enterprise stage is only compatible with DB2 Enterprise Server Edition with DPF on the same UNIX platform as the DataStage server. for maximum parallel performance. operating system. 10. .1. On UNIX. attributes). scalability. plug-in database stages match columns by order. From a design perspective. not position in the stage Table Definitions. Because plug-in stage types cannot read in parallel. the ODBC Enterprise stage cannot read in parallel (although a patch to allow parallel read may be available on some platforms through IBM IIS Support). Unlike the database-specific parallel stages. and version.3 Plug-In database stages Plug-in stage types are intended to provide connectivity to database configurations not offered by the native parallel stages. Parallel Framework Red Book: Data Flow Job Design July 17. not name. stored in a retrieval system. and cannot span multiple servers in a clustered or Grid configuration. they should only be used when it is not possible to use a native parallel stage. 2006 97 of 179 © 2006 IBM Information Integration Solutions.1. the native parallel stages often have more stringent connectivity requirements than plug-in stages.1. so Table Definitions must match the order of columns in a query. the ODBC Enterprise stage cannot interface with database-specific parallel load technologies. the DataDirect ODBC Driver Manager is also included.2 ODBC Enterprise stage In general.1 Native Parallel database stages In general. ODBC also provides an increased level of “data virtualization” which can be useful when sources and targets (or deployment platforms) can change. specific guidelines of when to use various stage types are provided in the database-specific topics in this section. The benefit of ODBC Enterprise stage comes from the large number of included and third party ODBC drivers to enable connectivity to all major database platforms. or translated into any language in any form by any means without the written permission of IBM. This allows Enterprise Edition to match return columns by name.1. DataStage Enterprise Edition bundles OEM versions of ODBC drivers from DataDirect. types. All rights reserved. 10.1.

2. No part of this publication may be reproduced.2. data types.rows of the database result set correspond to records of a DS/EE Data Set .2 Metadata Import When using the native parallel DB2 Enterprise. or translated into any language in any form by any means without the written permission of IBM. For each native parallel database stage: .1.1.1. However.Information Integration Solutions Center of Excellence 10.2 Database Metadata 10. stored in a retrieval system.1 Runtime metadata At runtime.columns of the database row correspond to columns of a DS/EE record . . Informix Enterprise or Oracle Enterprise stages.both DS/EE and relational databases support null values. use orchdbutil to import metadata to avoid type conversion issues. All rights reserved. and a null value in a database column is stored as an out-of-band NULL value in the DS/EE column The actual metadata used by a DS/EE native parallel database stage is always determined at runtime. This utility is available as a server command line utility and within Designer and Manager using “Import Orchestrate Schema Definitions”. This allows the database stages to match return values by column name instead of position.the name and data type of each database column corresponds to a DS/EE Data Set name and data type using a predefined mapping of database data types to Enterprise Edition data types . Database-specific data type mapping tables are included in the following sections. transmitted. transcribed. care must be taken that the column data types defined by the DataStage developer match the data types generated by the database stage at runtime. the DS/EE native parallel database stages always “pre-query” the database source or target to determine the actual metadata (column names. 10. and selecting “Import from Database Table” option in the wizard as illustrated below: Parallel Framework Red Book: Data Flow Job Design July 17. 2006 98 of 179 © 2006 IBM Information Integration Solutions. regardless of the table definitions assigned by the DataStage developer. nullability) and partitioning scheme (in some cases) of the source or target table.

The only exception to this rule is when building dynamic database jobs that use runtime column propagation to process all columns in a source table. it is important to use SQL aliases to explicitly name the calculated columns so that they can be referenced within the DataStage job. it will be easier to use the corresponding orchdbutil command-line utility from the DataStage server machine.4 Testing Database Connectivity The “View Data” button on the Output / Properties tab of source database stages lets you verify database connectivity and settings without having to create and run a job. transcribed. there may be cases where user-defined functions or logic need to be executed on the database server. 2006 99 of 179 © 2006 IBM Information Integration Solutions.1. always specify the “Select List” subproperty. The alias name(s) should then be added to the Table Definition within DataStage. similar to the illustration on the right: Parallel Framework Red Book: Data Flow Job Design July 17. As a command. you will see a window with the result columns and data. transmitted. 10.3 Optimizing Select Lists For best performance and optimal memory usage. However. stored in a retrieval system.3 Defining Metadata for Database Functions When using database functions within a SQL SELECT list in a Read or Lookup. 10.Information Integration Solutions Center of Excellence Figure 42: orchdbutil metadata import One disadvantage to the graphical orchdbutil metadata import is that the user interface requires each table to be imported individually.1. SUM(sales) Total FROM store_info GROUP BY store_name Note that in many cases it may be more appropriate to aggregate using the Enterprise Edition Aggregator stage. For example. If the connection is successful. All rights reserved. For “Auto-Generated” SQL. Test the connection using View Data button. instead of using an unqualified “Table” or SQL “SELECT *” read. For “Table” read method. 10. orchdbutil can be scripted to automate the process of importing a large number of tables. No part of this publication may be reproduced. When importing a large number of tables. it is best to explicitly specify column names on all source database stages.1. or translated into any language in any form by any means without the written permission of IBM. the following SQL assigns the alias Total to the calculated column: SELECT store_name. the DataStage Designer will automatically populate the select list based on the stage’s output column definition. .2.

5 Designing for Restart To enable restart of high-volume jobs. the OPEN command can be used to create a target table. the OPEN command could be used to create a temporary table.Information Integration Solutions Center of Excellence Figure 43: Sample View Data Output If the connection fails. OPEN and CLOSE are not offered by plugin database stages. After transformation. an error message may appear.1.6 Database OPEN and CLOSE Commands The native parallel database stages provide options for specifying OPEN and CLOSE commands. or translated into any language in any form by any means without the written permission of IBM. As a further optimization. These options allow commands (including SQL) to be sent to the database before (OPEN) or after (CLOSE) all rows are read/written/loaded to the database. it is important to separate the transformation process from the database write (Load or Upsert) operation. . the results should be landed to a parallel Data Set. stored in a retrieval system. 2006 100 of 179 © 2006 IBM Information Integration Solutions. and the CLOSE command could be used to select all rows from the temporary table and insert into a final target table. and you will be prompted to view additional detail. There are limited capabilities to specify Create table options in the stage. In general. logging. depending on data volume) can be used to identify existing rows before they are inserted into the target table. a Lookup stage (or Join stage. No part of this publication may be reproduced. etc) not possible with the “Create” option. Subsequent job(s) should read this Data Set and populate the target table using the appropriate database stage and write method. transcribed. As another example. For example. All rights reserved. Clicking YES will display a detailed dialog box with the specific error messages generated by the database stage that can be very useful in debugging a database connection failure. Figure 44: View Additional Error Detail 10. including databasespecific options (tablespace.1. 10. transmitted. it is not a good idea to let DataStage generate target tables unless they are used for temporary storage. Parallel Framework Red Book: Data Flow Job Design July 17. constraints. and doing so may violate data-management (DBA) policies.

when reading from DB2. Join Data read by any database stage can serve as the reference input to a Lookup operation. 10. No part of this publication may be reproduced. the optimal implementation involves leveraging the strengths of each technology to provide maximum throughput and developer productivity. and ongoing application maintenance costs. This minimizes impact on network and memory resources.7 Database Sparse Lookup vs. By default. The following guidelines can assist with the appropriate use of SQL and DataStage technologies in a given job flow: • When possible. and Oracle Enterprise stages allow the lookup type to be changed to “Sparse”. there is often a functional overlap between SQL and DataStage functionality. .Information Integration Solutions Center of Excellence It is important to understand the implications of specifying a user-defined OPEN and CLOSE command. For scenarios where the number of input rows is significantly smaller (for example.1. there may be “gray areas” where the decision should be made based on factors such as developer productivity. When directly connected as the reference link to a Lookup stage. 1:100 or more) than the number of reference rows in a DB2 or Oracle table. 2006 101 of 179 © 2006 IBM Information Integration Solutions. a Sparse Lookup may be appropriate. IMPORTANT: The individual SQL statements required by a “Sparse” Lookup are an expensive operation from a performance perspective. 10. this reference data is loaded into memory like any other reference link (“Normal” Lookup). All rights reserved. or translated into any language in any form by any means without the written permission of IBM. While there are extreme scenarios when the appropriate technology choice is clearly understood. For example. sending individual SQL statements to the reference database for each incoming Lookup row. Parallel Framework Red Book: Data Flow Job Design July 17. this lock is not sent – and should be specified explicitly if appropriate. transcribed. Sparse Lookup is only available when the database stage is directly connected to the reference link. Further details are outlined in the respective database sections of the Orchestrate Operators Reference which is part of the Orchestrate OEM documentation. In most cases. ODBC Enterprise. When specifying a user-defined OPEN command.8 Appropriate Use of SQL and DataStage When using relational database sources. with no intermediate stages. use a SQL filter (WHERE clause) to limit the number of rows sent to the DataStage job. the DB2/UDB Enterprise.1. and leverages the database capabilities. Although it is possible to use either SQL or DataStage to solve a given business problem. metadata capture and re-use. transmitted. a default OPEN statement places a shared lock on the source. stored in a retrieval system. it is faster to use a DataStage JOIN stage between the input and DB2 reference data than it is to perform a “Sparse” Lookup.

Avoid the use of database stored procedures (for example. Oracle PL/SQL) on a per-row basis within a high-volume data flow. transmitted. When combining data from very large tables. • • Parallel Framework Red Book: Data Flow Job Design July 17. transcribed. No part of this publication may be reproduced. A join that reduces the result set significantly is also often appropriate to do in the database. especially when the join columns are indexed. In this scenario. it can still be beneficial to use database filters (WHERE clause) if appropriate. it is best to implement business rules using native parallel DataStage components.Information Integration Solutions Center of Excellence • Use a SQL Join to combine data from tables with a small number of rows in the same database instance. or when the source includes a large number of database tables. stored in a retrieval system. 2006 102 of 179 © 2006 IBM Information Integration Solutions. For maximum scalability and parallel performance. All rights reserved. the efficiency of the Enterprise Edition Sort and Join stages can be significantly faster than an equivalent SQL query. . or translated into any language in any form by any means without the written permission of IBM.

transmitted.1. The DB2/UDB Enterprise stage requires DB2 Enterprise Server Edition on UNIX with Data Partitioning Facility (DPF) option. Parallel Framework Red Book: Data Flow Job Design July 17. same platform as ETL server 2 Any DB2 via DB2 Client or DB2-Connect Subject to DB2 Loader Limitations Any DB2 via DB2 Client or DBE-Connect Any DB2 via DB2 Client or DB2-Connect Supports Partitioned DB2? Yes / directly to each DB2 node Yes / through DB2 node 0 No Yes / through DB2 node 0 Yes / through DB2 node 0 Parallel Read? Yes Parallel Write? Yes Parallel Sparse Lookup Yes SQL Open / Close Yes No No No3 No Possible Limitations No No Possible Limitations No No No No No No No No For specific details on the stage capabilities. No part of this publication may be reproduced. lookup. (Before DB2 v8. you may experience data duplication when working in partitioned instances since the node configuration of the local instance may not be the same as the remote instance. If you use the stage in this way.2 DB2 Guidelines 10.) Furthermore.1 DB2/UDB Enterprise stage Enterprise Edition provides native parallel read.2. stored in a retrieval system. For this reason. and DataStage Plug-In guides) 10. the DB2 hardware/UNIX/software platform must match the hardware/software platform of the DataStage ETL server.2. or translated into any language in any form by any means without the written permission of IBM. Check with IBM IIS Support for availability. summarized in the following table: DataStage Stage Name DB2/UDB Enterprise DB2/UDB API DB2/UDB Load ODBC Enterprise Dynamic RDBMS Stage Type Native Parallel Plug-In Plug-In Native Plug-In DB2 Requirement DPF. 2 It is possible to connect the DB2 UDB stage to a remote database by simply cataloging the remote database in the local instance and then using it as if it were a local database. consult the DataStage documentation (DataStage Parallel Job Developers Guide. .1 DB2 Stage Types DataStage Enterprise Edition provides access to DB2 databases using one of 5 stages. and load capabilities to parallel DB2 databases on UNIX using the native parallel DB2/UDB Enterprise stage. the “client authentication” configuration of a remote instance is not recommended. All rights reserved. upsert. 2006 103 of 179 © 2006 IBM Information Integration Solutions.Information Integration Solutions Center of Excellence 10. 3 A patched version of the ODBC Enterprise stage allowing parallel read is available from IBM IIS Support for some platforms. This will only work when the authentication mode of the database on the remote instance is set to “client authentication”. this was also called “DB2 EEE”. transcribed.

10.2. transcribed. These stages also provide connectivity to non-UNIX DB2 databases. Sparse Lookup is not supported through the DB2/API stage. 10. parallel component the DB2/UDB Enterprise stage is designed for maximum performance and scalability. databases on UNIX platforms that differ from the platform of the DataStage ETL server. including direct communication with each DB2 database node. 2006 104 of 179 © 2006 IBM Information Integration Solutions.2 Connecting to DB2 with the DB2/UDB Enterprise Stage Create a Parallel job and add a DB2/UDB Enterprise stage.writing to DB2 in parallel (where appropriate). the use of DataStage plug-in stages will limit overall performance and scalability.Information Integration Solutions Center of Excellence As a native. All rights reserved. the ability to write in parallel may be limited by the table and index configuration set by the D2 database administrator. stored in a retrieval system. and reading from . plug-in stages cannot read from DB2 in parallel. it may be possible to write to a DB2 target in parallel. The DB2/API (plug-in) stage should only be used to read from and write to DB2 databases on nonUNIX platforms (such as mainframe editions through DB2-Connect). or DB2 databases on Windows or Mainframe platforms (except for the “Load” stage against a mainframe DB2 instance which is not supported). Furthermore. transmitted. when used as data sources. since the DS/EE framework will instantiate multiple copies of these stages to handle the data that has already been partitioned in the parallel framework. “DB2 EE”). By facilitating flexible connectivity to multiple types of remote DB2 database servers. Add the following properties: Parallel Framework Red Book: Data Flow Job Design July 17. Because each plug-in invocation will open a separate connection to the same target DB2 database table.1.2. These goals are achieved through tight integration with the DB2 RDBMS. No part of this publication may be reproduced. or translated into any language in any form by any means without the written permission of IBM. .2 ODBC and DB2 Plug-In Stages The ODBC Enterprise and plug-in stages are designed for lower-volume access to DB2 databases without the DPF option installed (prior to v8. Using the DB2/UDB API stage or the Dynamic RDBMS stage. using the same data partitioning as the referenced DB2 tables.

. you will need to set the following properties on the DB2/UDB Enterprise stage in your parallel job: • Client Instance Name. All rights reserved. this is required for a remote connection in order to retrieve the catalog information from the local instance of DB2 and thus must have privileges for that local instance. Set this to the DB2 client instance name. transmitted.3 Configuring DB2 Multiple Instances in One DataStage Job Although it is not officially supported.Two Instances Only reading from one instance and writing to another instance with no other DB2 instances (not sure how many stages of these 2 instances can be added to the canvas for this configuration for lookups) 2. 10. Optionally set this to the instance name of the DB2 server. This is required only if the client’s alias is different from the actual name of the remote server database. stored in a retrieval system. Since a db2nodes. Once this variable is set. Otherwise use the DB2 environment variable. Single stream . Enter the password for connecting to DB2. you must adhere to all of the directions specified for connecting to a remote instance AND the following: • You must not set the APT_DB2INSTANCE_HOME environment variable. 2006 105 of 179 Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions. this is required for a remote connection in order to retrieve the catalog information from the local instance of DB2 and thus must have privileges for that local instance. transcribed.Information Integration Solutions Center of Excellence Figure 45: DB2/UDB Enterprise stage properties For connection to a remote DB2/UDB instance. DataStage assumes you require remote connection. Multiple Stream with N DB2 sources with no DB2 targets reading from 1 to n DB2 instances in separate source stages with no downstream other DB2 stages In order to get this configuration to work correctly. Your job must meet one of the following configurations (note: the use of the word “stream” refers to a contiguous flow of one stage to another within a single job): 1. DB2INSTANCE.cfg file can July 17. • Client Alias DB Name. • Password. Optionally set this to the remote server database name. it is possible to connect to more than one DB2 instance within a single job. or translated into any language in any form by any means without the written permission of IBM. • Server. If you set this property. • Database. • User. Otherwise use the environment variables $APT_DBNAME or $APT_DB2DBDFT to identify the database. Two Stream – One Instance per Steam reading from instance A and writing to instance A and reading from instance B and writing to instance B (not sure how many stages of these 2 instances can be added to the canvas for this configuration for lookups) 3.2. Set this to the DB2 client’s alias database name for the remote DB2 server database. No part of this publication may be reproduced. it will try to use it for each of the connections in the job. Enter the user name for connecting to DB2. to identify the instance name of the DB2 server.

this will create problems. if the data volumes are sufficiently small. In the users UNIX home directory.if the DB2 column name does not begin with a letter or underscore. All rights reserved. Since the APT_DB2INSTANCE_HOME is not set. landing intermediate results to a parallel Data Set. For example.cfg there. transmitted. . if the third DB2 column is named 7dig. Observe the following guidelines when $DS_ENABLE_RESERVED_CHAR_CONVERT is set: Parallel Framework Red Book: Data Flow Job Design July 17.4 DB2/UDB Enterprise stage Column Names At runtime. Or. DS will default to this directory to find the configuration file for the remote instance.the name can contain only alphanumeric and underscore characters .the name must start with a letter or underscore character . which place no limit on the length of a column name. DB2 Load. and Dynamic RDBMS plug-in stages. the native parallel DB2/UDB Enterprise stage translates column names exactly except when a component of a DB2 column name is not compatible with Enterprise Edition column naming conventions.2.5 DB2/API stage Column Names When using the DB2/API. Dynamic RDBMS) may be used to access data in other instances.cfg. • In order for DataStage to locate the db2nodes. stored in a retrieval system. No part of this publication may be reproduced. DB2 Load. 2006 106 of 179 © 2006 IBM Information Integration Solutions. 10. DB2 plug-in stages (DB2 API. To connect to multiple DB2 instances. where column# is the number of the column. but have the following restrictions: . set the environment variable $DS_ENABLE_RESERVED_CHAR_CONVERT if your DB2 database uses the reserved characters # or $ in column names. although this incurs the overhead of Sequential File stage (corresponding export/import operators) which does not run in parallel. the string “APT__column#” (two underscores) is added to beginning of the column name.Information Integration Solutions Center of Excellence only contain information for one instance. or translated into any language in any form by any means without the written permission of IBM.2. transcribed. Depending on platform configuration and I/O subsystem performance. Enterprise Edition converts the DB2 column name as follows: . you must build a user on the DataStage server with the same name as the instance you are trying to connect to (the default logic for the DB2/UDB Enterprise stage is to use the instance’s home directory as defined for the UNIX user with the same name as the DB2 instance). the character is replaced by two underscore characters 10. create a sqllib subdirectory and place the remote instance’s db2nodes. This converts these special characters into an internal representation that DataStage can understand. separate jobs can communicate through named pipes. the Enterprise Edition column will be named “APT_37dig” . we recommend using separate jobs with their respective DB2 environment variable settings.if the DB2 column name contains a character that is not alphanumeric or an underscore.the name is case insensitive When there is an incompatibility.

r) REAL SERIAL SMALLFLOAT SMALLINT VARCHAR(n) If the DATETIME starts with an hour. transcribed. the result is a timestamp field. Table Definitions should be imported into DataStage using orchdbutil to ensure accurate Table Definitions. No part of this publication may be reproduced. decimal[p. transmitted. Once the table definition is loaded.s] where p is the precision and s is the scale dfloat dfloat int32 decimal string[n] or ustring[n] string[max=n] or ustring[max=n] sfloat int32 sfloat int16 string[max=n] or ustring[max=n] IMPORTANT: DB2 data types that are not listed in the above table cannot be used in the DB2/UDB Enterprise stage. however. 2006 107 of 179 © 2006 IBM Information Integration Solutions. examine the DDL for each schema to be accessed. The original names are used in generated SQL statements. and will generate an error at runtime Parallel Framework Red Book: Data Flow Job Design July 17.6 DB2/UDB Enterprise stage Data Type Mapping The DB2 database schema to be accessed must NOT have any columns with User Defined Types (UDTs).r) DATE DATETIME Enterprise Edition Data Type string[n] or ustring[n] string[max=n] or ustring[max=n] date Time or timestamp with corresponding fractional precision for time: If the DATETIME starts with a year component. Alternatively.2. or translated into any language in any form by any means without the written permission of IBM. 10. DECIMAL[p.Information Integration Solutions Center of Excellence - Avoid using the strings __035__ and __036__ in your DB2 column names (these are used as the internal representations of # and $ respectively) Import meta data using the Plug-in Meta Data Import tool. stored in a retrieval system. Use the “db2 describe table [table-name]” command on the DB2 client for each table to be accessed to determine if UDTs are in use. They are also used in derivations and expressions.s] DOUBLE-PRECISION FLOAT INTEGER MONEY NCHAR(n.r) NVARCHAR(n. as shown in the following table. . avoid hand editing (this minimizes the risk of mistakes or confusion). The DB2/UDB Enterprise stage converts DB2 data types to Enterprise Edition data types. the internal column names are displayed rather than the original DB2 names both in table definitions and in the Data Browser. All rights reserved. DB2 Data Type CHAR(n) CHARACTER VARYING(n. and you should use them if entering SQL in the job yourself. the result is a time field.

the contents of the table are unusable and the tablespace is left in a load pending state.run in Truncate mode to clear the load pending state. All rights reserved. That is. transcribed. parallel component. if the load operation is terminated before it is completed. and writing to a DB2 Enterprise Server Edition database with Database Partitioning Feature (DPF) • As a native. performing lookups against. the DB2 Load method places an exclusive lock on the entire DB2 tablespace into which it loads the data and no other tables in that tablespace can be accessed by other applications until the load completes. When writing to a DB2 database in parallel. In these instances. the overhead of routing information through a remote DB2 coordinator may be significant. During the load operation. communicating directly with each database node. The DB2 load operator performs a non-recoverable load. and the target table(s) may be accessed by other users. database log usage.7 DB2/UDB Enterprise stage options The DB2/UDB Enterprise (native parallel) stage should be used for reading from. and the availability of new rows to other applications. or translated into any language in any form by any means without the written permission of IBM. the DB2 Load DataStage job must be re.2. The choice between these methods depends on required performance. Parallel Framework Red Book: Data Flow Job Design July 17. Time and row-based commit intervals determine the transaction size.2. when using user-defined SQL without partitioning against large volumes of DB2 data. • DB2/UDB Enterprise stage is tightly integrated with the DB2 RDBMS. it may be beneficial to have the DB2 DBA configure separate DB2 coordinator nodes (no local data) on each ETL server (in clustered ETL configurations). DB2 Enterprise stage should not include the Client Instance Name property. All activity in the z/OS environment always goes through the DB2 coordinator node so parallelism differs slightly depending on how DB2 is accessed. the DB2/UDB Enterprise stage is designed for maximum performance and scalability against very large partitioned DB2 UNIX databases.8 Performance Notes In some cases. In this scenario. In this configuration. 10. . the DB2/UDB Enterprise stage offers the choice of SQL (insert / update / upsert / delete) or fast DB2 loader methods. reading from and writing to DB2 in parallel (where appropriate). 2006 108 of 179 © 2006 IBM Information Integration Solutions. a) The Write Method (and corresponding insert / update / upsert / delete) communicates directly with the DB2 database nodes to execute instructions in parallel.9 DB2 in the DataStage USS environment The manner in which DataStage / USS Edition interfaces with DB2 is slightly different than it is in the non-z/OS environment. stored in a retrieval system. No part of this publication may be reproduced. All operations are logged to the DB2 database log. b) The DB2 Load method requires that the DataStage user running the job have DBADM privilege on the target DB2 database. and recoverability. forcing the DB2 Enterprise stages on each ETL server to communicate directly with their local DB2 coordinator. and using the same data partitioning as the referenced DB2 tables. transmitted.Information Integration Solutions Center of Excellence 10.2. 10.

All rights reserved. as illustrated in Figure 46: Figure 46: DB2 read on DataStage/USS For example. T) and Col2 (10. the number of operators do not have to match to the number of partitions. 2006 109 of 179 © 2006 IBM Information Integration Solutions. transmitted. and the partition limit key value(s). Parallel Framework Red Book: Data Flow Job Design July 17. 30. Finally the SYSKEYS and SYSCOLUMNS tables are read using the index name to get the associated column metadata (name and type). . partitioning index name(s).Information Integration Solutions Center of Excellence When accessing a DB2 table using the Table read method. transcribed. This information determines the number of db2read operators that the conductor builds into the score and the queries that they execute. Table T is in tablespace TS and TS is partitioned into 3 partitions on Col1 (limits: F. This is illustrated in Figure 47. P. These values are in turn used to read the SYSTABLEPART table to retrieve the number of partitions. No part of this publication may be reproduced. stored in a retrieval system. functions within the db2read operator are used to read the DB2 SYSTABLES table to retrieve the tablespace and database name for the table. The WHERE clauses which are created to read this tables are: Where Col1 < ‘F’ or (Col1 = ‘F’ and (Col2 < 10 or Col2 = 10)) Where (Col1 > ‘F’ and Col1 < ‘P’) or (Col1 = ‘F’ and Col2 > 10) or (Col1 = ‘P’ and (Col2 < 20 or Col2 = 20)) Where Col1 > ‘T’ or (Col1 = ‘T’ and Col2 > 40) The method that DataStage/USS Edition uses to write to DB2 UDB on z/OS works differently than the read process. 40). Since all write operations need to go through the DB2 coordinator node on z/OS (this is different than on non-z/OS platforms). or translated into any language in any form by any means without the written permission of IBM. and is controlled by the number of nodes in the configuration file.

2006 110 of 179 © 2006 IBM Information Integration Solutions. An example of an in-memory Normal Lookup is shown in Figure 48. transcribed. All rights reserved.Information Integration Solutions Center of Excellence Figure 47: DB2 write on DataStage/USS On DataStage/USS Edition. transmitted. stored in a retrieval system. Lookups work differently depending on whether the lookup is done normally (in memory) or using a sparse technique where each lookup is effectively a query to the database. or translated into any language in any form by any means without the written permission of IBM. No part of this publication may be reproduced. . Parallel Framework Red Book: Data Flow Job Design July 17.

Figure 49: DB2 Sparse Lookup on DataStage/USS Finally. 2006 111 of 179 © 2006 IBM Information Integration Solutions. This requires DataStage/USS to create an MVS flat file to pass to the loader – note that this is the only non-HFS file that DS/USS can write to. we call a DB2 stored procedure called DSNUTILS. transcribed. The DB2 LOAD utility is designed to run from JCL only. No part of this publication may be reproduced.Information Integration Solutions Center of Excellence Figure 48: In-Memory Lookup on DataStage/USS Here we see that the Normal Lookup actually consists of reading the DB2 table into memory and then performing the lookup against the memory copy of the table. it matches the number of db2read operators to the partitioning scheme of the table (similar to the read) and the number of lookup operators to the number of nodes in the configuration file. Since there is no sequential file stage associated with this MVS load file. . we need to add a special resource statement in our configuration file to specify the MVS dataset name to use. Contrast the Normal Lookup with the way a Sparse Lookup is done as shown in Figure 49. using the DB2 load utility in USS is different from non-z/OS environments. Since each of these queries must go through the DB2 coordinator node we can effectively ignore the level of parallelism specified for the table. When the conductor creates the score. or translated into any language in any form by any means without the written permission of IBM. In order to invoke it from a DataStage/USS job. Parallel Framework Red Book: Data Flow Job Design July 17. All rights reserved. Figure 50 illustrates the DB2 LOAD process on USS and also shows the format of the special resource statement used to define the MVS dataset used during the load operation. nor can it be read in from a USS HFS file. The LOAD utility has a second limitation in that data cannot be piped into it. transmitted. stored in a retrieval system. where each lookup operator is issuing an SQL to DB2 for every row it processes.

or translated into any language in any form by any means without the written permission of IBM. . All rights reserved.Information Integration Solutions Center of Excellence Figure 50: Calling DB2 Load Utility on DataStage/USS Parallel Framework Red Book: Data Flow Job Design July 17. transmitted. 2006 112 of 179 © 2006 IBM Information Integration Solutions. transcribed. stored in a retrieval system. No part of this publication may be reproduced.

Informix Data Type CHAR(n) CHARACTER VARYING(n. The Informix Enterprise stage converts Informix data types to Enterprise Edition data types.3 Informix Database Guidelines 10.s] DOUBLE-PRECISION FLOAT INTEGER MONEY NCHAR(n. No part of this publication may be reproduced. as shown in the following table.3.s] where p is the precision and s is the scale The maximum precision is 32. transcribed. 2006 113 of 179 © 2006 IBM Information Integration Solutions. . decimal[p. and a null value in a database column is stored as an out-of-band NULL value in the DS/EE column 10. and will generate an error at runtime Parallel Framework Red Book: Data Flow Job Design July 17.1 Informix Enterprise Stage Column Names For each Informix Enterprise stage: . A decimal with floating scale is converted to dfloat dfloat dfloat int32 decimal string[n] string[max=n] sfloat int32 sfloat int16 string[max=n] IMPORTANT: Informix data types that are not listed in the above table cannot be used in the Informix Enterprise stage. or translated into any language in any form by any means without the written permission of IBM.2 Informix Enterprise stage Data Type Mapping Table Definitions should be imported into DataStage using orchdbutil to ensure accurate Table Definitions. time or timestamp with corresponding fractional precision for time: If the DATETIME starts with a year component and ends with a month. transmitted.columns of the database row correspond to columns of a DS/EE record .3.rows of the database result set correspond to records of a DS/EE Data Set . DECIMAL[p.r) REAL SERIAL SMALLFLOAT SMALLINT VARCHAR(n) If the DATETIME starts with an hour.both DS/EE and Informix support null values.Information Integration Solutions Center of Excellence 10.the name and data type of each database column corresponds to a DS/EE Data Set name and data type using a predefined mapping of database data types to Enterprise Edition data types . the result is a time field. the result is a date field. stored in a retrieval system.r) DATE DATETIME Enterprise Edition Data Type string[n] string[max=n] date date. the result is a timestamp field.r) NVARCHAR(n. If the DATETIME starts with a year component. All rights reserved.

s] where p is the precision and s is the scale decimal[p.2 ODBC Enterprise stage Data Type Mapping ODBC data sources are not supported by the orcdbutil utility.s] int16 int8 date time[p] timestamp[p] raw[max=n] string[max=n] ustring[n] ustring[max=n] Note that the maximum size of a DataStage record is limited to 32K.1 ODBC Enterprise Stage Column Names For each ODBC Enterprise stage: . No part of this publication may be reproduced. two underscore characters replace the unsupported character . and a null value in a database column is stored as an out-of-band NULL value in the DS/EE column 10.s] decimal[p.Information Integration Solutions Center of Excellence 10. transcribed. It is important to verify the correct ODBC to Enterprise Edition data mapping. Parallel Framework Red Book: Data Flow Job Design July 17. or translated into any language in any form by any means without the written permission of IBM.4 ODBC Enterprise Guidelines 10. If you attempt to read a record larger than 32K. 2006 114 of 179 © 2006 IBM Information Integration Solutions. stored in a retrieval system. In that case.4.names are translated exactly except when the external data source column name contains a character that DataStage does not support. All rights reserved. as shown in the following table: ODBC Data Type SQL_BIGINT SQL_BINARY SQL_CHAR SQL_DECIMAL SQL_DOUBLE SQL_FLOAT SQL_GUID SQL_INTEGER SQL_BIT SQL_REAL SQL_SMALLINT SQL_TINYINT SQL_TYPE_DATE SQL_TYPE_TIME SQL_TYPE_TIMESTAMP SQL_VARBINARY SQL_VARCHAR SQL_WCHAR SQL_WVARCHAR Enterprise Edition Data Type int64 raw(n) string[n] decimal[p.rows of the database result set correspond to records of a DS/EE Data Set .4. Enterprise Edition will return an error and abort your job.columns of the database row correspond to columns of a DS/EE record . transmitted.the name and data type of each database column corresponds to a DS/EE Data Set name and data type using a predefined mapping of database data types to Enterprise Edition data types . .both DS/EE and ODBC support null values.s] string[36] int32 int8 [0 or 1] decimal[p.

transmitted. 2006 115 of 179 © 2006 IBM Information Integration Solutions. or translated into any language in any form by any means without the written permission of IBM. All rights reserved. transcribed. stored in a retrieval system. and will generate an error at runtime Parallel Framework Red Book: Data Flow Job Design July 17.Information Integration Solutions Center of Excellence IMPORTANT: ODBC data types that are not listed in the above table cannot be used in the ODBC Enterprise stage. . No part of this publication may be reproduced.

or translated into any language in any form by any means without the written permission of IBM. 2006 116 of 179 © 2006 IBM Information Integration Solutions. Parallel reads through ODBC match the degree of parallelism in the $APT_CONFIG_FILE. the ODBC Enterprise stage does not support parallel read4. stored in a retrieval system. transcribed. transmitted. . and the table configuration (row or page level lock mode if available). Depending on the target database. since this capability is not provided by the ODBC API. No part of this publication may be reproduced. Parallel Framework Red Book: Data Flow Job Design July 17.4. 4 On some platforms.Information Integration Solutions Center of Excellence 10.3 Reading ODBC Sources Unlike other native parallel database stages. it may be possible to write to a target database in parallel using the ODBC Enterprise stage. All rights reserved. a patch may be available through IBM IIS Support to support parallel reads through ODBC.

This is particularly important for Oracle databases.3 Reading from Oracle in Parallel By default.5. In that case. transcribed.Information Integration Solutions Center of Excellence 10.5. Setting the partition table option to the specified table will enable parallel extracts from an Oracle source.s] if precision (p) >=11 or scale > 0 not supported string[max=n] or ustring[max=n] a variable-length string with maximum length = n Note that the maximum size of a DataStage record is limited to 32K.queries containing a GROUP BY clause that are also hash partitioned on the same field Parallel Framework Red Book: Data Flow Job Design July 17. Examples include: . and will generate an error at runtime 10. which are not heavily typed. and a null value in a database column is stored as an out-of-band NULL value in the DS/EE column 10.columns of the database row correspond to columns of a DS/EE record . or translated into any language in any form by any means without the written permission of IBM.rows of the database result set correspond to records of a DS/EE Data Set . transmitted. Enterprise Edition maps Oracle data types based on the rules given in the following table: Oracle Data Type CHAR(n) DATE NUMBER NUMBER[p. If you attempt to read a record larger than 32K.the name and data type of each database column corresponds to a DS/EE Data Set name and data type using a predefined mapping of database data types to Enterprise Edition data types . two underscore characters replace the unsupported character . . Enterprise Edition will return an error and abort your job.1 Oracle Enterprise Stage Column Names For each Oracle Enterprise stage: .2 Oracle Enterprise stage Data Type Mapping Oracle Table Definitions should be imported into DataStage using orchdbutil to ensure accurate Table Definitions. 2006 117 of 179 © 2006 IBM Information Integration Solutions.5.5 Oracle Database Guidelines 10.both DS/EE and Oracle support null values. The underlying Oracle table does not have to be partitioned for parallel read within Enterprise Edition. It is important to note that certain types of queries cannot run in parallel. IMPORTANT: Oracle data types that are not listed in the above table cannot be used in the Oracle Enterprise stage. No part of this publication may be reproduced. All rights reserved.names are translated exactly except when the Oracle source column name contains a character that DataStage does not support. stored in a retrieval system. the Oracle Enterprise stage reads sequentially from its source table or query.s] RAW(n) VARCHAR(n) Enterprise Edition Data Type string[n] or ustring[n] a fixed-length string with length = n timestamp decimal[38.10] int32 if precision(p) < 11 and scale (s) = 0 decimal[p.

transcribed. stored in a retrieval system. Enterprise Edition uses the Parallel Direct Path Load method. the key column(s) must be identified using the check boxes in the column grid. • Setting the environment variable $APT_ORACLE_LOAD_OPTIONS to “OPTIONS (DIRECT=TRUE. transmitted. In this instance. PARALLEL=FALSE) also allows loading of indexed tables without index maintenance.Information Integration Solutions Center of Excellence - queries performing a non-collocated join (a SQL JOIN between two tables that are not stored in the same partitions with the same partitioning strategy) 10.4 Oracle Load Options When writing to an Oracle table (using Write Method = Load). Parallel Framework Red Book: Data Flow Job Design July 17. In order to automatically generate the SQL required by the Upsert method.5. the Oracle stage cannot write to a table that has indexes (including indexes automatically generated by Primary Key constraints) on it unless you specify the Index Mode option (maintenance. 2006 118 of 179 © 2006 IBM Information Integration Solutions. or translated into any language in any form by any means without the written permission of IBM. the Oracle load will be done sequentially. When using this method. rebuild). No part of this publication may be reproduced. All rights reserved. . The Upsert Write Method can be used to insert rows into a target Oracle table without bypassing indexes or constraints.

Information Integration Solutions Center of Excellence

10.6 Sybase Enterprise Guidelines
10.6.1 Sybase Enterprise Stage Column Names For each Sybase Enterprise stage: - rows of the database result set correspond to records of a DS/EE Data Set - columns of the database row correspond to columns of a DS/EE record - the name and data type of each database column corresponds to a DS/EE Data Set name and data type using a predefined mapping of database data types to Enterprise Edition data types - names are translated exactly except when the Sybase source column name contains a character that DataStage does not support. In that case, two underscore characters replace the unsupported character - both DS/EE and Sybase support null values, and a null value in a database column is stored as an out-of-band NULL value in the DS/EE column 10.6.2 Sybase Enterprise stage Data Type Mapping Sybase databases are not supported by the orcdbutil utility. It is important to verify the correct Sybase to Enterprise Edition data mapping, as shown in the following table: Sybase Data Type
BINARY(n) BIT CHAR(n) DATE DATETIME DEC[p,s] or DECIMAL[p,s] DOUBLE PRECISION or FLOAT INT or INTEGER MONEY NCHAR(n) NUMERIC[p,s] NVARCHAR(n,r) REAL SERIAL SMALLDATETIME SMALLFLOAT SMALLINT SMALLMONEY TINYINT TIME UNSIGNED INT VARBINARY(n) VARCHAR(n)

Enterprise Edition Data Type
raw(n) int8 string[n] a fixed-length string with length n date timestamp decimal[p,s] where p is the precision and s is the scale dfloat int32 decimal[15,4] ustring[n] a fixed-length string with length n - only for ASE decimal[p,s] where p is the precision and s is the scale ustring[max=n] a variable-length string with length n - only for ASE sfloat int32 timestamp sfloat int16 decimal[10,4] int8 time unit32 raw[max=n] string[max=n] a variable-length string with maximum length n

IMPORTANT: Sybase data types that are not listed in the above table cannot be used in the Sybase Enterprise stage, and will generate an error at runtime
Parallel Framework Red Book: Data Flow Job Design July 17, 2006 119 of 179

© 2006 IBM Information Integration Solutions. All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language in any form by any means without the written permission of IBM.

Information Integration Solutions Center of Excellence

10.7 Teradata Database Guidelines
10.7.1 Choosing the Proper Teradata Stage Within DataStage Enterprise Edition, the following stages can be used for reading from and writing to Teradata databases in a parallel job flow: Source Teradata Stages Teradata Enterprise Teradata API Target Teradata Stages Teradata Enterprise Teradata API Teradata MultiLoad (MultiLoad option) Teradata MultiLoad (TPump option)

For maximum performance of high-volume data flows, the native parallel Teradata Enterprise stage should be used. Teradata Enterprise uses the programming interface of the Teradata utilities FastExport (reads) and FastLoad (writes), and is subject to all these utilities’ restrictions. NOTE: Unlike the FastLoad utility, the Teradata Enterprise stage supports Append mode, inserting rows into an existing target table. This is done through a shadow “terasync” table.

Teradata has a system-wide limit to the number of concurrent database utilities. Each use of the Teradata Enterprise stages counts toward this limit. 10.7.2 Source Teradata Stages Teradata Stage Stage Usage Guidelines Type
Teradata Enterprise Teradata API Native Parallel Plug-In - Reading a large number of rows in parallel - Supports OPEN and CLOSE commands - Subject to the limits of Teradata FastExport - Reading a small number of rows sequentially

Parallel Read
Yes No

Teradata Utility Limit
applies none

10.7.3 Target Teradata Stages Teradata Stage Stage Usage Guidelines Type
Teradata Enterprise Native Parallel - Writing a large number of rows in parallel - Supports OPEN and CLOSE commands - Limited to INSERT (new table) or APPEND (existing table) - Subject to the limits of Teradata FastLoad (but also supports APPEND) - Locks the target table in exclusive mode - Insert, Update, Delete, Upsert of moderate data volumes - Locks the target table(s) in exclusive mode

Parallel Write
Yes

Teradata Utility Limit
applies

Teradata MultiLoad (MultiLoad utility)

Plug-In

No

applies

Parallel Framework Red Book: Data Flow Job Design

July 17, 2006

120 of 179

© 2006 IBM Information Integration Solutions. All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language in any form by any means without the written permission of IBM.

Information Integration Solutions Center of Excellence Teradata MultiLoad (TPump utility) Plug-In - Insert, Update, Delete, Upsert of small volumes of data within a large database - Does not lock the target tables - Should not be run in parallel, because each node and use counts toward system-wide Teradata utility limit - Insert, Update, Delete, Upsert of small volumes of data - Allows concurrent writes (does not lock target) - Slower than TPump for equivalent operations

Teradata API

Plug-In

Yes

none

10.7.4 Teradata Enterprise Stage Column Names For each Teradata Enterprise stage: - rows of the database result set correspond to records of a DS/EE Data Set - columns of the database row correspond to columns of a DS/EE record - the name and data type of each database column corresponds to a DS/EE Data Set name and data type using a predefined mapping of database data types to Enterprise Edition data types - both DS/EE and Teradata support null values, and a null value in a database column is stored as an out-of-band NULL value in the DS/EE column - DS/EE gives the same name to its columns as the Teradata column name. However, while DS/EE column names can appear in either upper or lower case, Teradata column names appear only in upper case. 10.7.5 Teradata Enterprise stage Data Type Mapping Teradata databases are not supported by the orcdbutil utility. It is important to verify the correct Teradata to Enterprise Edition data mapping, as shown in the following table: Teradata Data Type
byte(n) byteint char(n) date decimal[p,s] double precision float graphic(n) integer long varchar long vargraphic numeric(p,s) real smallint time timestamp varbyte(n) varchar(n)

Enterprise Edition Data Type
raw[n] int8 string[n] date decimal[p,s] where p is the precision and s is the scale dfloat dfloat raw[max=n] int32 string[max=n] raw[max=n] decimal[p,s] Dfloat int16 time timestamp raw[max=n] string[max=n] July 17, 2006 121 of 179

Parallel Framework Red Book: Data Flow Job Design

© 2006 IBM Information Integration Solutions. All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language in any form by any means without the written permission of IBM.

the DB Options property specifies the connection string and connection properties in the form: user=username. To specify a Teradata password that contains special characters.password=password[. In that case SessionsPerPlayer should be increased. Setting the SessionsPerPlayer too low on a large system can result in so many players that the job fails due to insufficient resources.8 Improving Teradata Enterprise Performance Setting the environment variable $APT_TERA_64K_BUFFERS may significantly improve performance of Teradata Enterprise connections depending on network configuration. RequestedSessions equals the maximum number of available sessions on the Teradata instance.7. and will generate an error at runtime.RequestedSessions=nn] where SesionsPerPlayer and RequestedSessions are optional connection parameters that are required when accessing large Teradata databases. but this can be set to a value between 1 and the database vprocs. transcribed.7 Teradata Enterprise Settings Within the Teradata Enterprise stage. All rights reserved. By default.Information Integration Solutions Center of Excellence vargraphic(n) raw[max=n] IMPORTANT: Teradata data types that are not listed in the above table cannot be used in the Teradata Enterprise stage.7.7. 10. By default. transmitted. 2006 122 of 179 © 2006 IBM Information Integration Solutions. Indirectly. 10. (Note that 64K buffers must be enabled at the Teradata server level).SessionsPerPlayer=nn][. The SessionsPerPlayer option determines the number of connections each DataStage EE player opens to Teradata. where pa$$ is the example password: \’pa$$\’ 10. and/or RequestedSessions should be decreased. stored in a retrieval system. the password must be surrounded by an “escaped” single quote as shown. Aggregates and most arithmetic operators are not allowed in the SELECT clause of a Teradata Enterprise stage.6 Specifying Teradata Passwords with Special Characters Teradata permits passwords with special characters and symbols. and hence the number of UNIX processes and overall system resource requirements of the DataStage job. this determines the number of DataStage players. No part of this publication may be reproduced. . SessionsPerPlayer should be set such that: RequestedSessions = (sessions per player * the number of nodes * players per node) The default value for the SessionsPerPlayer suboption is 2. Parallel Framework Red Book: Data Flow Job Design July 17. Teradata Enterprise stage uses 32K buffers. or translated into any language in any form by any means without the written permission of IBM.

To connect to a Teradata server. also known as the tdpid. 2006 123 of 179 © 2006 IBM Information Integration Solutions. Parallel Framework Red Book: Data Flow Job Design July 17. transcribed. stored in a retrieval system. .9 Teradata on USS On the USS platform the Teradata Enterprise Stage uses CLIv2 for channel-attached systems (OS/390 and z/OS). transmitted. All rights reserved. you must supply the client with the Teradata Director Program (TDP) identifier.7.Information Integration Solutions Center of Excellence 10. the tdpid is the host name of the Teradata server. No part of this publication may be reproduced. #. $. The first three characters must be TDP. That leaves 39 possible TDP names and is different than the convention used for non-channel attached systems. or @. On MVS. A-Z (case insensitive). the tdpid must be in the form TDPx. where x is 0-9. or translated into any language in any form by any means without the written permission of IBM. On a network-attached system.

Prints detailed information in the job log for each operator. $DS_PX_DEBUG 1 $APT_PM_STARTUP_CONCURRENCY 5 Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions. This will ensure that the jobs have been designed with proper partitioning logic. and internal Enterprise Edition log messages in a directory corresponding to the job name. 2006 124 of 179 $APT_PM_PLAYER_TIMING 1 1 FORCE $APT_PM_PLAYER_MEMORY $APT_BUFFERING_POLICY Setting $APT_BUFFERING_POLICY=FORCE is not recommended for production job runs. No part of this publication may be reproduced. it is important that all jobs be tested with a configuration file that has more than one node in its default node pool. the job’s partitioning logic and parallel design concepts (especially within Transformer stages) should be examined. Normally. transcribed. Forces an internal buffer operator to be placed between every operator. This can be useful when determining if the actual runtime schema matches the expected job design table definitions.2 Debugging Environment Variables The following environment variables can be set to assist in debugging a parallel job: Environment Variable $OSH_PRINT_SCHEMAS Setting 1 Description Outputs the actual schema definitions used by the DataStage EE framework at runtime in the DataStage log.Information Integration Solutions Center of Excellence 11 Troubleshooting and Monitoring 11. including CPU utilization and elapsed processing time. 11. and incorrect with a multi-node configuration file. or translated into any language in any form by any means without the written permission of IBM. If the job results are correct with a single-node configuration file.1 Warning on Single-Node Configuration Files Because the DS/EE configuration file can be changed at runtime. Using the job monitor performance statistics. generated osh. Using $APT_BUFFERING_POLICY=FORCE in combination with $APT_BUFFER_FREE_RUN effectively isolates each operator from slowing upstream production. stored in a retrieval system. All rights reserved. this can identify which part of a job flow is impacting overall performance. This directory will be created in the “Debugging” sub-directory of the Project home directory on the DataStage server. transmitted. This environment variable should not normally need to be set. July 17. When trying to start very large jobs on heavilyloaded servers. the DataStage EE framework inserts buffer operators into a job flow at runtime to avoid deadlocks and improve performance. Set this environment variable to capture copies of the job score. Prints detailed information in the job log for each operator when allocating additional heap memory. . lowering this number will limit the number of processes that are simultaneously created when a job is started.

Set the environment variable $DS_PX_DEBUG to capture copies of the job score. . No part of this publication may be reproduced. Use the Data Set Management tool (available in the Tools menu of DataStage Designer or DataStage Manager) to examine the schema.  Examine the score dump (placed in the Director log when $APT_DUMP_SCORE is enabled). tune. All fatal and warning messages should be addressed before attempting to debug. look at row counts.    NOTE: For large jobs. transmitted. In some instances. When a fatal error occurs. it is possible for $OSH_PRINT_SCHEMAS to generate a log entry that is too large for DataStage Director to store or display. 2006 125 of 179 Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions. The default is 30 seconds.1: Environment Variable Settings and the DataStage Parallel Job Advanced Developers Guide. and to manage source or target Parallel Data Sets. This directory will be created in the “Debugging” sub-directory of the Project home directory on the DataStage server. generated osh.3 How to Isolate and Debug a Parallel Job There are a number of tools available to debug DataStage Enterprise Edition jobs. But all warnings should be examined and understood. this variable determines the number of seconds the conductor node will wait for a successful startup from each section leader. Use $OSH_PRINT_SCHEMAS to verify that the job’s runtime schemas matches what the job developer expected in the design-time column definitions. it may not be possible to remove all warning messages generated by the EE engine. enable both $OSH_PRINT_SCHEMAS and $DS_PX_DEBUG . stored in a retrieval system. transcribed. and internal Enterprise Edition log messages in a directory corresponding to the job name.5. or promote a job from development into test or production. All rights reserved. July 17. The general process for debugging a job is:  Check the Director job log for warnings. or translated into any language in any form by any means without the written permission of IBM. 11.  Enable the Job Monitoring Environment Variables detailed in Section 2. the log entry is sometimes preceded by a warning condition.Information Integration Solutions Center of Excellence $APT_PM_NODE_TIMEOUT [seconds] For heavily loaded MPP or clustered environments. This will place entries in the Director log with the actual runtime schema for every link using Enterprise Edition internal data types. To capture the full schema output in these cases. These may indicate an underlying logic problem or unexpected data type conversion.

NOTE: The wc command counts UNIX line delimiters. It is useful to examine the generated OSH for debugging purposes. jobs are compiled into OSH (Orchestrate SHell) scripts that are used to execute the given job design at runtime. 11. the generated OSH tab will appear in the Job Properties dialog box: Parallel Framework Red Book: Data Flow Job Design July 17. transcribed. stored in a retrieval system. It is also not useful for files of non-delimited fixed-length record format. . To enable viewing of generated OSH. transmitted.Information Integration Solutions Center of Excellence  For flat (sequential) sources and targets: o To display the actual contents of any file in hexadecimal and ASCII (including embedded control characters or ASCII NULLs). No part of this publication may be reproduced. it must be enabled for a given project within the Administrator client: Figure 51: Generated OSH Administrator option Once this option has been enabled for a given project. 2006 126 of 179 © 2006 IBM Information Integration Solutions. use the UNIX command od –xc –Ax o To display the number of lines and characters in a specified ASCII text file. use the UNIX command wc –lc [filename] Dividing the total number of characters number of lines provides an audit to ensure all rows are same length. All rights reserved.4 Viewing the Generated OSH Within Designer. or translated into any language in any form by any means without the written permission of IBM. this count may be incorrect. and to understand internally what is running. so if the file has any binary columns.

##I TFSC 004000 14:51:50(000) <main_program> This step has 1 dataset: ds0: {op0[1p] (sequential generator) eOther(APT_HashPartitioner { key={ value=a } })->eCollectAny op1[2p] (parallel APT_CombinedOperatorController:tsort)} It has 2 operators: op0[1p] {(sequential generator) on nodes ( Parallel Framework Red Book: Data Flow Job Design July 17. what degree of parallelism each operator runs with. including how composite operators and shared containers break down. A score dump includes a variety of information about a flow. or translated into any language in any form by any means without the written permission of IBM. where data is repartitioned and how it is repartitioned. they have been optimized into the same process. have been inserted by EE. the first task is to examine the score dump which is generated when you set APT_DUMP_SCORE=TRUE in your environment. It shows three stages: Generator. transcribed. 2006 127 of 179 © 2006 IBM Information Integration Solutions. The job runs 3 processes on 2 nodes. All stages in this flow are running on one node.Information Integration Solutions Center of Excellence Figure 52: Generated OSH in Designer Job Properties 11. No part of this publication may be reproduced. All rights reserved. . transmitted. which has a hash partitioner that partitions on key field a. that is. stored in a retrieval system. The Peek and Sort stages are combined. which operators. and exactly which nodes each operator runs on.5 Interpreting the Parallel Job Score When attempting to understand an Enterprise Edition flow. Sort (tsort) and Peek. The following score dump shows a flow with a single Data Set. Also available is some information about where data may be buffered. if any.

All rights reserved.torrent. transmitted.4. No part of this publication may be reproduced. or translated into any language in any form by any means without the written permission of IBM.torrent. there are three areas to investigate: • Are there sequential stages? • Is needless repartitioning occurring? • In a cluster or Grid.com[op1. are the computation-intensive stages shared evenly across all nodes? More details on interpreting the parallel job score can be found in 12.torrent. Parallel Framework Red Book: Data Flow Job Design July 17.Information Integration Solutions Center of Excellence lemond. stored in a retrieval system.p1] )} In a score dump.2 Understanding the Parallel Job Score.com[op0. .p0] lemond. transcribed. 2006 128 of 179 © 2006 IBM Information Integration Solutions.com[op1.p0] )} op1[2p] {(parallel APT_CombinedOperatorController: (tsort) (peek) )on nodes ( lemond.

stored in a retrieval system. They maintain reference data in DS/EE internal format. proceeds through integration and volume testing. use a select list to read needed columns instead of the entire table (if possible) • Be alert when using runtime column propagation (“RCP”) – it may be necessary to disable RCP for a particular stage to ensure that columns are actually removed using that stage’s Output Mapping. a) Use Parallel Data Sets to land intermediate result between parallel jobs. No part of this publication may be reproduced. • Data Sets can only be read by other DS/EE parallel jobs (or the orchadmin command line utility). This section provides tips for designing a job for optimal performance. . Parallel Framework Red Book: Data Flow Job Design July 17. File Sets facilitate parallel I/O at the expense of exporting to a specified file format.1 How to Design a Job for Optimal Performance Overall job design can be the most significant factor in data flow performance. If you need to share information with external applications. All rights reserved. However. in the DS/EE native internal format. facilitating end-to-end parallelism across job boundaries. pre-indexed. transcribed. There are no utilities for examining data within a Lookup File Set. 2006 129 of 179 © 2006 IBM Information Integration Solutions.Information Integration Solutions Center of Excellence 12 Performance Tuning Job Designs The ability to process large volumes of data in a short period of time depends on all aspects of the flow and environment being optimized for maximum throughput and performance. This section outlines performance-related tips that can be followed when building a parallel data flow using DataStage Enterprise Edition. • Parallel Data Sets retain data partitioning and sort order. Lookup File Sets can only be used on reference links to a Lookup stage. Every unused column requires additional memory which can impact performance (it also makes each transfer of a record from one stage to the next more expensive). transmitted. and continues throughout an application’s production lifecycle. Performance tuning and optimization is an iterative process that begins at job design and unit tests. b) Remove unneeded columns as early as possible within the data flow. or translated into any language in any form by any means without the written permission of IBM. • Lookup File Sets can be used to store reference data used in subsequent jobs. • When reading from database sources. 12. and for optimizing the performance of a given data flow using various settings and features within DataStage Enterprise Edition.

ensure data is as close to evenly distributed as possible. 32K) maximum length that are rarely populated  Varchar columns of a large maximum length with highly varying data sizes d) Avoid type conversions. It is usually possible to choose a smaller partition-key set. External user-defined functions can expand the capabilities of the parallel Transformer. and to simply re-sort on a differing set of secondary/tertiary/etc. Note. • When possible. Unbounded strings (Varchar’s without a maximum length) can have a significant negative performance impact on a job flow. 2006 130 of 179 © 2006 IBM Information Integration Solutions. For example:  Varchar columns of a large (for example. a Transformer is always faster than a Filter or Switch stage. or when complex reusable logic is required. if possible. Use BuildOps only when existing Transformers do not meet performance requirements. that unless dynamic (parameterized) conditions are required. use orchdbutil to ensure that the designtime metadata matches the actual runtime metadata (especially with Oracle databases). . renaming and removing columns. Because BuildOps are built in C++.Information Integration Solutions Center of Excellence c) Always specify a maximum length for Varchar columns. transcribed. Modify) may be more appropriate. o When working with database sources and targets. there is greater control over the efficiency of code. All rights reserved. Copy. For data type conversions. or translated into any language in any form by any means without the written permission of IBM. • • Avoid using the BASIC Transformer. other stages (for example. Parallel Framework Red Book: Data Flow Job Design July 17. however. repartition to a more balanced distribution as soon as possible to improve performance of downstream stages. keys. transmitted. at the expense of ease of development (and more skilled developer requirements). • There are limited scenarios when the memory overhead of handling large Varchar columns would dictate the use of unbounded strings. f) Minimize the number of partitioners in a job. When business rules dictate otherwise and the data volume is large and sufficiently skewed.  Enable $OSH_PRINT_SCHEMAS to verify runtime schema matches job design column definitions o Verify that the data type of defined Transformer stage variables matches the expected result type e) Minimize the number of Transformers. stored in a retrieval system. No part of this publication may be reproduced. especially in large-volume data flows.

partitioning. As with any example. or translated into any language in any form by any means without the written permission of IBM. there is nothing to be gained from pipeline partitioning5. disabling operator combination allows CPU activity to be spread across multiple processors instead of being constrained to a single processor. o When writing to parallel Data Sets. Combined operators are generally adjacent to each other in a data flow. The purpose behind operator combination is to reduce the overhead associated with an increased process count. The default setting is 20MB per partition.2 Understanding Operator Combination At runtime. o The stable sort option is much more expensive than non-stable sorts. by using “SAME” partitioning. All rights reserved. specifying the “don’t sort.e. When composing the score. No part of this publication may be reproduced. Choose hash key columns that generate sufficient unique key combinations (while satisfying business requirements). and should only be used if there is a need to maintain an implied (i. When reading from these Data Sets.Information Integration Solutions Center of Excellence • • Know your data.  If data has already been partitioned and sorted on a set of key columns. Remember that SAME maintains the degree of parallelism of the upstream operator. In these configurations. previously sorted” option for those key columns in the Sort stage will reduce the cost of sorting and take greater advantage of pipeline parallelism. 2006 131 of 179 © 2006 IBM Information Integration Solutions. Parallel Framework Red Book: Data Flow Job Design July 17. g) Minimize and combine use of Sorts where possible o It is frequently possible to arrange the order of business logic within a job flow to leverage the same sort order. if possible. transcribed. 5 One exception to this guideline is when operator combination generates too few processes to keep the processors busy. transmitted. In addition. 12. . sort order and partitioning are preserved. DataStage Enterprise Edition analyzes a given job design and uses the parallel configuration file to build a job score which defines the processes and connection topology (Data Sets) between them used to execute the job logic. the environment variable APT_TSORT_STRESS_BLOCKSIZE can be used to set (in units of MB) the size of the RAM buffer for all sorts in a job. Use SAME partitioning carefully. your results should be tested in your environment. even those that have the “Restrict Memory Usage” option set. stored in a retrieval system. and groupings. not explicitly stated in the sort keys) row order. Enterprise Edition attempts to reduce the number of processes by combining the logic from 2 or more stages (operators) into a single process (per partition). try to maintain this sorting. o Performance of individual sorts can be improved by increasing the memory usage per partition using the “Restrict Memory Usage (MB)” option of the standalone Sort stage. If two processes are interdependent (one processes the other’s output) and they are both CPU-bound or I/O-bound.

tuning combination might yield additional performance benefits. see 12. combined stages are indicated by parenthesis surrounding the % CPU. or globally. o Within Designer.it will include all operators that meet the following rules: o Must be contiguous o Must be the same degree of parallelism o Must be ‘Combinable’. or translated into any language in any form by any means without the written permission of IBM. when other performance tuning measures have been applied and still greater performance is needed. it is best to let DSEE decide what to combine and what to leave uncombined. All rights reserved. if the “%CPU” column is displayed in a Job Monitor window in Director. It is for this reason that combination can be enabled or disabled on a per-stage basis. . transmitted.4. this is only recommended on pre 7.Information Integration Solutions Center of Excellence However. Combined Operator Controller). When deciding which operators to include in a particular combined operator (a. (For information on interpreting a job score dump. 2006 132 of 179 © 2006 IBM Information Integration Solutions. combination can be set on a per-stage basis (on the Stage/Advanced tab) The job score identifies what components are combined. the assumptions used by the Enterprise Edition optimizer to determine which stages can be combined may not always be the most efficient.k. stored in a retrieval system. here is a partial list of non-combinable operators:  Join  Aggregator  Remove Duplicates  Merge  BufferOp  Funnel  DB2 Enterprise Stage  Oracle Enterprise Stage  ODBC Enterprise Stage  BuildOps In general. as shown in the following illustration: Figure 53: CPU-bound combined process in Job Monitor Parallel Framework Red Book: Data Flow Job Design July 17. However. disables ALL combination in the entire data flow.0 versions of DS/EE.2 Understanding the Parallel Job Score” in this document. Enterprise Edition is ‘greedy’ . No part of this publication may be reproduced.a. transcribed. There are 2 ways to affect operator combination: o The environment variable APT_DISABLE_COMBINATION.) In addition.

etc. and improves performance. In fact. as shown in this subsequent Job Monitor for the same job: Figure 54: Throughput in Job Monitor after disabling combination 12. for example:  Batch jobs that process a small volume of data  Real-time jobs that process data in small message units  Environments running a large number of jobs simultaneously on the same server(s) In these instances. when it is appropriate to minimize the resource requirements for a given scenario. DS/EE executes a given job across the resources defined in a the specified configuration file.) from CPU-heavy operators (Transformer. Disabling combination with the Transformer enables pipeline partitioning. if you have several transformers and database operators combined with an output Sequential File. Toward that end. 2006 133 of 179 © 2006 IBM Information Integration Solutions. it is good to separate I/O heavy operators (Sequential File. in general. However. Lookup. such as Join. it might be a good idea to set the sequential file to be non-combinable.3 Minimizing Runtime Processes and Resource Requirements The architecture of Enterprise Edition is well suited for processing massive volumes of data in parallel across available resources. There are many factors that can reduce the number of processes generated at runtime:  Use a single-node configuration file  Remove ALL partitioners and collectors (especially when using a single-node configuration file)  Enable runtime column propagation on Copy stages with only one input and one output  Minimize join structures (any stage with more than one input. however. This will prevent IO requests from waiting on CPU to become available and viceversa. stored in a retrieval system. Change Capture.Information Integration Solutions Center of Excellence Choosing which operators to disallow combination for is as much art as science. or translated into any language in any form by any means without the written permission of IBM. All rights reserved. transcribed. Full Sorts. Funnel) Parallel Framework Red Book: Data Flow Job Design July 17. Merge. For example. a single-node configuration file is often appropriate to minimize job startup time and resource requirements without significantly impacting overall performance. in the above job design. .). etc. No part of this publication may be reproduced. the I/O-intensive FileSet is combined with a CPU-intensive Transformer. There are times. transmitted.

Default is 8192. The second block will be used by the downstream/consumer stage to obtain data that is ready for the next processing step. records do not stream from one stage to another. ODBC Enterprise. This type of buffering (or ‘Record Blocking’) is rarely tuned. 2006 134 of 179   Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions. DB2 Enterprise. They are actually transferred in blocks (just like on old magnetic tapes) called “Transport Blocks”. Each pair of operators that have a producer/consumer relationship will share at least 2 of these blocks. so setting this value too high will result in a large amount of memory consumption. Cannot be less than 8192. Once the upstream block is full and the downstream block is empty. transmitted. All rights reserved. there are 2 of these transport blocks for each partition of each link.1 Inter-Operator Transport Buffering Though it may look like it from the performance statistics and documentation might discuss ‘record streaming’. strictly speaking. Funnel. BufferOp Selectively (being careful to to avoid deadlocks) disable buffering. 12. Merge. the blocks are swapped and the process begins again. If necessary.4. cannot be greater than 1048576. The behavior of these transport blocks is determined by these environment variables:  APT_DEFAULT_TRANSPORT_BLOCK_SIZE o Specifies the default block size for transferring data between players. the value provided by a user for this variable is rounded up to the operating system's nearest page size. Remember.Information Integration Solutions Center of Excellence   Minimize non-combinable stages (as outlined in the previous section) such as Join. then setting APT_DEFAULT_TRANSPORT_BLOCK_SIZE to a multiple of (or equal to) the record size will resolve the problem. Remove Duplicates. or translated into any language in any form by any means without the written permission of IBM. stored in a retrieval system. (Buffering is discussed in more detail in the following section. This variable is only meaningful when used in combination with APT_LATENCY_COEFFICIENT. APT_AUTO_TRANSPORT_BLOCK_SIZE and APT_MAX_TRANSPORT_BLOCK_SIZE APT_MAX_TRANSPORT_BLOCK_SIZE July 17. Aggregator. The default value is 8192.) 12.4 Understanding Buffering There are two types of buffering in Enterprise Edition: ‘inter-operator transport’ and ‘deadlock prevention’. Oracle Enterprise. No part of this publication may be reproduced. BuildOps. APT_MIN_TRANSPORT_BLOCK_SIZE o Specifies the minimum allowable block size for transferring data between players. The first block will be used by the upstream/producer stage to output data it is done with. with a valid value range for between 8192 and 1048576. transcribed. It usually only comes into play when the size of a single record exceeds the default size of the transport block. .

Cannot be less than 8192. or translated into any language in any form by any means without the written permission of IBM. Here is an example job fragment: Figure 55: Fork-Join example Parallel Framework Red Book: Data Flow Job Design July 17. This variable is only meaningful when used in combination with APT_LATENCY_COEFFICIENT. APT_AUTO_TRANSPORT_BLOCK_SIZE and APT_MMIN_TRANSPORT_BLOCK_SIZE APT_AUTO_TRANSPORT_BLOCK_SIZE o If set. “Deadlock Prevention” comes into play anytime there is a Fork-Join structure in a job. cannot be greater than 1048576. must be at least 2 NOTE: The environment variables APT_MIN/MAX_TRANSPORT_BLOCK_SIZE. No part of this publication may be reproduced. and APT_AUTO_TRANSPORT_BLOCK_SIZE are used only with fixed-length records. stored in a retrieval system. . 12. All rights reserved. transcribed. APT_LATENCY_COEFFICIENT.4.Information Integration Solutions Center of Excellence    o Specifies the maximum allowable block size for transferring data between players. 2006 135 of 179 © 2006 IBM Information Integration Solutions. transmitted. Default is 1048576. the framework calculates the block size for transferring data between players according to this algorithm: if (recordSize * APT_LATENCY_COEFFICIENT < APT_MIN_TRANSPORT_BLOCK_SIZE) then blockSize = APT_MIN_TRANSPORT_BLOCK_SIZE else if (recordSize * APT_LATENCY_COEFFICIENT > APT_MAX_TRANSPORT_BLOCK_SIZE) then blockSize = APT_MAX_TRANSPORT_BLOCK_SIZE else blockSize = recordSize * APT_LATENCY_COEFFICIENT APT_LATENCY_COEFFICIENT o Specifies the number of records to be written to each transport block APT_SHARED_MEMORY_BUFFERS o Specifies the number of Transport Blocks between a pair of operators.2 Deadlock Prevention Buffering The other type of buffering.

Like this: Aggregator 1 Waiting to Write to Join d e ue Qu ite Wr Qu eu Wr ed ite Aggregator2 Waiting to read from Transformer (Here the arrows represent dependency direction. Imagine that the Transformer is waiting to write to Aggregator1. the job would deadlock .bringing processing to a halt (though the job does not stop running. which go into an Inner Join. So the above job structure would be altered by the DS/EE engine to look like this: Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions. BufferOp is always ready to read or write and will not allow a read/write request to be queued. No part of this publication may be reproduced. the Transformer creates a fork with 2 parallel Aggregators. there is a specialized operator called BufferOp.) Without deadlock buffering. it doesn’t necessarily have to involve a Join stage. Join is waiting on Aggregator2. All rights reserved.Information Integration Solutions Center of Excellence In this example. d eue Qu ad Re Transformer Waiting to write to Aggregator1 Qu eue Re d ad Join Waiting to read from Aggregator2 July 17. it would eventually time out). transcribed. not necessarily a Join stage) by Enterprise Edition during job startup. and Join is waiting to read from Aggregator2. stored in a retrieval system. or translated into any language in any form by any means without the written permission of IBM. this scenario would create a circular dependency where Transformer is waiting on Aggregator1. it is important to understand the operation of a parallel pipeline. Note however. 2006 136 of 179 . It is placed on all inputs to a join structure (again. Aggregator1 is waiting on Join. that “Fork-Join” is a graphical description. and Aggregator2 is waiting on Transformer. To understand deadlock-prevention buffering. To guarantee that this problem never happens in Enterprise Edition. Aggregator2 is waiting to read from the Transformer. Without deadlock buffering. transmitted. Aggregator1 is waiting to write to the Join. instead of data flow.

Values greater than 1 indicate that the buffer July 17. “The Parallel Engine Configuration File” of the DataStage Manager guide). Join cannot be ‘stuck’ waiting to read from either of its inputs. TIP: For very wide rows. not dependency. or translated into any language in any form by any means without the written permission of IBM. as these same types of circular dependencies can result from partition-wise Fork-Joins. All rights reserved. 2006 137 of 179  Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions. per partition). May not exceed 2/3 of APT_BUFFER_MAXIMUM_MEMORY. stored in a retrieval system. When that is full (because the upstream operator is still writing but the downstream operator isn’t ready to accept that data yet) it will begin to flush data to the scratchdisk resources specified in the configuration file (detailed in Chapter 11. Default 1 MB. BufferOps will also be placed on the input partitions to any sequential stage that is fed by a parallel stage. thus breaking the circular dependency and guaranteeing no deadlock will occur. as a nonnegative (proper or improper) fraction of APT_BUFFER_MAXIMUM_MEMORY.Information Integration Solutions Center of Excellence BufferOp1 Aggregator 1 Transformer Join Aggregator2 BufferOp 2 (Here the arrows now represent data-flow. By default. . APT_BUFFER_FREE_RUN o Maximum capacity of the buffer operator before it starts to offer resistance to incoming flow.) Since BufferOp is always ready to read or write. BufferOps will allocate 3MB of memory each (remember that this is per operator. transmitted. The behavior of deadlock-prevention BufferOps can be tuned through these environment variables:  APT_BUFFER_DISK_WRITE_INCREMENT o Controls the “blocksize” written to disk as the memory buffer fills. transcribed. No part of this publication may be reproduced. it may be necessary to increase the default buffer size (APT_BUFFER_MAXIMUM_MEMORY) to hold more rows in memory.

but will almost certainly degrade performance and therefore shouldn’t be used in production job runs. use of this setting is only recommend for advanced users! FORCE_BUFFERING can be used to reveal bottlenecks in a job design during development and performance tuning. the buffer mode. No part of this publication may be reproduced. Additionally. transmitted. .Information Integration Solutions Center of Excellence operator will free run (up to a point) even when it has to write data to disk. All rights reserved. the default buffering policy is AUTOMATIC_BUFFERING. transcribed. and write increment can be set on a per-stage basis from the Input/ Advanced tab of the stage properties. This allows the job to run at the highest rate possible even when a Parallel Framework Red Book: Data Flow Job Design July 17. or translated into any language in any form by any means without the written permission of IBM. Valid settings are:  AUTOMATIC_BUFFERING: buffer as necessary to prevent dataflow deadlocks  FORCE_BUFFERING: buffer all virtual Data Sets  NO_BUFFERING: inhibit buffering on all virtual Data Sets  WARNING: Inappropriately specifying NO_BUFFERING can cause dataflow deadlock during job execution.  APT_BUFFER_MAXIMUM_MEMORY o Maximum memory consumed by each buffer operator for data storage. When it is not defined or defined to be the null string. APT_BUFFERING_POLICY o Specifies the buffering policy for the entire job. BufferOps also have the effect of “smoothing out” production/consumption spikes. 2006 138 of 179 © 2006 IBM Information Integration Solutions. queue bound. buffer free run. as shown in the illustration below: Aside from ensuring that no dead-lock occurs. buffer size. Default is 3 MB. stored in a retrieval system.

when a buffer has consumed its RAM. if you do not have force buffering set and APT_BUFFER_FREE_RUN set to at least ~1000. while changing only 1 thing at a time). If that doesn’t yield enough of a performance boost (remember to test iteratively. As implied above. Each place may offer an opportunity for buffer tuning. or translated into any language in any form by any means without the written permission of IBM. you may be able identify points in the data flow where a downstream stage is waiting on an upstream stage to produce data. Stages upstream/downstream from high-latency stages (such as remote databases. as some other stage far downstream could be responsible for cascading pushback all the way upstream to the place you are seeing the bottleneck. . When attempting to address these mismatches in production/consumption. No part of this publication may be reproduced. stored in a retrieval system. 2006 139 of 179 © 2006 IBM Information Integration Solutions. Because of this. it will ask the upstream stage to “slow down” . Choosing which stages to tune buffering for and which to leave alone is as much art as science. it is best to tune the buffers on a per-stage basis. transmitted. transcribed.this is called “pushback”. you cannot determine that any one stage is waiting on any other stage.) are a good place to start. etc. Parallel Framework Red Book: Data Flow Job Design July 17. then setting the buffering policy to “FORCE_BUFFERING” will cause buffering to occur everywhere. NFS mount points for data storage. By using the performance statistics in conjunction with this buffering. instead of globally through environment variable settings. All rights reserved.Information Integration Solutions Center of Excellence downstream stage is ready for data at different times than when its upstream stage is ready to produce that data. and should be considered among the last resorts for performance tuning.

Development Guidelines Modular development techniques should be used to maximize re-use of DataStage jobs and components. See Section 2. To ease re-use. All rights reserved. See Section 2. database login properties…)  environment variables and their default settings (as outlined in Section 2. 2. . stored in a retrieval system. etc) and directories where files are stored.2: Naming Conventions.Information Integration Solutions Center of Excellence Appendix A: Standard Practices Summary This Appendix summarizes Standard Practices recommendations outlined in this document. It is the DataStage developer’s responsibility to make personal backups of their work on their local workstation. 1. DataStage Template jobs should be created with:  standard parameters (for example. All DataStage jobs should be documented with Short Description field. transcribed. An example DataStage naming structure is given in Section 2. file names. No part of this publication may be reproduced. The scope of a parameter is discussed further in Section 3. or translated into any language in any form by any means without the written permission of IBM. password.  Create a standard directory structure outside of the DataStage project directory for source and target files. and links. create re-usable components such as parallel shared containers to encapsulate frequently-used logic. An example directory naming structure is given in Section 2. The Multiple-Instance job property allows multiple invocations of the same job to run simultaneously. along with cross-references for more detail. transmitted. as outlined in Section 3:Development Guidelines:  Job parameterization allows a single job design to process similar logic instead of creating multiple copies of the same job. Parallel Framework Red Book: Data Flow Job Design July 17.4: Working with Source Code Control Systems. source and target file paths. using the Manager DSX export capability.5. as well as Annotation fields. Standards It is important to establish and follow consistent standards in:  Directory structures for install and application support directories. user. intermediate work files. stage names.  Naming conventions.1 Environment Variable Settings)  annotation blocks Job Parameters should always be used for file paths.  A set of standard job parameters should be used in DataStage jobs for source and target database parameters (DSN. 2006 140 of 179 © 2006 IBM Information Integration Solutions.  Where possible. This can also be used for integration with source code control systems. and so forth. these standard parameters and settings should be made part of a Designer Job Template.3: Documentation and Annotation. database login settings.5: Job Parameters. especially for DataStage Project categories.1:Directory Structures.

BASIC Routines are appropriate only for job control sequences.  Use the Copy stage as a placeholder for iterative design.  Use BuildOp stages only when logic cannot be implemented in the parallel Transformer. No part of this publication may be reproduced. 2006 141 of 179 © 2006 IBM Information Integration Solutions. 4. This ensures that the processing workload is evenly balanced.  Always use parallel Data Sets for intermediate storage between jobs. Component Usage As discussed in Section 3. and to facilitate default type conversions. All rights reserved. Further details are provided in Section 3.   DataStage Data Types Be aware of the mapping between DataStage (SQL) data types and the internal DS/EE data types.  Use the parallel Transformer stage (not the BASIC Transformer) instead of the Filter or Switch stages. assigning related records to the same partition if required Any stage that processes groups of related records (generally using one or more key columns) must be partitioned using a keyed partition method.7:Error and Reject Record Handling. Leverage default type conversions using the Copy stage or across the Output mapping tab of other stages. Standardized Error Handling routines should be followed to capture errors and rejects.8: Component Usage. using RCP to maximize re-use. transmitted. . transcribed. the following guidelines should be followed when constructing parallel jobs in DS/EE:  Never use Server Edition components (BASIC Transformer.Information Integration Solutions Center of Excellence Parallel Shared Containers should be used to encapsulate frequently-used logic. the following objectives help to form a methodology for assigning partitioning: Objective 1: Choose a partitioning method that gives close to an equal number of rows in each partition. Objective 2: The partition method must match the business requirements and stage functional requirements. Parallel Framework Red Book: Data Flow Job Design July 17. Server Shared Containers) within a parallel job. 3. 5. as outlined in Section 4:DataStage Data Types. while minimizing overhead. minimizing overall run time. or translated into any language in any form by any means without the written permission of IBM. stored in a retrieval system. Partitioning Data Given the numerous options for keyless and keyed partitioning.

Change Capture. use Round Robin partitioning to redistribute data equally across all partitions o Especially useful if the input Data Set is highly skewed or sequential d) Use Same partitioning to optimize end-to-end partitioning and to minimize repartitioning o Being mindful that Same partitioning retains the degree of parallelism of the upstream stage o Within a flow. All rights reserved. Using the above objectives as a guide. Collecting Data Given the options for collecting data into a sequential stream. Remove Duplicates. Objective 4: Partition method should not be overly complex The simplest method that meets the above objectives will generally be the most efficient and yield the best performance. stored in a retrieval system. but is not limited to: Aggregator. use Auto partitioning (the default) Parallel Framework Red Book: Data Flow Job Design July 17. transcribed. No part of this publication may be reproduced. Join. It may also be necessary for Transformers and BuildOps that process groups of related records. it may not be possible to choose a partitioning method that gives close to an equal number of rows in each partition. Objective 3: Unless partition distribution is highly skewed. and Sort stages. minimize repartitioning. the following methodology can be applied: a) Start with Auto partitioning (the default) b) Specify Hash partitioning for stages that require groups of related records o Specify only the key column(s) that are necessary for correct grouping as long as the number of unique values is sufficient o Use Modulus partitioning if the grouping is on a single integer key column o Use Range partitioning if the data is highly skewed and the key column values and distribution do not change significantly over time (Range Map can be reused) c) If grouping is not required. examine up-stream partitioning and sort order and attempt to preserve for down-stream processing. This may require re-examining key column usage within stages and re-ordering stages within a flow (if business requirements permit). Change Apply. Note that in satisfying the requirements of this second objective. Across jobs. This is particularly useful if downstream jobs are run with the same degree of parallelism (configuration file) and require the same partition and sort order. the following guidelines form a methodology for choosing the appropriate collector type: a) When output order does not matter. transmitted. persistent Data Sets can be used to retain the partitioning and sort order. . especially in cluster or Grid configurations Repartitioning data in a cluster or Grid configuration incurs the overhead of network transport. Merge.Information Integration Solutions Center of Excellence This includes. 6. or translated into any language in any form by any means without the written permission of IBM. Further details on Partitioning methods can be found in Section 5: Partitioning and Collecting. 2006 142 of 179 © 2006 IBM Information Integration Solutions.

stored in a retrieval system.  Stage-Specific Guidelines As discussed in Section 8. Sorting Using the rules and behavior outlined in Section 6: Sorting. Create Key Change Column. use the Join or Merge stage. the following methodology should be applied when sorting in a DataStage Enterprise Edition data flow: a) Start with a link sort b) Specify only necessary key column(s) c) Don’t use Stable Sort unless needed d) Use a stand-alone Sort stage instead of a Link sort for options that not available on a Link sort:  Sort Key Mode. 2006 143 of 179 © 2006 IBM Information Integration Solutions.Information Integration Solutions Center of Excellence b) When the input Data Set has been sorted in parallel. the Ordered collector may be more efficient c) Use a Round Robin collector to reconstruct rows in input order for round-robin partitioned input Data Sets. or translated into any language in any form by any means without the written permission of IBM.1. sequential ordered result set use a parallel Sort and a Sort Merge collector 8.1: Transformer NULL Handling and Reject Link. 7.1: Lookup vs. Create Cluster Key Change Column. use Sort Merge collector to produce a single. transmitted. . Further details on Partitioning methods can be found in Section 5: Partitioning and Collecting. precautions must be taken when using expressions or derivations on nullable columns within the parallel Transformer: o Always convert nullable columns to in-band values before using them in an expression or derivation. o Always place a reject link on a parallel Transformer to capture / audit possible rejects. transcribed. See Section 9. All rights reserved. No part of this publication may be reproduced. globally sorted stream of rows o When the input Data Set has been sorted in parallel and Range partitioned. If the Data Sets are larger than available memory resources. Output Statistics  Always specify “DataStage” Sort Utility for standalone Sort stages  Use the “Sort Key Mode=Don’t Sort (Previously Sorted)” to resort a sub-grouping of a previously-sorted input Data Set e) Be aware of automatically-inserted sorts  Set $APT_SORT_INSERTION_CHECK_ONLY to verify but not establish required sort order f) Minimize the use of sorts within a job flow g) To generate a single. Join vs. The Lookup stage is most appropriate when reference data is small enough to fit into available memory.  Parallel Framework Red Book: Data Flow Job Design July 17. Merge. as long as the Data Set has not been repartitioned or reduced.

use the native parallel database stages for maximum performance and scalability. transmitted. . Parallel Framework Red Book: Data Flow Job Design July 17. or Informix databases. Check the Director log for warnings. Care must be taken to observe the data type mappings documented in Section 10: Database Stage Guidelines when designing a parallel job with DS/EE. which may indicate an underlying problem or data type conversion issue. Use Hash method Aggregators only when the number of distinct key column values is small.1. No part of this publication may be reproduced. (See Section 9. Avoid the use of database stored procedures on a per-row basis within a high-volume data flow. it is best to implement business rules natively using DataStage parallel components. A Sort method Aggregator should be used when the number of distinct key values is large or unknown. the non-key columns must be defined as nullable in the Join stage input in order to identify unmatched records. use a SQL where clause to limit the number of rows sent to a DataStage job. DB2. If possible. or translated into any language in any form by any means without the written permission of IBM. All rights reserved. stored in a retrieval system. 10. use orchdbutil to properly import design metadata.1: Database stage types: Native Parallel Database Stages DB2/UDB Enterprise Informix Enterprise ODBC Enterprise Oracle Enterprise SQL Server Enterprise Teradata Enterprise      The ODBC Enterprise stage should only be used when a native parallel stage is not available for the given source or target database.  Database Stage Guidelines Where possible.2Capturing Unmatched Records from a Join). Be particularly careful to observe the nullability properties for input links to any form of Outer Join. Even if the source data is not nullable. or when exception processing. For maximum scalability and parallel performance. transcribed. as discussed in Section 10. 2006 144 of 179 © 2006 IBM Information Integration Solutions. All warnings and failures should be addressed (and removed if possible) before deploying a DS/EE job.Information Integration Solutions Center of Excellence    Limit the use of database Sparse Lookups to scenarios where the number of input rows is significantly smaller (for example 1:100 or more) than the number of reference rows. 9. When using Oracle.   Troubleshooting and Monitoring Always test DS/EE jobs with a parallel configuration file ($APT_CONFIG_FILE) that has two or more nodes in its default pool.

2006 145 of 179 © 2006 IBM Information Integration Solutions. . transmitted. and examine the job score by following the guidelines outlined in Section 12. error and warning messages from a running DS/EE job.4. transcribed.Information Integration Solutions Center of Excellence    The environment variable $DS_PX_DEBUG can be used to capture all generated OSH. Parallel Framework Red Book: Data Flow Job Design July 17. Set the environment variable $OSH_PRINT_SCHEMAS to capture actual runtime schema to the Director log. Set $DS_PX_DEBUG if the schema record is too large to capture in a Director log entry. Enable $APT_DUMP_SCORE by default. No part of this publication may be reproduced. stored in a retrieval system. or translated into any language in any form by any means without the written permission of IBM.2 Understanding the Parallel Job Score. All rights reserved.

or translated into any language in any form by any means without the written permission of IBM. stored in a retrieval system. or the function the object performs: Project Repository and Components <proj>Dev Development <proj>Test Test <proj>Prod Production BdOp<name> BuildOp XFn<name> Parallel External Function Wrap<name> Wrapper Job Names and Properties Extract Job Load Sequence Parallel Shared Container Server Shared Container Parameter Links (prefix with “lnk_”) Reference (Lookup) Reject (Lookup. transcribed. 2006 Tail SF CFF FS DS LFS XSrc XTgt SASd Agg ChAp ChCp Cp Filt Funl InJn LOJn ROJn FOJn Lkp Mrg Mod Pivt RmDp SASp Srt SKey Swch Tfm BTfm SV RTIi RTIo XMLi 146 of 179 Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions. transmitted. Subject Modifier. File. .Information Integration Solutions Center of Excellence Appendix B: DataStage Naming Reference Every name should be based on a three-part concept: Subject. All rights reserved. Class Word where the following frequently-used Class Words describe the object type. No part of this publication may be reproduced. DB) Message (Sequence) Get (Shared Container) Put (Shared Container) Input Output Delete Insert Update Data Store Database Stored Procedure Table View Dimension Fact Source Target Development / Debug Stages Column Generator Head Peek Row Generator Sample Src<job> Load<job> <job>_Seq <job>Psc <job>Ssc <name>Parm Ref Rej Msg Get Put In Out Del Ins Upd DB SP Tab View Dim Fact Src Tgt CGen Head Peek RGen Smpl Tail File Stages Sequential File Complex Flat File File Set Parallel Data Set Lookup File Set External Source External Target Parallel SAS Data Set Processing Stages Aggregator Change Apply Change Capture Copy Filter Funnel Join (Inner) Join (Left Outer) Join (Right Outer) Join (Full Outer) Lookup Merge Modify Pivot Remove Duplicates SAS processing Sort Surrogate Key Generator Switch Transformer Stage Transformer (native parallel) BASIC Transformer (Server) Stage Variable Real Time Stages RTI Input RTI Output XML Input July 17.

All rights reserved. or translated into any language in any form by any means without the written permission of IBM. stored in a retrieval system. . 2006 147 of 179 © 2006 IBM Information Integration Solutions. No part of this publication may be reproduced. transmitted.Information Integration Solutions Center of Excellence XML Output XML Transformer Restructure Stages Column Export Column Import XMLo XMLt CExp CImp Parallel Framework Red Book: Data Flow Job Design July 17. transcribed.

The second score entry is the actual job score. or translated into any language in any form by any means without the written permission of IBM. Enterprise Edition uses the given job design and configuration file to compose a job score which details the processes created. It is recommended that this setting be enabled by default at the project level. transcribed. At runtime. and the overhead to capture the score is negligible. the job score is output to the DataStage Director log. transmitted. 1. .Information Integration Solutions Center of Excellence Appendix C: Understanding the Parallel Job Score Jobs developed in DataStage Enterprise Edition are independent of the actual hardware and degree of parallelism used to run the job. stored in a retrieval system. not the actual job. the DS/EE job score: • • • • • Identifies degree of parallelism and node assignment(s) for each operator Details mappings between functional (stage/operator) and actual operating system processes Includes operators automatically inserted at runtime: o Buffer operators to prevent deadlocks and optimize data flow rates between stages o Sorts and Partitioners that have been automatically inserted to ensure correct results Outlines connection topology (Data Sets) between adjacent operators and/or persistent Data Sets Defines number of actual operating system processes Where possible. 2006 148 of 179 © 2006 IBM Information Integration Solutions. No part of this publication may be reproduced. and interconnects (Data Sets) between them. Parallel Framework Red Book: Data Flow Job Design July 17. All rights reserved. multiple operators are combined within a single operating system process to improve performance and optimize resource requirements. degree of parallelism and node (server) assignments. and can be ignored. Similar to the way a parallel database optimizer builds a query plan. As shown in the illustration below. Viewing the Job Score When the environment variable APT_DUMP_SCORE is set. The parallel Configuration File provides a mapping at runtime between the compiled job and the actual runtime infrastructure and resources by defining logical processing nodes. as the job score offers invaluable data for debugging and performance tuning. job score entries start with the phrase “main_program: This step has n datasets…” Two separate scores are written to the log for each job run. The first score is from the license operator.

2006 149 of 179 Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions.Information Integration Solutions Center of Excellence Actual job score 2. and the degree of parallelism per operator o Node assignment for each operator. (in this example: “node1”. The actual node names correspond to node names in the parallel configuration file. Terminology in this section can be used to identify the type of partitioning or collecting that was used between operators. No part of this publication may be reproduced. two running in parallel across 4 nodes. transcribed. Parallel Job Score Components The Enterprise Edition parallel job score is divided into two sections. • Operators: starts with the words “It has n operators:” The second section details actual operators created to execute the job flow. links between stages). there are two virtual Data Sets. stored in a retrieval system. “node4”). transmitted. . In this example. for a total of 9 operating system process. All rights reserved. one running sequentially. including persistent (on disk) and virtual (in memory. as shown in the example on the right: • Data Sets: starts with the words “main_program: This step has n datasets:” The first section details all Data Sets. “node3”. “node2”. This includes: o Sequential or Parallel operation. there are 3 operators. July 17. In this example. or translated into any language in any form by any means without the written permission of IBM.

or translated into any language in any form by any means without the written permission of IBM. No part of this publication may be reproduced. stored in a retrieval system. followed by a notation to indicate the type of partitioning or collecting (if any). The symbol between the partition name and collector name indicates: -> <> => #> >> > Sequential producer to Sequential consumer Sequential producer to Parallel consumer Parallel producer to Parallel consumer (SAME partitioning) Parallel producer to Parallel consumer (repartitioned. Producer Partitioner Collector Consumer The notation between producer and consumer is used to report the type of partitioning or collecting (if any) that is applied. The memory used by deadlock-prevention BufferOps can be calculated based on the number of inserted BufferOps. Producers and consumers may be either persistent (on disk) Data Sets or parallel operators. Within the Data Set definition. followed by the downstream consumer. transmitted. as illustrated in the example on the right: The degree of parallelism is identified in brackets after the operator name. For example. operator zero (op0) is running sequentially. in the example on the right. with each Data Set identified by its number (starting at zero). In the above example. the first Data Set is identified as “ds0”. The partition type is associated with the first term. All rights reserved. Persistent Data Sets are identified by their Data Set name. corresponding to the lower section of the job score. and the next “ds1”. transcribed. not SAME) Parallel producer to Sequential consumer No producer or no consumer (typically. 3. Job Score: Data Sets The parallel pipeline architecture of DataStage Enterprise Edition passes data from upstream producers to downstream consumers through in-memory virtual data sets. the upstream producer is identified first. for persistent Data Sets) July 17. Operator 1 (op1) is running in parallel with 4 degrees of parallelism [4p]. 2006 150 of 179 Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions.Information Integration Solutions Center of Excellence Note that the number of virtual Data Sets and the degree of parallelism determine the amount of memory used by the inter-operator transport buffers. with 1 degree of parallelism [1p]. . collector type with the second. while operators are identified by their operator number and name. Data Sets are identified in the first section of the parallel job score.

p1] operators node3[op2. stored in a retrieval system. All rights reserved. 4. But internally.p3] )} op4[4p] {(parallel APT_CombinedOperatorController: (APT_LUTProcessImpl in Lookup_3) (APT_TransformOperatorImplV0S7_cpLookupTest1_Tran sformer_7 in Transformer_7) (PeekNull) ) on nodes ( ecc3671[op4. Lookup is a composite operator.p0] )} . as shown in the following score fragment shown on the right: ecc3673[op3.APT_LUTCreateImpl: op2[1p] {(parallel APT_LUTCreateImpl in Lookup_3) on nodes ( Reads the reference data into memory ecc3671[op2. For each operator. For example.p3] (APT_CombinedOperatorController) which include logic from multiple stages in a single operator o may also include framework-inserted operators such as Buffers.p1] • Components of the operator node3[op2.p2] Using this information together with the output from the $APT_PM_SHOW_PIDS environment variable. each individual component of a composite operator is represented as an individual operator in the job score. (example “[4p]”) key={value=FirstName}}(0)) on nodes ( • “sequential” or “parallel” execution mode node1[op2.p0] node2[op2.p2] ecc3674[op3.p0] from zero (example “op0”) )} op1[4p] {(parallel inserted tsort operator • degree of parallelism within brackets {key={value=LastName}. the notation “[pp]” will appear in this section of the job score.p0] data has been loaded ecc3672[op3. or translated into any language in any form by any means without the written permission of IBM.p2] o typically correspond to the usernode4[op2.p0] o may also include combined node2[op2. you can evaluate the memory used by a lookup. Job Score: Operators The lower portion of the parallel job score details op0[1p] {(sequential the mapping between stages and actual processes APT_CombinedOperatorController: (Row_Generator_0) generated at runtime. Since Parallel Framework Red Book: Data Flow Job Design July 17. transcribed. Sorts o may include “composite” operators (for example.p1] At runtime. a composite operator includes more than one function. It is composted of the following internal operators: . No part of this publication may be reproduced.APT_LUTProcessImpl: op3[4p] {(parallel buffer(0)) Performs actual lookup processing once reference on nodes ( ecc3671[op3. transmitted. 2006 151 of 179 © 2006 IBM Information Integration Solutions.p1] ecc3673[op4.p3] )} specified stage name in the Designer op2[4p] {(parallel buffer(0)) canvas on nodes ( node1[op2.Information Integration Solutions Center of Excellence Finally.p2] node4[op2. if the Preserve Partitioning flag has been set for a particular Data Set. a composite operator appears to be a single stage on the design canvas. includes (as illustrated in the job score fragment): key={value=FirstName}}) ) on nodes ( • operator name (opn) numbered sequentially node1[op0. this (inserted tsort operator {key={value=LastName}. Lookup) Some stages are composite operators – to the DataStage developer.p0] ecc3672[op4. .

a persistent Data Set defined to “Overwrite” an existing Data Set of the same name main_program: This step has 2 datasets: will have multiple entries in the job score to: ds0: {op1[1p] (parallel delete data files in delete temp. All rights reserved. .p0] )} op2[1p] {(sequential delete descriptor file in delete temp. transcribed.ds) on nodes ( node1[op1. In a similar way. No part of this publication may be reproduced. stored in a retrieval system.ds) on nodes ( node1[op2.p0] )} op1[1p] {(parallel delete data files in delete temp. you can also determine the delay associated with loading the lookup structure.Delete Descriptor File ds1: {op0[1p] (sequential Row_Generator_0) -> temp.p0] )} Parallel Framework Red Book: Data Flow Job Design July 17.Delete Data Files ->eCollectAny op2[1p] (sequential delete descriptor file in delete temp. or translated into any language in any form by any means without the written permission of IBM. transmitted.ds} It has 3 operators: op0[1p] {(sequential Row_Generator_0) on nodes ( node1[op0.ds)} .ds) . 2006 152 of 179 © 2006 IBM Information Integration Solutions.Information Integration Solutions Center of Excellence the entire structure needs to be loaded before actual lookup processing can begin.

transcribed. 2006 153 of 179 © 2006 IBM Information Integration Solutions. or translated into any language in any form by any means without the written permission of IBM. No part of this publication may be reproduced.Information Integration Solutions Center of Excellence Appendix D: Estimating the Size of a Parallel Data Set For the advanced user. rounded up 8 bytes n + 4 bytes for non-NLS data 2n + 4 bytes for NLS data (internally stored as UTF-16) n bytes for non-NLS data 2n bytes for NLS data 4 bytes 8 bytes with microsecond resolution 4 bytes 8 bytes 12 bytes with microsecond resolution For the overall record width: .add (# nullable fields)/8 for null indicators . . stored in a retrieval system. As can APT_Transfer::getTransferBufferSize(). transmitted. this Appendix provides a more accurate and detailed way to estimate the size of a parallel Data Set based on the internal storage requirements for each data type: Data Type Integers Small Integer Tiny Integer Big Integer Decimal Float VarChar(n) Char(n) Time Date Timestamp Size 4 bytes 2 bytes 1 byte 8 bytes (precision+1)/2. if you have a transfer that transfers all fields from input to output. Parallel Framework Red Book: Data Flow Job Design July 17. the method APT_Record::estimateFinalOutputSize() can give you an estimate for a given record schema. All rights reserved.one byte per column for field alignment (worst case is 3.5 bytes per field) Using the internal DataStage Enterprise Edition C++ libraries.

or translated into any language in any form by any means without the written permission of IBM. All rights reserved. Default is 128 (128K). Setting this value to a low number (such as 1) is useful for realtime applications. setting this variable to a value equal to the read / write size in bytes can improve performance of Sequential File import/export operations. See section 4. Setting this environment variable directs DataStage to reject Sequential File records with strings longer than their declared maximum column length.01 and later) [Kbytes] $APT_IMPORT_BUFFER_SIZE $APT_EXPORT_BUFFER_SIZE $APT_CONSISTENT_BUFFERIO_SIZE [bytes] Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions.1. In some disk array configurations. 1. July 17. transcribed. but there is a small performance penalty from increased I/O. or to change the default behavior of specific DataStage Enterprise Edition stages. These variables can be used on an as-needed basis to tune the performance of a particular job flow. Increasing these values on heavily-loaded file servers may improve performance. with a minimum of 8. transmitted. Environment Variable $APT_EXPORT_FLUSH_COUNT Sequential File Stage Environment Variables Setting [nrows] Description Specifies how frequently (in rows) that the Sequential File stage (export operator) flushes its internal buffer to disk. 2006 154 of 179 $APT_IMPORT_REJECT_STRING_FIELD_OVERRUN S 1 (DataStage v7. . or pads. No part of this publication may be reproduced. An extensive list of environment variables is documented in the DataStage Parallel Job Advanced Developer’s Guide. Set values that are optimal to your environment. stored in a retrieval system. NOTE: The environment variable settings in this Appendix are only examples.2: Default and Explicit Type Conversions 2. imported string fields that exceed their maximum declared length are truncated.Information Integration Solutions Center of Excellence Appendix E: Environment Variable Reference This Appendix summarizes the environment variables mentioned throughout this document. By default. to assist in debugging. Environment Variable $APT_STRING_PADCHAR Job Design Environment Variables Setting [char] Description Overrides the default pad character of 0x0 (ASCII null) used when EE extends. a variable-length string field to a fixed length (or a fixed-length to a longer fixed-length). Defines size of I/O buffer for Sequential File reads (imports) and writes (exports) respectively.

$APT_MAX_DELIMITED_READ_SIZE [bytes] $APT_IMPORT_PATTERN_USES_FILESET [set] 3. The default is 500 bytes. socket or FIFO) to avoid blocking. $DB2DBDFT is used to find the database name. Used as a backup for specifying the DB2 installation directory (if $INSTHOME is undefined). If $APT_DBNAME is not defined. $APT_DB2INSTANCE_HOME $APT_DBNAME $APT_RDBMS_COMMIT_ROWS Can also be specified with the “Row Commit Interval” stage input property. If it is not found the importer looks ahead 4*500=2000 (1500 more) bytes. By default. Allows DataStage plug-in stages to handle DB2 databases which use the special characters # and $ in column names. Sequential File (import) will read ahead 500 bytes to get the next delimiter. transmitted. but this can be set as low as 2 bytes. No part of this publication may be reproduced. . For disk configurations with multiple controllers and disk. All rights reserved. transcribed.db2profile. stored in a retrieval system. When this environment variable is set (present in the environment) file pattern reads are done in parallel by dynamically building a File Set header based on the list of files that match the given expression. Specifies the number of records to insert between commits. When more than 500 bytes read-ahead is desired. $DS_ENABLE_RESERVED_CHAR_CONVE RT [rows] 1 Parallel Framework Red Book: Data Flow Job Design July 17. Specifies the name of the DB2 database for DB2/UDB Enterprise stages if the “Use Database Environment Variable” option is True.Information Integration Solutions Center of Excellence $APT_DELIMITED_READ_SIZE [bytes] Specifies the number of bytes the Sequential File (import) stage reads-ahead to get the next delimiter. This variable controls the upper bound which is by default 100. This variable is usually set in a user’s environment from . The default value is 2000 per partition.000 bytes. this will significantly improve file pattern reads. Environment Variable $INSTHOME DB2 Environment Variables Setting [path] [path] [database] Description Specifies the DB2 install directory. and so on (4X) up to 100. or translated into any language in any form by any means without the written permission of IBM. use this variable instead of APT_DELIMITED_READ_SIZE. This setting should be set to a lower value when reading from streaming inputs (for example. 2006 155 of 179 © 2006 IBM Information Integration Solutions.000 bytes.

commits are made every 2 seconds or 5000 rows per partition. These two environment variables work together to specify how often target rows are committed for target Oracle stages with Upsert method. The default is 10000 per partiton. Commits are made whenever the time interval period has passed or the row interval is reached. Specifies the commit interval in rows for Informix HPL Loads. Environment Variable $ORACLE_HOME Oracle Environment Variables Setting [path] [sid] [num] [seconds] Description Specifies installation directory for current Oracle instance. Specifies the name of the Informix server matching an entry in the sqlhosts file. By default. Specifies the Oracle service name. corresponding to a TNSNAMES entry. . or translated into any language in any form by any means without the written permission of IBM. The filepath specified by this environment variable specifies the file with the SQL*Loader commands. 5.Information Integration Solutions Center of Excellence 4. a target Oracle stage with Load method will limit the number of players to the number of datafiles in the table’s tablespace. When set. No part of this publication may be reproduced. whichever comes first. PARALLEL=TRUE) $ORACLE_SID $APT_ORAUPSERT_COMMIT_ROW_INTERVAL $APT_ORAUPSERT_COMMIT_TIME_INTERVAL $APT_ORACLE_LOAD_OPTIONS [SQL* Loader options] [char] $APT_ORACLE_LOAD_DELIMITED (DataStage 7. 2006 156 of 179 Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions. Useful in debugging Oracle SQL*Loader issues. Specifies Oracle SQL*Loader options used in a target Oracle stage with Load method.01 and later) $APT_ORA_IGNORE_CONFIG_FILE_PARALLELIS M 1 $APT_ORA_WRITE_FILES [filepath] Specifies a field delimiter for target Oracle stages using the Load method. this is set to OPTIONS(DIRECT=TRUE. transcribed. July 17. When set. Normally set in a user’s environment by Oracle scripts. the output of a Target Oracle stage with Load method is written to files instead of invoking the Oracle SQL*Loader. stored in a retrieval system. transmitted. By default. Setting this variable makes it possible to load fields with trailing or leading blank characters. All rights reserved. Specifies the path to the Informix sqlhosts file. Informix Environment Variables Environment Variable $INFORMIXDIR $INFORMIXSQLHOSTS $INFORMIXSERVER $APT_COMMIT_INTERVAL Setting [path] [filepath] [name] [rows] Description Specifies the Informix install directory.

Information Integration Solutions Center of Excellence
$DS_ENABLE_RESERVED_CHAR_CONVERT

1 Allows DataStage plug-in stages to handle Oracle databases which use the special characters # and $ in column names.

6.
Environment Variable
$APT_TERA_SYNC_DATABASE $APT_TERA_SYNC_USER $APT_TER_SYNC_PASSWORD $APT_TERA_64K_BUFFERS

Teradata Environment Variables
Setting
[name] [user] [password] 1 1

Description
Starting with v7, specifies the database used for the terasync table. By default, EE uses the Starting with v7, specifies the user that creates and writes to the terasync table. Specifies the password for the user identified by $APT_TERA_SYNC_USER. Enables 64K buffer transfers (32K is the default). May improve performance depending on network configuration. This environment variable is not recommended for general use. When set, this environment variable may assist in job debugging by preventing the removal of error tables and partially written target table. Disables permission checking on Teradata system tables that must be readable during the TeraData Enterprise load process. This can be used to improve the startup time of the load.

$APT_TERA_NO_ERR_CLEANUP

$APT_TERA_NO_PERM_CHECKS

1

7.
Environment Variable
$APT_MONITOR_TIME

Job Monitoring Environment Variables
Setting [seconds] Description In v7 and later, specifies the time interval (in seconds) for generating job monitor information at runtime. To enable size-based job monitoring, unset this environment variable, and set $APT_MONITOR_SIZE below. Determines the minimum number of records the job monitor reports. The default of 5000 records is usually too small. To minimize the number of messages during large job runs, set this to a higher value (for example, 1000000). Disables job monitoring completely. In rare instances, this may improve performance. In general, this should only be set on a per-job basis when attempting to resolve performance bottlenecks. Prints record counts in the job log as each operator completes processing. The count is per operator per partition.

$APT_MONITOR_SIZE

[rows]

$APT_NO_JOBMON

1

$APT_RECORD_COUNTS

1

Parallel Framework Red Book: Data Flow Job Design

July 17, 2006

157 of 179

© 2006 IBM Information Integration Solutions. All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language in any form by any means without the written permission of IBM.

Information Integration Solutions Center of Excellence

8. PerformanceTuning Environment Variables
Environment Variable
$APT_BUFFER_MAXIMUM_MEMORY

Setting 41903040 (example)

$APT_BUFFER_FREE_RUN

1000 (example)

Description Specifies the maximum amount of virtual memory, in bytes, used per buffer per partition. If not set, the default is 3MB (3145728). Setting this value higher will use more memory, depending on the job flow, but may improve performance. Specifies how much of the available in-memory buffer to consume before the buffer offers resistance to any new data being written to it. If not set, the default is 0.5 (50% of $APT_BUFFER_MAXIMUM_MEMORY). If this value is greater than 1, the buffer operator will read $APT_BUFFER_FREE_RUN * $APT_BUFFER_MAXIMIMUM_MEMORY before offering resistance to new data. When this setting is greater than 1, buffer operators will spool data to disk (by default scratch disk) after the $APT_BUFFER_MAXIMUM_MEMORY threshold. The maximum disk required will be
$APT_BUFFER_FREE_RUN * # of buffers * $APT_BUFFER_MAXIMUM_MEMORY

$APT_PERFORMANCE_DATA

directory [path]

$TMPDIR

Enables capture of detailed, per-process performance data in an XML file in the specified directory. Unset this environment variable to disable. Defaults to /tmp. Used for miscellaneous internal temporary data including FIFO queues and Transformer temporary storage. As a minor optimization, may be best set to a filesystem outside of the DataStage install directory.

9.
Environment Variable
$OSH_PRINT_SCHEMAS

Job Flow Debugging Environment Variables
Setting
1

Description
Outputs the actual schema definitions used by the DataStage EE framework at runtime in the DataStage log. This can be useful when determining if the actual runtime schema matches the expected job design table definitions. Disables operator combination for all stages in a job, forcing each EE operator into a separate process. While not normally needed in a job flow, this setting may help when debugging a job flow or investigating performance by isolating individual operators to separate processes. Note that disabling operator combination will generate more UNIX processes, and hence require more system resources (and memory). Disabling operator July 17, 2006 158 of 179

$APT_DISABLE_COMBINATION

1

The Advanced Stage Properties editor in DataStage Designer v7.1 and later allows combination to be enabled and disabled for on a per-stage basis.

Parallel Framework Red Book: Data Flow Job Design

© 2006 IBM Information Integration Solutions. All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language in any form by any means without the written permission of IBM.

Information Integration Solutions Center of Excellence

$APT_PM_PLAYER_TIMING

1 1 FORCE

$APT_PM_PLAYER_MEMORY $APT_BUFFERING_POLICY

combination also disables internal optimizations for job efficiency and run-times. Prints detailed information in the job log for each operator, including CPU utilization and elapsed processing time. Prints detailed information in the job log for each operator when allocating additional heap memory. Forces an internal buffer operator to be placed between every operator. Normally, the DataStage EE framework inserts buffer operators into a job flow at runtime to avoid deadlocks and improve performance. Using $APT_BUFFERING_POLICY=FORCE in combination with $APT_BUFFER_FREE_RUN effectively isolates each operator from slowing upstream production. Using the job monitor performance statistics, this can identify which part of a job flow is impacting overall performance. Set this environment variable to capture copies of the job score, generated osh, and internal Enterprise Edition log messages in a directory corresponding to the job name. This directory will be created in the “Debugging” sub-directory of the Project home directory on the DataStage server. This environment variable should not normally need to be set. When trying to start very large jobs on heavilyloaded servers, lowering this number will limit the number of processes that are simultaneously created when a job is started. For heavily loaded MPP or clustered environments, this variable determines the number of seconds the conductor node will wait for a successful startup from each section leader. The default is 30 seconds.

Setting
$APT_BUFFERING_POLICY=FORCE is not

recommended for production job runs.
$DS_PX_DEBUG

1

$APT_PM_STARTUP_CONCURRENCY

5

$APT_PM_NODE_TIMEOUT

[seconds]

Parallel Framework Red Book: Data Flow Job Design

July 17, 2006

159 of 179

© 2006 IBM Information Integration Solutions. All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language in any form by any means without the written permission of IBM.

a) Sort within partitions. will notice that two rows have identical values in the user-defined key column only if the two rows are contiguous. all require sorted inputs. This approach is guaranteed to work.a.e. transcribed. This creates partition-wise concurrency (a. across all partitions. this may be review for you. Sort actually does two things: (i) Groups rows that share the same values in key columns (forces related rows to be contiguous.a. An illustrative piece of information. Merge.) on any super-set of the keys. but is frequently inefficient as records are ‘over-hashed’ and ‘over-partitioned’. If you have a lot of experience with hashing and sorting. at the same time. key clustering. RemoveDuplicates. transmitted. for example. partition-wise co-location). Sorting is rarely required by the business logic.k. but there is little you Parallel Framework Red Book: Data Flow Job Design July 17. related rows are in the same partition. for example. Join. below).Information Integration Solutions Center of Excellence Appendix F: Sorting and Hashing Advanced Example The standard recipe for using the ‘Inter-Record Relationship Suite’ (Sort. or translated into any language in any form by any means without the written permission of IBM. In most cases. It will be followed by a detailed example that discusses these ideas in much greater depth.k. in the same order. Remove Duplicates requires only (i): when it completes processing all the rows in a key cluster. not globally. These operations take place in parallel. There is also an “advanced” rule: a) b) Hash on any sub-set of the keys Sort (join/etc. key-clustering is sufficient in many cases (a-only. it does not care about the key value of the next cluster with respect to the current key value—in part because this stage takes only one input. and related stages) is: Hash and Sort/Join/Merge on exactly the same keys. etc. c) Sort clusters and orders Sorting is often overkill. Join. The second portion of this Appendix assumes you have read and thoroughly understand these concepts. only needs to see two records at a time —one from each input stream—to do its job. a. rows from all partitions that share the same value in key columns. . sorting is needed to satisfy an input requirement of a downstream stage. b) Hash gathers Hash gathers into the same partition. Merge. The reason for this requirement lies in the “light-weight” nature of these stages. 2006 160 of 179 © 2006 IBM Information Integration Solutions. for example. but other rows may separate them within that partition. Join.) (ii) Orders the clusters resulting from (i). i. in order This Appendix contains descriptions of what happens “behind the scenes”. RemoveDuplicates. record adjacency. stored in a retrieval system. No part of this publication may be reproduced. All rights reserved.

so row order between the two inputs is obviously critical. partitioners (except for SAME). When this stage completes processing all the rows in a key cluster. Nonetheless. d) Partitioners respect row order but split clusters. require both (i) and (ii). but it can be invoked via the generic stage. partitioners. allow a row in a partition to jump ahead of another row in the same partitionii. (and most other stages) do not gratuitously alter existing intra-partition row order. transcribed. On multi-partitioned (i. In other words. or translated into any language in any form by any means without the written permission of IBM. on the other hand. . in part. grouped/clustered for remove duplicates). non-sequential) inputs. and your data will retain its previous sort order. a sort operation is needed even on previously sorted columns following any partitioner. however. Join and Merge. to the fact these stages take multiple input links—these stages only see 2 records at a timei. work in parallel. There is a component that will allow you to partition sorted data and achieve a sorted result: parallelsortmerge (PSM). for example: Repartitioning: P0 2 1 3 P1 103 102 101 Note that ‘1’ and ‘101’ have switched partitions. As you will see in this Appendix. they DO care about the key value of the next cluster. Inside a partitioner In Enterprise Edition. there are more advanced methods to sort and partition that can leverage this capability and mitigate the cost of sorting vs. as a rule. any existing sort order is usually destroyed—see example below. No part of this publication may be reproduced. All rights reserved. ‘streaming-style’). Partitioners.Information Integration Solutions Center of Excellence can do to take advantage of it as there are no stages which guarantee key-clustering but do not perform a sort (some databases might be able to do key-clustering more cheaply than a sort. Partitioner P0 2 101 P1 1 103 July 17. transmitted.e. reshuffle rows among partitions. one from each input. 1. Note that neither partition has a sorted result despite P1 having a sorted input (read row order from the bottom up. If the values on both inputs aren't ordered (vs. This due. Whenever you re-partition your sorted data. To restore row-adjacency. Enterprise Edition itself normally manages this use of this component. Join/Merge can't effectively choose which input stream to advance for finding subsequent key matches. Enterprise Edition will not. clustering.. stored in a retrieval system. 2006 161 of 179 Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions. See usage notes in footnotesiii. like stages. this is one instance where this might be handy). follow the partitioner with a PSM.

let’s look at how we can capitalize on these behaviors for performance benefits. Partition 0 Partition 1 1 Orlando 10 Rose 1 10 Boris 2 2 Adam 10 3 3 John Eve Jones Jones Elm Pine 2 1 Adam Smith Orlando Jones Boris Rose John Eve Smith Jones Zorn Smith Smith Walnut 10 2 Smith Pine 10 1 Zorn Walnut 10 3 Smith Pine 3 2. . No part of this publication may be reproduced. but a different number of partitions. 6 There is an exception to this rule: If your hash key has only one value. transcribed. July 17. stored in a retrieval system. Illustrated Above Before Partitioner Partition 0 3 Eve Smith Pine 3 Eve 1 Orlando Jones Elm 2 Adam 2 Adam Smith Pine 10 Rose 1 Partition 1 10 Rose Jones Pine 1 Orlando 1 10 Boris Smith Walnut 10 Boris 2 2 10 John Zorn Walnut 10 John 3 3 After Hash partitioning on Street/Tree: Illustrated Above After Partitioner Partition 0 Smith 3 Eve Smith Pine 3 Eve Smith 10 Rose Jones Pine 1 Orlando 1 Jones 2 Adam Smith Pine 10 Rose 1 Partition 1 Jones 10 Boris Smith Walnut 10 Boris 2 2 Smith 10 John Zorn Walnut 10 John 3 Zorn3 1 Orlando Jones Elm 2 Adam Smith Jones Jones Smith Zorn Smith There is more than one way to correctly hash-partition any Data Set6. Minimizing Record Movement for Maximizing Performance Now we have covered the basic rules and mechanics for hash-partitioning and sorting. or translated into any language in any form by any means without the written permission of IBM.Information Integration Solutions Center of Excellence 3 102 Example: 6 rows in 2 partitions. Here is another possible outcome: Also: Consider the result of running the same job with the same data. All rights reserved. transmitted. 2006 162 of 179 Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions.

This would make it possible to determine how well each store is doing in relation to the national averages and track these performance trends over time. No part of this publication may be reproduced. 2006 163 of 179 © 2006 IBM Information Integration Solutions. taking advantage of Enterprise Edition’s ability to analyze a jobflow and insert sorts and partitioners in Parallel Framework Red Book: Data Flow Job Design July 17. They wish to determine the weighted average transaction amount peritem nation-wide. There are many common extensions on gathering these kinds of sales metrics that take the following ideas and increase the scale of the problem at hand. Here is our source data: Data Set 1: 32 Rows Store Location 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Item ID 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 Transaction Date 2004-01-01 2004-01-02 2004-01-01 2004-01-03 2004-01-04 2004-01-02 2004-01-04 2004-01-03 2004-01-04 2004-01-03 2004-01-01 2004-01-04 2004-01-02 2004-01-02 2004-01-01 2004-01-03 2004-01-03 2004-01-01 2004-01-02 2004-01-04 2004-01-02 2004-01-03 2004-01-01 2004-01-04 2004-01-04 2004-01-01 2004-01-03 2004-01-02 2004-01-04 2004-01-02 2004-01-01 2004-01-03 Transaction Amt 1 2 3 5 5 54 7 8 2 3 45 65 7 85 9 98 23 3 32 45 54 56 7 8 23 45 534 6 65 7 78 87 The screen capture below shows how to implement the business logic in an efficient manner. transmitted. .Information Integration Solutions Center of Excellence Scenario Description: Our customer is a national retail business with several hundred outlets nation-wide. per store for all stores in the nation. or translated into any language in any form by any means without the written permission of IBM. transcribed. All rights reserved. and append these values to the original data. as well as the average transaction amount per-item. thereby increasing the value of this exercise. stored in a retrieval system.

This is the per-store transaction average per item. ensure that the environment variable.Information Integration Solutions Center of Excellence appropriate places notice. there is only one sort and one repartition in the diagram. to get the original data with the averages appended. APT_NO_PART_INSERTION is NOT defined in your environment. transmitted. transcribed. No part of this publication may be reproduced. not store). both on the output link of JoinSourceToAggregator_1): NOTE: In this job. with ANY value. Enterprise Edition will hash-partition and sort on ‘Store ID’. we will need to join each aggregator’s output back to the original data in order to get the original row count. The Aggregator StoreAverageItemTransactionAmt will aggregate the data on ‘Store ID’. and calculate the average of the ‘Transaction Amt’ column and place the results in a column named ‘Store Average Item Transaction Amt’. If you allow this environment variable to exist with any value. and ‘Transaction Date’. APT_NO_SORT_INSERTION is NOT defined in your environment. Parallel Framework Red Book: Data Flow Job Design July 17. Here you want to let DS/EE choose where to insert sorts and partitioners for you. . 7 To enable automatic partition insertion. Enterprise Edition will hash-partition and sort on ‘Item ID’. with ANY value. Here. To enable automatic sort insertion. This is done with JoinSourceToAggregator_1 and JoinSourceToAggregator_2. All rights reserved. 2006 164 of 179 © 2006 IBM Information Integration Solutions. To do this. The Aggregator stage NationalAverageItemTransactionAmt will aggregate the data on ‘Item ID’. This is the nation-wide transaction average per item (weighted by transaction. or translated into any language in any form by any means without the written permission of IBM. so you want to leave them enabled (the default). and ‘Transaction Date’. stored in a retrieval system. If you allow this environment variable to exist with any value. and ‘Transaction Date’. you will disable this facility. ‘Item ID’. ensure that the environment variable. automatic sort insertion. and ‘Transaction Date’ calculating the average of the ‘TransactionAmt’ column and place the results in a column named ‘National Average Item Transaction Amt’. ‘Item ID’. you will disable this facility. Since the aggregator reduces row count (to the group count). and automatic partition insertion must be turned on7.

however.25 Store Average Item Transaction Amt 2 2 5 5 6 6 July 17. .5 46 46 6. All rights reserved. It does this by keeping running totals in memory for the aggregation for each output group. not Hash. transmitted.25 180. and ‘Average Item Transaction Amt By Store’) The output Data Set should look something like this (A 3-node configuration file was used in this implementation): Data Set 2: 32 Rows PeekFinalOutput.5 6.5 35. or translated into any language in any form by any means without the written permission of IBM.5 310.5 180. it does not guarantee output order. The hash method only requires the input data to be hashed.25 26. Therefore. stored in a retrieval system.5 Store Average Item Transaction Amt 28 28 43 43 6.5 180. JoinSourceToAggregator_2 produces the final result: the original input Data Set with two columns appended (‘Average Item Transaction Amt’.5 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2004/01/02 2004/01/02 2004/01/02 2004/01/02 2004/01/03 2004/01/03 2004/01/03 2004/01/03 2004/01/02 2004/01/02 2004/01/02 2004/01/02 2004/01/03 2004/01/03 2004/01/03 2004/01/03 2 54 54 32 5 8 56 23 85 7 6 7 3 98 87 534 PeekFinalOutput.5 35.5 310.5 35. Partition 2: 16 Rows Store Location Item ID Transaction Date Transaction Amt National Average Item Transaction Amt 3.5 6. The sort method requires the input data to be hashed and sorted.Information Integration Solutions Center of Excellence NOTE: For this scenario. you will need to set the Aggregator’s “Method” to Sort.5 50.5 3.25 16.5 3.5 39.25 26.5 16. transcribed.5 39. No part of this publication may be reproduced.5 23 23 23 23 26.25 26.5 180.5 50. in return. 2006 165 of 179 1 1 2 2 1 1 1 1 1 1 1 1 2004/01/01 2004/01/01 2004/01/01 2004/01/01 2004/01/04 2004/01/04 1 3 3 7 7 5 Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions. it guarantees the output order to be sorted since the result of aggregation can be released for downstream processing as soon as the key change is detected.5 3. it consumes an amount of RAM proportionate to the number of output rows and the number of columns involved in the aggregation. Partition 0: 16 Rows Store Location Item ID Transaction Date Transaction Amt National Average Item Transaction Amt 35.

25 44.5 61. transmitted.: record adjacency assumes partition concurrency8. 3. All rights reserved.25 38.25 44. or translated into any language in any form by any means without the written permission of IBM. appended to the end of this document for masochistsiv) might suggest: 4. A deeper examination (of the score dump. 6. and 3.Information Integration Solutions Center of Excellence 2 2 1 1 2 2 1 1 2 2 1 1 2 2 2 2 2 2 2 2 2004/01/04 2004/01/04 2004/01/01 2004/01/01 2004/01/01 2004/01/01 2004/01/04 2004/01/04 2004/01/04 2004/01/04 8 45 45 9 78 45 2 65 65 23 16. and 1. i.5 27 27 61. solution (score dump also attached below vi): 8 Records cannot be adjacent if they are not in the same partition.25 16.25 44.75 38. even sequential job execution does not alter the answer for the sort-related questions.e.75 38.5 33. An examination of the job above would suggest: 6. and 6. No part of this publication may be reproduced. A much better answer is: 1. 3. transcribed.5 33. stored in a retrieval system. 2006 166 of 179 © 2006 IBM Information Integration Solutions.5 44 44 Since both the Aggregator and Join expect the data to arrive hashed and sorted on the grouping key(s) —both operations that consume large amounts of CPU—a couple of questions arise with respect to efficiency: What is the minimum number of hash-partitioners needed to implement this solution correctly? What is the minimum number of sorts needed to implement this solution? What is the minimum number of times that sort will need to buffer the entire Data Set to disk to implement this solution? Though running the job sequentially eliminates questions related to partitioners. more efficientv. Here’s a screen shot of this. Parallel Framework Red Book: Data Flow Job Design July 17.25 44.75 26. . as only partition concurrency is affected by sequential execution. This is certainly an improvement on the previous answer.75 38.

but it is a lengthy parenthetical statement that would interrupt the flow of the scenario discussion). or translated into any language in any form by any means without the written permission of IBM. However. and automatic partition insertion must be turned offvii. Hashing on these fields will gather all unique combinations of ItemID and TransactionDate into the same partition. However. and ItemId. No part of this publication may be reproduced. stored in a retrieval system. but we know that the data is already sorted on TransactionDate. transmitted. in order. the data is not properly prepared for StoreAverageItemTransactionAmt. automatic sort insertion. This is a problem for StoreAverageItemTransactionAmt. This combination of hash and sort adequately prepares the data for NationalAverageItemTransactionAmt. In our initial copy stage (DistributeCopiesOfSourceData). You may be wondering why the partitioning wasn’t mentioned as part of the problem. as it isn’t available on the link sort. One would expect that we would need to sort on StoreLocation. This is because the data is already partitioned in a compatible manner for the aggregator. All rights reserved. just as in the previous example. and ItemId. What is wrong with the data? The sort order does not include the StoreLocation. but you must use the sort stage to access it. as it expects all of the records for a particular StoreLocation/TransactionDate/ItemId combination to arrive on the same partition. we still need to fix the sort order. transcribed. TransactionDate. keys (viii This footnote contains key concepts that this document addresses. we hash and sort on ItemID and TransactionDate only. 2006 167 of 179 © 2006 IBM Information Integration Solutions. The ‘advanced’ rule for hash partitioning is: you may partition on any sub-set of the aggregation/join/sort/etc. Sort offers an efficiency-mode for pre-sorted data.Information Integration Solutions Center of Excellence NOTE: In this job. . The settings in the sort should look like this: Parallel Framework Red Book: Data Flow Job Design July 17.

which is what makes this sort possible w/o re-partitioning (which is also quite expensive. The previous two paragraphs contain two key concepts in Enterprise Edition (pun fully intended. especially in MPP environments where repartitioning implies network I/O). and we only want to ‘sub-sort’ the data on StoreLocation (this option is only viable for situations where you need to maintain the sort order on the initial keys). This lets sort know that it only needs to gather all records with a unique combination of ItemID and TransactionDate in order to sort a batch of records. ALL extant values of the remaining columns are already in the same partition. granted.Information Integration Solutions Center of Excellence As you can see. or translated into any language in any form by any means without the written permission of IBM. No part of this publication may be reproduced. 2006 168 of 179 © 2006 IBM Information Integration Solutions. transcribed. key order is very important). transmitted. but the entire Data Set was 100 million records. Also worth noting here: because we already hashed the data on ItemID and TransactionDate. stored in a retrieval system. instead of buffering the entire Data Set. to append a column representing the national (weighted) average item transaction amount. Getting back to the aggregators. the rows will come out in the same order they went in (different rows. All rights reserved. we will have to prep the output from the first join to account for Parallel Framework Red Book: Data Flow Job Design July 17. This means that the output of the DistributeCopiesOfSourceData and NationalAverageItemTransactionAmt are already hashed and sorted on the keys needed to perform JoinSourceToAggregator_1. If the group size was only several hundred records. however dreadful). this would save a tremendous amount of very expensive disk I/O as sort can hold a few hundred records in memory in most cases (disk I/O is typically several orders of magnitude more costly than memory I/O. Since the aggregator does not need to disturb row-order (for pre-sorted data). However since we sub-sorted the data before this aggregator (unlike NationalAverageItemTransactionAmt). The output of StoreAverageItemTransactionAmt contains the other column we need to append to our source rows. but the group keys will force the proper order). even for ‘fast’ disks). . This accomplishes the first goal. we have instructed the sort stage that the data is already sorted on ItemID and TransactionDate (as always with sorting records.

5 26.75 Store Average Item Transaction Amt 2 2 6 6 5 5 26. transmitted.5 33.25 16.25 16. No part of this publication may be reproduced.75 38. This sort will look exactly like the other sort stage: Remember to disable the ‘Stable Sort’ option if you do not need it (it will try to maintain row order except as needed to perform the sort. and it is enabled by default.5 33. Output from above solution: Data Set 3: PeekFinalOutput.Information Integration Solutions Center of Excellence the new row ordering of StoreAverageItemTransactionAmt. or translated into any language in any form by any means without the written permission of IBM.5 27 27 61.5 16.75 38. 2006 169 of 179 © 2006 IBM Information Integration Solutions.75 38. Partition 1: 16 Rows Store Location Item ID Transaction Date Transaction Amt National Average Item Transaction Amt 3. . useful for preserving previous sort orderings).25 44. All rights reserved. transcribed.5 44 44 1 1 1 1 2 2 2 2 1 1 2 2 1 1 2 2 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2004/01/01 2004/01/01 2004/01/04 2004/01/04 2004/01/01 2004/01/01 2004/01/04 2004/01/04 2004/01/01 2004/01/01 2004/01/01 2004/01/01 2004/01/04 2004/01/04 2004/01/04 2004/01/04 3 1 5 7 3 7 45 8 9 45 45 78 2 65 23 65 PeekFinalOutput.25 44.25 44.5 16.5 61.25 44. as it is much more expensive than non-stable sorts.5 3. Partition 2: 16 Rows Parallel Framework Red Book: Data Flow Job Design July 17.25 38.5 3.25 3. stored in a retrieval system.

25 180.5 180.5 6. and only hashes.5 39.5 310.000 records.5 50.000 additional record movements—half of them involving disk I/O—for a 100 million record input volume. a savings of 400.5 Store Average Item Transaction 28 28 43 43 6.000 records. 000.000.5 50.5 310. There is an even more efficient solution. transmitted.000. transcribed. The second solution only sorts (on disk) 100. It looks very similar to the first solution.000. Imagine a job with 100 million records as the input. .25 26.5 180.000 records in addition to hashing 300.000. or translated into any language in any form by any means without the written permission of IBM.5 23 23 26. All rights reserved.25 26. With the initial solution.5 39. That is a LOT of saved processing power. and two sub-sorts—a much more efficient solution for large data volumes. No part of this publication may be reproduced.5 35.25 26. a single partitioner. we had to sort (on disk) 300.000 records.5 6. but there is a critical difference.5 46 46 6.Information Integration Solutions Center of Excellence Store Location Item ID Transaction Date Transaction Amt 1 1 2 2 1 1 1 1 2 2 1 1 2 2 2 2 1 1 1 1 1 1 2 2 2 2 2 2 1 1 2 2 2004/01/02 2004/01/02 2004/01/02 2004/01/02 2004/01/03 2004/01/03 2004/01/02 2004/01/02 2004/01/02 2004/01/02 2004/01/03 2004/01/03 2004/01/03 2004/01/03 2004/01/03 2004/01/03 2 54 54 32 5 8 7 85 7 6 3 98 23 56 534 87 National Average Item Transaction Amt 35.5 35. Parallel Framework Red Book: Data Flow Job Design July 17. 2006 170 of 179 © 2006 IBM Information Integration Solutions. stored in a retrieval system.5 23 23 180.5 35. 100.5 This solution produces the same result but is achieved with only one complete sort.

5 26. However it will not create additional processes to handle the records and re-order them. and automatic partition insertion must be turned off vii. transmitted.25 16.5 27 27 July 17. stored in a retrieval system. The difference is on DistributeCopiesOfSourceData: Here. we saved a sub-sort on 100 million records . Data Set 4: PeekFinalOutput. 2006 171 of 179 1 1 2 2 1 1 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2004/01/01 2004/01/01 2004/01/01 2004/01/01 2004/01/04 2004/01/04 2004/01/04 2004/01/04 2004/01/01 2004/01/01 1 3 7 3 5 7 8 45 45 9 Parallel Framework Red Book: Data Flow Job Design © 2006 IBM Information Integration Solutions. transcribed. All rights reserved. No part of this publication may be reproduced. Looks a lot like solution 1.5 3. we have chosen to use the StoreLocation column as a part of our sorting key. automatic sort insertion. or translated into any language in any form by any means without the written permission of IBM. This is functionally equivalent to doing a sub-sort right before the StoreAverageItemTransactionAmt aggregator. for the same reasons.25 44.5 16.5 3.25 Store Average Item Transaction Amt 2 2 5 5 6 6 26.Information Integration Solutions Center of Excellence NOTE: In this job. Partition 1: 16 Rows Store Location Item ID Transaction Date Transaction Amt National Average Item Transaction Amt 3. This is a potentially huge savings on large data volumes (remember the previous example).25 16. Here is the output from this version of the job. the need for the second sort on the output of the JoinSourceToAggregator_1 is not needed.25 44. Comparing the efficiency of this solution with that of number two.25 16.5 3. but NOT to use it for hashing. . Also.a significant savings. except w/o the sort on the output of JoinSourceToAggregator.

75 38.25 38.5 180.5 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2004/01/02 2004/01/02 2004/01/02 2004/01/02 2004/01/03 2004/01/03 2004/01/03 2004/01/03 2004/01/02 2004/01/02 2004/01/02 2004/01/02 2004/01/03 2004/01/03 2004/01/03 2004/01/03 2 54 54 32 5 8 23 56 7 85 7 6 3 98 534 87 Finally.5 44 44 PeekFinalOutput. or translated into any language in any form by any means without the written permission of IBM. inhibits pipe-lining (by buffering large amounts of data to disk since it needs to see all data before it can determine the resulting sorted sequence)ix.5 50.5 180. sort.25 180.5 50. 2006 172 of 179 © 2006 IBM Information Integration Solutions. stored in a retrieval system.5 33.5 180.5 33.25 44.5 39.5 39.75 38. transmitted.5 Store Average Item Transaction Amt 28 28 43 43 6.75 61. No part of this publication may be reproduced.75 38.5 35.5 6.5 310. .25 26. Partition 2: 16 Rows Store Location Item ID Transaction Date Transaction Amt National Average Item Transaction Amt 35.5 35. Here is a screen shot of a sort running on 40 million records: Parallel Framework Red Book: Data Flow Job Design July 17.5 23 23 23 23 26. in addition to the heavy penalty paid in disk I/O for using a full sort.5 46 46 6.5 310.5 35. transcribed.25 26. by definition.5 6.Information Integration Solutions Center of Excellence 2 2 1 1 2 2 2 2 2 2 2 2 2004/01/01 2004/01/01 2004/01/04 2004/01/04 2004/01/04 2004/01/04 78 45 2 65 23 65 44.25 26. All rights reserved.

. Here is an example of a ‘sub-sort’: Here. or translated into any language in any form by any means without the written permission of IBM. 2006 173 of 179 © 2006 IBM Information Integration Solutions. This allows down-stream stages to be processing data during the sorting process. you can clearly see that a sub-sort does not inhibit pipe-lining--very nearly the same number of rows have entered and left the sort stage (and NO buffering is required to perform the subsort). no rows have left yet. This situation is analogous to all of the sorts in solution 1. Parallel Framework Red Book: Data Flow Job Design July 17. This is because a standard sort requires all rows to be present in order to release the first row. All rights reserved. No part of this publication may be reproduced. the link sort in solution 2. and the link sort in solution three. transmitted. stored in a retrieval system.Information Integration Solutions Center of Excellence As you can see. instead of waiting until all 40 million records have been sorted (in this instance. although ~5 million records have entered the sort. transcribed. requiring a large amount of scratch diskx. we are sub-sorting the data we sorted in the previous diagram).

default=first -asc or ascending -. 1 or more name -. key={ value=TransactionDate }.integer. datasets with differing partition counts and you wish to join/merge them.ascending sort order.descending sort order. -cs) (mutually exclusive: -asc. key={ value=StoreLocation } })#>eCollectAny op3[3p] (parallel APT_HashedGroup2Operator in StoreAverageItemTransactionAmt)} ds3: {op1[3p] (parallel DistributeCopiesOfSourceDta) eOther(APT_HashPartitioner { key={ value=ItemID }.input field name Sub-options for key: -ci -. key={ value=TransactionDate } })#>eCollectAny op2[3p] (parallel APT_HashedGroup2Operator in NationalAverageItemTransactionAmt)} ds2: {op1[3p] (parallel DistributeCopiesOfSourceDta) eOther(APT_HashPartitioner { key={ value=ItemID }. 0 or larger. but the job that reads it only has 4 nodes.queue length at which to issue a warning.extra parameters for key. optional.property=value pair(s). Join needs to see all of the rows in the current cluster on at least one of the input links. In other cases. gender codes. At least one of these dataset must be re-hashed. value one of first.DSLink2) eAny=>eCollectAny op1[3p] (parallel DistributeCopiesOfSourceDta)} ds1: {op1[3p] (parallel DistributeCopiesOfSourceDta) eOther(APT_HashPartitioner { key={ value=ItemID }. it’s only true for cases where the key is unique. 2147483647 or smaller. default -nulls -. optional -param -. you can use the ParallelSortMerge stage to ensure that no matter the degree of parallelism of the writer + reader. but in another section you need to hash and sort on columns A and B. optional params -. default=10000 -doStats -. -desc) -warnLevel -.dataset to be resorted/merged. exactly one occurrence required This operator may have following outputs -reSorted -.resorted dataset. optional This operator may have following inputs -Sorted -. without curly braces (mutually exclusive: -ci. but not introduce superfluous sorts.where null values should sort. key={ value=TransactionDate } })#>eCollectAny op4[3p] (parallel APT_TSortOperator(0))} ds4: {op2[3p] (parallel APT_HashedGroup2Operator in NationalAverageItemTransactionAmt) [pp] eSame=>eCollectAny op5[3p] (parallel APT_TSortOperator(1))} ds5: {op3[3p] (parallel APT_HashedGroup2Operator in StoreAverageItemTransactionAmt) [pp] eSame=>eCollectAny op8[3p] (parallel APT_TSortOperator(2))} ds6: {op4[3p] (parallel APT_TSortOperator(0)) . optional records -. exactly one occurrence required <add example here of how psm works> iv Dump score for solution 1 main_program: This step has 16 datasets: ds0: {op0[3p] (parallel SourceData. optional. You could hash only on A. There are other situations where this is valuable but they are much less common. optional position -. otherwise a Cartesian product is impossible. This ‘problem’ is addressed by the parallelsortmerge component iii. last.specify a key field. iii ParallelSortMerge Operator Options: -key -. optional -cs -. A third. ii A common problem: Suppose you have two (or more). This would allow you to combine other columns into your hash key to reduce data-skew. presorted. less common.string. Another common problem: You need to Hash and Sort on columns A and C to implement the business logic in one section of the flow. default -desc or descending -. problem: you created a fileset with 8 nodes. the sort order will be preserved. but suppose that A has too small a number of unique values (country codes.i This is an over-simplification. race/gender/ethnicity codes are typical). However. which would result in having to completely re-sort that dataset despite having a sorted version already.case-insensitive comparison.case-sensitive comparison. Normally EE would re-partition the data into 4 nodes + destroy your sort order.report statistics at the end of the run.

p2] )} op5[3p] {(parallel APT_TSortOperator(1)) on nodes ( node1[op5.p2] )} op1[3p] {(parallel DistributeCopiesOfSourceDta) on nodes ( node1[op1.p2] )} op3[3p] {(parallel APT_HashedGroup2Operator in StoreAverageItemTransactionAmt) on nodes ( node1[op3.p1] node3[op4.p1] node1[op0.p0] node2[op2.DSLink18_Sort) [pp] eSame=>eCollectAny op11[3p] (parallel buffer(2))} ds13: {op11[3p] (parallel buffer(2)) [pp] eSame=>eCollectAny op13[3p] (parallel APT_JoinSubOperator in JoinSourceToAggregator_2)} ds14: {op12[3p] (parallel buffer(3)) [pp] eSame=>eCollectAny op13[3p] (parallel APT_JoinSubOperator in JoinSourceToAggregator_2)} ds15: {op13[3p] (parallel APT_JoinSubOperator in JoinSourceToAggregator_2) [pp] eSame=>eCollectAny op14[3p] (parallel PeekFinalOutput)} It has 15 operators: op0[3p] {(parallel SourceData.p1] node3[op3.p2] )} op6[3p] {(parallel buffer(0)) .p0] node2[op5.p0] node1[op0.p0] node1[op1.[pp] eSame=>eCollectAny op6[3p] (parallel buffer(0))} ds7: {op5[3p] (parallel APT_TSortOperator(1)) [pp] eSame=>eCollectAny op7[3p] (parallel buffer(1))} ds8: {op6[3p] (parallel buffer(0)) [pp] eSame=>eCollectAny op9[3p] (parallel APT_JoinSubOperator in JoinSourceToAggregator_1)} ds9: {op7[3p] (parallel buffer(1)) [pp] eSame=>eCollectAny op9[3p] (parallel APT_JoinSubOperator in JoinSourceToAggregator_1)} ds10: {op8[3p] (parallel APT_TSortOperator(2)) [pp] eSame=>eCollectAny op12[3p] (parallel buffer(3))} ds11: {op9[3p] (parallel APT_JoinSubOperator in JoinSourceToAggregator_1) [pp] eOther(APT_HashPartitioner { key={ value=ItemID.DSLink18_Sort)} ds12: {op10[3p] (parallel JoinSourceToAggregator_2.p0] node2[op3.p1] node3[op5.p2] )} op2[3p] {(parallel APT_HashedGroup2Operator in NationalAverageItemTransactionAmt) on nodes ( node1[op2. subArgs={ cs } }.p1] node1[op1.p0] node2[op4. subArgs={ cs } } })#>eCollectAny op10[3p] (parallel JoinSourceToAggregator_2.DSLink2) on nodes ( node1[op0. key={ value=StoreLocation.p1] node3[op2.p2] )} op4[3p] {(parallel APT_TSortOperator(0)) on nodes ( node1[op4. key={ value=TransactionDate }.

or order. Since moving records around takes CPU time and extra system calls. key={ value=TransactionDate } })#>eCollectAny op1[3p] (parallel DistributeCopiesOfSourceDta.p0] node2[op12.p1] node3[op11.p2] )} op9[3p] {(parallel APT_JoinSubOperator in JoinSourceToAggregator_1) on nodes ( node1[op9.p1] node3[op8.p1] node3[op9.p2] )} It runs 45 processes on 3 nodes.p0] node2[op10.p0] node2[op11.p2] )} op10[3p] {(parallel JoinSourceToAggregator_2.p2] )} op11[3p] {(parallel buffer(2)) on nodes ( node1[op11. your run time will be adversely affected.p2] )} op8[3p] {(parallel APT_TSortOperator(2)) on nodes ( node1[op8.DSLink2_Sort)} ds1: {op1[3p] (parallel DistributeCopiesOfSourceDta. if you move records unnecessarily.p1] node3[op7. v Throughout this document the general meaning of the phrase ‘more efficient’ is fewer record movements--i.on nodes ( node1[op6.DSLink18_Sort) on nodes ( node1[op10. subArgs={ cs } }.p0] node2[op9.p1] node3[op6.p2] )} op14[3p] {(parallel PeekFinalOutput) on nodes ( node1[op14.e.p0] node2[op6. a record changes partition.p2] )} op13[3p] {(parallel APT_JoinSubOperator in JoinSourceToAggregator_2) on nodes ( node1[op13.p1] node3[op10.DSLink2) eOther(APT_HashPartitioner { key={ value=ItemID.p1] node3[op12.p1] node3[op14.p0] node2[op13.p0] node2[op7.p2] )} op7[3p] {(parallel buffer(1)) on nodes ( node1[op7.p0] node2[op14. vi Dump Score for Solution 2 main_program: This step has 15 datasets: ds0: {op0[3p] (parallel SourceData.p2] )} op12[3p] {(parallel buffer(3)) on nodes ( node1[op12.DSLink2_Sort) [pp] eSame=>eCollectAny op2[3p] (parallel DistributeCopiesOfSourceDta)} ds2: {op2[3p] (parallel DistributeCopiesOfSourceDta) . fewer times.p0] node2[op8.p1] node3[op13.

p2] )} op2[3p] {(parallel DistributeCopiesOfSourceDta) on nodes ( node1[op2.p0] node1[op0.p2] )} op4[3p] {(parallel APT_SortedGroup2Operator in NationalAverageItemTransactionAmt) on nodes ( node1[op4.p0] node2[op1.[pp] eSame=>eCollectAny op3[3p] (parallel SubSortOnStoreLocation)} ds3: {op2[3p] (parallel DistributeCopiesOfSourceDta) [pp] eSame=>eCollectAny op4[3p] (parallel APT_SortedGroup2Operator in NationalAverageItemTransactionAmt)} ds4: {op2[3p] (parallel DistributeCopiesOfSourceDta) [pp] eSame=>eCollectAny op6[3p] (parallel buffer(0))} ds5: {op3[3p] (parallel SubSortOnStoreLocation) [pp] eSame=>eCollectAny op5[3p] (parallel APT_SortedGroup2Operator in StoreAverageItemTransactionAmt)} ds6: {op4[3p] (parallel APT_SortedGroup2Operator in NationalAverageItemTransactionAmt) [pp] eSame=>eCollectAny op7[3p] (parallel buffer(1))} ds7: {op5[3p] (parallel APT_SortedGroup2Operator in StoreAverageItemTransactionAmt) [pp] eSame=>eCollectAny op8[3p] (parallel buffer(2))} ds8: {op6[3p] (parallel buffer(0)) [pp] eSame=>eCollectAny op9[3p] (parallel APT_JoinSubOperator in JoinSourceToAggregator_1)} ds9: {op7[3p] (parallel buffer(1)) [pp] eSame=>eCollectAny op9[3p] (parallel APT_JoinSubOperator in JoinSourceToAggregator_1)} ds10: {op8[3p] (parallel buffer(2)) [pp] eSame=>eCollectAny op12[3p] (parallel APT_JoinSubOperator in JoinSourceToAggregator_2)} ds11: {op9[3p] (parallel APT_JoinSubOperator in JoinSourceToAggregator_1) [pp] eSame=>eCollectAny op10[3p] (parallel SubSortOnStoreLocation2)} ds12: {op10[3p] (parallel SubSortOnStoreLocation2) [pp] eSame=>eCollectAny op11[3p] (parallel buffer(3))} ds13: {op11[3p] (parallel buffer(3)) [pp] eSame=>eCollectAny op12[3p] (parallel APT_JoinSubOperator in JoinSourceToAggregator_2)} ds14: {op12[3p] (parallel APT_JoinSubOperator in JoinSourceToAggregator_2) [pp] eSame=>eCollectAny op13[3p] (parallel PeekFinalOutput)} It has 14 operators: op0[3p] {(parallel SourceData.p1] node3[op5.p1] node3[op4.p2] )} op3[3p] {(parallel SubSortOnStoreLocation) on nodes ( node1[op3.p1] node3[op1.p0] node2[op3.p0] node2[op2.p1] node1[op0.p0] node2[op5.DSLink2) on nodes ( node1[op0.DSLink2_Sort) on nodes ( node1[op1.p0] node2[op4.p1] node3[op3.p1] node3[op2.p2] .p2] )} op5[3p] {(parallel APT_SortedGroup2Operator in StoreAverageItemTransactionAmt) on nodes ( node1[op5.p2] )} op1[3p] {(parallel DistributeCopiesOfSourceDta.

you could have ALL 5 groups sent to the same partition (this is unlikely.p0] node2[op10.p2] )} op11[3p] {(parallel buffer(3)) on nodes ( node1[op11.p1] node3[op10.p1] node3[op12. the distribution of groups across partitions is nearly even for large numbers of groups).p0] node2[op7.p1] node3[op11.p2] )} op12[3p] {(parallel APT_JoinSubOperator in JoinSourceToAggregator_2) on nodes ( node1[op12.p1] node3[op6.p2] )} op7[3p] {(parallel buffer(1)) on nodes ( node1[op7. in fact. vii In this instance.p0] node2[op9. This does not mean that these groups will be in unique partitions: consider a job that only has 3 partitions. and the likelihood decreases with larger numbers of groups.p2] )} op13[3p] {(parallel PeekFinalOutput) on nodes ( node1[op13. look at this example: Here is my source data: ColumnAColumnBColumnC111112113121122123211212213221222223231232233 Here are the possible outcomes if I hash-partition on ColumnA.p0] node2[op13.p2] )} op9[3p] {(parallel APT_JoinSubOperator in JoinSourceToAggregator_1) on nodes ( node1[op9.p0] node2[op12.p1] node3[op8. viii To understand why this is true.p1] node3[op7.)} op6[3p] {(parallel buffer(0)) on nodes ( node1[op6.p1] node3[op13. you want auto insertion turned off b/c EE will see that you are ‘missing’ a sort/partitioner and insert one for you.p2] )} It runs 42 processes on 3 nodes.p0] node2[op11.p1] node3[op9.p2] )} op8[3p] {(parallel buffer(2)) on nodes ( node1[op8. and ColumnB: ColumnAColumnBColumnCGroup 1111112113Group 2121122123Group 3211212213Group 4221222223Group 5231232233 There must be exactly 5 groups identified by the hash algorithm b/c there are exactly 5 unique combinations of ColumnA and ColumnB.p2] )} op10[3p] {(parallel SubSortOnStoreLocation2) on nodes ( node1[op10.p0] node2[op8. regardless of the number of partitions: if you are running a job with 6 partitions. thus introducing the inefficiencies we are trying to avoid.p0] node2[op6. Here are the possible outcomes if I hash-partition on ColumnA only: ColumnAColumnBColumnCGroup 1111112113121122123Group 2211212213221222223231232233 . Any combination of these groups can be in any partition.

So hashing on fewer columns resulted in fewer. In the above example. we wouldn’t see any improvements in performance over a 2-way job. as well as all unique combinations of ColumnA.As you can see. even if we ran the job 12-ways. We can do this by identifying the intersection of keys needed among all of the hash-partitioners and hashing only on those keys: TransactionDate and ItemId NOTE: if you take this to an extreme. effectively. One effect is that if we wanted to aggregate on ColumnA and ColumnB. It is only true on a per-partition basis. ix This means that down-stream process will be sitting idle until the sort is completed. there are only two groups by hashing on ColumnA only. You need to understand your data and make educated decisions about your hashing strategy. summing ColumnC. x This is a slight oversimplification. then all unique combinations of ColumnA and ColumnB are together. consuming RAM and process space and offering nothing in return. not for the entire dataset. Therefore. ColumnB. we would have only two groups. reduce the parallelism of the job. . b/c: if all unique values of ColumnA are together. you will get a very small number of groups. this grouping is OK. In the scenario that we are discussing in the main document. which will. larger groups. we want to reduce the number of times that we hash (b/c partitioning costs CPU time). and ColumnC.

Sign up to vote on this title
UsefulNot useful