DataStage Mainframe Job Developer's Guide
DataStage Mainframe Job Developer's Guide
This document, and the software described or referenced in it, are confidential and proprietary to Ascential Software Corporation ("Ascential"). They are provided under, and are subject to, the terms and conditions of a license agreement between Ascential and the licensee, and may not be transferred, disclosed, or otherwise provided to third parties, unless otherwise permitted by that agreement. No portion of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of Ascential. The specifications and other information contained in this document for some purposes may not be complete, current, or correct, and are subject to change without notice. NO REPRESENTATION OR OTHER AFFIRMATION OF FACT CONTAINED IN THIS DOCUMENT, INCLUDING WITHOUT LIMITATION STATEMENTS REGARDING CAPACITY, PERFORMANCE, OR SUITABILITY FOR USE OF PRODUCTS OR SOFTWARE DESCRIBED HEREIN, SHALL BE DEEMED TO BE A WARRANTY BY ASCENTIAL FOR ANY PURPOSE OR GIVE RISE TO ANY LIABILITY OF ASCENTIAL WHATSOEVER. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ASCENTIAL BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. If you are acquiring this software on behalf of the U.S. government, the Government shall have only "Restricted Rights" in the software and related documentation as defined in the Federal Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you are acquiring the software on behalf of the Department of Defense, the software shall be classified as "Commercial Computer Software" and the Government shall have only "Restricted Rights" as defined in Clause 252.227-7013 (c) (1) of DFARs. 2000-2004 Ascential Software Corporation. All rights reserved. DataStage, EasyLogic, EasyPath, Enterprise Data Quality Management, Iterations, Matchware, Mercator, MetaBroker, Application Integration, Simplified, Ascential, Ascential AuditStage, Ascential DataStage, Ascential ProfileStage, Ascential QualityStage, Ascential Enterprise Integration Suite, Ascential Real-time Integration Services, Ascential MetaStage, and Ascential RTI are trademarks of Ascential Software Corporation or its affiliates and may be registered in the United States or other jurisdictions. The software delivered to Licensee may contain third-party software code. See Legal Notices (LegalNotices.pdf) for more information.
This manual describes the features of the DataStage Manager and DataStage Designer. It is intended for application developers and system administrators who want to use Ascential DataStage Enterprise MVS Edition to design and develop data warehousing applications in a mainframe environment. If you are new to Ascential DataStage, you should read the Ascential DataStage Manager Guide and Ascential DataStage Designer Guide. These provide enough information to get you started in designing DataStage jobs. This manual contains information specific to mainframe jobs and is intended to be used as a reference guide. It gives detailed information about stage editors for particular mainframe data sources. It also provides information about the powerful programming facilities that are built in to Ascential DataStage Enterprise MVS Edition. To find particular topics in the guide, you can: Use the Guides contents list (at the beginning of the Guide). Use the Guides index (at the end of the Guide). Use the Adobe Acrobat Reader bookmarks. Use the Adobe Acrobat Reader search facility (select Edit Search).
iii
Chapter 14
Chapter 15 Chapter 16 Chapter 17 Chapter 18 Chapter 19 Chapter 20 Chapter 21 Chapter 22 Chapter 23 Chapter 24 Appendix A Appendix B Appendix C Appendix D Appendix E
iv
Related Documentation
Related Documentation
To learn more about documentation from other Ascential products as they relate to Ascential DataStage Enterprise MVS Edition, refer to the following table.
Guide
Ascential DataStage Administrator Guide Ascential DataStage Designer Guide
Description
Describes Ascential DataStage setup, routine housekeeping, and administration Describes the DataStage Designer, and gives a general description of how to create, design, and develop a DataStage application Describes the DataStage Manager and explains how to use and maintain the DataStage Repository Describes the tools that are used in building a server job, and supplies programmers reference information Describes the tools that are used in building a parallel job, and supplies programmers reference information Gives more specialized information about parallel job design
Ascential DataStage Manager Guide Ascential DataStage Server Job Developers Guide Ascential DataStage Parallel Job Developers Guide Ascential DataStage Parallel Job Advanced Developers Guide
Describes the tools that are used in building a mainframe job, and supplies programmers reference information
Documentation Conventions
Product
Guide
Ascential DataStage Director Guide Ascential DataStage Install and Upgrade Guide
Description
Describes the DataStage Director and how to validate, schedule, run, and monitor DataStage server jobs Contains instructions for installing Ascential DataStage on Windows and UNIX platforms, and for upgrading existing installations of Ascential DataStage Contains information about using the NLS features that are available in Ascential DataStage when NLS is installed
These guides are also available online in PDF format. You can read them with the Adobe Acrobat Reader supplied with Ascential DataStage. See Ascential DataStage Install and Upgrade Guide for details on installing the manuals and the Adobe Acrobat Reader. You can use the Acrobat search facilities to search the whole Ascential DataStage document set. To use this feature, select Edit Search then choose the All PDF Documents in option and specify the Ascential DataStage docs directory (by default this is C:\Program Files\ Ascential\DataStage\Docs). Extensive online help is also supplied. This is especially useful when you have become familiar with using Ascential DataStage and need to look up particular pieces of information.
Documentation Conventions
This manual uses the following conventions:
Convention
bold
Used for
Field names, button names, menu items, and keystrokes. Also used to indicate filenames, and window and dialog box names. Information that you need to enter as is. Code examples Placeholders for information that you need to enter. Do not type the greater-/less-than brackets as part of the variable.
or
<variable>
vi
Convention
Used for
Indicators used to separate menu options, such as: Start Programs Ascential DataStage
[A]
B A|B {}
Options in command syntax. Do not type the brackets as part of the option. Elements that can repeat. Indicator used to separate mutually-exclusive elements. Indicator used to identify sets of choices.
The following conventions are also used: Syntax definitions and examples are indented for ease in reading. All punctuation marks included in the syntaxfor example, commas, parentheses, or quotation marksare 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.
Option Button
Check Box
Button
vii
Contacting Support
The DataStage user interface makes extensive use of tabbed pages, sometimes nesting them to enable you to reach the controls you need from within a single dialog box. At the top level, these are called pages, while at the inner level they are called tabs. The example shown above displays the General tab of the Inputs page. When using context-sensitive online help, you will find that each page opens a separate help topic, but each tab always opens the help topic for the parent page. You can jump to the help pages for the separate tabs from within the online help.
Contacting Support
To reach Customer Care, please refer to the information below: Call toll-free: 1-866-INFONOW (1-866-463-6669) Email: [email protected] Ascential Developer Net: http://developernet.ascential.com Please consult your support agreement for the location and availability of customer support personnel. To find the location and telephone number of the nearest Ascential Software office outside of North America, please visit the Ascential Software Corporation website at http://www.ascential.com.
viii
Contents
How to Use this Guide
How This Book is Organized . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii Related Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v Ascential Software Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v Documentation Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi User Interface Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii Contacting Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii
Chapter 1
Introduction
Developing Mainframe Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1 Importing Meta Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 Creating a Mainframe Job . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 Designing Job Stages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5 Editing Job Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9 After Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9 Generating Code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10 Uploading Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10 Compiling and Uploading Multiple Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10 Programming Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-11
ix
Contents
Chapter 2
Chapter 3
Chapter 4
Chapter 5
IMS Stages
Using an IMS Stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1 Defining IMS Output Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
Contents
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Relational Stages
Using a Relational Stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1 Defining Relational Input Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3 Updating Input Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5 Using a WHERE Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7 Defining Relational Output Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-8 Defining Computed Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-12 Modifying the SQL Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-14
xi
Contents
Chapter 10
Chapter 11
Chapter 12
Chapter 13
xii
Contents
Using an External Source Stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-10 Specifying the External Source Routine . . . . . . . . . . . . . . . . . . . . . . . . . . 13-12 Defining External Source Output Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-14
Chapter 14
Chapter 15
Transformer Stages
Using a Transformer Stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Transformer Editor Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Link Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Meta Data Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Shortcut Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Transformer Stage Properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Transformer Stage Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Input Links. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Output Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-1 15-2 15-2 15-2 15-3 15-3 15-6 15-6 15-7 15-7
xiii
Contents
Editing Transformer Stages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-8 Using Drag and Drop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-8 Find and Replace Facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-9 Select Facilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-10 Creating and Deleting Output Columns . . . . . . . . . . . . . . . . . . . . . . . . . . 15-11 Moving Output Columns Within a Link . . . . . . . . . . . . . . . . . . . . . . . . . . 15-12 Editing Output Column Meta Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-12 Defining Output Column Derivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-12 Editing Multiple Derivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-15 Defining Constraints and Handling Rejects . . . . . . . . . . . . . . . . . . . . . . . 15-18 Specifying Output Link Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-20 Defining Local Stage Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-21 The DataStage Expression Editor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-24 Entering Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-24 Validating the Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-25 Exiting the Expression Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-26
Chapter 16
Chapter 17
Chapter 18
Join Stages
Using a Join Stage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-1 Defining Join Input Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-3
xiv
Contents
Defining Join Output Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-5 Defining the Join Condition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-6 Mapping Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-7 Join Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-11
Chapter 19
Lookup Stages
Using a Lookup Stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-1 Performing Conditional Lookups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-3 Defining the Lookup Condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-5 Defining Lookup Input Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-6 Defining Lookup Output Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-8 Mapping Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-9 Lookup Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-13 Conditional Lookup Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-15
Chapter 20
Aggregator Stages
Using an Aggregator Stage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Defining Aggregator Input Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Defining Aggregator Output Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Aggregating Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Mapping Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-1 20-2 20-3 20-5 20-7
Chapter 21
Sort Stages
Using a Sort Stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Defining Sort Input Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Defining Sort Output Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sorting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Mapping Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-1 21-2 21-3 21-4 21-5
xv
Contents
Chapter 22
Chapter 23
FTP Stages
Using an FTP Stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23-1 Specifying Target Machine Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23-2 Defining FTP Input Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23-4
Chapter 24
xvi
Contents
Appendix A
Programmers Reference
Programming Components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-1 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2 Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2 Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-3 Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-4 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-16 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-18 Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-19 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-19
Appendix B
Appendix C
Appendix D
Appendix E
JCL Templates
JCL Template Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-1 JCL Template Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-3
xvii
Contents
Customizing a JCL Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-4 JCL Template Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-5 JCL Extension Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-13 Defining JCL Extension Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-14 Conditional Statements in JCL Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . E-15 % Symbols in JCL Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-16
Appendix F
Appendix G
Run-time Library
Sort Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Hash Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Calculating Hash Table Memory Requirements . . . . . . . . . . . . . . . . . . . . . Delimited Flat File Creation Routines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Utility Routines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Data Type Conversion Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Operational Meta Data Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-1 G-3 G-4 G-5 G-6 G-6 G-7
Appendix H
Reserved Words
COBOL Reserved Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-1 SQL Reserved Words. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-5
xviii
Contents
Index
xix
Contents
xx
1
Introduction
This chapter gives an overview of DataStage mainframe jobs. If you have Ascential DataStage Enterprise MVS Edition installed, you can generate jobs that are compiled and run on a mainframe. Data read by these jobs can then be loaded into the data warehouse. Ascential DataStage also supports server jobs and parallel jobs. These are compiled and run on the DataStage server. Such jobs connect to a data source, extract and transform data, and write it to a data warehouse. Server jobs are described in Ascential DataStage Server Job Developers Guide and parallel jobs are described in Ascential DataStage Parallel Job Developers Guide.
1-1
Introduction
Before you start to develop your job, you must plan and set up your project. See Ascential DataStage Manager Guide for information on how to set up a project using the DataStage Manager.
1-2
Introduction
To create a new mainframe job, do one of the following: Choose File New from the Designer menu. The New dialog box appears. Select Mainframe Job and click OK:
Click the New drop-down arrow on the Designer toolbar and select Mainframe Job.
1-3
Introduction
The diagram window appears in the right pane of the Designer, and the tool palette for mainframe jobs becomes available in the lower left pane:
The DataStage Designer window consists of the following parts: The Diagram window where you design your jobs. The Repository window where you view components in a project. A Toolbar from where you select Designer functions. A Tool Palette from which you select job components. A Status Bar which displays one-line help for the window components, and information on the current state of job operations. For full information about the Designer window, including the functions of the pull-down and shortcut menus, refer to Ascential DataStage Designer Guide. You can customize the Designer to create a new mainframe job at startup by doing the following:
1 2 3
Choose Tools
Select the General page under the Default branch of the project tree in the left pane. Click Create new and select Mainframe from the drop-down list.
Save your job by choosing File Save. In the Create new job dialog box, type a job name and a category. Click OK to save the job.
1-4
Introduction
1-5
Introduction
Target stages. Used to write data to a target data warehouse. Mainframe target stage types include: DB2 Load Ready Flat File Delimited Flat File (can also be used as a source stage) External Target Fixed-Width Flat File (can also be used as a source stage) Relational (can also be used as a source stage) Teradata Load Teradata Relational (can also be used as a source stage)
Processing stages. Used to transform data before writing it to the target. Mainframe processing stage types include: Aggregator Business Rule External Routine Join Link Collector Lookup Sort Transformer
1-6
Introduction
Post-processing stage. Used to post-process target files produced by a mainframe job. There is one type of postprocessing stage: FTP Stages are added and linked together using the tool palette. The mainframe tool palette is divided into groups for General, Database, File, and Processing stage types. Buttons for mainframe source and target stages appear in the Database and File groups, and mainframe processing stage buttons appear in the Processing group. The General group contains the following buttons for linking stages together and adding diagram annotations: Annotation Description Annotation Link
For information on customizing the tool palette, see Ascential DataStage Designer Guide. A mainframe job must have at least one active stage, and every stage in the job must have at least one link. Only one chain of stages is allowed in a job. Active stages must have at least one input link and one output link. Passive stages cannot be linked to passive stages. Relational and Teradata Relational stages cannot be used in the same job. Table 1-1 shows the links that are allowed between mainframe stage types.
1-7
Introduction
Complex Flat File Multi-Format Flat File IMS Fixed-Width Flat File Delimited Flat File DB2 Load Ready Flat File Relational Teradata Relational Teradata Export External Source Transformer Business Rule Link Collector Join Lookup Aggregator Sort External Routine
1-8
Introduction
After Development
After you add stages and links to the Designer canvas, you must edit the stages to specify the data you want to use and how it is handled. Data arrives into a stage on an input link and is output from a stage on an output link. The properties of the stage and the data on each input and output link are specified using a stage editor. There are different stage editors for each type of mainframe job stage. See Ascential DataStage Designer Guide for details on how to develop a job using the Designer. Chapters 3 through 23 of this manual describe the individual stage characteristics and stage editors available for mainframe jobs.
After Development
When you have finished developing your mainframe job, you are ready to generate code. The code is then uploaded to the mainframe machine, where the job is compiled and run.
1-9
After Development
Introduction
Generating Code
To generate code for a mainframe job, open the job in the Designer and choose File Generate Code. Or, click the Generate Code button on the toolbar. The Code generation dialog box appears. This dialog box displays the code generation path, COBOL program name, compile JCL file name, and run JCL file name. There is a Generate button for generating the COBOL code and JCL files, a View button for viewing the generated code, and an Upload job button for uploading a job once code has been generated. There is also a progress bar and a display area for status messages. When you click Generate, your job design is automatically validated before the COBOL source, compile JCL, and run JCL files are generated. You can print the program and data flow during program execution by selecting an option in the Trace runtime information drop-down box. In addition, you can customize the COBOL program by selecting the Generate COPY statements for customization check box. You can also create and manage several versions of the COPYLIB members by specifying a copy library prefix. For more information on generating code, see Chapter 24, "Code Generation and Job Upload."
Uploading Jobs
To upload a job from the Designer, choose File Upload Job, or click Upload job in the Code generation dialog box after youve generated code. The Remote System dialog box appears, allowing you to specify information about connecting to the target mainframe system. Once you have successfully connected to the target machine, the Job Upload dialog box appears, allowing you to actually upload the job. You can also upload jobs in the Manager. Choose the Jobs branch of the project tree, select one or more jobs in the display area, and choose Tools Upload Job. For more information about uploading jobs, see Chapter 24, "Code Generation and Job Upload."
1-10
Introduction
Programming Resources
For details on using the wizard, see "Compiling Multiple Jobs" on page 24-16.
Programming Resources
You may need to perform certain programming tasks in your mainframe jobs, such as reading data from an external source, calling an external routine, writing expressions, or customizing the DataStage-generated code. External Source stages allow you to retrieve rows from an external data source. After you write the external source program, you create an external source routine in the Repository. Then you use an External Source stage to represent the external source program in your job design. The external source program is called from the DataStagegenerated COBOL program. See Chapter 13, "External Source Stages" for details about calling external source programs. External Target stages allow you to write rows to an external data target. After you write the external target program, you create an external target routine in the Repository. Then you use an External Target stage to represent the external target program in your job design. The external target program is called from the DataStagegenerated COBOL program. See Chapter 14, "External Target Stages" for details about calling external target programs. External Routine stages allow you to incorporate complex processing or functionality specific to your environment within the DataStagegenerated COBOL program. As with External Source or External Target stages, you first write the external program, then you define an external routine in the Repository, and finally you add an External Routine stage to your job design. For more information, see Chapter 22, "External Routine Stages." Expressions are used to define column derivations, constraints, SQL clauses, stage variables, and conditions for performing joins and lookups. The DataStage Expression Editor helps you define column derivations, constraints, and stage variables in Transformer stages, as well as column derivations and stage variables in Business Rule stages. It is also used to update input columns in Relational, Teradata Relational, and Teradata Load stages. An expression grid helps you define constraints in source stages, as well as SQL clauses in Relational, Teradata Relational, Teradata Export, and Teradata Load stages. It also helps you define key expressions in Join and Lookup stages. Details on defining expressions are provided in the chapters describing the individual stage editors. In addition, Appendix A, "Programmers Reference" contains reference information about the
Mainframe Job Developers Guide 1-11
Programming Resources
Introduction
programming components that you can use in mainframe expressions. You can also customize the DataStage-generated COBOL program to meet your shop standards. Processing can be done at both program initialization and termination. In addition, you can change the text associated with various warning and error messages, and you can create and manage several versions of COPYLIB members. For details see "Code Customization" on page 24-5.
1-12
2
Importing Meta Data for Mainframe Jobs
This chapter explains how to import meta data from mainframe data sources, including table definitions and IMS definitions. These definitions contain the meta data for each data source and data target in a data warehouse. They specify the data to be used at each stage of a job. You can save time and increase the accuracy of your table definitions by importing them into the DataStage Repository. They can then be shared by all the jobs in a project. If you are not able to import table definitions, you have the option of manually creating definitions in the Repository before you develop a job, or defining columns directly in the stage editors during job design. Columns entered during job design can be saved as table definitions in the Repository by clicking the Save As button on the Columns tab, allowing you to use them in other jobs. For details on manually creating a table definition in the Manager, see Ascential DataStage Manager Guide. For details on saving columns as table definitions during job design, see the chapters on the individual stage editors in this manual.
2-1
In the Designer Repository window, right-click on the Table Definitions branch and select Import COBOL File Definitions from the shortcut menu.
2-2
This dialog box has the following fields: Seen from. Your computers network identification name. The name is automatically filled in and is read-only. COBOL file description pathname. The pathname where the CFD file is located. You can type the pathname or browse for it by clicking the (browse) button. The CFD file must either reside on the DataStage client workstation or on a network that is visible from the client workstation. The default capture file extension is *.cfd. Start position. The starting column where the table description begins (the 01 level). The default start position is 8. You can change the start position to any value from 2 to 80. Ascential DataStage allows 64 positions from the start position. For example, if the start position is 2, the last valid column position is 65. Platform type. The operating system for the mainframe platform. (OS/390 is the only platform currently supported.) Column comment association. The column to associate with a comment line in a CFD file. Specify whether a comment line should be associated with the column that follows it (the default) or the column that precedes it. Tables. The tables defined in the selected CFD file. This list will appear after you enter the CFD pathname. Click Refresh to refresh the list if necessary. Select a single table by clicking the table name, or select multiple tables by holding down the Ctrl key and clicking the table names. To select all tables, click Select all. To see a summary description of a table, select the table name and click Details. The Details of dialog box appears, displaying the table name, description, and column names.
2-3
To category. The name of the category in the Repository where the CFD will be saved. There are two parts to the category: the data source type and the data source name. This field is automatically filled in when you select a table. The default category for CFDs is COBOL FD\filename. You can change the category by typing a different name in this field. Click Import after selecting the items to import. The data from the CFD file is extracted and parsed. If any syntactical or semantic errors are found, the Import Error dialog box appears:
This dialog box displays the number of errors and provides the following options: Edit . Allows you to view and fix the errors. Skip. Skips the current table and begins importing the next table, if one has been selected. Stop. Aborts the import of this table and any remaining tables. If you click Edit, the Edit CFD File dialog box appears:
This dialog box displays the CFD file in the top pane and the errors in the bottom pane. For each error, the line number, an error indicator, and an error message are shown. Double-clicking an error message
2-4
automatically positions the cursor at the corresponding line in the top pane. You can edit the file by typing directly in the top pane. Click Skip to skip the current table and begin importing the next one, if one exists. Click Stop to abort the import of the table and any remaining tables. After you are done making changes, click Save to save your work. If you have not changed the names or number of tables in the file, you can click Retry to start importing the table again. However, if you changed a table name or added or removed a table from the file, the Import File dialog box appears. You can click Re-start to restart the import process or Stop to abort the import.
In the Designer Repository window, right-click on the Table Definitions branch and select Import DCLGen File Definitions from the shortcut menu.
2-5
This dialog box has the following fields: Seen from. Your computers network identification name. The name is automatically filled in and is read-only. DCLGen pathname. The pathname where the DCLGen file is located. You can type the pathname or browse for it by clicking the (browse) button. The DCLGen file must either reside on the DataStage client workstation or on a network that is visible from the client workstation. The default capture file extension is *.dfd. Start position. This is not used for DCLGen files. Ascential DataStage captures the table definition from the EXEC SQL DECLARE statement. Platform type. The operating system for the mainframe platform. (OS/390 is the only platform currently supported.) Tables. The table defined in the selected DCLGen file. This list will appear after you enter the DCLGen pathname. Click Refresh to refresh the list if necessary. Click the table name to select the table. To see a summary description of a table, select the table name and click Details. The Details of dialog box appears, displaying the table type, owner, description, and column names. To category. The name of the category in the Repository where the DCLGen file will be saved. This field is automatically filled in when you select a table. The default category for DCLGen files is DB2 Dclgen\filename. You can change the category by typing a different name in this field.
2-6
Click Import after selecting the table to import. The data from the DCLGen file is extracted and parsed. If any syntactical or semantic errors are found, the Import Error dialog box appears:
This dialog box displays the number of errors and provides the following options: Edit . Allows you to view and fix the errors. Skip. Skips the current table and begins importing the next table, if one has been selected. Stop. Aborts the import of this table and any remaining tables. If you click Edit, the Edit DCLGen File dialog box appears:
This dialog box displays the DCLGen file in the top pane and the errors in the bottom pane. For each error, the line number, an error indicator, and an error message are shown. Double-clicking an error message automatically positions the cursor at the corresponding line in the top pane. You can edit the file by typing directly in the top pane. Click Stop to abort the import of the table. After you are done making changes, click Save to save your work. If you have not changed the table name, you can click Retry to start importing the table again. However, if you changed the table name,
2-7
the Import File dialog box appears. You can click Re-start to restart the import process or Stop to abort the import.
Comments must be designated with an asterisk in the begin column and must lie within the statement field. They may not appear between an instruction statement and its continuation lines. Comments that appear before the first DSECT keyword become the long description for the table. The fully qualified path and filename of the AsmFD, as well as the current date and time, are saved as the short description for the table. The import process creates a DataStage table of type QSAM_SEQ_ COMPLEX. Assembler data types are converted to COBOL native data types during capture, as described in Table 2-1.
2-8
SQL Type
Char Char Decimal Decimal Integer NChar SmallInt Char Decimal Char Decimal
Note The DataStage Expression Editor provides functions for performing bit manipulations. For more information, see Appendix A, "Programmers Reference."
To import an AsmFD, do one of the following: In the Manager, choose Import Table Definitions Assembler File Definitions from the menu bar. In the Designer Repository window, right-click on the Table Definitions branch and select Import Assembler File Definitions from the shortcut menu. The Import Meta Data (ASM) dialog box appears:
2-9
This dialog box has the following fields: Seen from. Your computers network identification name. The name is automatically filled in and is read-only. Assembler file description pathname. The pathname where the AsmFD is located. You can type the pathname or browse for it by clicking the (browse) button. The file must either reside on the DataStage client workstation or on a network that is visible from the client workstation. The default capture file extension is *.asm for source files and *.lst for listing files. Start position. The starting column where the table description begins (level 1). Defaults to 1 for source files and 42 for listing files. Platform type. The operating system for the mainframe platform. (OS/390 is the only platform currently supported.) Column comment association. The column to associate with a comment line in an Assembler file. Specify whether a comment line should be associated with the column that follows it (the default) or the column that precedes it. The column definition is included with the comment as part of each column description; if you want to exclude the column definition from the description, clear the Include column description check box. Tables. The tables defined in the selected source file. This list will appear after you enter the source file pathname. Click Refresh to refresh the list if necessary. Select a single table by clicking the table name, or select multiple tables by holding down the Ctrl key and clicking the table names. To select all tables, click Select all. To see a summary description of a table, select the table name and click Details. The Details of dialog box appears, displaying the table name, description, and column names. To category. The name of the category in the Repository where the AsmFD will be saved. This field is automatically filled in when you select a table. The default category for AsmFDs is Assembler\filename. You can change the category by typing a different name in this field. Click Import after selecting the items to import. The data is extracted and parsed. If any syntactical or semantic errors are found, the Import Error dialog box appears, allowing you to view and fix the errors, skip the import of the incorrect item, or stop the import process altogether.
2-10
Comments must begin with /* and end with */. The fully qualified path and filename of the PL/I FD, as well as the current date and time, are saved as the short description for the table. Comments that appear before the first DCL or DECLARE level 1 become the long description. In addition, any comments defined on the level 1 variable declaration are appended to the short description. Other comments defined on or between level n (n > 1) variable definitions become column descriptions. The import process creates a DataStage table of type QSAM_SEQ_ COMPLEX. PL/I data types are converted to COBOL native data types during capture, as described in Table 2-2.
2-11
SQL Type
Char
PIC X(n) PIC X(n+1) PIC N(n) PIC N(n+2) PIC N(n) PIC N(n+2) Signed: PIC S9(p-s)V9(s) COMP-3 Unsigned: PIC 9(p-s)V9(s) COMP-3
CHARACTER
PIC X(1)
Char
2-12
SQL Type
VarChar
CHARACTER(n) VARYING GRAPHIC(n) VARYING WIDECHAR(n) VARYING BINARY FIXED (p,s) Signed: 8 p 15 Unsigned: 9 p 16 BINARY FIXED (p,s) Signed: 16 p 31 Unsigned: 17 p 32 BINARY FLOAT(p) 1 p 21 DECIMAL FLOAT(p) 1p6 BINARY FLOAT(p) 22 p 53 DECIMAL FLOAT(p) 7 p 16 PICTURE (q)9V(s)9 POINTER
VARCHAR
VarChar
VARGRAPHIC
NVarChar
VARGRAPHIC
NVarChar
2-byte BINARY
Decimal
4-byte BINARY
Decimal
4-byte FLOAT
PIC COMP-1
Decimal
CHARACTER
PIC X(4)
Char
8-byte FLOAT
PIC COMP-2
Decimal
CHARACTER
PIC X(8)
Char
Decimal
Char
2-13
BIT Data Type Examples Certain BIT and BIT VARYING data types require special handling. The following examples illustrate how Ascential DataStage processes these data types during capture.
1
Arrays on BIT columns are multiplied to the column length and the array is dropped. For example:
BITCOL1(16) BIT(01)
becomes
BITCOL1 BIT(16).
If an unaligned BIT column can be stored in full bytes (the length is divisible by 8 with no remainder), the column name is preserved. For example:
BITCOL1 BIT(8) BITCOL2 BIT(16) UNALIGNED
becomes
BITCOL1 PIC X(1) BITCOL2 PIC X(2)
If a BIT column follows another BIT column (aligned or unaligned) and cannot be stored in full bytes (there is a remainder when the length is divided by 8), the second column is merged with the first column. For example:
BITCOL1 BIT(5) BITCOL2 BIT(6) UNALIGNED
becomes
BITCOL1 PIC X(2)
4 5
BIT VARYING columns are not merged. GROUP BIT columns are collapsed to one element. For example:
03 BIT S1 05 S11 BIT(1) 05 S12 BIT(1) 05S13 BIT(1) 05 S14 BIT(1) 05 S15 BIT(1) 05 S16 BIT(1) 05 S17 BIT(1) 05 S18 BIT(1) 03 BIT S2 05 S21 BIT(1) 05 S22 BIT(1) 05 S23 BIT(1) 05 S24 BIT(1) 05 S25 BIT(1)
2-14
which becomes
PIC X(1) PIC X(1)
If the number of group elements is not evenly divisible by eight, then the second group column is merged with the first group column. For example:
03 BIT S1 05 S11 05 S12 05 S13 05 S14 05 S15 03 BIT S2 05 S21 05 S22 05 S23 05 S24 05 S25 05 S26 05 S27 BIT(1) BIT(1) BIT(1) BIT(1) BIT(1) BIT(1) BIT(1) BIT(1) BIT(1) BIT(1) BIT(1) BIT(1)
The second GROUP column is then merged with the first GROUP column as shown:
03 BIT S1 BIT(12)
Note The DataStage Expression Editor provides functions for performing bit manipulations. For more information, see Appendix A, "Programmers Reference."
To import a PL/I FD, do one of the following: In the Manager, choose Import Table Definitions Definitions from the menu bar. PL/I File
In the Designer Repository window, right-click on the Table Definitions branch and select Import PL/I File Definitions from the shortcut menu.
2-15
This dialog box has the following fields: Seen from. Your computers network identification name. The name is automatically filled in and is read-only. PL/I file description pathname. The pathname where the PL/I FD is located. You can type the pathname or browse for it by clicking the (browse) button. The PL/I FD must either reside on the DataStage client workstation or on a network that is visible from the client workstation. The default capture file extension is *.pli or *.pl1 for source files and *.lst for listing files. Start position. The starting column where the table description begins (level 1). Defaults to 1 for source files and 15 for listing files. Platform type. The operating system for the mainframe platform. (OS/390 is the only platform currently supported.) Column comment association. The column to associate with a comment line in a PL/I FD. Specify whether a comment line should be associated with the column that follows it (the default) or the column that precedes it. The column definition is included with the comment as part of each column description; if you want to exclude the column definition from the description, clear the Include column description check box. Tables. The tables defined in the selected PL/I FD. This list will appear after you enter the PL/I FD pathname. Click Refresh to refresh the list if necessary. Select a single table by clicking the table name, or select multiple tables by holding down the Ctrl key and clicking the table names. To select all tables, click Select all. To see a summary description of a table, select the table name and click Details. The Details of dialog box appears, displaying the table name, description, and column names.
2-16
To category. The name of the category in the Repository where the PL/I FD will be saved. There are two parts to the category: the data source type and the data source name. This field is automatically filled in when you select a table. The default category for PL/I FDs is PLI\filename. You can change the category by typing a different name in this field. Click Import after selecting the items to import. The data is extracted and parsed. If any syntactical or semantic errors are found, the Import Error dialog box appears, allowing you to view and fix the errors, skip the import of the incorrect item, or stop the import process altogether.
Teradata Tables
You can import Teradata table definitions into the DataStage Repository using either the ODBC Table Definitions menu option or, if you have the Teradata plug-in installed for server jobs, you can use the Plug-in Metadata Definitions menu option. In either case, you must open the Table Definition dialog box afterward and manually change the mainframe platform type and access type. To import Teradata tables:
1
Do one of the following: In the Manager, choose Import Table Definitions ODBC Table Definitions or Import Table Definitions Plugin Metadata Definitionsfrom the menu bar. In the Designer Repository window, right-click on the Table Definitions branch and select Import ODBC Table Definitionsor Import Plug-in Metadata Definitionsfrom the shortcut menu. The Import Meta Data dialog box appears, allowing you to connect to the Teradata data source (for the Teradata plug-in, a wizard appears and guides you through the process).
Fill in the required connection details and click OK. Once the connection has been made, the updated dialog box gives details of the table definitions available for import. Select the table definition to import and click OK. The table definition meta data is imported into the DataStage Repository. Expand the Table Definitions branch of the project tree and either double-click the Teradata table definition or select it and choose Properties from the shortcut menu. The Table Definition dialog box appears. On the General page, change the mainframe platform type to OS390 and the mainframe access type to Teradata.
3 4
2-17
Choose Properties from the shortcut menu. Double-click the table definition in the display area. Click the Properties button on the toolbar. To open a table definition in the Designer, either double-click the table definition in the Repository window, or right-click and select Properties from the shortcut menu. The Table Definition dialog box appears:
This dialog box has up to seven pages: General, Columns, Format, NLS, Relationships, Parallel, and Layout. Only the General, Columns, and Layout pages apply to mainframe table definitions. The General page displays the data source type and name, table or filename, owner, mainframe platform and access types, and short and long descriptions of the data. You can edit any of these fields. The Columns page displays the column definitions of the imported data. You can edit the meta data on the Columns page in two ways: directly in the grid or using the Edit Column Meta Data dialog box. To edit directly in the grid, either double-click the cell you want to
2-18
change or highlight the cell and choose Edit cell from the shortcut menu. To use the Edit Column Meta Data dialog box, which allows you to edit the meta data row by row, do one of the following: Click any cell in the row you want to change, then choose Edit row from the shortcut menu. Press Ctrl-E. For information about using the Edit Column Meta Data dialog box in mainframe jobs, see Appendix D, "Editing Column Meta Data." To delete a column definition, click any cell in the row you want to remove and press the Delete key or choose Delete row from the shortcut menu. The Layout page displays the schema format of the column definitions in a table. Select a button to view the data representation in one of three formats: Parallel. Displays the OSH record schema. You can right-click to save the layout as a text file in *.osh format. COBOL. Displays the COBOL representation, including the COBOL PICTURE clause, starting and ending offsets, and storage length of each column. You can right-click to save the layout as an HTML file. Standard. Displays the SQL representation, including SQL type, length, and scale. Click OK to save any changes and to close the Table Definition dialog box.
2-19
FIELD XDFIELD DBDGEN FINISH END The clauses captured from PSB files include: PCB SENSEG SENFLD PSBGEN END You can import IMS definitions from IMS version 5 and above. IMS field types are converted to COBOL native data types during capture, as described in Table 2-3. Table 2-3 IMS Field Type Conversion
IMS Field Type COBOL Native Type COBOL Usage Representation
X P C F H CHARACTER DECIMAL CHARACTER BINARY BINARY PIC X(n)1
SQL Type
Char
PIC S9(n)V9(0) COMP-3 Decimal PIC X(n) PIC S9(9) COMP PIC S9(4) COMP Char Integer SmallInt
Note The DataStage Expression Editor provides functions for performing bit manipulations. For more information, see Appendix A, "Programmers Reference."
2-20
In the Designer Repository window, right-click on the IMS Databases (DBDs) branch and select Import IMS Database (DBD) from the shortcut menu. The Import IMS Database (DBD) dialog box appears:
This dialog box has the following fields: Seen from. Your computers network identification name. The name is automatically filled in and is read-only. IMS file description pathname. The pathname where the IMS file is located. You can type the pathname or browse for it by clicking the (browse) button. The IMS file must either reside on the DataStage client workstation or on a network that is visible from the client workstation. The default capture file extension is *.dbd for DBD files. Platform type. The operating system for the mainframe platform. (OS/390 is the only platform currently supported.) Database names. The databases defined in the selected DBD file. This list will appear after you enter the IMS file description pathname. Click Refresh to refresh the list if necessary. Select a single database by clicking the item name, or select multiple databases by holding down the Ctrl key and clicking the names. To select all databases, click Select all. To view the details of a database, select it and click View. The default editor (such as WordPad or Notepad) opens, displaying the details of the database description file. To category. The name of the category in the IMS Databases (DBDs) branch of the project tree where the item will be saved. This field is automatically filled in when you select a database to import. The default category is Database\filename. You can change the category by typing a different name in this field. Click Import after selecting the items to import. The data is extracted and parsed. If any syntactical or semantic errors are found, the Import Error dialog box appears, allowing you to view and fix the
Mainframe Job Developers Guide 2-21
errors, skip the import of the incorrect item, or stop the import process altogether.
This dialog box has the following fields: Seen from. Your computers network identification name. The name is automatically filled in and is read-only. IMS file description pathname. The pathname where the IMS file is located. You can type the pathname or browse for it by clicking the (browse) button. The IMS file must either reside on the DataStage client workstation or on a network that is visible from the client workstation. The default capture file extension is *.psb for PSB files. Platform type. The operating system for the mainframe platform. (OS/390 is the only platform currently supported.) Create associated tables. Select this to have Ascential DataStage create a table in the Repository that corresponds to each sensitive segment in the PSB file, and columns in the table that correspond to each sensitive field. If no sensitive fields exist in the PSB, then the created columns correspond to the segments in the DBD. Only those fields that are defined in the PSB become
2-22
columns; fillers are created where necessary to maintain proper field displacement and segment size. The associated tables are stored in the Table Definitions branch of the project tree. If you have a CFD with a definition of the complete IMS segment, you can import it to create the completely defined table, including any columns that were captured as fillers. You can then change the associated table for each segment in the IMS Viewset Editor; see "IMS Viewset Editor" on page 2-25 for details. Viewset names. The names of the PSBs defined in the selected PSB file. This list will appear after you enter the IMS file description pathname. Click Refresh to refresh the list if necessary. Select a single viewset by clicking the PSB name, or select multiple items by holding down the Ctrl key and clicking the names. To select all items, click Select all. To view the details of a viewset, select it and click View. The default editor (such as WordPad or Notepad) opens, displaying the details of the viewset file. To category. The name of the category in the IMS Viewsets (PSBs/PCBs) branch of the project tree where the item will be saved. This field is automatically filled in when you select a viewset name. The default category is Viewset\filename. You can change the category by typing a name in the To category field. Click Import after selecting the items to import. The data is extracted and parsed. If any syntactical or semantic errors are found, the Import Error dialog box appears, allowing you to view and fix the errors, skip the import of the incorrect item, or stop the import process altogether.
2-23
To open an IMS definition in the Manager, select the database or viewset name in the display area and do one of the following: Choose File Properties.
Choose Properties from the shortcut menu. Double-click the item in the display area. Click the Properties button on the toolbar. To open an IMS definition in the Designer, either double-click the database or viewset name in the Repository window, or right-click and select Properties from the shortcut menu. Depending on the type of IMS item you selected, either the IMS Database (DBD) or the IMS Viewset (PSB/PCB) dialog box appears.
This dialog box is divided into two panes. The left pane displays the IMS database, segments, and datasets in a tree, and the right pane displays the properties of selected items. Depending on the type of item selected, the right pane has up to two pages: Database. There are two pages for database properties:
General. Displays the general properties of the database including the name, version number, access type, organization, category, and short and long descriptions. All of these fields are read-only except for the short and long descriptions.
2-24
Hierarchy. Displays the segment hierarchy of the database. You can right-click to view the hierarchy in detailed mode. This diagram is read-only. General. Displays the segment name, the parent segment, its minimum and maximum size in bytes, and a description. All of these fields are read-only except for the description. Fields. Displays the fields of the selected segment. The field descriptions are read-only.
Dataset. Properties are displayed on one page and include the DD names that are used in the JCL to read the file. These names are read-only. You can optionally enter a description of the dataset.
This dialog box is divided into two panes. The left pane contains a tree structure displaying the IMS viewset (PSB), its views (PCBs), and the sensitive segments. The right pane displays the properties of selected items. It has up to three pages depending on the type of item selected: Viewset. Properties are displayed on one page and include the PSB name and the category in the Repository where the viewset is stored. These fields are read-only. You can optionally enter short and long descriptions. View. There are two pages for view properties:
2-25
General. Displays the PCB name, DBD name, type, and an optional description. If you did not create associated tables during import or you want to change which tables are associated with PCB segments, click the Segment/Table Mapping button. The Segment/Associated Table Mapping dialog box appears.
To create a table association for a segment, select a table in the left pane and drag it to the segment in the right pane. The left pane displays available tables in the Repository which are of type QSAM_SEQ_COMPLEX. The right pane displays the segment names and the tables currently associated with them; you can right-click to clear one or all of the current table mappings. Be sure that the record length of the associated table matches the buffer length of the segment it refers to. If the lengths dont match, segment data may be read incorrectly. Click OK when you are done with the mappings, or click Cancel to discard any changes you have made and revert back to the original table associations.
Hierarchy. Displays the PCB segment hierarchy in a read-only diagram. You can right-click to view the hierarchy in detailed mode.
Sensitive Segment. There are three pages for sensitive segment properties:
General. Displays the segment name and its associated table. If you want to change the associated table, click the browse button next to the Associate table field to select another table. Sen Fields. Displays the sensitive fields associated with the sensitive segment. These fields are read-only.
2-26
Columns. Displays the columns of the associated table. The column descriptions are read-only.
2-27
2-28
3
Complex Flat File Stages
This chapter describes Complex Flat File stages, which are used to read data from complex flat file data structures. A complex flat file may contain one or more GROUP REDEFINES, OCCURS or OCCURS , DEPENDING ON clauses.
3-1
When you edit a Complex Flat File stage, the Complex Flat File Stage dialog box appears:
This dialog box has two pages: Stage. Displays the stage name, which can be edited. This page has up to five tabs. The General tab is where you specify the source data attributes. You can also enter an optional description of the stage, which appears in the generated COBOL program. The General tab has the following fields:
The File name field is the mainframe source file from which data will be read. Generate an end-of-data row. Select this check box to add an end-of-data indicator after the last row is processed on each output link. The indicator is a built-in variable called ENDOFDATA which has a value of TRUE, meaning the last row of data has been processed. (See "ENDOFDATA" on page A-20 for more information on using this variable). In addition, all columns are set to null. The DD name field is the data definition name of the file in the JCL. It can be 1 to 8 alphanumeric characters and the first character must be alphabetic. The default name is DDn, where n is the internal job number. You can edit this name. The Access type drop-down list defines whether the data is part of a QSAM or VSAM file. You must specify the category your data falls into: QSAM_SEQ_COMPLEX. QSAM file structure. VSAM_ESDS. VSAM Entry-Sequenced Data Set file structure.
3-2
VSAM_KSDS. VSAM Key-Sequenced Data Set file structure. If this is selected, at least one column must be defined as a Key. VSAM_RRDS. Relative Record Data Set file structure.
Start row. Select First row to read the source file starting with the first row, or Row number to start reading from a specific row number. Type a whole number in the Row number field, which has a default value of 1. There is no maximum. End row. Select Last row to stop reading the source file after the last row, or Row number to stop after a specific row number. Type a whole number in the Row number field, which has a default value of 1. There is no maximum. Block type. Select the block type of the source file. The default is Fixed block file, which indicates that the source file contains fixed record lengths. Complex Flat File stages can also be used to read variable-block files with or without OCCURS DEPENDING ON clauses.
The Columns tab is where you specify the column definitions for the source data. See "Specifying Stage Column Definitions" on page 3-3 for details on defining or loading column definitions. The File view tab displays specialized information about the columns in your source file, including the COBOL PICTURE clause, the starting and ending offsets, and the storage length of each column. You can right-click to save the file view layout as an HTML file. The Pre-sort tab allows you to pre-sort your source data before passing it to the next stage in the job design. See "Pre-Sorting Data" on page 3-7 for details on creating the sort control statement. The Options tab is available only if you have chosen to pre-sort your source data on the Pre-sort tab. See "Specifying Sort File Parameters" on page 3-10 for details on setting these options. Outputs. Specifies the column definitions for the data output links. Click OK to close this dialog box. Changes are saved when you save the job.
3-3
column definitions are then projected to the Outputs page. The Columns tab contains a grid with the following information: Level number. The COBOL level number where the data is defined. If no level number is given, a default value of 05 is assigned. Column name. The name of the column. Key. Indicates if the input column is a record key. Only one field can be defined as a key. Groups can be defined as keys by defining the group field as a key. This field is required if the access type of the source file is VSAM_KSDS. Native type. The native data type. For details about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHARACTER and GROUP data, and the total number of digits for numeric data types. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL and FLOAT data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. (Nullable columns are not supported in Complex Flat File stages.) Description. A text description of the column. You can Load columns from a table definition in the Repository, or enter column definitions manually and click Save As to save them as a table definition, a CFD file, or a DCLGen file. Click Clear All to start over. For details on editing column definitions, see Appendix D, "Editing Column Meta Data."
Note If the access type of the table loaded is not one of those listed in the Access type field on the Stage page, then native data type conversions are done for all columns that have a native data type which is unsupported in Complex Flat File stages. For more information, see Appendix C, "Native Data Types."
3-4
This option is available when you load columns from a simple or complex flat file. It allows you to collapse sequences of unselected columns into FILLER items with the appropriate size. The data type will be set to CHARACTER and the name set to FILLER_XX_YY, where XX is the start offset and YY is the end offset. This leads to more efficient use of space and time and easier comprehension for users. If you load more than one table definition, the list of columns from the subsequent tables is added to the end of the current list. In cases where the first column of the subsequent list has a level number higher than the last column of the current list, Ascential DataStage inserts an 02 FILLER group item before the subsequent list is loaded. (This is not done, however, if the first column being loaded already has a level number of 02.) Columns displayed here should reflect the actual layout of the source file. Even though you may not want to output every column, all columns of the file layout, including fillers, should appear here. You select the columns to output from the stage on the Outputs page.
3-5
Array Handling
If you load a file containing arrays, the Complex file load option dialog box appears:
This dialog box offers the following options: Normalize all arrays. Presents the data as multiple rows at execution time with one row for each column in the array. This is the default. Flatten all arrays. Creates new columns for each element of the array and presents the data as one row at execution time. Flatten selective arrays. Allows you to choose whether to flatten or normalize arrays on an individual basis. Use the right mouse button to select Flatten or Normalize. The array icon changes for the arrays you select to flatten. A column which contains an OCCURS DEPENDING ON clause may be flattened when it is either the last column, or it is followed only by subordinate columns and none of the following columns contain an OCCURS DEPENDING ON clause. In all other cases, a column which contains an OCCURS DEPENDING ON clause must be normalized. If a column containing an OCCURS DEPENDING ON clause is flattened, it is flattened to the maximum number of occurrences. When a record contains fewer than the maximum number of occurrences, the elements of the unused occurrences are set to null if the element is nullable, or set to space or zero (depending on data type) if the element is not nullable. If a column containing an OCCURS DEPENDING ON clause is normalized and the record contains zero occurrences of the column, one row will be processed. The value used for the elements which were subject to the OCCURS DEPENDING ON clause will be null if the
3-6
element is nullable, or space or zero (depending on data type) it the element is not nullable.
Note Ascential DataStage does not flatten array columns that have redefined fields, even if you choose to flatten all arrays in the Complex file load option dialog box.
Pre-Sorting Data
Pre-sorting your source data can simplify processing in active stages where data transformations and aggregations may occur. Ascential DataStage allows you to pre-sort data loaded into Complex Flat File stages by utilizing the mainframe DFSORT utility during code generation. You specify the pre-sort criteria on the Pre-sort tab:
This tab is divided into two panes. The left pane displays the available control statements, and the right pane allows you to edit the pre-sort statement that will be added to the generated JCL. When you highlight an item in the Control statements list, a short description of the statement is displayed in the status bar at the bottom of the dialog box. To create a pre-sort statement, do one of the following: Double-click an item in the Control statements list to insert it into the Statement editor box. Type any valid control statement directly in the Statement editor text box.
3-7
The Control statements list contains the following items: SORT FIELDS. Describes the sort control fields in the input records. When you select SORT, the Select sort columns dialog box appears:
This is where you select the columns to sort by and the sort order. To move a column from the Available columns list to the Selected columns list, double-click the column name or highlight the column name and click >. To move all columns, click >>. Remove a column from the Selected columns list by doubleclicking the column name or highlighting the column name and clicking <. Remove all columns by clicking <<. Click Find to search for a particular column in either list. Array columns cannot be sorted and are unavailable for selection in the Available columns list. Columns containing VARCHAR, VARGRAPHIC_G, or VARGRAPHIC_N data are sorted based on the data field only; the two-byte length field is skipped. The sort uses the maximum size of the data field and operates in the same manner as a CHARACTER column sort. To specify the column sort order, click the Order field next to each column in the Selected columns list. There are two options:
Ascending. This is the default setting. Select this option to sort the input column data in ascending order. Descending. Select this option to sort the input column data in descending order.
Use the arrow buttons to the right of the Selected columns list to change the order of the columns being sorted. The first column is the primary sort column and any remaining columns are sorted secondarily.
3-8
When you are finished, click OK to close the Select sort columns dialog box. The selected columns and their sort order appear in the Statement editor box. ALTSEQ CODE. Changes the collating sequence of EBCDIC character data. INCLUDE COND. Specifies particular records to include. OMIT COND. Filters unwanted input records. RECORD TYPE. Specifies the type and length of records being processed. SUM FIELDS. Adds summary fields to the output data list. Click Help to see the complete syntax diagrams for these control statements. Ascential DataStage does not support the following control statements on the Pre-sort tab: DEBUG END INREC MERGE MODS OPTION OUTFIL OUTREC No syntax checking is performed on the statement entered. However, if you use an unsupported control statement, you may get an error when the job runs even though you will not get an error during code generation.
3-9
This tab contains the following fields: Normal EOJ handling. Contains the parameter for the disposition of the data file when job upload successfully completes. There are four options:
CATLG. Catalogs the data set. DELETE. Deletes the data set after job execution. KEEP Retains the data set, but does not catalog it. . PASS. Passes the data set to the next job step, but deletes it at the end of the job. This is the default.
Abnormal EOJ handling. Contains the parameter for the disposition of the data file when job upload does not complete successfully. There are three options:
CATLG. Catalogs the data set. DELETE. Deletes the data set. This is the default. KEEP Retains the data set, but does not catalog it. .
Unit. Specifies the device type of the disk on which the data is to be stored. The default value is SYSDA. Allocation type. Specifies the unit of allocation used when storage space is reserved for the file. There are two options:
3-10
CYL. Cylinder. This generally allocates a greater amount of storage space than TRK.
The exact size of a track or cylinder is device dependent. Primary allocation amount. Contains the number of tracks or cylinders to be reserved as the initial storage for the job. The minimum is 1 and the maximum is 32768. The default value is 10. Secondary allocation amount. Contains the number of tracks or cylinders to be reserved if the primary allocation is insufficient for the job. The minimum is 1 and the maximum is 32768. The default value is 10. Vol ser. The volume serial number of the unit where the file will be written. Up to six alphanumeric characters are allowed. Expiration date. Specifies the expiration date for a new data set in YYDDD or YYYY/DDD format. For expiration dates of January 1, 2000 or later, you must use the YYYY/DDD format. JCL extension variables can also be used. The YY can be from 01 to 99 or the YYYY can be from 1900 to 2155. The DDD can be from 000 to 365 for nonleap years or 000 to 366 for leap years. If you specify the current date or an earlier date, the data set is immediately eligible for replacement. Data sets with expiration dates of 99365, 99366, 1999/365 and 1999/366 are considered permanent and are never deleted or overwritten. Retention period. Specifies the number of days to retain a new data set. You can enter a number or use a JCL extension variable. When the job runs, this value is added to the current date to produce an expiration date, using 365-day years and 366-day leap years. Note that if the calculated expiration date is December 31, 1999, the expiration date is set to January 1, 2000.
Note You can specify either an expiration date or a retention period, but not both. When you enter a value in one of these fields, the other field becomes unavailable. No validation is done on either field; if you enter an incorrect value, JCL errors may occur.
These parameters are used during JCL generation. All fields except Vol ser, Expiration date, and Retention period are required.
links and the column definitions of the data are described on the Outputs page in the Complex Flat File Stage dialog box:
The Outputs page has the following field and four tabs: Output name. The name of the output link. Select the link you want to edit from the Output name drop-down list. This list displays all the output links from the Complex Flat File stage. If there is only one output link, the field is read-only. General. Contains an optional description of the link. Selection. This tab allows you to select columns to output data from. The Available columns list displays the columns loaded from the source file, and the Selected columns list displays the columns to be output from the stage.
Note If the Column push option is selected in Designer options, all stage column definitions are automatically propagated to each empty output link when you click OK to exit the stage. You do not need to select columns on the Selection tab, unless you want to output only a subset of them. However, if any stage columns are GROUP data type, the column push option works only if all members of the group are CHARACTER data type.
You can move a column from the Available columns list to the Selected columns list by double-clicking the column name or highlighting the column name and clicking >. To move all columns, click >>. You can remove single columns from the Selected columns list by double-clicking the column name or highlighting the column name and clicking <. Remove all columns by clicking <<. Click Find to locate a particular column.
3-12
You can select a group as one element if all elements of the group are CHARACTER data. If one or more elements of the group are of another type, then they must be selected separately. If a group item and its sublevel items are all selected, storage is allocated for the group item as well as each sublevel item. The Selected columns list displays the column name and SQL type for each column. Use the arrow buttons to the right of the Selected columns list to rearrange the order of the columns. Constraint. This tab is displayed by default. The Constraint grid allows you to define a constraint that filters your output data:
(. Select an opening parenthesis if needed. Column. Select a column or job parameter from the dropdown list. (Group columns cannot be used in constraint expressions and are not displayed.) Op. Select an operator or a logical function from the dropdown list. For information on using functions in constraint expressions, see "Constraints" on page A-2. Column/Value. Select a column or job parameter from the drop-down list, or double-click in the cell to enter a value. Character values must be enclosed in single quotation marks. ). Select a closing parenthesis if needed. Logical. Select AND or OR from the drop-down list to continue the expression in the next row.
All of these fields are editable. As you build the constraint expression, it appears in the Constraint field. When you are done building the expression, click Verify. If errors are found, you must either correct the expression, click Clear All to start over, or cancel. You cannot save an incorrect constraint. Ascential DataStage follows SQL guidelines on orders of operators in expressions. After you verify a constraint, any redundant parentheses may be removed. For details, see "Operators" on page A-16. Columns. This tab displays the output columns. It has a grid with the following columns:
Column name. The name of the column. Native type. The native data type. For more information about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types."
3-13
Length. The data precision. This is the number of characters for CHARACTER and GROUP data, and the total number of digits for numeric data types. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL and FLOAT data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. (Nullable columns are not supported in Complex Flat File stages.) Description. A text description of the column.
Column definitions are read-only on the Outputs page. You must go back to the Columns tab on the Stage page if you want to change the definitions. Click Save As to save the output columns as a table definition, a CFD file, or a DCLGen file.
Output Rows:
Row 1: Row 2: Row 3: FIELD-A FIELD-A FIELD-A FIELD-B (1) FIELD-B (2) FIELD-B (3)
3-14
Output Rows:
Row 1: Row 2: Row 3: Row 4: Row 5: Row 6: Row 7: Row 8: Row 9: Row 10: Row 11: Row 12: Row 13: Row 14: Row 15: FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-C (1, 1) FIELD-C (1, 2) FIELD-C (1, 3) FIELD-C (1, 4) FIELD-C (1, 5) FIELD-C (2, 1) FIELD-C (2, 2) FIELD-C (2, 3) FIELD-C (2, 4) FIELD-C (2, 5) FIELD-C (3, 1) FIELD-C (3, 2) FIELD-C (3, 3) FIELD-C (3, 4) FIELD-C (3, 5)
3-15
Output Rows:
Row 1: Row 2: Row 3: Row 4: Row 5: FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-B (1) FIELD-B (2) FIELD-B (3) FIELD-B (1) FIELD-B (2) FIELD-C (1) FIELD-C (2) FIELD-C (3) FIELD-C (4) FIELD-C (5)
Output Rows:
Row 1: Row 2: Row 3: Row 4: Row 5: Row 6: Row 7: Row 8: Row 9: Row 10: Row 11: Row 12: Row 13: Row 14: Row 15: FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-A FIELD-C (1, 1) FIELD-C (1, 2) FIELD-C (1, 3) FIELD-C (1, 4) FIELD-C (1, 1) FIELD-C (2, 1) FIELD-C (2, 2) FIELD-C (2, 3) FIELD-C (2, 4) FIELD-C (2, 1) FIELD-C (3, 1) FIELD-C (3, 2) FIELD-C (3, 3) FIELD-C (3, 4) FIELD-C (3, 1) FIELD-E (1, 1) FIELD-E (1, 2) FIELD-E (1, 3) FIELD-E (1, 4) FIELD-E (1, 5) FIELD-E (2, 1) FIELD-E (2, 2) FIELD-E (2, 3) FIELD-E (2, 4) FIELD-E (2, 5) FIELD-E (1, 1) FIELD-E (1, 2) FIELD-E (1, 3) FIELD-E (1, 4) FIELD-E (1, 5)
3-16
Notice that some of the subscripts repeat. In particular, those that are smaller than the largest OCCURS value at each level start over, including the second subscript of FIELD-C and the first subscript of FIELD-E.
3-17
3-18
4
Multi-Format Flat File Stages
This chapter describes Multi-Format Flat File stages, which are used to read data from files containing multiple record types. The source data may contain one or more GROUP REDEFINES, OCCURS or OCCURS , DEPENDING ON clauses.
4-1
This dialog box has two pages: Stage. Displays the stage name, which can be edited. This page has four tabs. The General tab is where you specify details about the source data file, including:
File name. Type the name of the mainframe source file to read data from. Generate an end-of-data row. Select this check box to add an end-of-data indicator after the last row is processed on each output link. The indicator is a built-in variable called ENDOFDATA which has a value of TRUE, meaning the last row of data has been processed. (See "ENDOFDATA" on page A-20 for more information on using this variable). In addition, all columns are set to null. DD name. Type the data definition name of the file in the JCL. This can be 1 to 8 alphanumeric characters and the first character must be alphabetic. The default name is DDn, where n is the internal job number. You can edit this name. Access type. Select the access type of the source file from the drop-down list. There are four choices: QSAM_SEQ_COMPLEX. QSAM file structure. VSAM_ESDS. VSAM Entry-Sequenced Data Set file structure. VSAM_KSDS. VSAM Key-Sequenced Data Set file structure. If this is selected, at least one column must be defined as a Key. VSAM_RRDS. Relative Record Data Set file structure.
Start row. Select First row to read the source file starting with the first row, or Row number to start reading from a specific row number. Type a whole number in the Row number field, which has a default value of 1. There is no maximum. End row. Select Last row to stop reading the source file after the last row, or Row number to stop after a specific row number. Type a whole number in the Row number field, which has a default value of 1. There is no maximum. Block type. Select the block type of the source file. The default is Variable block file, which indicates that the source file contains variable record lengths. Multi-Format Flat File stages can also be used to read fixed-block files, which contain records of the same length. Maximum file record size. Specify the maximum record size in the source file. The size must be greater than or equal to the storage length of the largest record in the source file,
4-2
regardless of whether that record is loaded into the stage. If no value is specified, it is set to the storage length of the largest record loaded into the stage after clicking OK.
Description. Enter an optional description, which will appear in the generated COBOL program.
The Records tab is where you specify the record definitions for the source data. See "Specifying Stage Record Definitions" on page 4-3 for details on defining or loading record definitions. The Records ID tab allows you to specify record ID constraints. See "Specifying Record ID Constraints" on page 4-7 for details. The Records view tab displays specialized information about the record types in your source file, including the COBOL PICTURE clause, the starting and ending offsets, and the storage length of each record. You can right-click to save the records view layout as an HTML file. Outputs. Specifies the column definitions for the data output links. Click OK to close this dialog box. Changes are saved when you save the job.
4-3
The Records tab lists the record definitions on the left and the columns associated with each record on the right:
To create a new record type, do one of the following: Click New record. Right-click in the left pane and select New record from the shortcut menu. A new record is created with the default name of NEWRECORD. You can edit this name either by double-clicking the name or choosing Rename from the shortcut menu. Record names cannot be COBOL reserved words (see Appendix H, "Reserved Words" for a list). Select the Master check box if the record is the master. Only one master record is permitted. Once you have created a record, you can manually enter column definitions in the Columns grid, or click Load to selectively load column definitions from a table definition in the Repository. The Columns grid displays the column information associated with the selected record definition, including: Level number. The COBOL level number where the data is defined. If no level number is given, a default value of 05 is assigned. Column name. The name of the column. Key. This field is required if the access type of the source file is VSAM_KSDS. Native type. The native data type. For details about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types."
4-4
Length. The data precision. This is the number of characters for CHARACTER and GROUP data, and the total number of digits for numeric data types. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL and FLOAT data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. (Nullable columns are not supported in Multi-Format Flat File stages.) Description. A text description of the column. To edit column definitions, type directly in the grid or select Edit Row from the shortcut menu. This brings up the Edit Column Meta Data dialog box, allowing you to enter COBOL-specific column information. For details on using this dialog box see Appendix D, "Editing Column Meta Data." To remove a record definition and its columns, select the record name in the left pane and click Clear All.
This option is available when you load columns from a simple or complex flat file. It allows you to collapse sequences of unselected columns into FILLER items with the appropriate size. The data type will be set to CHARACTER and the name set to FILLER_XX_YY, where XX is the start offset and YY is the end offset. This leads to more efficient use of space and time and easier comprehension for users.
4-5
Record definitions and columns displayed here should reflect the actual layout of the source file. Even though you may not want to output every column, all columns in the file layout, including fillers, should appear here. You select the columns to output from the stage on the Outputs page.
Array Handling
If you load a file containing arrays, the Complex file load option dialog box appears:
This dialog box offers the following options: Normalize all arrays. Presents the data as multiple rows at execution time with one row for each column in the array. This is the default. Flatten all arrays. Creates new columns for each element of the array and presents the data as one row at execution time. Flatten selective arrays. Allows you to choose whether to flatten or normalize arrays on an individual basis. Use the right mouse button to select Flatten or Normalize. The array icon changes for the arrays you select to flatten. Columns containing OCCURS DEPENDING ON clauses are always normalized in Multi-Format Flat File stages, regardless of your selection on the Complex file load option dialog box. Only the used occurrences are output from the stage.
Note Ascential DataStage does not flatten array columns that have redefined fields, even if you choose to flatten all arrays in the Complex file load option dialog box.
4-6
Columns identified in the record ID clause must be in the same physical storage location across records. Specify the constraint using the following fields: (. Select an opening parenthesis if needed. Column. Select the record ID column from the drop-down list, which displays all columns from the selected record type. Op. Select an operator from the drop-down list. Column/Value. Type the identifying value for the record ID column. Character values must be enclosed in single quotation marks. ). Select a closing parenthesis if needed. Logical. Select AND or OR from the drop-down list to continue the expression in the next row. All of these fields are editable. As you build the constraint expression, it appears in the Constraint field. When you are done building the expression, click Verify. If errors are found, you must either correct the expression, click Clear All to start over, or cancel. You cannot save an incorrect constraint. Ascential DataStage follows SQL guidelines on orders of operators in expressions. After you verify a constraint, any redundant parentheses may be removed. For details, see "Operators" on page A-16.
4-7
The Outputs page has the following field and four tabs: Output name. The name of the output link. Select the link you want to edit from the Output name drop-down list. This list displays all the output links from the Multi-Format Flat File stage. If there is only one output link, the field is read-only. General. Contains an optional description of the link. Selection. Displayed by default. This tab allows you to select columns to output from multiple record types. The Available columns list displays the record definitions loaded into the stage and their corresponding columns, and the Selected columns list displays the columns to be output from the stage.
Note The Column push option does not operate in MultiFormat Flat File stages. Even if you have this option selected in Designer options, you must select columns to output from the stage on the Selection tab.
You can move a column from the Available columns list to the Selected columns list by double-clicking the column name or highlighting the column name and clicking >. Move all columns
4-8
from a single record definition by highlighting the record name or any of its columns and clicking >>. You can remove columns from the Selected columns list by double-clicking the column name or highlighting the column name and clicking <. Remove all columns by clicking <<. Click Find to locate a particular column. You can select a group as one element if all elements of the group are CHARACTER data. If one or more elements of the group are of another type, then they must be selected separately. If a group item and its sublevel items are all selected, storage is allocated for the group item as well as each sublevel item. The Selected columns list displays the column name, record name, SQL type, and alias for each column. You can edit the alias to rename output columns since their names must be unique. Use the arrow buttons to the right of the Selected columns list to rearrange the order of the columns. Constraint. This tab allows you to optionally define a constraint that filters your output data:
(. Select an opening parenthesis if needed. Column. Select a column or job parameter from the dropdown list. (Group columns cannot be used in constraint expressions and are not displayed.) Op. Select an operator or a logical function from the dropdown list. For information on using functions in constraint expressions, see "Constraints" on page A-2
4-9
Column/Value. Select a column or job parameter from the drop-down list, or double-click in the cell to enter a value. Character values must be enclosed in single quotation marks. ). Select a closing parenthesis if needed. Logical. Select AND or OR from the drop-down list to continue the expression in the next row.
All of these fields are editable. As you build the constraint expression, it appears in the Constraint field. Click the Default button to set the constraint to match the record ID constraint on the Records ID tab for those records selected as output. The Default button is available only when the Constraint grid is empty. When you are done building the expression, click Verify. If errors are found, you must either correct the expression, click Clear All to start over, or cancel. You cannot save an incorrect constraint. Ascential DataStage follows SQL guidelines on orders of operators in expressions. After you verify a constraint, any redundant parentheses may be removed. For details, see "Operators" on page A-16. Columns. This tab displays the output columns. It has a grid with the following columns:
Column name. The name of the column. Native type. The native data type. For more information about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHARACTER and GROUP data, and total number of digits for numeric data types. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL and FLOAT data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. (Nullable columns are not supported in Multi-Format Flat File stages.) Description. A text description of the column.
Column definitions are read-only on the Outputs page. You must go back to the Records tab on the Stage page if you want to change the definitions. Click Save As to save the output columns as a table definition, a CFD file, or a DCLGen file.
4-10
4-11
4-12
5
IMS Stages
This chapter describes IMS stages, which are used to read data from IMS databases.
5-1
IMS Stages
This dialog box has two pages: Stage. Displays the stage name, which can be edited. This page has two tabs:
The General tab allows you to enter an optional description of the stage, which appears in the generated COBOL program. Select the Generate an end-of-data row check box to add an end-of-data indicator after the last row is processed on each output link. The indicator is a built-in variable called ENDOFDATA which has a value of TRUE, meaning the last row of data has been processed. (See "ENDOFDATA" on page A-20 for more information on using this variable). In addition, all columns are set to null.
The View tab allows you to specify details about the IMS source file and view its hierarchy:
It contains the following fields: IMS id. Type the name of the IMS subsystem. This field is required. PSB. Select the Program Specification Block that defines the view of the IMS database. The drop-down list displays those PSBs imported into the Manager which contain at least one PCB for IMS database retrieval. This field is required. PCB. Select the Program Communication Block that is associated with the PSB you selected. The drop-down list displays all PCBs imported into the Manager that allow for retrieval from the IMS database. This field is required.
5-2
IMS Stages
Note If there are multiple IMS stages in a job, they must use the same IMS id and PSB. They can use different PCBs.
Segment hierarchy view. Contains a diagram of the PCB segment hierarchy. The diagram is not editable. You can view details for individual segments by placing your cursor over a segment until a ToolTip appears, or you can view the entire hierarchy in detailed mode by selecting Details from the shortcut menu. Detailed mode displays the name of the associated table, its record length, and the segment key field. Outputs. Specifies the column definitions for the data output link. Click OK to close this dialog box. Changes are saved when you save the job.
The Outputs page has the following field and six tabs: Output name. The name of the output link. Since only one output link is allowed, the link name is read-only. General. Contains an optional description of the output link.
5-3
IMS Stages
Path. Allows you to select a hierarchical path of segments to output data from. The columns from the segments you select become available for output on the Selection tab. The diagram displays the segments of the PCB you selected on the View tab. Each segment represents a DataStage table and its associated columns. You can view details for individual segments by placing your cursor over a segment until a ToolTip appears. To view the entire segment hierarchy in detailed mode, right-click and select Details. The segment name, associated table name, record length, and key field are displayed. You can place your cursor over the table name to view its location in the Manager. Select a segment by clicking a box in the diagram. If you select a child segment, all of its parent segments are also selected. Once selected, the background color of a segment and its parent segments turns blue. To clear the selection of a segment, click it again. The background color of the segment and its child segments returns to white. The Process partial paths check box determines how paths are processed. By default this box is not selected, meaning only complete paths are processed. Complete paths are those path occurrences where all the segments of the path exist. If this box is selected, then path occurrences with missing children (called partial paths) are processed. The columns for the missing children are initialized to zeros and spaces. Note that when a segment is missing, all the segments below it are missing as well. The flexibility of doing partial path processing may come at the expense of some efficiency. Depending on the IMS database, it may be more efficient to do complete path processing. This is because the data for all segments in a complete path can often be returned to the program with a single IMS call. For partial paths, separate IMS calls must be made for each segment.
Note Ascential DataStage always uses path processing for efficiency, as long as your IMS database supports it and you have not selected Process partial paths.
Select Flatten all arrays if you want to flatten arrays in the source file. New columns are created for each array element and the data is presented as one row at execution time. If this box is not selected, any arrays in the source file are normalized and the data is presented as multiple rows at execution time, with one row for each column in the array.
5-4
IMS Stages
Segments view. Displays column information for the tables associated with selected segments. The left pane displays the segments you selected on the Path tab, and the right pane displays the COBOL PICTURE clause, the starting and ending offsets, and the storage length of each column in its associated table. Right-click in the right pane to save the segment view layout as an HTML file. Selection. This tab allows you to select output columns from the segments in the selected path. The Available columns list displays the columns from the segments you selected on the Path tab, and the Selected columns list displays the columns to be output from the stage.
Note The Column push option does not operate in IMS stages. Even if you have this option selected in Designer options, you must select columns to output from the stage on the Selection tab.
You can move a column from the Available columns list to the Selected columns list by double-clicking the column name or highlighting the column name and clicking >. Move all columns from a single segment by highlighting the segment name or any of its columns and clicking >>. You can remove columns from the Selected columns list by double-clicking the column name or highlighting the column name and clicking <. Remove all columns by clicking <<. Click Find to locate a particular column. You can select a group as one element if all elements of the group are CHARACTER data. If one or more elements of the group are of another type, then they must be selected separately. If a group
5-5
IMS Stages
item and its sublevel items are all selected, storage is allocated for the group item as well as each sublevel item. The Selected columns list displays the column name, segment name, SQL type, and alias for each column. You can edit the alias to rename output columns since their names must be unique. Use the arrow buttons to the right of the Selected columns list to rearrange the order of the columns. Constraint. This tab allows you to optionally define a constraint that filters your output data:
(. Select an opening parenthesis if needed. Column. Select a column or job parameter from the dropdown list. If you select a column that corresponds to a field defined to IMS, the constraint expression is optimized so that IMS evaluates it. This may result in faster and more efficient processing. (Group columns cannot be used in constraint expressions and are not displayed.) Op. Select an operator or a logical function from the dropdown list. For information on using functions in constraint expressions, see "Constraints" on page A-2 Column/Value. Select a column or job parameter from the drop-down list, or double-click in the cell to enter a value. Character values must be enclosed in single quotation marks. ). Select a closing parenthesis if needed.
5-6
IMS Stages
Logical. Select AND or OR from the drop-down list to continue the expression in the next row.
All of these fields are editable. As you build the constraint expression, it appears in the Constraint field. When you are done building the expression, click Verify. If errors are found, you must either correct the expression, click Clear All to start over, or cancel. You cannot save an incorrect constraint. Ascential DataStage follows SQL guidelines on orders of operators in expressions. After you verify a constraint, any redundant parentheses may be removed. For details, see "Operators" on page A-16. Columns. This tab displays the output columns. It has a grid with the following columns:
Column name. The name of the column. Native type. The native data type. For more information about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHARACTER and GROUP data, and total number of digits for numeric data types. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL and FLOAT data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. (Nullable columns are not supported in IMS stages.) Description. A text description of the column.
Column definitions are read-only on the Outputs page. If you want to change the definitions, use the Table Definition dialog box to edit the associated table definition in the Repository. Click Save As to save the output columns as a table definition, a CFD file, or a DCLGen file.
5-7
IMS Stages
5-8
6
Fixed-Width Flat File Stages
This chapter describes Fixed-Width Flat File stages, which are used to read data from or write data to a simple flat file. A simple flat file does not contain GROUP REDEFINES, OCCURS, or OCCURS DEPENDING , ON clauses.
6-1
When you edit a Fixed-Width Flat File stage, the Fixed-Width Flat File Stage dialog box appears:
This dialog box can have up to three pages, depending on whether there are inputs to and outputs from the stage: Stage. Displays the stage name, which can be edited. This page has up to five tabs, based on whether the stage is being used as a source or a target. The General tab allows you to specify the data file name, DD name, write option, and starting and ending rows. You can also enter an optional description of the stage, which appears in the generated COBOL program.
The File name field is the mainframe file from which data will be read (when the stage is used as a source) or to which data will be written (when the stage is used as a target). Generate an end-of-data row. Appears only when the stage is used as a source. Select this check box to add an end-of-data indicator after the last row is processed on each output link. The indicator is a built-in variable called ENDOFDATA which has a value of TRUE, meaning the last row of data has been processed. (See "ENDOFDATA" on page A-20 for more information on using this variable). In addition, all columns are set to null. The DD name field is the data definition name of the file in the JCL. It can be 1 to 8 alphanumeric characters and the first character must be alphabetic.
6-2
The Write option field in a target stage allows you to select how to place the data in the target file. The available options are: Create a new file. Creates a new file without checking to see if one already exists. This is the default. Append to existing file. Adds data to the existing file. Overwrite existing file. Deletes the existing file and replaces it with a new file. Delete and recreate existing file. Deletes the existing file if it has already been cataloged and recreates it.
Start row. Select First row to read the source file starting with the first row, or Row number to start reading from a specific row number. Type a whole number in the Row number field, which has a default value of 1. There is no maximum. End row. Select Last row to stop reading the source file after the last row, or Row number to stop after a specific row number. Type a whole number in the Row number field, which has a default value of 1. There is no maximum.
The Columns tab is where you specify the stage column definitions. See "Specifying Stage Column Definitions" on page 6-4 for details on defining or loading column definitions. The File view tab displays specialized information about the stage columns, including the COBOL PICTURE clause, the starting and ending offsets, and the storage length of each column. You can right-click to save the file view layout as an HTML file. The Pre-sort tab appears only when the stage is used as a source. It allows you to pre-sort your source data before passing it to the next stage in the job design. See "Pre-Sorting Data" on page 6-5 for details on creating the sort control statement. The Options tab is available in source stages if you have chosen to pre-sort the source data, or in target stages if you have chosen to create a new file, or delete and recreate an existing file, in the Write option field. See "Specifying Target File Parameters" on page 6-9 for details on setting these options. Inputs. Specifies the column definitions for the data input links. Outputs. Specifies the column definitions for the data output links. Click OK to close this dialog box. Changes are saved when you save the job.
6-3
6-4
This option is available when you load columns from a simple or complex flat file. It allows you to collapse sequences of unselected columns into FILLER items with the appropriate size. The data type will be set to CHARACTER and the name set to FILLER_XX_YY, where XX is the start offset and YY is the end offset. This leads to more efficient use of space and time and easier comprehension for users. Columns displayed here should reflect the actual layout of the source file. Even though you may not want to output every column, all of the columns of the file layout, including fillers, should appear here. You select the columns to output from the stage on the Outputs page.
Pre-Sorting Data
Pre-sorting your source data can simplify processing in active stages where data transformations and aggregations may occur. Ascential DataStage allows you to pre-sort data loaded into Fixed-Width Flat
6-5
File stages by utilizing the mainframe DFSORT utility during code generation. You specify the pre-sort criteria on the Pre-sort tab:
This tab is divided into two panes. The left pane displays the available control statements, and the right pane allows you to edit the pre-sort statement that will be added to the generated JCL. When you highlight an item in the Control statements list, a short description of the statement is displayed in the status bar at the bottom of the dialog box. To create a pre-sort statement, do one of the following: Double-click an item in the Control statements list to insert it into the Statement editor box. Type any valid control statement directly in the Statement editor text box.
6-6
The Control statements list contains the following items: SORT FIELDS. Describes the sort control fields in the input records. When you select SORT, the Select sort columns dialog box appears:
This is where you select the columns to sort by and the sort order. To move a column from the Available columns list to the Selected columns list, double-click the column name or highlight the column name and click >. To move all columns, click >>. Remove a column from the Selected columns list by doubleclicking the column name or highlighting the column name and clicking <. Remove all columns by clicking <<. Click Find to search for a particular column in either list. Array columns cannot be sorted and are unavailable for selection in the Available columns list. To specify the column sort order, click the Order field next to each column in the Selected columns list. There are two options:
Ascending. This is the default setting. Select this option to sort the input column data in ascending order. Descending. Select this option to sort the input column data in descending order.
Use the arrow buttons to the right of the Selected columns list to change the order of the columns being sorted. The first column is the primary sort column and any remaining columns are sorted secondarily. When you are finished, click OK to close the Select sort columns dialog box. The selected columns and their sort order appear in the Statement editor box. ALTSEQ CODE. Changes the collating sequence of EBCDIC character data.
6-7
INCLUDE COND. Specifies particular records to include. OMIT COND. Filters unwanted input records. RECORD TYPE. Specifies the type and length of records being processed. SUM FIELDS. Adds summary fields to the output data list. Click Help to see the complete syntax diagrams for these control statements. Ascential DataStage does not support the following control statements on the Pre-sort tab: DEBUG END INREC MERGE MODS OPTION OUTFIL OUTREC No syntax checking is performed on the statement entered. However, if you use an unsupported control statement, you may get an error when the job runs even though you will not get an error during code generation.
6-8
This tab contains the following fields: Normal EOJ handling. Contains the parameter for the disposition of the data file when job upload successfully completes. There are four options:
CATLG. Catalogs the data set. DELETE. Deletes the data set after job execution. KEEP Retains the data set, but does not catalog it. . PASS. Passes the data set to the next job step, but deletes it at the end of the job. This is the default.
Abnormal EOJ handling. Contains the parameter for the disposition of the data file when job upload does not complete successfully. There are three options:
CATLG. Catalogs the data set. DELETE. Deletes the data set. This is the default. KEEP Retains the data set, but does not catalog it. .
Unit. Specifies the device type of the disk on which the data is to be stored. The default value is SYSDA. Allocation type. Specifies the unit of allocation used when storage space is reserved for the file. There are two options:
6-9
CYL. Cylinder. This generally allocates a greater amount of storage space than TRK.
The exact size of a track or cylinder is device dependent. Primary allocation amount. Contains the number of tracks or cylinders to be reserved as the initial storage for the job. The minimum is 1 and the maximum is 32768. The default value is 10. Secondary allocation amount. Contains the number of tracks or cylinders to be reserved if the primary allocation is insufficient for the job. The minimum is 1 and the maximum is 32768. The default value is 10. Vol ser. The volume serial number of the unit where the file will be written. Up to six alphanumeric characters are allowed. Expiration date. Specifies the expiration date for a new data set in YYDDD or YYYY/DDD format. For expiration dates of January 1, 2000 or later, you must use the YYYY/DDD format. JCL extension variables can also be used. The YY can be from 01 to 99 or the YYYY can be from 1900 to 2155. The DDD can be from 000 to 365 for nonleap years or 000 to 366 for leap years. If you specify the current date or an earlier date, the data set is immediately eligible for replacement. Data sets with expiration dates of 99365, 99366, 1999/365 and 1999/366 are considered permanent and are never deleted or overwritten. Retention period. Specifies the number of days to retain a new data set. You can enter a number or use a JCL extension variable. When the job runs, this value is added to the current date to produce an expiration date, using 365-day years and 366-day leap years. Note that if the calculated expiration date is December 31, 1999, the expiration date is set to January 1, 2000.
Note You can specify either an expiration date or a retention period, but not both. When you enter a value in one of these fields, the other field becomes unavailable. No validation is done on either field; if you enter an incorrect value, JCL errors may occur.
These parameters are used during JCL generation. All fields except Vol ser, Expiration date, and Retention period are required.
column definitions of the data are described on the Inputs page of the Fixed-Width Flat File Stage dialog box:
The Inputs page has the following field and two tabs: Input name. The names of the input links to the Fixed-Width Flat File stage. Use this drop-down menu to select which set of input data you wish to view. General. Contains an optional description of the selected link. Columns. Contains the column definitions for the data being written to the file. This tab has a grid with the following columns:
Column name. The name of the column. Native type. The native data type. For more information about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHARACTER data and the total number of digits for numeric data types. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL and FLOAT data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
Column definitions are read-only on the Inputs page in the FixedWidth Flat File stage. You must go back to the Columns tab on the Stage page if you want to make changes.
6-11
If the stage has multiple input links, the columns on all the input links should be the same as the stage columns.
This dialog box has the following field and four tabs: Output name. This drop-down list contains names of all output links from the stage. If there is only one output link, this field is read-only. When there are multiple output links, select the one you want to edit before modifying the data. Selection. This tab allows you to select columns to output data from. The Available columns list displays the columns loaded from the source file, and the Selected columns list displays the columns to be output from the stage.
Note If the Column push option is selected in Designer options, all stage column definitions are automatically propagated to each empty output link when you click OK to exit the stage. You do not need to select columns on the Selection tab, unless you want to output only a subset of them.
You can move a column from the Available columns list to the Selected columns list by double-clicking the column name or
6-12
highlighting the column name and clicking >. To move all columns, click >>. You can remove single columns from the Selected columns list by double-clicking the column name or highlighting the column name and clicking <. Remove all columns by clicking <<. Click Find to locate a particular column. The Selected columns list displays the column name and SQL type for each column. Use the arrow buttons to the right of the Selected columns list to rearrange the order of the columns. Constraint. This tab is displayed by default. The Constraint grid allows you to define a constraint that filters your output data:
(. Select an opening parenthesis if needed. Column. Select a column or job parameter from the dropdown list. Op. Select an operator or a logical function from the dropdown list. For information on using functions in constraint expressions, see "Constraints" on page A-2. Column/Value. Select a column or job parameter from the drop-down list, or double-click in the cell to enter a value. Character values must be enclosed in single quotation marks. ). Select a closing parenthesis if needed. Logical. Select AND or OR from the drop-down list to continue the expression in the next row.
All of these fields are editable. As you build the constraint expression, it appears in the Constraint field. When you are done building the expression, click Verify. If errors are found, you must either correct the expression, click Clear All to start over, or cancel. You cannot save an incorrect constraint. Ascential DataStage follows SQL guidelines on orders of operators in expressions. After you verify a constraint, any redundant parentheses may be removed. For details, see "Operators" on page A-16. Columns. This tab displays the output columns. It has a grid with the following columns:
Column name. The name of the column. Native type. The native data type. For information about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHARACTER data and the total number of digits for numeric data types.
6-13
Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL and FLOAT data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
Column definitions are read-only on the Outputs page. You must go back to the Columns tab on the Stage page if you want to change the definitions. Click Save As to save the output columns as a table definition, a CFD file, or a DCLGen file.
6-14
7
Delimited Flat File Stages
This chapter describes Delimited Flat File stages, which are used to read data from or write data to delimited flat files.
7-1
When you edit a Delimited Flat File stage, the Delimited Flat File Stage dialog box appears:
This dialog box can have up to three pages, depending on whether there are inputs to and outputs from the stage: Stage. Displays the name of the stage, which can be edited. This page has up to four tabs, based on whether the stage is being used as a source or a target. The General tab displays the basic characteristics of the stage. You can also enter an optional description of the stage, which appears in the generated COBOL program.
The File name field is the mainframe file from which data will be read (when the stage is used as a source) or to which data will be written (when the stage is used as a target). Generate an end-of-data row. Appears only when the stage is used as a source. Select this check box to add an end-of-data indicator after the last row is processed on each output link. The indicator is a built-in variable called ENDOFDATA which has a value of TRUE, meaning the last row of data has been processed. (See "ENDOFDATA" on page A-20 for more information on using this variable). In addition, all columns are set to null. The DD name field is the data definition name of the file in the JCL. It can be 1 to 8 alphanumeric characters and the first character must be alphabetic.
7-2
The Write option field allows you to specify how to write data to the target file. There are four options: Create a new file. Creates a new file without checking to see if one already exists. This is the default. Append to existing file. Adds data to the existing file. Overwrite existing file. Deletes the existing file and replaces it with a new file. Delete and recreate existing file. Deletes the existing file if it has already been cataloged and recreates it.
Start row. Appears when the stage is used as a source. Select First row to read the source file starting with the first row, or Row number to start reading from a specific row number. Type a whole number in the Row number field, which has a default value of 1. There is no maximum. End row. Appears when the stage is used as a source. Select Last row to stop reading the source file after the last row, or Row number to stop after a specific row number. Type a whole number in the Row number field, which has a default value of 1. There is no maximum.
The Columns tab is where you specify the column definitions for the data used in the stage. See "Specifying Stage Column Definitions" on page 7-3 for details on defining or loading column definitions. The Format tab allows you to specify delimiter information for the source or target file. See "Specifying Delimiter Information" on page 7-5 for details on specifying the file format. The Options tab appears if you have chosen to create a new file, or delete and recreate an existing file, in the Write option field. See "Specifying Target File Parameters" on page 7-7 for details on specifying these options. Inputs. Specifies the column definitions for the data input links. Outputs. Specifies the column definitions for the data output links. If the output is to an FTP stage, displays only the name and an optional description of the link. Click OK to close this dialog box. Changes are saved when you save the job.
File stages. These column definitions are then projected to the Inputs page when the stage is used as a target, the Outputs page when the stage is used as a source, or both pages if the stage is being used to land intermediate files. The Columns tab contains a grid with the following columns: Column name. The name of the column. Native type. The native data type. For details about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHAR data, the maximum number of characters for VARCHAR data, and the total number of digits for numeric data types. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL data, and zero for all other data types. Description. A text description of the column. You can Load columns from a table definition in the Repository, or enter column definitions manually and click Save As to save them as a table definition, a CFD file, or a DCLGen file. Click Clear All to start over. For details on editing column definitions, see Appendix D, "Editing Column Meta Data." If a complex flat file is loaded, the incoming file is flattened and REDEFINE and GROUP columns are removed. Array and OCCURS DEPENDING ON columns are flattened to the maximum size. All level numbers are set to zero.
7-4
You define the column and string delimiters for the source or target file in the Delimiter area. Delimiters must be single-byte, printable characters. Possible delimiters include: A character, such as a comma. An ASCII code in the form of a three-digit decimal number, from 000 to 255. A hexadecimal code in the form &Hxx or &hxx, where x is a hexadecimal digit (09, af, AF). The Delimiter area contains the following fields: Column. Specifies the character that separates the data fields in the file. By default this field contains a comma. Column delimiter precedes line delimiter. Indicates whether there is a delimiter after the last column. Select this check box to specify that a column delimiter always precedes a new line. String. Specifies the character used to enclose strings. By default this field contains a double quotation mark. String delimiters are handled in the following manner:
In source stages string delimiters are removed when the source data is read. If the source data contains the string delimiter character, each occurrence of the extra delimiter is removed. For example, if the source data is abc and the string delimiter is a double quotation mark, the result will be abc If the source data is abc, the result will be abc. .
7-5
In target stages string delimiters are generated only if the data contains the column or string delimiter character itself. For example, if delimited target data contains the string delimiter character, the output will contain a duplicate string delimiter in each place where the delimiter appears. If the data is abc and the string delimiter is a double quotation mark, the result will be abc If the data is abc, the result will be abc. . Similarly, if the target data contains the column delimiter character, the output is enclosed with a string delimiter. In this case, if the data is ab,c and the column delimiter is a comma, then the output will be ab,c assuming the string delimiter is a double quotation mark.
Always delimit string data. Select this check box to always generate string delimiters in target stages, regardless of whether the data contains the column delimiter character or not. The Source defaults area allows you to set additional options for delimited files. It contains the following fields: NULL string. Specifies characters to interpret as an SQL null value in a source file. Columns containing these characters are initialized to zero or spaces, depending on the data type. Padding. Specifies the character used to pad missing columns in a source file. The default value is #. Missing column action. Specifies the action to take when a column is missing from the source data. The options are:
Pad with NULL value. Missing columns are written as null values and are initialized to zero or spaces, depending on the data type. This is the default. Pad with empty value. Missing columns are written as an empty string.
There are two check boxes at the bottom of the Format tab: First line is column names. Select this check box if the first row of data in the source file contains the column names. Suppress row truncation warnings. If the source file contains more columns than what is defined on the Stage page, this field allows you to block warning messages about overlong rows during run time. By default this check box is selected. When the stage is used as a source, all fields on the Format tab are available except Always delimit string data. When the stage is used as a target, only the Delimiter area is available.
7-6
This tab contains the following fields: Normal EOJ handling. Contains the parameter for the disposition of the data file when job execution successfully completes. There are four options:
CATLG. Catalogs the data set. This is the default. DELETE. Deletes the data set after job execution. KEEP Retains the data set, but does not catalog it. . PASS. Passes the data set to an FTP job step, but deletes it at the end of the job.
Abnormal EOJ handling. Contains the parameter for the disposition of the data file when job execution does not complete successfully. There are three options:
CATLG. Catalogs the data set. DELETE. Deletes the data set. This is the default. KEEP Retains the data set, but does not catalog it. .
Unit. Specifies the device type of the disk on which the data is to be stored. The default value is SYSDA. Allocation type. Specifies the unit of allocation used when storage space is reserved for the file. There are two options:
7-7
CYL. Cylinder. This generally allocates a greater amount of storage space than TRK.
The exact size of a track or cylinder is device dependent. Primary allocation amount. Contains the number of tracks or cylinders to be reserved as the initial storage for the job. The minimum is 1 and the maximum is 32768. The default value is 10. Secondary allocation amount. Contains the number of tracks or cylinders to be reserved if the primary allocation is insufficient for the job. The minimum is 1 and the maximum is 32768. The default value is 10. Vol ser. The volume serial number of the unit where the file will be written. Up to six alphanumeric characters are allowed. Expiration date. Specifies the expiration date for a new data set in YYDDD or YYYY/DDD format. For expiration dates of January 1, 2000 or later, you must use the YYYY/DDD format. JCL extension variables can also be used. The YY can be from 01 to 99 or the YYYY can be from 1900 to 2155. The DDD can be from 000 to 365 for nonleap years or 000 to 366 for leap years. If you specify the current date or an earlier date, the data set is immediately eligible for replacement. Data sets with expiration dates of 99365, 99366, 1999/365 and 1999/366 are considered permanent and are never deleted or overwritten. Retention period. Specifies the number of days to retain a new data set. You can enter a number or use a JCL extension variable. When the job runs, this value is added to the current date to produce an expiration date, using 365-day years and 366-day leap years. Note that if the calculated expiration date is December 31, 1999, the expiration date is set to January 1, 2000.
Note You can specify either an expiration date or a retention period, but not both. When you enter a value in one of these fields, the other field becomes unavailable. No validation is done on either field; if you enter an incorrect value, JCL errors may occur.
These parameters are used during JCL generation. All fields except Vol ser, Expiration date, and Retention period are required.
column definitions of the data are described on the Inputs page of the Delimited Flat File Stage dialog box:
The Inputs page has the following field and two tabs: Input name. The names of the input links to the Delimited Flat File stage. Use this drop-down menu to select which set of input data you wish to view. General. Contains an optional description of the selected link. Columns. Displayed by default. Contains the column definitions for the data being written to the file. This tab has a grid with the following columns:
Column name. The name of the column. Native type. The native data type. For information about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHAR data, the maximum number of characters for VARCHAR data, and the total number of digits for numeric data types. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL data, and zero for all other data types. Description. A text description of the column.
Column definitions are read-only on the Inputs page in the Delimited Flat File stage. You must go back to the Columns page on the Stage page to make any changes.
7-9
The Outputs page has the following field and four tabs: Output name. This drop-down list contains names of all output links from the stage. If there is only one output link, this field is read-only. When there are multiple output links, select the one you want to edit before modifying the data. Selection. This tab allows you to select columns to output data from. The Available columns list displays the columns loaded from the source file, and the Selected columns list displays the columns to be output from the stage.
Note If the Column push option is selected in Designer options, all stage column definitions are automatically propagated to each empty output link when you click OK to exit the stage. You do not need to select columns on the Selection tab, unless you want to output only a subset of them.
You can move a column from the Available columns list to the Selected columns list by double-clicking the column name or highlighting the column name and clicking >. To move all columns, click >>. You can remove single columns from the Selected columns list by double-clicking the column name or highlighting the column name and clicking <. Remove all columns by clicking <<. Click Find to locate a particular column.
7-10
The Selected columns list displays the column name and SQL type for each column. Use the arrow buttons to the right of the Selected columns list to rearrange the order of the columns. Constraint. This tab is displayed by default. The Constraint grid allows you to define a constraint that filters your output data:
(. Select an opening parenthesis if needed. Column. Select a column or job parameter from the dropdown list. Op. Select an operator or a logical f unction from the dropdown list. For information on using functions in constraint expressions, see "Constraints" on page A-2 Column/Value. Select a column or job parameter from the drop-down list, or double-click in the cell to enter a value. Character values must be enclosed in single quotation marks. ). Select a closing parenthesis if needed. Logical. Select AND or OR from the drop-down list to continue the expression in the next row.
All of these fields are editable. As you build the constraint expression, it appears in the Constraint field. When you are done building the expression, click Verify. If errors are found, you must either correct the expression, click Clear All to start over, or cancel. You cannot save an incorrect constraint. Ascential DataStage follows SQL guidelines on orders of operators in expressions. After you verify a constraint, any redundant parentheses may be removed. For details, see "Operators" on page A-16. Columns. This tab displays the output columns. It has a grid with the following columns:
Column name. The name of the column. Native type. The native data type. For information about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHAR data, the maximum number of characters for VARCHAR data, and the total number of digits for numeric data types. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL data, and zero for all other data types.
7-11
Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
Column definitions are read-only on the Outputs page. You must go back to the Columns tab on the Stage page if you want to change the definitions. Click Save As to save the output columns as a table definition, a CFD file, or a DCLGen file.
7-12
8
DB2 Load Ready Flat File Stages
This chapter describes DB2 Load Ready Flat File stages, which are used to write data to a sequential or delimited flat file in a format that is compatible for use with the DB2 bulk loader facility.
8-1
When you edit a DB2 Load Ready Flat File stage, the DB2 Load Ready Flat File Stage dialog box appears:
This dialog box can have up to three pages (depending on whether there is an output from the stage): Stage. Displays the name of the stage, which can be edited. This page has up to five tabs, depending on the write option and file type you specify. The General tab displays the basic characteristics of the stage including the load data file name, DD name, write option, and file type. You can also enter an optional description of the stage, which appears in the generated COBOL program.
The File name field is the name of the resulting load ready file that is used in the mainframe JCL. The DD name field is the data definition name of the file in the JCL. It can be 1 to 8 alphanumeric characters and the first character must be alphabetic. The Write option field allows you to specify how to write data to the load file. There are four options: Create a new file. Creates a new file without checking to see if one already exists. This is the default. Append to existing file. Adds data to the existing file. Overwrite existing file. Deletes the existing file and replaces it with a new file. Delete and recreate existing file. Deletes the existing file if it has already been cataloged and recreates it.
8-2
The Fixed width flat file and Delimited flat file buttons allow you to specify the type of file to be written. The default is Fixed width flat file.
The Columns tab is where you specify the column definitions for the data being written by the stage. See "Specifying Stage Column Definitions" on page 8-3 for details on defining or loading column definitions. The Bulk Loader tab allows you to set parameters for running the bulk loader utility and generating the required control file. See "Setting DB2 Bulk Loader Parameters" on page 8-4 for details on setting these parameters. The Format tab appears if you select Delimited flat file as the target file type. This allows you to specify delimiter information for the file. See "Specifying Delimiter Information" on page 8-5 for details on specifying the file format. The Options tab appears if you have chosen to create a new file, or delete and recreate an existing file, in the Write option field. See "Specifying Load Data File Parameters" on page 8-6 for details on specifying these options. Inputs. Specifies the column definitions for the data input links. Outputs. Displays the name and an optional description of the data output link to an FTP stage. Click OK to close this dialog box. Changes are saved when you save the job.
8-3
Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL PACKED and DECIMAL ZONED data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column. You can Load columns from a table definition in the Repository, or enter column definitions manually and click Save As to save them as a table definition, a CFD file, or a DCLGen file. Click Clear All to start over. For details on editing column definitions, see Appendix D, "Editing Column Meta Data."
Note If a complex flat file is loaded, the incoming file is flattened and REDEFINE and GROUP columns are removed. Array and OCCURS DEPENDING ON columns are flattened to the maximum size. All level numbers are set to zero.
This tab has the following fields: User name. The user ID needed to sign on to the DB2 host system. DB2 subsystem id. The designation for the DB2 instance on the host system. This name can be different from the one specified at the project level.
8-4
Table name. The physical table name to be loaded by the bulk load operation. Table owner. The name of the table owner. A password is not required for the bulk load operation. The unique control statement is generated within the JCL.
Delimiters must be single-byte, printable characters. Possible delimiters include: A character, such as a comma. An ASCII code in the form of a three-digit decimal number, from 000 to 255. A hexadecimal code in the form &Hxx or &hxx, where x is a hexadecimal digit (09, af, AF). The following restrictions apply to delimiter settings: You cannot specify the same character for more than one type of delimiter. You can specify a character constant for a delimiter only if the DB2 bulk load utility control statement is coded in the same encoding scheme as the input file, such as UNICODE.
8-5
If the utility control statement and the input file are not coded in the same encoding scheme, you must use the hexadecimal representation for non-default delimiters. You cannot specify a binary 0 (zero) for any delimiter. The Format tab contains the following fields: Column delimiter. Specifies the character that separates the data fields in the file. By default this field contains a comma. String delimiter. Specifies the character used to enclose strings. By default this field contains a double quotation mark. String fields are delimited only if the data contains the column delimiter character. For example, if the data is ab,c and the column delimiter is a comma, then the output will be ab,c assuming the string delimiter is a double quotation mark. Select Always delimit string data to delimit all string fields in the target file, regardless of whether the data contains the column delimiter character or not. Decimal. Specifies the decimal point character used in the input file. By default this field contains a period.
8-6
This tab contains the following fields: Normal EOJ handling. Contains the parameter for the disposition of the data file when job execution successfully completes. There are four options:
CATLG. Catalogs the data set. This is the default. DELETE. Deletes the data set at the end of the bulk load step. KEEP Retains the data set, but does not catalog it. . PASS. Passes the data set to an FTP job step, but deletes it at the end of the job.
Abnormal EOJ handling. Contains the parameter for the disposition of the data file when job execution does not complete successfully. There are three options:
CATLG. Catalogs the data set. DELETE. Deletes the data set. This is the default. KEEP Retains the data set, but does not catalog it. .
Unit. Specifies the device type of the disk on which the data is to be stored. The default value is SYSDA. Allocation type. Specifies the unit of allocation used when storage space is reserved for the file. There are two options:
TRK. Track. This is the default. CYL. Cylinder. This generally allocates a greater amount of storage space than TRK.
The exact size of a track or cylinder is device dependent. Primary allocation amount. Contains the number of tracks or cylinders to be reserved as the initial storage for the job. The minimum is 1 and the maximum is 32768. The default value is 10. Secondary allocation amount. Contains the number of tracks or cylinders to be reserved if the primary allocation is insufficient for the job. The minimum is 1 and the maximum is 32768. The default value is 10. Vol ser. The volume serial number of the unit where the file will be written. Up to six alphanumeric characters are allowed. Database version. Contains the version number of the DB2 database to be updated. Ascential DataStage supports DB2 versions 5.1 and later. Expiration date. Specifies the expiration date for a new data set in YYDDD or YYYY/DDD format. For expiration dates of January 1, 2000 or later, you must use the YYYY/DDD format. JCL extension variables can also be used.
8-7
The YY can be from 01 to 99 or the YYYY can be from 1900 to 2155. The DDD can be from 000 to 365 for nonleap years or 000 to 366 for leap years. If you specify the current date or an earlier date, the data set is immediately eligible for replacement. Data sets with expiration dates of 99365, 99366, 1999/365 and 1999/366 are considered permanent and are never deleted or overwritten. Retention period. Specifies the number of days to retain a new data set. You can enter a number or use a JCL extension variable. When the job runs, this value is added to the current date to produce an expiration date, using 365-day years and 366-day leap years. Note that if the calculated expiration date is December 31, 1999, the expiration date is set to January 1, 2000.
Note You can specify either an expiration date or a retention period, but not both. When you enter a value in one of these fields, the other field becomes unavailable. No validation is done on either field; if you enter an incorrect value, JCL errors may occur.
These parameters are used during JCL generation. All fields except Vol ser, Expiration date, and Retention period are required.
8-8
and the column definitions of the data are described on the Inputs page of the DB2 Load Ready Flat File Stage dialog box:
The Inputs page has the following field and two tabs: Input name. The names of the input links to the DB2 Load Ready Flat File stage. Use this drop-down menu to select which set of input data you wish to view. General. Contains an optional description of the selected link. Columns. Displayed by default. Contains the column definitions for the data being written to the table. This page has a grid with the following columns:
Column name. The name of the column. Native type. The native data type. For information about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHARACTER data, the maximum number of characters for VARCHAR data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of TIMESTAMP data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL PACKED and DECIMAL ZONED data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
8-9
Column definitions are read-only on the Inputs page in the DB2 Load Ready Flat File stage. You must go back to the Columns tab on the Stage page to make any changes.
The Outputs page has the following field and tab: Output name. The name of the output link. Since only one output link is allowed, the field is read-only. General. Allows you to enter an optional description of the output link.
8-10
9
Relational Stages
This chapter describes Relational stages, which are used to read data from or write data to a DB2 database table on an OS/390 platform.
9-1
Relational Stages
When you edit a Relational stage, the Relational Stage dialog box appears:
This dialog box can have up to three pages (depending on whether there are inputs to and outputs from the stage): Stage. Displays the stage name, which can be edited. This page has a General tab where you can enter an optional description of the stage. The description will appear in the generated COBOL program. The General tab has two fields:
Generate an end-of-data row. Appears only when the stage is used as a source. Select this check box to add an end-of-data indicator after the last row is processed on each output link. The indicator is a built-in variable called ENDOFDATA which has a value of TRUE, meaning the last row of data has been processed. (See "ENDOFDATA" on page A-20 for more information on using this variable). In addition, all columns are set to null. Access type. Displays the relational access type. DB2 is the default in Relational stages and is read-only.
Inputs. Specifies the table name, update action, column definitions, and optional WHERE clause for the data input links. Outputs. Specifies the table to use and the associated column definitions for each data output link. This page also specifies the SQL query used to extract the data from the tables. Click OK to close this dialog box. Changes are saved when you save the job.
9-2
Relational Stages
The Inputs page has the following field and up to four tabs, depending on the update action you specify: Input name. The name of the input link. Select the link you want to edit from the Input name drop-down list. This list displays all the input links to the Relational stage. If there is only one input link, the field is read-only. General. This tab is always present and is displayed by default. It contains the following parameters:
Table name. This specifies the name of the table where the data will be written. Type a name in the Table name text box, qualifying it with the location and owner names if necessary. Qualified names should be entered in the format location.owner.tablename or owner.tablename. Table names cannot be COBOL or SQL reserved words. See Appendix H, "Reserved Words" for a list. Update action. Specifies how the data is written. Select the option you want from the drop-down list: Insert new or update existing rows. New rows are inserted or, if the insert fails, the existing rows are updated. Insert rows without clearing. Inserts the new rows in the table without checking to see if they already exist.
9-3
Relational Stages
Replace existing rows completely. Deletes the existing rows that match the rows to be inserted, then adds the new rows to the table. Update existing rows only. Updates the existing data rows that match the rows to be inserted. Any rows in the data that do not exist in the table are ignored. Update existing rows or insert new ones. The existing data rows are updated or, if this fails, new rows are added. Delete rows. Deletes the existing rows if they match the predicates for the new rows.
Columns. This tab is always present and contains the column definitions for the data being written to the table. This tab has a grid with the following columns:
Column name. The name of the column. Native type. The SQL data type. For details about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHARACTER data, the maximum number of characters for VARCHAR data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of TIMESTAMP data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
The columns are automatically loaded if you have mapped data from a prior, active stage. You can also enter and edit column definitions on the Columns tab, or click Load to load column definitions from the Repository. Click Save As to save the columns as a table definition, a CFD file, or a DCLGen file. For
9-4
Relational Stages
details on editing column definitions, see Appendix D, "Editing Column Meta Data." Update Columns. This tab appears if you have chosen to update or replace rows in the Update action field on the General tab. It does not appear if you select Insert rows without clearing, Replace existing rows completely, or Delete rows. It allows you to select the columns to update and to define the column derivations. See "Updating Input Columns" on page 9-5 for details on updating columns. Where. This tab appears if you have chosen to update, replace, or delete rows in the Update action field on the General tab. It does not appear if you select Insert rows without clearing. It allows you to specify the filter criteria for selecting rows to update. See "Using a WHERE Clause" on page 9-7 for details on constructing a WHERE clause.
9-5
Relational Stages
Derivation expressions must return a value. You can build an expression using the items shown in the Item type list box, including columns, job parameters, and constants. (See Appendix A, "Programmers Reference" for definitions of these expression components.) When you click an item type, the available items are displayed in the Item properties list box. Double-click an item to insert it in the Expression syntax box. You can select operators for your expression by clicking the buttons on the Operators tool palette. Click Undo to undo the last change to the expression, or click Clear All to start over. The Expression Editor validates expressions as they are built. If a syntax error is found, a message appears in red and the element causing the error is underlined in the Expression syntax text box. To perform both syntax and semantic checking, click Verify. (The Verify button is available if you select Perform expression semantic checking in project or job properties.) When you are finished building an expression, click OK to save your changes. If your expression contains errors, you will be allowed to continue without correcting the syntax, but you will be warned that the expression is invalid.
9-6
Relational Stages
To specify a WHERE clause, create an expression in the Where grid: (. Select an opening parenthesis if needed. Column. Select the column you want to filter on from the dropdown list. Op. Select an operator or a logical function from the drop-down list. For information on using functions in WHERE clauses, see "Constraints" on page A-2. Column/Value. Select a column or job parameter from the dropdown list, or double-click in the cell to enter a value. Character values must be enclosed in single quotation marks. Note that job parameters can be used here, but they are not allowed in the WHERE clauses of Relational source stages. For details on using job parameters in Relational WHERE clauses, see "Parameters" on page A-18. ). Select a closing parenthesis if needed. Logical. Select AND or OR from the drop-down list to continue the expression in the next row. All of these fields are editable. As you build the WHERE clause, it appears in the Where field. WHERE clauses must be boolean expressions that return TRUE or FALSE. To validate the clause, click
Mainframe Job Developers Guide 9-7
Relational Stages
the Verify button. If errors are found, you must either correct the expression, click Clear All to start over, or cancel. You cannot save an incorrect WHERE clause. Ascential DataStage follows SQL guidelines on orders of operators in clauses. After you verify a WHERE clause, any redundant parentheses may be removed. For details, see "Operators" on page A-16.
The Outputs page has the following field and up to nine tabs, depending on how you choose to specify the SQL statement to output the data: Output name. The name of the output link. Select the link you want to edit from the Output name drop-down list. This list displays all the output links from the Relational stage. If there is only one output link, the field is read-only. General. Contains an optional description of the link. Tables. This tab is displayed by default and allows you to select the tables to extract data from. The available tables must already have definitions in the Repository. If table names are qualified with an owner name, you can select tables having the same table name.
9-8
Relational Stages
You can move a table to the Selected tables list either by doubleclicking the table name or by highlighting the table name and clicking >. To move all tables, click >>. Remove single tables from the Selected tables list either by double-clicking the table name or by highlighting the table name and clicking <. Remove all tables by clicking <<. Click Find to search for a particular column in either list. Use the arrow buttons to the right of the Selected tables list to rearrange the order of the tables. You can select a table more than once to perform a self join. In this case, a unique alias name is automatically generated in the Selected tables list. You can edit the alias by highlighting the alias name and typing a new name. The length of the alias is limited to the length allowed by the version of DB2 you are using. Select. This tab allows you to select the columns to extract data from. Using a tree structure, the Available columns list displays the set of tables you selected on the Tables tab. Click the + next to the table name to display the associated column names. You can move a column to the Selected columns list either by double-clicking the column name or by highlighting the column name and clicking >. To move all columns from a single table, highlight the table name and click > or >>. Remove single columns from the Selected columns list either by double-clicking the column name or by highlighting the column name and clicking <. Remove all columns by clicking <<. Click Find to search for a particular column in either list. Use the arrow buttons to the right of the Selected columns list to rearrange the order of the columns.
Note If you remove a table from the Selected tables list on the Tables tab, its columns are automatically removed from the Select tab.
The Selected columns list displays the column name, table alias, native data type, and expression for each column. Click New to add a computed column or Modify to change the computed value of a selected column. For details on computed columns, see "Defining Computed Columns" on page 9-12. Where. The Where grid allows you to define a WHERE clause to filter rows in the output link:
(. Select an opening parenthesis if needed. Column. Select the column you want to filter on from the drop-down list.
9-9
Relational Stages
Op. Select an operator or a logical function from the dropdown list. For information on using functions in WHERE clauses, see "Constraints" on page A-2. Column/Value. Select a column from the drop-down list or double-click in the cell to enter a value. Character values must be enclosed in single quotation marks. Job parameters cannot be used here; they are allowed only in the WHERE clauses of Relational target stages. For more information on using job parameters in Relational WHERE clauses, see "Parameters" on page A-18. ). Select a closing parenthesis if needed. Logical. Select AND or OR from the drop-down list to continue the expression in the next row.
All of these fields are editable. As you build the WHERE clause, it appears in the Where field. WHERE clauses must be boolean expressions that return TRUE or FALSE. When you are done building the clause, click Verify. If errors are found, you must either correct the expression, click Clear All to start over, or cancel. You cannot save an incorrect WHERE clause. Ascential DataStage follows SQL guidelines on orders of operators in clauses. After you verify a WHERE clause, any redundant parentheses may be removed. For details, see "Operators" on page A-16. Group By. This tab allows you to select the columns to group by in the output link. The Available columns list displays the columns you selected on the Select tab. The Available columns and Group by columns lists display the name, table alias, and native data type for each column. You can move a column to the Group by columns list either by double-clicking the column name or by highlighting the column name and clicking >. To move all columns, click >>. Remove single columns from the Selected columns list either by doubleclicking the column name or by highlighting the column name and clicking <. Remove all columns by clicking <<. Click Find to search for a particular column in either list. Use the arrow buttons to the right of the Group by columns list to change the order of the columns to group by. Having. This tab appears only if you have selected columns to group by. It allows you to narrow the scope of the GROUP BY clause. The Having grid allows you to specify conditions the grouped columns must meet before they are selected:
9-10
Relational Stages
Column. Select the column you want to filter on from the drop-down list. Op. Select an operator or a logical function from the dropdown list. Column/Value. Select a column from the drop-down list or double-click in the cell to enter a value. Character values must be enclosed in single quotation marks. ). Select a closing parenthesis if needed. Logical. Select AND or OR from the drop-down list to continue the expression in the next row.
All of these fields are editable. As you build the HAVING clause, it appears in the Having field. HAVING clauses must be boolean expressions that return TRUE or FALSE. When you are done building the HAVING clause, click Verify. If errors are found, you must either correct the expression, click Clear All to start over, or cancel. You cannot save an incorrect HAVING clause. Order By. This tab allows you to specify the sort order of data in selected output columns. The Available columns and Order by columns lists display the name, table alias, and native data type for each column. The Order column in the Order by columns list shows the sort order of column data. You can move a column to the Order by columns list either by double-clicking the column name or by highlighting the column name and clicking >. To move all columns, click >>. Remove single columns from the Order by columns list either by doubleclicking the column name or by highlighting the column name and clicking <. Remove all columns by clicking <<. Click Find to search for a particular column in either list. Use the arrow buttons to the right of the Order by columns list to rearrange the column order. To specify the sort order of data in the selected columns, click on the Order field in the Order by columns list. Select Ascending or Descending from the drop-down list, or select nothing to sort by the database default. SQL. This tab displays the SQL statement constructed from your selections on the Tables, Select, Where, Group By, Having, and Order By tabs. You can edit the statement by typing in the SQL text box. For more information see "Modifying the SQL Statement" on page 9-14.
9-11
Relational Stages
Columns. This tab displays the output columns generated by the SQL statement. This grid has the following columns:
Column name. The name of the column. Native type. The SQL data type. For details about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHARACTER data, the maximum number of characters for VARCHAR data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of TIMESTAMP data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
You can edit only column names on this tab, unless you modified the SQL statement on the SQL tab. If you modified the SQL statement but no meta data has been defined in the DataStage Manager for the identified tables, then you can also add, edit, and remove columns on the Columns tab. Click Load to load columns from a table definition in the Repository or Clear All to start over. Click Save As to save the columns as a table definition, a CFD file, or a DCLGen file. For details about the conditions under which column editing is allowed, see "Modifying the SQL Statement" on page 9-14.
9-12
Relational Stages
This dialog box contains the following fields: As name. The name of the computed column. You must assign a unique name to the computed column. Description. An optional description of the column. Native data type. The native data type of the column. For details about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHARACTER data, the maximum number of characters for VARCHAR data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of TIMESTAMP data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL data, and zero for all other data types. Nullable. Specifies whether the column can contain a null value. Expression. Contains the expression used to compute the column value. You can define the expression for the computed column by typing in the Expression text entry box. Click the Functions button to get a list of available DB2 functions. You can select a function and click OK to insert it into the Expression field, or simply double-click the function name.
Note All of the functions supported in DB2 versions 8.1 and earlier are available when you click the Functions button. However, you must ensure that the functions you select are compatible with the version of DB2 you are using, or you will get an error.
9-13
Relational Stages
To replace <Operand> with a column name in the expression, highlight or delete <Operand> and click the Columns button. You will get a list of available columns. Select one of these columns and click OK to insert it into the Expression field, or simply double-click the column name. When you are done, click Verify to validate the expression, then click OK to save your changes.
Note You cannot save an incorrect column derivation. If errors are found when your expression is validated, you must either correct the expression or cancel the action.
9-14
Relational Stages
If the SELECT list on the SQL tab and the columns list on the Columns tab do not match, DB2 precompiler, DB2 bind, or execution time errors will occur. If the SQL SELECT list clause and the SELECT FROM clause can be parsed and table meta data has been defined in the Manager for the identified tables, then the columns list on the Columns tab is cleared and repopulated from the meta data. The Load and Clear All buttons on the Columns tab are unavailable and no edits are allowed except for changing the column name. If either the SQL SELECT list clause or the SELECT FROM clause cannot be parsed, then no changes are made to columns defined on the Columns tab. You must ensure that the number of columns matches the number defined in the SELECT list clause and that they have the correct attributes in terms of data type, length, and scale. Use the Load or Clear All buttons to edit, clear, or load new column definitions on the Columns tab. If the SELECT list on the SQL tab and the columns list on the Columns tab do not match, DB2 precompiler, DB2 bind, or execution time errors will occur. If validation is unsuccessful, you will receive an error message. You can correct the SQL statement, undo your changes, or choose to continue without making any corrections. If you continue without making corrections, however, only the General, SQL, and Columns tabs on the Outputs page will be active.
Note Some DB2 syntax, such as subqueries, cannot be successfully validated by Ascential DataStage. Though you will receive an error message, you should continue without
9-15
Relational Stages
making changes if you are confident that the SQL statement is correct.
9-16
10
Teradata Relational Stages
This chapter describes Teradata Relational stages, which are used to read data from or write data to a Teradata database table on an OS/ 390 platform.
10-1
When you edit a Teradata Relational stage, the Teradata Relational Stage dialog box appears:
This dialog box can have up to three pages (depending on whether there are inputs to and outputs from the stage): Stage. Displays the stage name, which can be edited. This page has a General tab where you can enter an optional description of the stage. The description will appear in the generated COBOL program The General tab has two fields:
Generate an end-of-data row. Appears only when the stage is used as a source. Select this check box to add an end-of-data indicator after the last row is processed on each output link. The indicator is a built-in variable called ENDOFDATA which has a value of TRUE, meaning the last row of data has been processed. (See "ENDOFDATA" on page A-20 for more information on using this variable). In addition, all columns are set to null. Access type. Displays the relational access type. TERADATA is the default in Teradata Relational stages and is read-only.
Inputs. Specifies the table name, update action, column definitions, and optional WHERE clause for the data input links. Outputs. Specifies the table to use and the associated column definitions for each data output link. This page also specifies the SQL query used to extract the data from the tables. Click OK to close this dialog box. Changes are saved when you save the job.
10-2
The Inputs page has the following field and up to four tabs, depending on the update action you specify: Input name. The name of the input link. Select the link you want to edit from the Input name drop-down list. This list displays all the input links to the Teradata Relational stage. If there is only one input link, the field is read-only. General. This tab is always present and is displayed by default. It contains the following parameters:
Table name. This specifies the name of the table where the data will be written. Type a name in the Table name text box, qualifying it with the location and owner names if necessary. Qualified names should be entered in the format location.owner.tablename or owner.tablename. Table names cannot be COBOL or SQL reserved words. See Appendix H, "Reserved Words" for a list. Update action. Specifies how the data is written. Select the option you want from the drop-down list: Insert new or update existing rows. New rows are inserted or, if the insert fails, the existing rows are updated. Insert rows without clearing. Inserts the new rows in the table without checking to see if they already exist.
10-3
Replace existing rows completely. Deletes the existing rows that match the rows to be inserted, then adds the new rows to the table. Update existing rows only. Updates the existing data rows that match the rows to be inserted. Any rows in the data that do not exist in the table are ignored. Update existing rows or insert new ones. The existing data rows are updated or, if this fails, new rows are added. This is performed using two SQL statements for the UPDATE and INSERT. Delete rows. Deletes the existing rows if they match the predicates for the new rows. Atomic upsert of rows. The existing data rows are updated or, if this fails, new rows are added. This is performed using a single SQL statement for both the UPDATE and INSERT.
Columns. This tab is always present and contains the column definitions for the data being written to the table. This tab has a grid with the following columns:
Column name. The name of the column. Native type. The SQL data type. For details about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHAR data, the maximum number of characters for VARCHAR data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of TIMESTAMP data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
The columns are automatically loaded if you have mapped data from a prior, active stage. You can also enter and edit column definitions on the Columns tab, or click Load to load column definitions from the Repository. Click Save As to save the columns as a table definition, a CFD file, or a DCLGen file. For
10-4
details on editing column definitions, see Appendix D, "Editing Column Meta Data." Update Columns. This tab appears if you have chosen to update or replace rows in the Update action field on the General tab. It does not appear if you select Insert rows without clearing, Replace existing rows completely, or Delete rows. It allows you to select the columns to update and define the column derivations. See "Updating Input Columns" on page 10-5 for details on updating columns. Where. This tab appears if you have chosen to update, replace, or delete rows in the Update action field on the General tab. It does not appear if you select Insert rows without clearing. It allows you to specify the filter criteria for selecting rows to update. See "Using a WHERE Clause" on page 10-7 for details on constructing a WHERE clause.
10-5
Derivation expressions must return a value. You can build an expression using the items shown in the Item type list box, including columns, job parameters, and constants. (See Appendix A, "Programmers Reference" for definitions of these expression components.) When you click an item type, the available items are displayed in the Item properties list box. Double-click an item to insert it in the Expression syntax box. You can select operators for your expression by clicking the buttons on the Operators tool palette. Click Undo to undo the last change to the expression, or click Clear All to start over. The Expression Editor validates expressions as they are built. If a syntax error is found, a message appears in red and the element causing the error is underlined in the Expression syntax text box. To perform both syntax and semantic checking, click Verify. (The Verify button is available if you select Perform expression semantic checking in project or job properties.) When you are finished building an expression, click OK to save your changes. If your expression contains errors, you will be allowed to continue without correcting the syntax, but you will be warned that the expression is invalid.
10-6
To specify a WHERE clause, create an expression in the Where grid: (. Select an opening parenthesis if needed. Column. Select the column you want to filter on from the dropdown list. Op. Select an operator or a logical function from the drop-down list. For information on using functions in WHERE clauses, see "Constraints" on page A-2. Column/Value. Select a column or job parameter from the dropdown list, or double-click in the cell to enter a value. Character values must be enclosed in single quotation marks. Note that job parameters can be used here, but they are not allowed in the WHERE clauses of Teradata Relational source stages. For more information on using job parameters in Teradata Relational WHERE clauses, see "Parameters" on page A-18. ). Select a closing parenthesis if needed. Logical. Select AND or OR from the drop-down list to continue the expression in the next row. All of these fields are editable. As you build the WHERE clause, it appears in the Where field. WHERE clauses must be boolean expressions that return TRUE or FALSE. To validate the clause, click
10-7
the Verify button. If errors are found, you must either correct the expression, click Clear All to start over, or cancel. You cannot save an incorrect WHERE clause. Ascential DataStage follows SQL guidelines on orders of operators in clauses. After you verify a WHERE clause, any redundant parentheses may be removed. For details, see "Operators" on page A-16.
The Outputs page has the following field and up to nine tabs, depending on how you choose to specify the SQL statement to output the data: Output name. The name of the output link. Select the link you want to edit from the Output name drop-down list. This list displays all the output links from the Teradata Relational stage. If there is only one output link, the field is read-only. General. Contains an optional description of the link. Tables. This tab is displayed by default and allows you to select the tables to extract data from. The available tables must already have definitions in the Repository. You can move a table to the Selected tables list either by doubleclicking the table name or by highlighting the table name and
10-8 Mainframe Job Developers Guide
clicking >. To move all tables, click >>. Remove single tables from the Selected tables list either by double-clicking the table name or by highlighting the table name and clicking <. Remove all tables by clicking <<. Click Find to search for a particular column in either list. Use the arrow buttons to the right of the Selected tables list to rearrange the order of the tables. You can select a table more than once to perform a self join. In this case, a unique alias name is automatically generated in the Selected tables list. You can edit the alias by highlighting the alias name and typing a new name. Select. This tab allows you to select the columns to extract data from. Using a tree structure, the Available columns list displays the set of tables you selected on the Tables tab. Click the + next to the table name to display the associated column names. You can move a column to the Selected columns list either by double-clicking the column name or by highlighting the column name and clicking >. To move all columns from a single table, highlight the table name and click > or >>. Remove single columns from the Selected columns list either by double-clicking the column name or by highlighting the column name and clicking <. Remove all columns by clicking <<. Click Find to search for a particular column in either list. Use the arrow buttons to the right of the Selected columns list to rearrange the order of the columns.
Note If you remove a table from the Selected tables list on the Tables tab, its columns are automatically removed from the Select tab.
The Selected columns list displays the column name, table alias, native data type, and expression for each column. Click New to add a computed column or Modify to change the computed value of a selected column. For details on computed columns, see "Defining Computed Columns" on page 10-12. Where. The Where grid allows you to define a WHERE clause to filter rows in the output link:
(. Select an opening parenthesis if needed. Column. Select the column you want to filter on from the drop-down list. Op. Select an operator or a logical function from the dropdown list. For information on using functions in WHERE clauses, see "Constraints" on page A-2.
10-9
Column/Value. Select a column from the drop-down list or double-click in the cell to enter a value. Character values must be enclosed in single quotation marks. Note that job parameters cannot be used here; they are only allowed in the WHERE clauses of Teradata Relational target stages. For more information on using job parameters in Teradata Relational WHERE clauses, see "Parameters" on page A-18. ). Select a closing parenthesis if needed. Logical. Select AND or OR from the drop-down list to continue the expression in the next row.
All of these fields are editable. As you build the WHERE clause, it appears in the Where field. WHERE clauses must be boolean expressions that return TRUE or FALSE. When you are done building the clause, click Verify. If errors are found, you must either correct the expression, click Clear All to start over, or cancel. You cannot save an incorrect WHERE clause. Ascential DataStage follows SQL guidelines on orders of operators in clauses. After you verify a WHERE clause, any redundant parentheses may be removed. For details, see "Operators" on page A-16. Group By. This tab allows you to select the columns to group by in the output link. The Available columns list displays the columns you selected on the Select tab. The Available columns and Group by columns lists display the name, table alias, and native data type for each column. You can move a column to the Group by columns list either by double-clicking the column name or by highlighting the column name and clicking >. To move all columns, click >>. Remove single columns from the Selected columns list either by doubleclicking the column name or by highlighting the column name and clicking <. Remove all columns by clicking <<. Click Find to search for a particular column in either list. Use the arrow buttons to the right of the Group by columns list to change the order of the columns to group by. Having. This tab appears only if you have selected columns to group by. It allows you to narrow the scope of the GROUP BY clause. The Having grid allows you to specify conditions the grouped columns must meet before they are selected:
(. Select an opening parenthesis if needed. Column. Select the column you want to filter on from the drop-down list.
10-10
Op. Select an operator or a logical function from the dropdown list. Column/Value. Select a column from the drop-down list or double-click in the cell to enter a value. Character values must be enclosed in single quotation marks. ). Select a closing parenthesis if needed. Logical. Select AND or OR from the drop-down list to continue the expression in the next row.
All of these fields are editable. As you build the HAVING clause, it appears in the Having field. HAVING clauses must be boolean expressions that return TRUE or FALSE. When you are done building the HAVING clause, click Verify. If errors are found, you must either correct the expression, click Clear All to start over, or cancel. You cannot save an incorrect HAVING clause. Order By. This tab allows you to specify the sort order of data in selected output columns. The Available columns and Order by columns lists display the name, table alias, and native data type for each column. The Order column in the Order by columns list shows the sort order of column data. You can move a column to the Order by columns list either by double-clicking the column name or by highlighting the column name and clicking >. To move all columns, click >>. Remove single columns from the Order by columns list either by doubleclicking the column name or by highlighting the column name and clicking <. Remove all columns by clicking <<. Click Find to search for a particular column in either list. Use the arrow buttons to the right of the Order by columns list to rearrange the column order. To specify the sort order of data in the selected columns, click on the Order field in the Order by columns list. Select Ascending or Descending from the drop-down list, or select nothing to sort by the database default. SQL. This tab displays the SQL statement constructed from your selections on the Tables, Select, Where, Group By, Having, and Order By tabs. You can edit the statement by typing in the SQL text box. For more information see "Modifying the SQL Statement" on page 10-14. Columns. This tab displays the output columns generated by the SQL statement. This grid has the following columns:
10-11
Native type. The SQL data type. For details about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHAR data, the maximum number of characters for VARCHAR data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of TIMESTAMP data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
You can edit only column names on this tab, unless you modified the SQL statement on the SQL tab. If you modified the SQL statement but no meta data has been defined in the Manager for the identified tables, then you can also add, edit, and remove columns on the Columns tab. Click Load to load columns from a table definition in the Repository or Clear All to start over. Click Save As to save the columns as a table definition, a CFD file, or a DCLGen file. For details about the conditions under which column editing is allowed, see "Modifying the SQL Statement" on page 10-14.
10-12
This dialog box contains the following fields: As name. The name of the computed column. You must assign a unique name to the computed column. Description. An optional description of the column. Native data type. The native data type of the column. For details about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHAR data, the maximum number of characters for VARCHAR data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of TIMESTAMP data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL data, and zero for all other data types. Nullable. Specifies whether the column can contain a null value. Expression. Contains the expression used to compute the column value. You can define the expression for the computed column by typing in the Expression text entry box. Click the Functions button to get a list of available Teradata functions. You can select a function and click OK to insert it into the Expression field, or simply double-click the function name. To replace <Operand> with a column name in the expression, highlight or delete <Operand> and click the Columns button. You will get a list of available columns. Select one of these columns and click OK to insert it into the Expression field, or simply double-click the column name. When you are done, click Verify to validate the expression, then click OK to save your changes.
10-13
Note You cannot save an incorrect column derivation. If errors are found when your expression is validated, you must either correct the expression or cancel the action.
10-14
If the SELECT list on the SQL tab and the columns list on the Columns tab do not match, Teradata precompiler, Teradata bind, or execution time errors will occur. If the SQL SELECT list clause and the SELECT FROM clause can be parsed and table meta data has been defined in the Manager for the identified tables, then the columns list on the Columns tab is cleared and repopulated from the meta data. The Load and Clear All buttons on the Columns tab are unavailable and no edits are allowed except for changing the column name. If either the SQL SELECT list clause or the SELECT FROM clause cannot be parsed, then no changes are made to columns defined on the Columns tab. You must ensure that the number of columns matches the number defined in the SELECT list clause and that they have the correct attributes in terms of data type, length, and scale. Use the Load or Clear All buttons to edit, clear, or load new column definitions on the Columns tab. If the SELECT list on the SQL tab and the columns list on the Columns tab do not match, Teradata precompiler, Teradata bind, or execution time errors will occur. If validation is unsuccessful, you will receive an error message. You can correct the SQL statement, undo your changes, or choose to continue without making any corrections. If you continue without making corrections, however, only the General, SQL, and Columns tabs on the Outputs page will be active.
Note Some Teradata syntax, such as subqueries, cannot be successfully validated by Ascential DataStage. Though you will receive an error message, you should continue without making changes if you are confident that the SQL statement is correct.
10-15
10-16
11
Teradata Export Stages
This chapter describes Teradata Export stages, which use the Teradata FastExport utility to read data from a Teradata database table on an OS/390 platform.
11-1
This dialog box has two pages: Stage. Displays the stage name, which can be edited. This page has three tabs. The General tab is where you specify the Teradata connection parameters. You can also enter an optional description of the stage, which appears in the generated COBOL program. The General tab has four fields:
TDP id. The identifier of the Teradata database. Account id. The Teradata account associated with the user. This field is optional. User id. The user name for Teradata login. Password. The password associated with the login user name.
If you have already specified Teradata connection parameters in job properties, the TDP id, Account id, User id, and Password fields display these settings as their initial values. You can edit these fields. If your job contains multiple Teradata Export stages, each one can connect to a different Teradata database. The Parameters tab allows you to specify parameters that control the execution of FastExport. See "Specifying Teradata FastExport Parameters" on page 11-3 for details. The File tab contains information needed to create the flat file where FastExport writes the exported data. See "Specifying File Options" on page 11-4 for details. Outputs. Specifies the SELECT statement used by FastExport to extract data from the Teradata table. Click OK to close this dialog box. Changes are saved when you save the job.
11-2
This tab contains the following fields: Min sessions. The minimum number of sessions required. Max sessions. The maximum number of sessions allowed. Tenacity. The number of hours that FastExport will attempt to log on to the Teradata database to get the minimum number of sessions specified. Sleep. The number of minutes to wait between each logon attempt. Out limit. The maximum number of records to write to the output file. Block size.The maximum block size (in bytes) that should be used when returning data from the database. Log table. The name of the table used for logging. The default name is ExpLog#####_date_time, where date is the current date in CCYYMMDD format and time is the current time in HHMMSS format. The ##### is a 5-digit sequence number which is used to make the name unique in case there are multiple Teradata Export stages in the job. Only the Min sessions and Log table fields are required.
11-3
This tab contains the following fields: File name. The name of the file where data will be written. Write option. Specifies how to write data to the file. There are four options:
Create a new file. Creates a new file without checking to see if one already exists. This is the default. Append to existing file. Adds data to the existing file. Overwrite existing file. Deletes the existing file and replaces it with a new file. Delete and recreate existing file. Deletes the existing file if it has already been cataloged and recreates it.
DD name. The data definition name of the file in the JCL. It can be 1 to 8 alphanumeric characters and the first character must be alphabetic. Normal EOJ handling. Contains the parameter for the disposition of the data file when job upload successfully completes. There are four options:
CATLG. Catalogs the data set. This is the default. DELETE. Deletes the data set after job execution. KEEP Retains the data set, but does not catalog it. .
11-4
PASS. Passes the data set to the next job step, but deletes it at the end of the job.
Abnormal EOJ handling. Contains the parameter for the disposition of the data file when job upload does not complete successfully. There are three options:
CATLG. Catalogs the data set. DELETE. Deletes the data set. This is the default. KEEP Retains the data set, but does not catalog it. .
Vol ser. The volume serial number of the unit where the file will be written. Up to six alphanumeric characters are allowed. Unit. Specifies the device type of the disk on which the data is to be stored. The default value is SYSDA. Allocation type. Specifies the unit of allocation used when storage space is reserved for the file. There are two options:
TRK. Track. This is the default. CYL. Cylinder. This generally allocates a greater amount of storage space than TRK.
The exact size of a track or cylinder is device dependent. Primary allocation amount. Contains the number of tracks or cylinders to be reserved as the initial storage for the job. The minimum is 1 and the maximum is 32768. The default value is 10. Secondary allocation amount. Contains the number of tracks or cylinders to be reserved if the primary allocation is insufficient for the job. The minimum is 1 and the maximum is 32768. The default value is 10. Expiration date. Specifies the expiration date for a new data set in YYDDD or YYYY/DDD format. For expiration dates of January 1, 2000 or later, you must use the YYYY/DDD format. JCL extension variables can also be used. The YY can be from 01 to 99 or the YYYY can be from 1900 to 2155. The DDD can be from 000 to 365 for nonleap years or 000 to 366 for leap years. If you specify the current date or an earlier date, the data set is immediately eligible for replacement. Data sets with expiration dates of 99365, 99366, 1999/365 and 1999/366 are considered permanent and are never deleted or overwritten. Retention period. Specifies the number of days to retain a new data set. You can enter a number or use a JCL extension variable. When the job runs, this value is added to the current date to
11-5
produce an expiration date, using 365-day years and 366-day leap years. Note that if the calculated expiration date is December 31, 1999, the expiration date is set to January 1, 2000.
Note You can specify either an expiration date or a retention period, but not both. When you enter a value in one of these fields, the other field becomes unavailable. No validation is done on either field; if you enter an incorrect value, JCL errors may occur.
These parameters are used during JCL generation. All fields except Vol ser, Expiration date, and Retention period are required.
The Outputs page has the following field and up to nine tabs, depending on how you choose to specify the SQL statement to output the data: Output name. The name of the output link. Since only one output link is allowed, this field is read-only. General. Contains an optional description of the link. Tables. This tab is displayed by default and allows you to select the tables to extract data from. The available tables must already have definitions in the Repository.
11-6 Mainframe Job Developers Guide
You can move a table to the Selected tables list either by doubleclicking the table name or by highlighting the table name and clicking >. To move all tables, click >>. Remove single tables from the Selected tables list either by double-clicking the table name or by highlighting the table name and clicking <. Remove all tables by clicking <<. Click Find to search for a particular column in either list. Use the arrow buttons to the right of the Selected tables list to rearrange the order of the tables. You can select a table more than once to perform a self join. In this case, a unique alias name is automatically generated in the Selected tables list. You can edit the alias by highlighting the alias name and typing a new name. Select. This tab allows you to select the columns to extract data from. Using a tree structure, the Available columns list displays the set of tables you selected on the Tables tab. Click the + next to the table name to display the associated column names. You can move a column to the Selected columns list either by double-clicking the column name or by highlighting the column name and clicking >. To move all columns from a single table, highlight the table name and click > or >>. Remove single columns from the Selected columns list either by double-clicking the column name or by highlighting the column name and clicking <. Remove all columns by clicking <<. Click Find to search for a particular column in either list. Use the arrow buttons to the right of the Selected columns list to rearrange the order of the columns.
Note If you remove a table from the Selected tables list on the Tables tab, its columns are automatically removed from the Select tab.
The Selected columns list displays the column name, table alias, native data type, and expression for each column. Click New to add a computed column or Modify to change the computed value of a selected column. For details on computed columns, see "Defining Computed Columns" on page 11-10. Where. The Where grid allows you to define a WHERE clause to filter rows in the output link:
(. Select an opening parenthesis if needed. Column. Select the column you want to filter on from the drop-down list.
11-7
Op. Select an operator or a logical function from the dropdown list. For information on using functions in WHERE clauses, see "Constraints" on page A-2. Column/Value. Select a column from the drop-down list or double-click in the cell to enter a value. Character values must be enclosed in single quotation marks. ). Select a closing parenthesis if needed. Logical. Select AND or OR from the drop-down list to continue the expression in the next row.
All of these fields are editable. As you build the WHERE clause, it appears in the Where field. WHERE clauses must be boolean expressions that return TRUE or FALSE. When you are done building the clause, click Verify. If errors are found, you must either correct the expression, click Clear All to start over, or cancel. You cannot save an incorrect WHERE clause. Ascential DataStage follows SQL guidelines on orders of operators in clauses. After you verify a WHERE clause, any redundant parentheses may be removed. For details, see "Operators" on page A-16. Group By. This tab allows you to select the columns to group by in the output link. The Available columns list displays the columns you selected on the Select tab. The Available columns and Group by columns lists display the name, table alias, and native data type for each column. You can move a column to the Group by columns list either by double-clicking the column name or by highlighting the column name and clicking >. To move all columns, click >>. Remove single columns from the Selected columns list either by doubleclicking the column name or by highlighting the column name and clicking <. Remove all columns by clicking <<. Click Find to search for a particular column in either list. Use the arrow buttons to the right of the Group by columns list to change the order of the columns to group by. Having. This tab appears only if you have selected columns to group by. It allows you to narrow the scope of the GROUP BY clause. The Having grid allows you to specify conditions the grouped columns must meet before they are selected:
(. Select an opening parenthesis if needed. Column. Select the column you want to filter on from the drop-down list.
11-8
Op. Select an operator or a logical function from the dropdown list. Column/Value. Select a column from the drop-down list or double-click in the cell to enter a value. Character values must be enclosed in single quotation marks. ). Select a closing parenthesis if needed. Logical. Select AND or OR from the drop-down list to continue the expression in the next row.
All of these fields are editable. As you build the HAVING clause, it appears in the Having field. HAVING clauses must be boolean expressions that return TRUE or FALSE. When you are done building the HAVING clause, click Verify. If errors are found, you must either correct the expression, click Clear All to start over, or cancel. You cannot save an incorrect HAVING clause. SQL. This tab displays the SQL statement constructed from your selections on the Tables, Select, Where, Group By, Having, and Order By tabs. You can edit the statement by typing in the SQL text box. For more information see "Modifying the SQL Statement" on page 11-11. Columns. This tab displays the output columns generated by the SQL statement. This grid has the following columns:
Column name. The name of the column. Native type. The SQL data type. For details about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHAR data, the maximum number of characters for VARCHAR data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of TIMESTAMP data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
You can edit only column names on this tab, unless you modified the SQL statement on the SQL tab. If you modified the SQL statement but no meta data has been defined in the Manager for the identified tables, then you can also add, edit, and remove columns on the Columns tab. Click Load to load columns from a
11-9
table definition in the Repository or Clear All to start over. Click Save As to save the columns as a table definition, a CFD file, or a DCLGen file. For details about the conditions under which column editing is allowed, see "Modifying the SQL Statement" on page 11-11.
This dialog box contains the following fields: As name. The name of the computed column. You must assign a unique name to the computed column. Description. An optional description of the column. Native data type. The native data type of the column. For details about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHAR data, the maximum number of characters for VARCHAR data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of TIMESTAMP data.
11-10
Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL data, and zero for all other data types. Nullable. Specifies whether the column can contain a null value. Expression. Contains the expression used to compute the column value. You can define the expression for the computed column by typing in the Expression text entry box. Click the Functions button to get a list of available Teradata functions. You can select a function and click OK to insert it into the Expression field, or simply double-click the function name. To replace <Operand> with a column name in the expression, highlight or delete <Operand> and click the Columns button. You will get a list of available columns. Select one of these columns and click OK to insert it into the Expression field, or simply double-click the column name. When you are done, click Verify to validate the expression, then click OK to save your changes.
Note You cannot save an incorrect column derivation. If errors are found when your expression is validated, you must either correct the expression or cancel the action.
11-11
and Clear All buttons to edit, clear, or load new column definitions on the Columns tab, as shown:
If the SELECT list on the SQL tab and the columns list on the Columns tab do not match, Teradata precompiler, Teradata bind, or execution time errors will occur. If the SQL SELECT list clause and the SELECT FROM clause can be parsed and table meta data has been defined in the Manager for the identified tables, then the columns list on the Columns tab is cleared and repopulated from the meta data. The Load and Clear All buttons on the Columns tab are unavailable and no edits are allowed except for changing the column name. If either the SQL SELECT list clause or the SELECT FROM clause cannot be parsed, then no changes are made to columns defined on the Columns tab. You must ensure that the number of columns matches the number defined in the SELECT list clause and that they have the correct attributes in terms of data type, length, and scale. Use the Load or Clear All buttons to edit, clear, or load new column definitions on the Columns tab. If the SELECT list on the SQL tab and the columns list on the Columns tab do not match, Teradata precompiler, Teradata bind, or execution time errors will occur. If validation is unsuccessful, you will receive an error message. You can correct the SQL statement, undo your changes, or choose to continue without making any corrections. If you continue without making corrections, however, only the General, SQL, and Columns tabs on the Outputs page will be active.
Note Some Teradata syntax, such as subqueries, cannot be successfully validated by Ascential DataStage. Though you will receive an error message, you should continue without
11-12 Mainframe Job Developers Guide
making changes if you are confident that the SQL statement is correct.
11-13
11-14
12
Teradata Load Stages
This chapter describes Teradata Load stages, which are used to write data to a sequential file in a format that is compatible for use with a Teradata load utility.
12-1
This dialog box has two pages: Stage. Displays the stage name, which can be edited. This page has seven tabs. The General tab displays the basic characteristics of the stage. It contains the following fields:
Load type. Select the load utility to execute. FastLoad moves large volumes of data into an empty table in a Teradata database. MultiLoad is used to load a table in a Teradata database. TPump is used for low-volume batch maintenance of a Teradata database. Table name. The name of the table where data will be written. Qualified names should be entered in the format owner.tablename or location.owner.tablename. Table names cannot be COBOL or SQL reserved words. See Appendix H, "Reserved Words" for a list. Table preparation. Specifies the table action to be taken at the start of the load operation. Choose one of the following options from the drop-down list: None. No action taken. This is the default. Create a new table. Creates a new table in the target database. Drop and redefine the table. Drops the existing table and creates a new one. Delete rows from an existing table. Deletes the rows from an existing table.
Update action. Specifies how the data is written to the table. This field is only available if MultiLoad or TPump are selected as the load utility. The options are: Insert rows without clearing. Inserts the new rows in the table. Update existing rows only. Updates the existing data rows that match the rows to be inserted. Any rows in the data that do not exist in the table are ignored. Update existing rows or insert new ones (Upsert). The existing data rows are updated or, if this fails, new rows are added. This is performed using a single SQL statement for both the UPDATE and INSERT. Delete rows. Deletes the existing rows if they match the predicates for the current rows.
12-2
TDP id. The identifier of the Teradata database. Account id. The Teradata account associated with the user. This field is optional. User id. The user name for Teradata login. Password. The password associated with the login user name. If you have already specified Teradata connection parameters in job properties, the TDP id, Account id, User id, and Password fields display these settings as their initial values. You can edit these fields. If your job contains multiple Teradata Load stages, each one can connect to a different Teradata database.
Description. Contains an optional description of the stage, which appears in the generated COBOL program.
The Columns tab contains the column definitions for the data being written to the table. See "Specifying Stage Column Definitions" on page 12-4 for details on defining or loading column definitions. The Update Columns tab is available if you have chosen to update or upsert rows in the Update action field. It allows you to select the columns to update and define the column derivations. See "Updating Input Columns" on page 12-4 for details on updating columns. The Where tab is available if you have chosen to update, upsert, or delete rows in the Update action field on the General tab. It allows you to specify the filter criteria for selecting rows to update. See "Defining a WHERE Clause" on page 12-6 for details on constructing a constraint. The Parameters tab allows you to specify parameters that control the execution of the load utility. See "Specifying Teradata Load Utility Parameters" on page 12-7 for details on setting these options. The Errors tab allows you to set error handling options for the load utility. See "Specifying Error Handling Options" on page 12-8 for details on setting these options. The File tab contains information needed to create the flat file where data is written. See "Specifying File Options" on page 12-10 for details. Inputs. Specifies the column definitions for the data input links.
12-3
Click OK to close this dialog box. Changes are saved when you save the job.
12-4
When you move a column to the Selected columns list, the default column derivation is to replace the column. You can edit this derivation by clicking the Modify button. The Expression Editor appears:
Derivation expressions must return a value. You can build an expression using the items shown in the Item type list box, including columns, job parameters, and constants. (See Appendix A, "Programmers Reference" for definitions of these expression components.) When you click an item type, the available items are displayed in the Item properties list box. Double-click an item to insert it in the Expression syntax box. You can select operators for your expression by clicking the buttons on the Operators tool palette. Click Undo to undo the last change to the expression, or click Clear All to start over. The Expression Editor validates expressions as they are built. If a syntax error is found, a message appears in red and the element causing the error is underlined in the Expression syntax text box. To perform both syntax and semantic checking, click Verify. (The Verify button is available if you select Perform expression semantic checking in project or job properties.) When you are finished building an expression, click OK to save your changes. If your expression contains errors, you will be allowed to continue without correcting the syntax, but you will be warned that the expression is invalid.
12-5
To define a WHERE clause, create an expression in the grid: (. Select an opening parenthesis if needed. Column. Select the column you want to filter on from the dropdown list. Op. Select an operator or a logical function from the drop-down list. For information on using functions in WHERE clauses, see "Constraints" on page A-2. Column/Value. Select a column or job parameter from the dropdown list, or double-click in the cell to enter a value. Character values must be enclosed in single quotation marks. ). Select a closing parenthesis if needed. Logical. Select AND or OR from the drop-down list to continue the expression in the next row. All of these fields are editable. As you build the WHERE clause, it appears in the Where field. WHERE clauses must be boolean expressions that return TRUE or FALSE. To validate the clause, click the Verify button. If errors are found, you must either correct the expression, click Clear All to start over, or cancel. You cannot save an incorrect WHERE clause.
12-6
Ascential DataStage follows SQL guidelines on orders of operators in clauses. After you verify a WHERE clause, any redundant parentheses may be removed. For details, see "Operators" on page A-16.
The fields displayed here vary depending on the load utility selected on the General tab. For FastLoad they include: Min sessions. The minimum number of sessions required. Max sessions. The maximum number of sessions allowed. Tenacity. The number of hours that the load utility will attempt to log on to the Teradata database to get the minimum number of sessions specified. Sleep. The number of minutes to wait between each logon attempt. MultiLoad parameters include all of the above plus the following: Log table. The name of the table used for logging. The default name is LoadLog#####_date_time, where date is the current date in CCYYMMDD format and time is the current time in HHMMSS format. The ##### is a 5-digit sequence number which is used to make the name unique in case there are multiple such names in the job. Work table. The name of the work table used by the load utility. The table name must be a new, nonexisting name for a nonrestart task, or an existing table name for a restart task. The default name
12-7
is WorkTbl#####_date_time, where date is the current date in CCYYMMDD format and time is the current time in HHMMSS format. The ##### is a 5-digit sequence number which is used to make the name unique in case there are multiple such names in the job. Checkpoint. The number of rows sent to Teradata between checkpoints. For TPump this can be 0 to 60 and for MultiLoad it can be any integer greater than 0. It can also be left blank. For TPump the parameters are the same as those for FastLoad and MultiLoad, as well as the following: Serialize. Specifies whether operations on a given row should occur serially. Select ON or OFF . Latency. Specifies the flushing threshold based on the number of seconds that the oldest record has resided in the buffer. This can be blank or an integer greater than 10. Pack. Specifies the number of statements to pack into a multistatement request. Type a number from 1 to 300 or MAX. Rate. Specifies the maximum rate per minute at which statements should be sent to Teradata. Robust. Specifies whether to enable complex restarts in Teradata. Select ON or OFF .
12-8
The fields displayed here vary depending on the load utility selected on the General tab. They include some or all of the following: Error table 1. The name of the database table where error information should be inserted. Error table 2. The name of a second database table where error information should be inserted. Error limit (percent). The number of errors to allow before the run is terminated. Duplicate UPDATE rows. Determines the handling of duplicate rows during an update. MARK inserts duplicate rows into the error table and IGNORE disregards the duplicates. Duplicate INSERT rows. Determines the handling of duplicate rows during an insert. MARK inserts duplicate rows into the error table and IGNORE disregards the duplicates. Missing UPDATE rows. Determines the handling of missing rows during an update. MARK inserts missing rows into the error table and IGNORE does nothing. Missing DELETE rows. Determines the handling of missing rows during a delete. MARK inserts missing rows into the error table and IGNORE does nothing. Extra UPDATE rows. Determines the handling of extra rows during an update. MARK inserts extra rows into the error table and IGNORE does nothing. Extra DELETE rows. Determines the handling of extra rows during a delete. MARK inserts extra rows into the error table and IGNORE does nothing. Only a subset of these fields may be displayed, depending on the load utility you selected on the Stage page.
12-9
This tab contains the following fields: File name. The name of the file where data will be written. Write option. Allows you to specify how to write data to the load file. There are four options:
Create a new file. Creates a new file without checking to see if one already exists. This is the default. Append to existing file. Adds data to the existing file. Overwrite existing file. Deletes the existing file and replaces it with a new file. Delete and recreate existing file. Deletes the existing file if it has already been cataloged and recreates it.
DD name. The data definition name of the file in the JCL. It can be 1 to 8 alphanumeric characters and the first character must be alphabetic. Normal EOJ handling. Contains the parameter for the disposition of the data file when job upload successfully completes. There are four options:
CATLG. Catalogs the data set. This is the default. DELETE. Deletes the data set after job execution. KEEP Retains the data set, but does not catalog it. .
12-10
PASS. Passes the data set to the next job step, but deletes it at the end of the job.
Abnormal EOJ handling. Contains the parameter for the disposition of the data file when job upload does not complete successfully. There are three options:
CATLG. Catalogs the data set. DELETE. Deletes the data set. This is the default. KEEP Retains the data set, but does not catalog it. .
Vol ser. This is the name of the volume serial identifier associated with the disk where storage space is being reserved. Up to six alphanumeric characters are allowed. Unit. Designates the type of disk on which the data is to be stored. The default value is SYSDA. Allocation type. Specifies the type of units to be reserved in the SPACE parameter to receive the data. There are two options:
TRK. Track. This is the default. CYL. Cylinder. This generally allocates a greater amount of storage space than TRK.
The exact size of a track or cylinder is device dependent. Primary allocation amount. Contains the number of tracks or cylinders to be reserved as the initial storage for the job. The minimum is 1 and the maximum is 32768. The default value is 10. Secondary allocation amount. Contains the number of tracks or cylinders to be reserved if the primary allocation is insufficient for the job. The minimum is 1 and the maximum is 32768. The default value is 10. Expiration date. Specifies the expiration date for a new data set in YYDDD or YYYY/DDD format. For expiration dates of January 1, 2000 or later, you must use the YYYY/DDD format. JCL extension variables can also be used. The YY can be from 01 to 99 or the YYYY can be from 1900 to 2155. The DDD can be from 000 to 365 for nonleap years or 000 to 366 for leap years. If you specify the current date or an earlier date, the data set is immediately eligible for replacement. Data sets with expiration dates of 99365, 99366, 1999/365 and 1999/366 are considered permanent and are never deleted or overwritten. Retention period. Specifies the number of days to retain a new data set. You can enter a number or use a JCL extension variable. When the job runs, this value is added to the current date to
12-11
produce an expiration date, using 365-day years and 366-day leap years. Note that if the calculated expiration date is December 31, 1999, the expiration date is set to January 1, 2000.
Note You can specify either an expiration date or a retention period, but not both. When you enter a value in one of these fields, the other field becomes unavailable. No validation is done on either field; if you enter an incorrect value, JCL errors may occur.
These parameters are used during JCL generation. All fields except Vol ser, Expiration date, and Retention period are required.
The Inputs page has the following field and two tabs: Input name. The names of the input links to the Teradata Load stage. Use this drop-down menu to select which set of input data you wish to view. General. Contains an optional description of the selected link.
12-12
Columns. Contains the column definitions for the data being written to the table. This page has a grid with the following columns:
Column name. The name of the column. Native type. The native data type. For information about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHAR data, the maximum number of characters for VARCHAR data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of TIMESTAMP data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
Column definitions are read-only on the Inputs page of Teradata Load stages. You must go back to the Columns tab on the Stage page to make any changes.
12-13
12-14
13
External Source Stages
This chapter describes External Source stages, which are used to retrieve rows from an external data source. An External Source stage represents a user-written program that is called from the DataStagegenerated COBOL program. The external source program can be written in any language that is callable from COBOL.
13-1
The General page is displayed by default. Enter general information about the external source routine, including: Routine name. Type the name (up to 8 characters) of the external subroutine. In mainframe terms, the routine name is the name of an entry point in a member of a load or object library. The library member may also contain other entry points with other names. The routine name must match the external subroutine name if Dynamic invocation (the default) is selected, and automatically appears in the External subroutine name field. Type. Select the type of routine, in this case, External Source Routine. (External target routines are discussed in Chapter 14, "External Target Stages." External routines are discussed in Chapter 22, "External Routine Stages.") Category. Type or browse for a category name to store the routine under in the Repository. If you do not enter a name in this field, the routine is created under the main Routines branch. Platform. Select the operating system that the COBOL subroutine runs on. (OS/390 is the only platform currently supported.)
13-2
External subroutine name. Type the name of the load or object library member that contains the subroutine or function entry point. If dynamic invocation is selected, then the external subroutine name must match the routine name. If the invocation method is static, then the two names need not match. Invocation method. Select the invocation method for the routine. Dynamic invocation calls the routine at run-time. Static invocation embeds the routine within a program. Dynamic is the default. Library path. Type the pathname of the library that contains the routine member. JCL extension variables can be used. This field is required for static invocation. Short description. Type an optional brief description of the routine. The text entered in this field is displayed when you choose View Details from the DataStage Manager window or print a report. It also appears in the External Source stage editor. Long description. Type an optional detailed description of the routine. Next, select the Creator page to enter creator information:
The Creator page allows you to specify information about the creator and version number of the routine, including: Vendor. Type the name of the company that created the routine. Author. Type the name of the person who created the routine. Version. Type the version number of the routine. This is used when the routine is imported. The Version field contains a threepart version number, for example, 2.0.0. The first part of this
13-3
number is an internal number used to check compatibility between the routine and the Ascential DataStage system, and cannot be changed. The second part of this number represents the release number. This number should be incremented when major changes are made to the routine definition or the underlying code. The new release of the routine supersedes any previous release. Any jobs using the routine use the new release. The last part of this number marks intermediate releases when a minor change or fix has taken place. Copyright. Type the copyright information. The next step is to define routine arguments by selecting the Arguments page:
For external source routines, arguments are treated as fields of a record. The record is passed to the external source routine program. You can define an unlimited number of arguments, and the columns in the argument record can have complex data structures such as GROUP REDEFINES, OCCURS and OCCURS DEPENDING ON clauses. , Click Load to load arguments from an existing table definition. Arguments loaded from a table definition are not flattened when the routine type is External Source Routine on the General page. However, if you change the routine type from External Source Routine to External Routine, Ascential DataStage will flatten the arguments, eliminating any GROUP or OCCURS that may have existed.
13-4
To create a new argument, type directly in the Arguments grid or, if you need to specify COBOL attributes, do one of the following: Right-click in the column area and select Edit row from the shortcut menu. Press Ctrl-E. The Edit Routine Argument Meta Data dialog box appears:
The top pane of this dialog box contains the same fields that appear on the Arguments grid, plus an additional field for the date format. Enter the following information for each argument you want to define: Argument name. Type the name of the argument. Native type. Select the native data type of the argument from the drop-down list. Length. Type a number representing the length or precision of the argument. Scale. If the argument is numeric, type a number to define the number of digits to the right of the decimal point. Nullable. Select Yes or No from the drop-down list to specify whether the argument can contain a null value. The default is No in the Edit Routine Argument Meta Data dialog box. Date format. Select the date format of the argument from the drop-down list. Description. Type an optional description of the argument.
13-5
The bottom pane of the Edit Routine Argument Meta Data dialog box displays the COBOL page by default. Use this page to enter any required COBOL information for the external source argument: Level number. Type the COBOL level number where the data is defined. The default value is 05. Occurs. Type the number of the COBOL OCCURS clause. Usage. Select the COBOL USAGE clause from the drop-down list. This specifies which COBOL format the column will be read in. These formats map to the formats in the Native type field, and changing one will normally change the other. Possible values are:
COMP Used with BINARY native types. . COMP-1. Used with single-precision FLOAT native types. COMP-2. Used with double-precision FLOAT native types. COMP-3. Packed decimal, used with DECIMAL native types. COMP-5. Used with NATIVE BINARY native types. DISPLAY. Zoned decimal, used with DISPLAY_NUMERIC or CHARACTER native types. DISPLAY-1. Double-byte zoned decimal, used with GRAPHIC_G or GRAPHIC_N.
Sign indicator. Select Signed or blank from the drop-down list to specify whether the argument can be signed or not. The default is Signed for numeric data types and blank for all other types. Sign option. If the argument is signed, select the location of the sign in the data from the drop-down list. Choose from the following:
LEADING. The sign is the first byte of storage. TRAILING. The sign is the last byte of storage. LEADING SEPARATE. The sign is in a separate byte that has been added to the beginning of storage. TRAILING SEPARATE. The sign is in a separate byte that has been added to the end of storage.
Selecting either LEADING SEPARATE or TRAILING SEPARATE will increase the storage length of the column by one byte. Sync indicator. Select SYNC or blank from the drop-down list to indicate whether the argument is a COBOL-SYNCHRONIZED clause or not. The default is blank. Redefined field. Optionally specify a COBOL REDEFINES clause. This allows you to describe data in the same storage area using a different data description. The redefining argument must be the
13-6 Mainframe Job Developers Guide
same length, or smaller, than the argument it redefines. Both arguments must have the same level number, and an argument can only redefine the immediately preceding argument with that level. Depending on. Optionally specify a COBOL OCCURS DEPENDING ON clause from the drop-down list. Storage length. Gives the storage length in bytes of the argument as defined. This field is derived and cannot be edited. Picture. Gives the COBOL PICTURE clause, which is derived from the argument definition and cannot be edited. The buttons at the bottom of the Edit Routine Argument Meta Data dialog box allow you to continue adding or editing arguments, or to save and close. The buttons are: < Previous and Next >. Displays the meta data in the previous or next argument. These buttons are available only when a previous or next argument exists. If there are unsaved changes to the current argument, you are prompted to save them before continuing. Close. Closes the Edit Routine Argument Meta Data dialog box. If you have any unsaved changes, you are prompted to save them. Apply. Saves changes to the current argument. Reset. Removes all changes made to the argument since the last time you applied changes. Help. Starts the Help system. The last step is to define the JCL associated with the external source routine, including any DD names or library names needed to run the external source program. The JCL page appears when you select External Source Routine as the routine type on the General page.
13-7
You can type directly in the Additional JCL required for the routine box, or click Load JCL to load the JCL from an existing file. The JCL on this page is included in the run JCL that Ascential DataStage generates for your job.
Note No syntax checking is performed on the JCL entered on this page.
The Save button is available after you define the JCL. Click Save to save the external source routine definition when you are finished.
Select Properties from the shortcut menu. Click the Properties button on the toolbar. Double-click the external source routine in the display area. To view or edit existing external source routines in the Designer, either double-click the routine in the Repository window, or right-click and select Properties from the short cut menu. The Mainframe Routine dialog box appears. You can edit any of the fields and options on any of the pages. If you make any changes, be sure to save them before closing the Mainframe Routine dialog box.
13-8
Select Copy from the shortcut menu. Click the Copy button on the toolbar. To copy an existing routine in the Designer, highlight the routine in the Repository window and select CreateCopy from the shortcut menu. The routine is copied and a new routine is created under the same branch in the project tree. By default, the name of the copy is called CopyOfXXX, where XXX is the name of the chosen routine. An edit box appears, allowing you to rename the copy immediately. If the invocation method of the routine is dynamic, the external subroutine name is set automatically.
13-9
The first byte indicates the type of call from the DataStage-generated COBOL program to the external source routine. Call type O opens a file, R reads a record, and C closes a file. The next two bytes are for the return code that is sent back from the external source routine to confirm the success or failure of the call. A zero indicates success and nonzero indicates failure. The fourth byte is an EOF (end of file) status indicator returned by the external source routine. A Y indicates EOF and N is for a returned row. The last four bytes comprise a data area that can be used for reentrant code. You can optionally use this area to store information such as an address or a value needed for dynamic calls.
13-10
This dialog box has two pages: Stage. Displays the stage name, which can be edited. This page has four tabs:
General. Contains an optional description of the stage, which appears in the generated COBOL program. Select the Generate an end-of-data row check box to add an end-ofdata indicator after the last row is processed. The indicator is a built-in variable called ENDOFDATA which has a value of TRUE, meaning the last row of data has been processed. (See "ENDOFDATA" on page A-20 for more information on using this variable). In addition, all columns are set to null. The endof-data row is sent down all output links from the stage. Routine. Specifies the name of the external source routine and its arguments. See "Specifying the External Source Routine" on page 13-12 for details on specifying the routine. JCL. Contains the JCL for the external source routine. This tab is available after you load an external source routine on the Routine tab. It displays any JCL you specified as part of the external source routine in the Manager. You can enter and edit JCL in the JCL statements box, or click Load JCL to load JCL from another file. JCL extension variables can be used. Click Reset to reset any changes you have made to the JCL, reverting back to what was originally specified in the Manager. Any changes you make are saved when you click OK on the Stage page. File view. Displays the record structure of the arguments in the external source program, including the COBOL PICTURE clause, the starting and ending offsets, and the storage length
13-11
of each argument. The total storage length is displayed in the status bar. You can right-click to save the file view layout as an HTML file. Outputs. Specifies the column definitions for the data output links. Click OK to close this dialog box. Changes are saved when you save the job.
The Routine tab displays the following information: Name. The name of the external source routine. Arguments. The arguments of the external source routine, including the following:
Level number. The COBOL level number where the data is defined. If no level number is given, a default value of 05 is assigned. Column name. The name of the column. Native type. The native data type. For details about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHARACTER and GROUP data, and the total number of digits for numeric data types.
Mainframe Job Developers Guide
13-12
Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL and FLOAT data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
Click Load to load an external source routine from the Repository. The routine name and arguments are then displayed in read-only format on the Routine tab. If you want to make changes to the routine, you must go back to the Mainframe Routine dialog box in the DataStage Manager. Click Clear All to remove a routine and its arguments from the Routine tab.
Array Handling
If you load a routine containing arrays, the Complex file load option dialog box appears:
This dialog box offers the following options: Normalize all arrays. Presents the data as multiple rows at execution time with one row for each column in the array. This is the default. Flatten all arrays. Creates new columns for each element of the array and presents the data as one row at execution time. Flatten selective arrays. Allows you to choose whether to flatten or normalize arrays on an individual basis. Use the right mouse button to select Flatten or Normalize. The array icon changes for the arrays you select to flatten. Columns containing OCCURS DEPENDING ON clauses are always flattened in External Source stages, regardless of your selection on the Complex file load option dialog box. Such columns are
Mainframe Job Developers Guide 13-13
flattened to the maximum number of occurrences. The elements of the unused occurrences are set to null if the element is nullable or space or zero (depending on the column data type) if the element is not nullable.
Note Ascential DataStage does not flatten array columns that have redefined fields, even if you choose to flatten all arrays in the Complex file load option dialog box.
The Outputs page has the following field and four tabs: Output name. The name of the output link. Select the link you want to edit from the Output name drop-down list. This list displays all the output links from the External Source stage. If there is only one output link, the field is read-only. General. Contains an optional description of the link. Selection. This tab allows you to select arguments as output columns. The Available arguments list displays the arguments loaded from the external source routine, and the Selected columns list displays the columns to be output from the stage.
13-14
Note If the Column push option is selected in Designer options, the routine arguments are automatically selected as output columns on each empty output link when you click OK to exit the stage. You do not need to select columns on the Selection tab, unless you want to output only a subset of them. However, if any routine arguments are GROUP data type, the column push option works only if all members of the group are CHARACTER data type.
You can move an argument from the Available arguments list to the Selected columns list by double-clicking the argument name or highlighting the argument name and clicking >. To move all arguments, click >>. You can remove single columns from the Selected columns list by double-clicking the column name or highlighting the column name and clicking <. Remove all columns by clicking <<. Click Find to locate a particular argument. You can select a group as one element if all elements of the group are CHARACTER data. If one or more elements of the group are of another type, then they must be selected separately. If a group item and its sublevel items are all selected, storage is allocated for the group item as well as each sublevel item. If you select an argument that is an array element, you have the option of flattening the array or denormalizing it at run-time. If you flatten the array, a unique name is generated for each subelement of the array. You can delete any subelements that are not needed from the Selected columns list. The Selected columns list displays the column name and SQL type for each column. Use the arrow buttons to the right of the Selected columns list to rearrange the order of the columns. Constraint. This tab is displayed by default. The Constraint grid allows you to define a constraint that filters your output data:
(. Select an opening parenthesis if needed. Column. Select a column or job parameter from the dropdown list. (Group columns cannot be used in constraint expressions and are not displayed.) Op. Select an operator or a logical function from the dropdown list. For information on using functions in constraint expressions, see "Constraints" on page A-2 Column/Value. Select a column or job parameter from the drop-down list, or double-click in the cell to enter a value. Character values must be enclosed in single quotation marks. ). Select a closing parenthesis if needed.
13-15
Logical. Select AND or OR from the drop-down list to continue the expression in the next row.
All of these fields are editable. As you build the constraint expression, it appears in the Constraint field. When you are done building the expression, click Verify. If errors are found, you must either correct the expression, click Clear All to start over, or cancel. You cannot save an incorrect constraint. Ascential DataStage follows SQL guidelines on orders of operators in expressions. After you verify a constraint, any redundant parentheses may be removed. For details, see "Operators" on page A-16. Columns. This tab displays the output columns. It has a grid with the following columns:
Column name. The name of the column. Key. Indicates if the column is a record key. SQL type. The SQL data type. For details about the data types supported in mainframe jobs, see Appendix B, "Data Type Definitions and Mappings." Length. The data precision. This is the number of characters for CHARACTER and GROUP data, and the total number of digits for numeric data types. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL and FLOAT data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
Column definitions are read-only on the Outputs page. You must go back to the Mainframe Routine dialog box in the DataStage Manager if you want to make changes to the external source routine arguments. Click Save As to save the output columns as a table definition, a CFD file, or a DCLGen file.
13-16
14
External Target Stages
This chapter describes External Target stages, which are used to write rows to a given data target. An External Target stage represents a user-written program that is called from the DataStage-generated COBOL program. The external target program can be written in any language that is callable from COBOL.
14-1
The General page is displayed by default. Enter general information about the external target routine, including: Routine name. Type the name (up to 8 characters) of the external subroutine. In mainframe terms, the routine name is the name of an entry point in a member of a load or object library. The library member may also contain other entry points with other names. The routine name must match the external subroutine name if Dynamic invocation (the default) is selected, and automatically appears in the External subroutine name field. Type. Select the type of routine, in this case, External Target Routine. (External source routines are discussed in Chapter 13, "External Source Stages." External routines are detailed in Chapter 22, "External Routine Stages.") Category. Type or browse for a category name to store the routine under in the Repository. If you do not enter a name in this field, the routine is created under the main Routines branch. Platform. Select the operating system that the COBOL subroutine runs on. (OS/390 is the only platform currently supported.)
14-2
External subroutine name. Type the name of the load or object library member that contains the subroutine or function entry point. If dynamic invocation is selected, then the external subroutine name must match the routine name. If the invocation method is static, then the two names need not match. Invocation method. Select the invocation method for the routine. Dynamic invocation calls the routine at run-time. Static invocation embeds the routine within a program. Dynamic is the default. Library path. Type the pathname of the library that contains the routine member. JCL extension variables can be used. This field is required for static invocation. Short description. Type an optional brief description of the routine. The text entered in this field is displayed when you choose View Details from the DataStage Manager window or print a report. It also appears in the External Target stage editor. Long description. Type an optional detailed description of the routine. Next, select the Creator page to enter creator information:
The Creator page allows you to specify information about the creator and version number of the routine, including: Vendor. Type the name of the company that created the routine. Author. Type the name of the person who created the routine. Version. Type the version number of the routine. This is used when the routine is imported. The Version field contains a threepart version number, for example, 2.0.0. The first part of this
14-3
number is an internal number used to check compatibility between the routine and the Ascential DataStage system, and cannot be changed. The second part of this number represents the release number. This number should be incremented when major changes are made to the routine definition or the underlying code. The new release of the routine supersedes any previous release. Any jobs using the routine use the new release. The last part of this number marks intermediate releases when a minor change or fix has taken place. Copyright. Type the copyright information. The next step is to define routine arguments by selecting the Arguments page:
For external target routines, arguments are treated as fields of a record. The record is passed to the external target routine program. You can define an unlimited number of arguments. The columns in the argument record cannot contain complex data structures such as GROUP REDEFINES, OCCURS and OCCURS DEPENDING ON clauses. , Click Load to load arguments from an existing table definition. Arguments loaded from a table definition are flattened as necessary. To create a new argument, type directly in the Arguments grid or, if you need to specify COBOL attributes, do one of the following: Right-click in the column area and select Edit row from the shortcut menu. Press Ctrl-E.
14-4
The top pane of this dialog box contains the same fields that appear on the Arguments grid, plus an additional field for the date format. Enter the following information for each argument you want to define: Argument name. Type the name of the argument. Native type. Select the native data type of the argument from the drop-down list. Length. Type a number representing the length or precision of the argument. Scale. If the argument is numeric, type a number to define the number of digits to the right of the decimal point. Nullable. Select Yes or No from the drop-down list to specify whether the argument can contain a null value. The default is No in the Edit Routine Argument Meta Data dialog box. Date format. Select the date format of the argument from the drop-down list. Description. Type an optional description of the argument. The bottom pane of the Edit Routine Argument Meta Data dialog box displays the COBOL page by default. Use this page to enter any required COBOL information for the external target argument: Usage. Select the COBOL USAGE clause from the drop-down list. This specifies which COBOL format the column will be read in. These formats map to the formats in the Native type field, and changing one will normally change the other. Possible values are:
14-5
COMP Used with BINARY native types. . COMP-1. Used with single-precision FLOAT native types. COMP-2. Used with double-precision FLOAT native types. COMP-3. Packed decimal, used with DECIMAL native types. COMP-5. Used with NATIVE BINARY native types. DISPLAY. Zoned decimal, used with DISPLAY_NUMERIC or CHARACTER native types. DISPLAY-1. Double-byte zoned decimal, used with GRAPHIC_G or GRAPHIC_N.
Sign indicator. Select Signed or blank from the drop-down list to specify whether the argument can be signed or not. The default is Signed for numeric data types and blank for all other types. Sign option. If the argument is signed, select the location of the sign in the data from the drop-down list. Choose from the following:
LEADING. The sign is the first byte of storage. TRAILING. The sign is the last byte of storage. LEADING SEPARATE. The sign is in a separate byte that has been added to the beginning of storage. TRAILING SEPARATE. The sign is in a separate byte that has been added to the end of storage.
Selecting either LEADING SEPARATE or TRAILING SEPARATE will increase the storage length of the column by one byte. Storage length. Gives the storage length in bytes of the argument as defined. This field is derived and cannot be edited. Picture. Gives the COBOL PICTURE clause, which is derived from the argument definition and cannot be edited. The buttons at the bottom of the Edit Routine Argument Meta Data dialog box allow you to continue adding or editing arguments, or to save and close. The buttons are: < Previous and Next >. Displays the meta data in the previous or next argument. These buttons are available only when a previous or next argument exists. If there are unsaved changes to the current argument, you are prompted to save them before continuing. Close. Closes the Edit Routine Argument Meta Data dialog box. If you have any unsaved changes, you are prompted to save them. Apply. Saves changes to the current argument.
14-6 Mainframe Job Developers Guide
Reset. Removes all changes made to the argument since the last time you applied changes. Help. Starts the Help system. The last step is to define the JCL associated with the external target routine, including any DD names or library names needed to run the external target program. The JCL page appears when you select External Target Routine as the routine type on the General page. Click JCL to bring this page to the front:
You can type directly in the Additional JCL required for the routine box, or click Load JCL to load the JCL from an existing file. The JCL on this page is included in the run JCL that Ascential DataStage generates for your job.
Note No syntax checking is performed on the JCL entered on this page.
The Save button is available after you define the JCL. Click Save to save the external target routine definition when you are finished.
Select Properties from the shortcut menu. Click the Properties button on the toolbar.
14-7
Double-click the external target routine in the display area. To view or edit existing external target routines in the Designer, either double-click the routine in the Repository window, or right-click and select Properties from the short cut menu. The Mainframe Routine dialog box appears. You can edit any of the fields and options on any of the pages. If you make any changes, be sure to save them before closing the Mainframe Routine dialog box.
Select Copy from the shortcut menu. Click the Copy button on the toolbar. To copy an existing routine in the Designer, highlight the routine in the Repository window and select Create Copy from the shortcut menu. The routine is copied and a new routine is created under the same branch in the project tree. By default, the name of the copy is called CopyOfXXX, where XXX is the name of the chosen routine. An edit box appears, allowing you to rename the copy immediately. If the invocation method of the routine is dynamic, the external subroutine name is set automatically.
14-8
Choose File Rename (Manager only). An edit box appears and you can type a different name or edit the existing one. Save the new name by pressing Enter or by clicking outside the edit box. If the invocation method of the routine is dynamic, the external subroutine name is set automatically.
The first byte indicates the type of call from the DataStage-generated COBOL program to the external target routine. Call type O opens a file, W writes a record, and C closes a file. The next two bytes are for the return code that is sent back from the external target routine to confirm the success or failure of the call. A zero indicates success and nonzero indicates failure. The fourth byte is an EOF (end of file) status indicator returned by the external target routine. A Y indicates EOF and N is for a returned row. The last four bytes comprise a data area that can be used for reentrant code. You can optionally use this area to store information such as an address or a value needed for dynamic calls.
14-9
When you edit the External Target stage, the External Target Stage dialog box appears:
This dialog box has two pages: Stage. Displays the stage name, which can be edited. This page has four tabs:
General. Contains an optional description of the stage, which appears in the generated COBOL program. Routine. Specifies the name of the external target routine and deploys its arguments. See "Specifying the External Target Routine" on page 14-11 for details on specifying the routine. JCL. Contains the JCL for the external target routine. This tab is available after you load an external target routine on the Routine tab. It displays any JCL you specified as part of the external target routine in the Manager. You can enter and edit JCL in the JCL statements box, or click Load to load JCL from another file. JCL extension variables can be used. Any changes you make are saved when you click OK on the Stage page. File view. Displays the record structure of the arguments in the external target program, including the COBOL PICTURE clause, the starting and ending offsets, and the storage length of each argument. The total storage length is displayed in the status bar. You can right-click to save the file view layout as an HTML file.
Inputs. Shows the column definitions for the data input links. Click OK to close this dialog box. Changes are saved when you save the job.
14-10
The Routine tab displays the following information: Name. The name of the external target routine. Arguments. The arguments of the external target routine, including the following:
Column name. The name of the column. Native type. The native data type. For details about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The data precision. This is the number of characters for CHARACTER and GROUP data, and the total number of digits for numeric data types. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL and FLOAT data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
Click Load to load an external target routine from the Repository. The routine name and arguments are then displayed in read-only format on the Routine tab. If you want to make changes to the routine, you must go back to the Mainframe Routine dialog box in the DataStage
14-11
Manager. Click Clear All to remove a routine and its arguments from the Routine tab. If you have pushed columns from a previous stage in the job design, they are displayed in the Arguments grid and you can simply type the routine name in the Name field. However, you still must define the external target routine in the Manager prior to generating code.
The Inputs page has the following field and two tabs: Input name. The name of the input link. Select the link you want from the Input name drop-down list. This list displays all the links to the External Target stage. If there is only one input link, the field is read-only. General. Contains an optional description of the link. Columns. This tab displays the input columns. It has a grid with the following columns:
Column name. The name of the column. Native type. The native data type.
14-12
Length. The data precision. This is the number of characters for CHARACTER and GROUP data, and the total number of digits for numeric data types. Scale. The data scale factor. This is the number of digits to the right of the decimal point for DECIMAL and FLOAT data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
Column definitions are read-only on the Inputs page. You must go back to the Mainframe Routine dialog box in the DataStage Manager if you want to make changes to the external target routine arguments.
14-13
14-14
15
Transformer Stages
This chapter describes Transformer stages, which perform data conversions on extracted data. The data is then passed to another active stage or to a stage that writes data to a target file or database. The same Transformer stage editor is used for server and mainframe jobs. This chapter describes only the mainframe functionality. For server functionality, see Ascential DataStage Server Job Developers Guide.
15-1
Transformer Stages
When you edit a Transformer stage, the Transformer Editor appears. In the following example, there is one input link and two output links. Meta data has been defined for the input link, but not for the output links:
Toolbar
The Transformer toolbar appears at the top of the Transformer Editor. It contains the following buttons:
Show All or Stage Properties Selected Cut Relations Paste Load Column Definition Column Auto-Match
Find/ Replace
Link Area
The top area displays links to and from the Transformer stage, showing their columns and the relationships between them.
15-2
Transformer Stages
The link area is where all column definitions and stage variables are defined. The link area is divided into two panes; you can drag the splitter bar between them to resize the panes relative to one another. There is also a horizontal scroll bar, allowing you to scroll the view left or right. The left pane shows the input link and the right pane shows output links and stage variables. For all types of link, key fields are shown in bold. Output columns that have no derivation defined are shown in red (or the color defined in Tools Options). Within the Transformer Editor, a single link may be selected at an one time. When selected, the links title bar is highlighted, and arrowheads indicate any selected columns.
Shortcut Menus
The Transformer Editor shortcut menus are displayed by right-clicking the links in the links area. There are three slightly different menus, depending on whether you right-click an input link, an output link, or a stage variable.
15-3
Transformer Stages
The input link shortcut menu enables you to: Open the Properties dialog box to enter a description of the link. Open the Column Auto-Match dialog box. Display the Find/Replace dialog box. Select all columns on the link. Display the Select dialog box. Copy a column on the link. The output link shortcut menu enables you to: Open the Properties dialog box to enter a description of the link. Open the Constraints dialog box to specify a constraint. Open the Column Auto-Match dialog box. Display the Find/Replace dialog box. Select all columns on the link. Display the Select dialog box. Edit several derivations in one operation. Edit, validate, or clear a derivation. Append or insert a new column into the selected link. Delete columns on the link. Cut, copy, and paste a column or derivation on the link.
15-4
Transformer Stages
The stage variable shortcut menu enables you to: Open the Stage Properties dialog box to specify a variable. Open the Column Auto-Match dialog box. Display the Find/Replace dialog box. Select all stage variables. Display the Select dialog box. Edit several derivations in one operation. Edit, validate, or clear a derivation. Append or insert a new stage variable. Delete a stage variable. Cut, copy, and paste a stage variable or derivation. If you display the shortcut menu from the links area background, you can: Open the Stage Properties dialog box to enter a description of the stage, specify a variable, or specify the order of output link processing. Open the Constraints dialog box to specify a constraint. Open the Link Ordering tab of the Stage Properties dialog box to reorder output link processing. Toggle between displaying stage variables and hiding them. Toggle between viewing link relations for all links, or for the selected link only. Right-clicking in the meta data area of the Transformer Editor opens the standard grid-editing shortcut menus.
Mainframe Job Developers Guide 15-5
Transformer Stages
The Transformer Stage Properties dialog box has three pages: Stage. This is used to specify general information about the stage. The Stage page has three tabs:
General. Allows you to enter an optional description of the stage. Variables. Allows you to specify stage variables for use in the stage. See "Defining Local Stage Variables" on page 15-21 for details on defining stage variables. Link Ordering. Allows you to specify the order in which the output links are processed. See "Specifying Output Link Order" on page 15-20 for details on link ordering.
Inputs. Allows you to enter an optional description of the data on the input link. The Transformer stage can have only one input link. Outputs. Allows you to enter an optional description for each of the output links from the stage.
15-6
Transformer Stages
input link. You will use the Transformer Editor to define the data that will be output by the stage and how it will be transformed.
Input Links
Data is passed to the Transformer stage via a single input link. The input link can come from a passive or active stage. Input data to a Transformer stage is read-only. You must go back to the stage on your input link if you want to change the column definitions.
Output Links
You can have any number of output links from the Transformer stage. You may want to pass some data straight through the Transformer stage unaltered, but its likely that youll want to transform data from some input columns before outputting it from the Transformer stage. Each output link column is defined in the columns Derivation cell within the Transformer Editor. To simply pass data through the Transformer stage, you can drag an input column to an output columns Derivation cell. To transform the data, you can enter an expression using the Expression Editor. In addition to specifying derivation details for individual output columns, you can also specify constraints that operate on entire output links. A constraint is an expression based on the SQL3 language that specifies criteria that the data must meet before it can be passed to the output link. For data that does not meet the criteria, you can use a constraint to designate another output link as the reject link. The reject link will contain columns that did not meet the criteria for the other output links. Each output link is processed in turn. If the constraint expression evaluates to TRUE for an input row, the data row is output on that link. Conversely, if a constraint expression evaluates to FALSE for an input row, the data row is not output on that link. Constraint expressions on different links are independent. If you have more than one output link, an input row may result in a data row being output from some, none, or all of the output links. For example, consider the data that comes from a paint shop. It could include information about any number of different colors. If you want to separate the colors into different files, you would set up different constraints. You could output the information about green and blue paint on LinkA, red and yellow paint on LinkB, and black paint on LinkC.
15-7
Transformer Stages
When an input row contains information about yellow paint, the LinkA constraint expression evaluates to FALSE and the row is not output on LinkA. However, the input data does satisfy the constraint criterion for LinkB and the rows are output on LinkB. If the input data contains information about white paint, this does not satisfy any constraint and the data row is not output on Links A, B, or C. However, you could designate another link to serve as the reject link. The reject link is used to route data to a table or file that is a catch-all for rows that are not output on any other link. The table or file containing these rejects is represented by another stage in the job design.
15-8
Transformer Stages
Click the source cell to select it. Click the selected cell again and, without releasing the mouse button, drag the mouse pointer to the desired location within the target link. An insert point appears on the target link to indicate where the new cell will go. Release the mouse button to drop the selected cell.
You can drag and drop multiple columns or derivations. Use the standard Explorer keys when selecting the source column cells, then proceed as for a single cell. You can add a column to the end of an existing derivation by holding down the Ctrl key as you drag the column. This opens the Expression Editor, allowing you to continue editing the column derivation. The drag-and-drop insert point is shown below:
15-9
Transformer Stages
This dialog box has three tabs: Expression Text. Allows you to locate the occurrence of a particular string within an expression, and replace it if required. You can search up or down, and choose to match case, search the selected link only, or neither. You can also choose to replace all occurrences of the string within an expression. Column Names. Allows you to find a particular column and rename it if required. You can search up or down, and choose to match case, match whole words, or search the selected link only. Expression Types. Allows you to find the next empty expression or the next expression that contains an error. You can search up or down and choose to search the selected link only. You can also press Ctrl-M to find the next empty expression or Ctrl-N to find the next erroneous expression.
Note The find and replace results are shown in the color specified in Tools Options.
Press F3 to repeat the last search you made without opening the Find and Replace dialog box.
Select Facilities
If you are working on a complex job where several links, each containing several columns, go in and out of the Transformer stage, you can use the select column facility to select multiple columns. The select facility enables you to: Select all columns/stage variables whose expressions contain text that matches the text specified. Select all column/stage variables whose name contains the text specified (and, optionally, matches a specified type). Select all columns/stage variables with a certain data type. Select all columns with missing or invalid expressions.
15-10
Transformer Stages
To use the select facility, choose Select from the link shortcut menu. The Select dialog box appears. It has three tabs: Expression Text. This allows you to select all columns/stage variables whose expressions contain text that matches the text specified. The text specified is a simple text match, taking into account the Match case setting. Column Names. This allows you to select all columns/stage variables whose name contains the text specified. There is an additional Data type drop-down list that will limit the columns selected to those with that data type. You can use the Data type drop-down list on its own to select all columns of a certain data type. For example, all string columns can be selected by leaving the text field blank, and selecting String as the data type. The data types in the list are generic data types, where each of the column SQL data types belong to one of these generic types. Expression Types. This allows you to select all columns with either empty expressions or invalid expressions.
15-11
Transformer Stages
15-12
Transformer Stages
does not meet the DataStage usage pattern rules, but will actually function correctly.) Once an output column has a derivation defined that contains any input columns, then a relationship line is drawn between the input column and the output column, as shown in the following example:
This is a simple example; there can be multiple relationship lines either into or out of columns. You can choose whether to view the relationships for all links, or just the relationships for the selected links, using the button on the toolbar.
Do one of the following: Click the Column Auto-Match button on the Transformer Editor toolbar. Select Auto Match from the input link header or output link header shortcut menu. Select Auto-Match Columns from the Transformer stage shortcut menu on the Designer canvas, and choose the target output link. With this option, the matching is done automatically based on column names, without opening the Transformer Editor or the Column Auto-Match dialog box.
15-13
Transformer Stages
With either of the first two options, the Column Auto-Match dialog box appears:
2 3
Select the output link that you want to match columns for from the drop-down list. Click Location match or Name match from the Match type area. If you click Location match, this will set output column derivations to the input link columns in the equivalent positions. It starts with the first input link column going to the first output link column, and works its way down until there are no more input columns left. If you click Name match, you need to specify further information for the input and output columns as follows: Input Columns:
Match all columns or Match selected columns. Click one of these to specify whether all input link columns should be matched, or only those currently selected on the input link. Ignore prefix. Allows you to optionally specify characters at the front of the column name that should be ignored during the matching procedure. Ignore suffix. Allows you to optionally specify characters at the end of the column name that should be ignored during the matching procedure.
15-14
Transformer Stages
Output Columns:
Ignore prefix. Allows you to optionally specify characters at the front of the column name that should be ignored during the matching procedure. Ignore suffix. Allows you to optionally specify characters at the end of the column name that should be ignored during the matching procedure.
Ignore case. Select this check box to specify that case should be ignored when matching names. The setting of this also affects the Ignore prefix and Ignore suffix settings. For example, if you specify that the prefix IP will be ignored and select Ignore case, then both IP and ip will be ignored.
4
Note Auto-matching does not take into account any data type incompatibility between matched columns; the derivations are set regardless.
Whole Expression
With this option the whole existing expression for each column is replaced by the replacement value specified. This replacement value can be a completely new value, but will usually be a value based on the original expression value. When specifying the replacement value, the existing value of the columns expression can be included in this new value by including $1. This can be included any number of times.
15-15
Transformer Stages
For example, when adding a trim() call around each expression of the currently selected column set, having selected the required columns, you would:
1 2
Select the Whole expression option. Enter a replacement value of: trim($1) Click OK.
This is applied to the expressions in each of the selected columns. If you need to include the actual text $1 in your expression, enter it as $$1.
Part of Expression
With this option, only part of each selected expression is replaced rather than the whole expression. The part of the expression to be replaced is specified by selecting Regular expression to match. It is possible that more that one part of an expression string could match the regular expression specified. If Replace all occurrences of a match within the expression is checked, then each occurrence of a match will be updated with the replacement value specified. If it is not checked, then just the first occurrence is replaced. When replacing part of an expression, the replacement value specified can include that part of the original expression being replaced. In order to do this, the regular expression specified must have round brackets around its value. $1 in the replacement value will then represent that matched text. If the regular expression is not surrounded by round brackets, then $1 will simply be the text $1. For complex regular expression usage, subsets of the regular expression text can be included in round brackets rather than the whole text. In this case, the entire matched part of the original expression is still replaced, but $1, $2 etc. can be used to refer to each matched bracketed part of the regular expression specified. The following is an example of the Part of expression replacement.
15-16
Transformer Stages
Suppose a selected set of columns have derivations that use input columns from DSLink3. For example, two of these derivations could be:
DSLink3.OrderCount + 1 If (DSLink3.Total > 0) Then DSLink3.Total Else -1
You may want to protect the usage of these input columns from null values, and use a zero value instead of the null. To do this:
1 2 3
Select the columns you want to substitute expressions for. Select the Part of expression option. Specify a regular expression value of: (DSLink3\.[a-z,A-Z,0-9]*) This will match strings that contain DSLink3. followed by any number of alphabetic characters or digits. (This assumes that column names in this case are made up of alphabetic characters and digits). The round brackets around the whole expression means that $1 will represent the whole matched text in the replacement value.
Specify a replacement value of: NullToZero($1) This replaces just the matched substrings in the original expression with those same substrings, but surrounded by the NullToZero call.
would become:
NullToZero(DSLink3.OrderCount) + 1
and
If (DSLink3.Total > 0) Then DSLink3.Total Else 1
would become:
If (NullToZero(DSLink3.Total) > 0) Then DSLink3.Total Else 1
If the Replace all occurrences of a match within the expression option is selected, the second expression will become:
If (NullToZero(DSLink3.Total) > 0) Then NullToZero(DSLink3.Total) Else 1
15-17
Transformer Stages
The replacement value can be any form of expression string. For example, in the case above, the replacement value could have been:
(If (StageVar1 > 50000) Then $1 Else ($1 + 100))
would become:
(If (StageVar1 > 50000) Then DSLink3.OrderCount Else (DSLink3.OrderCount + 100)) + 1
Define a constraint by double-clicking the Constraint field next to the output link name. This opens the Expression Editor dialog box. (For
15-18
Transformer Stages
details on defining expressions, see "The DataStage Expression Editor" on page 15-24). Once you have defined a constraint, it will appear below the output links title bar in the Transformer Editor. When the job runs, the constraint expression will be checked against the row data. If the data does not satisfy the constraint, the row will not be written to that link. Define a reject link by entering an expression in the Constraint field that tests the variable REJECTEDCODE for failure in any of the previous links. To build the expression, use the constant DSE_TRXCONSTRAINT, which indicates that a row was rejected because the link constraint was not satisfied. An example would be:
OutLink.REJECTEDCODE = DSE_TRXCONSTRAINT
You can use the AND/OR operators to build a compound expression that tests constraints on multiple output links. Note that the reject link(s) must be last in the execution order. Any data on rows not written to any other output link in the stage is then written to the reject link(s), using the column mappings you have specified. For example, suppose you have a job that writes out regional data to a relational database. You want to create a reject link as well as an error log. Your job design might look like this:
Data Source
Transformer Stage
Link2
Lets assume that the links are executed in order: Link1, Link2, Link3. A constraint on Link1 checks that the correct region codes are being used. Link2, the reject link, captures rows which are rejected from Link1 because the region code is incorrect. The constraint expression for Link2 would be:
Link1.REJECTEDCODE = DSE_TRXCONSTRAINT
15-19
Transformer Stages
Link3, the error log, captures rows that were rejected from the Relational target stage because of a DBMS error rather than a failed constraint. The expression for Link3 would be:
Link1.REJECTEDCODE = DSE_TRXLINK
You could then insert an additional output column on Link3 to return the DBMS error code. The derivation expression for this column would be:
Link1.DBMSCODE
By looking at the value in this column, you would be able to determine the reason why the row was rejected.
Do one of the following: Click the Output Link Execution Order button on the Transformer Editor toolbar. Choose Reorder Output Links from the background shortcut menu. Click the Stage Properties button on the Transformer Editor toolbar, or choose Stage Properties from the background shortcut menu and click the Link Ordering tab. The Transformer Stage Properties dialog box appears with the Link Ordering tab of the Stage page displayed.
15-20
Transformer Stages
2 3
Use the arrow buttons to rearrange the list of links in the execution order required. When you are satisfied with the order, click OK.
15-21
Transformer Stages
The table lists the stage variables together with the expressions used to derive their values. Link lines join the stage variables with input columns used in the expressions. Links from the right side of the table connect the variables to the output columns that use them. To declare a stage variable:
1
Do one of the following: Select Insert New Stage Variable from the stage variable shortcut menu. A new variable is added to the stage variables table in the links pane. The variable is given the default name StageVar and default data type Decimal (18, 4). You can edit these properties using the Transformer Stage Properties dialog box, as described in the next step. Click the Stage Properties button on the Transformer toolbar. Select Stage Properties from the background shortcut menu. Select Stage Variable Properties from the stage variable shortcut menu.
15-22
Transformer Stages
Click the Variables tab. The Variables tab contains a grid showing currently declared variables, their initial values, SQL type, precision, scale, and an optional description. Use the standard grid controls to add or edit variables. Click the Load button to load stage variables from a table definition in the Repository, or Save As to save them as a table definition in the Repository. Click Clear All to start over. Variable names must begin with an alphabetic character (az, AZ) and can only contain alphanumeric characters (az, AZ, 09). The initial value is required and must be an absolute value in mainframe jobs. If the initial value is a string, it must be enclosed in single quotes.
Click OK. The new variable appears in the stage variable table in the links pane.
You can perform most of the same operations on a stage variable as you can on an output column (see "Defining Output Column Derivations" on page 15-12). A shortcut menu offers the same commands. You cannot, however, paste a stage variable as a new column, or paste a column as a new stage variable.
15-23
Transformer Stages
Entering Expressions
There are two ways to define expressions using the Expression Editor: typing directly in the Expression syntax text box, or building the expression using the available items and operators shown in the bottom pane.
15-24
Transformer Stages
To build an expression:
1
Click a branch in the Item type box. The available items are displayed in the Item properties list. The Expression Editor offers the following programming components: Columns. Input columns. The column name, data type, and link name are displayed under Item properties. When you select a column, any description that exists will appear at the bottom of the Expression Editor dialog box. Variables. The built-in variables SQLCA.SQLCODE, ENDOFDATA, REJECTEDCODE and DBMSCODE, as well as any local stage variables you have defined. The variable name and data type are displayed under Item properties. Built-in Routines. SQL3 functions including data type conversion, date and time, logical, numerical, and string functions. Function syntax is displayed under Item properties. When you select a function, a description appears at the bottom of the Expression Editor dialog box. Parameters. Any job parameters that you have defined. The parameter name and data type are displayed under Item properties. Constants. Built-in constants including CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP DSE_NOERROR, , DSE_TRXCONSTRAINT, DSE_TRXLINK, NULL, HIGH_VALUES, LOW_VALUES, and X. The DSE_ constants are available only for constraint expressions, and NULL is available only for derivation expressions. For definitions of these programming components, see Appendix A, "Programmers Reference."
2 3
Double-click an item in the Item properties list to insert it into the Expression syntax box. Click one of the buttons on the Operators toolbar to insert an operator in the Expression syntax box. (For operator definitions see Appendix A, "Programmers Reference.")
As you build the expression, you can click Undo to undo the last change or Clear All to start over. Click OK to save the expression when you are finished.
15-25
Transformer Stages
expression semantic checking in project or job properties, then click the Verify button in the Expression Editor. You can save an expression without correcting errors, but you will be warned that the expression is invalid.
15-26
16
Business Rule Stages
This chapter describes Business Rule stages, which are used to perform complex transformations using SQL business rule logic. They provide access to the control-flow features of SQL, such as conditional and looping statements, and give you greater transaction control over a job using SQLs COMMIT and ROLLBACK statements. You can also use Business Rule stages to terminate job processing using an EXIT statement or to display information in COBOL using a DISPLAY statement.
16-1
When you edit a Business Rule stage, the Business Rule Stage dialog box appears:
This dialog box has three pages: Stage. Displays the name of the stage you are editing. The stage name is editable. This page has three tabs:
General. Allows you to enter an optional description of the stage. Variables. Used to define stage variables. See "Defining Stage Variables" on page 16-2 for details. Definition. Used to specify the business rule logic for the stage. See "Specifying Business Rule Logic" on page 16-4 for details.
Inputs. Specifies the column definitions for the data input link. Outputs. Specifies the column definitions for the data output links. Click OK to close this dialog box. Changes are saved when you save the job.
16-2
If an initial value is not specified for a stage variable, it has an initial value of NULL. The variable is initialized before the first input row is processed. If the business rule logic specified on the Definition tab assigns a value to the stage variable for any given input row, the variable retains its value for subsequent rows until it is reassigned another value. You declare stage variables on the Variables tab of the Business Rule Stage dialog box:
Declare a stage variable using the grid: Name. The name of the stage variable. Variable names must begin with an alphabetic character (a-z, A-Z) and can only contain alphanumeric characters (a-z, A-A, 0-9). Initial Value. The initial value of the variable. If the initial value is a string, it must be enclosed in single quotes. SQL type. The SQL data type of the variable. Choose the SQL type from the drop-down list. For details about the data types supported in mainframe jobs, see Appendix B, "Data Type Definitions and Mappings." Precision. The precision of the variable. This is the number of characters for Char data, the maximum number of characters for VarChar data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of Timestamp data. Scale. The data scale factor of the variable. This is the number of digits to the right of the decimal point for Decimal data, and zero for all other data types. Description. An optional description of the variable.
16-3
Click Load to load a set of stage variables from the table definition in the Repository. You can also enter and edit stage variables manually and click Save As to save them as a table definition, a CFD file, or a DCLGen file. Click Clear All to start over.
The Definition tab is divided into four panes: Templates. Lists the programming components you can use in a business rule, including:
Columns. The columns on the input and output links. Parameters. Any job parameters you have defined. Variables. Any stage variables you have defined on the Variables tab, as well as the built-in variables ENDOFDATA and SQLCA.SQLCODE. SQL Constructs. The available SQL constructs. See "SQL Constructs" on page 16-6 for SQL statement definitions. Built-in Routines. SQL3 functions including data type conversion, date and time, logical, numerical and string functions. Constants. Built-in constants including CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP HIGH_VALUES, , LOW_VALUES, X, and NULL.
16-4
For definitions of Ascential DataStages built-in variables, functions, and constants, see Appendix A, "Programmers Reference." Business rule editor. Displays the business rule as you define it. A business rule consists of an SQL statement list, which is a sequence of SQL statements terminated by semicolons. Any comments must begin with /* and end with */. To create a business rule, type directly in the text box or insert code fragments by selecting or dragging items from the Templates and Operators panes. Standard editing functions such as cut, copy, paste, delete, select all, and replace are available from the shortcut menu, which you can access by rightclicking anywhere in the box. This pane contains two buttons:
Build Rule. Click this to automatically generate the SET and INSERT statements (and constraints if any exist) to map input columns to output columns. The following dialog box appears:
This dialog box contains a Comment page, where you can type comments to be inserted in the Business rule editor pane, and a Rule page, where you define the mappings between input columns, output columns, and any stage variables that exist. To define the mappings, use a drag-and-drop operation or click the Auto-Match button to map columns based on name or location. You can also double-click the Derivation cell next to an output column or stage variable to create derivation
16-5
expressions using the Expression Editor. For more information on using the Expression Editor, see "Entering Expressions" on page 15-24. Once the mappings are defined, the necessary SET and INSERT statements appear where the cursor is positioned in the Business rule editor text box. To define another set of mappings, click the Build Rule button again. Any previously defined mappings are not displayed.
Verify. Click this to check the syntax and semantics of the business rule. Any errors are displayed in the Status pane.
Operators. Displays the available operators, including arithmetic, logical, relational, and string concatenation operators. Operator definitions are provided in Appendix A, "Programmers Reference." Status. Displays status messages about any syntax or semantic errors found in the business rule logic. You can double-click a syntax error to highlight the location of the error in the Business rule editor text box. Output columns are initialized to NULL before the first input row is processed. If the business rule logic assigns a value to an output column for any given input row, the column retains its value for subsequent rows until it is reassigned another value.
Note If the Column push option is selected in Designer options and you close the Business Rule stage without specifying any logic on the Definition tab, the stage automatically generates business rule logic to copy all input link columns to any empty output links.
SQL Constructs
When you define the business rule logic on the Definition tab, you can choose from a number of SQL constructs in the Templates pane.
16-6
Table 16-1 describes the syntax descriptions and semantic rules for these SQL constructs. Table 16-1 SQL Constructs
Name
BEGIN END Block
Description
Groups statements together. Acts as an organization tool and does not affect the business rule logic. Syntax:
[<beginning label>:] BEGIN <block body> END [<ending label>] block body is an SQL statement list
Semantic Rules: A block label is an SQL identifier that gives a name for the block. Block labels are optional. If an ending label is specified, it must match the beginning label. SET Statement Evaluates an expression and assigns the result to a variable or an output link column. Syntax:
SET <target> = <source> target is an output link column or a variable source is an expression or NULL
Semantic Rules: If the data types of the source and target are not equivalent, the source is automatically converted to the targets data type before assignment. If the source is not convertible to the target data type, an error will occur. The conversions that are supported are the same as those allowed by the CAST function. For details about the CAST function, see Appendix A, "Programmers Reference." INSERT Statement Sends columns down an output link. Syntax:
INSERT INTO <output link>
Semantic Rules: A business rule must contain at least one INSERT statement for each output link. To verify that data has been successfully written to an output link, check the variable SQLCA.SQLCODE after the INSERT statement. A nonzero value indicates an error. DISPLAY Statement Writes values to the SYSPRINT spooler. Syntax:
DISPLAY (<value list>) value list is <expression> [,<expression>]...
Semantic Rules: Expression values are written to the SYSPRINT spooler from left to right on one line, terminated by a carriage return. Noncharacter values are displayed as if they were converted to VARCHAR.
16-7
Description
Allows conditional execution of SQL statements. Syntax:
IF <condition> <THEN clause> [<ELSE clause>] END IF condition is a comparison whose value determines the program flow. THEN clause is the statement to be executed if the condition is true. ELSE clause is the statement to be executed if the condition is false.
Semantic Rules: A condition must be a boolean expression. If the condition evaluates to TRUE, the business rule executes the SQL statements in the THEN clause. If the condition evaluates to FALSE or UNKNOWN (NULL), the business rule executes the SQL statements in the ELSE clause if present. LOOP Statement Executes the loop body repeatedly until a LEAVE statement is executed to exit the loop. Syntax:
<beginning label> : LOOP <loop body> END LOOP [<ending label>] loop body is an SQL statement list
Semantic Rules: A loop label is an SQL identifier that gives a name for the loop. The ending label is optional. If an ending label is specified, it must match the beginning label. The loop body must contain a LEAVE statement. LEAVE Statement Exits a loop. Syntax:
LEAVE <loop label> loop label is an SQL identifier that gives a name for a loop
Semantic Rules: A LEAVE statement must be used in a loop body. It exits the loop, allowing program execution to resume at the statement following the END LOOP The loop label must match the label of the nearest . LOOP statement that contains the LEAVE statement. COMMIT Statement Commits any inserts, updates, and deletes made to relational tables in a job. Syntax:
COMMIT
Semantic Rules: To use a COMMIT statement, a job must contain a target Relational or Teradata Relational stage.
16-8
Description
Cancels any inserts, updates, and deletes made to relational tables in a job since the last COMMIT statement. Syntax:
ROLLBACK
Semantic Rules: To use a ROLLBACK statement, a job must contain a target Relational or Teradata Relational stage. EXIT Statement Performs an implicit COMMIT and terminates the job with the status. Syntax:
EXIT (<status>)
Semantic Rules: The exit status must be an integer expression. Its value is returned to the operating system.
16-9
The Inputs page has the following field and two tabs: Input name. The name of the input link to the Business Rule stage. Since only one input link is allowed, the link name is readonly. General. Contains an optional description of the link. Columns. Contains a grid displaying the column definitions for the data being written to the stage. This grid has the following columns:
Column name. The name of the column. SQL type. The SQL data type. For details about the data types supported in mainframe jobs, see Appendix B, "Data Type Definitions and Mappings." Length. The data precision. This is the number of characters for Char data, the maximum number of characters for VarChar data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of Timestamp data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for Decimal data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
Input column definitions are read-only in the Business Rule stage. You must go back to the stage on your input link if you want to change the column definitions.
16-10
The Outputs page has the following field and two tabs: Output name. The name of the output link. If there is only one output link, this field is read-only. If there are multiple output links, select the one you want to edit from the drop-down list. General. Contains an optional description of the link. Columns. Contains the column definitions for the data on the output links. This grid has the following columns:
Column name. The name of the column. SQL type. The SQL data type. For details about the data types supported in mainframe jobs, see Appendix B, "Data Type Definitions and Mappings." Length. The data precision. This is the number of characters for Char data, the maximum number of characters for VarChar data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of Timestamp data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for Decimal data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
Click Load to selectively load columns from a table definition in the Repository. You can also enter and edit column definitions manually and click Save As to save them as a table definition, a CFD file, or a DCLGen file. Click Clear All to start over. For details
Mainframe Job Developers Guide 16-11
16-12
17
Link Collector Stages
This chapter describes Link Collector stages, which are used to combine data from multiple input links into a single output link. The number of columns on the output link must be the same as the number of columns on each of the input links. Data from the input links is appended to the output link, preserving the number of columns and increasing the number of rows. In mainframe Link Collector stages you do not specify a collection algorithm as you do in server Link Collector stages. If you wish to collect data using the sort/merge method provided in server jobs, use a Join stage instead of a Link Collector stage and specify the Two File Match join technique. In mainframe jobs there is no equivalent to the Round-Robin data collection method provided in server jobs.
17-1
When you edit a Link Collector stage, the Link Collector Stage dialog box appears:
This dialog box has three pages: Stage. Displays the stage name, which can be edited. This page has a General tab where you can enter an optional description of the stage. Inputs. Specifies the column definitions for the data input links. Outputs. Specifies the column definitions for the data output link. Click OK to close this dialog box. Changes are saved when you save the job.
17-2
The Inputs page has the following field and two tabs: Input name. The name of the input link. Select the link you want to edit from the Input name drop-down list. This list displays all of the input links to the Link Collector stage. General. Contains an optional description of the link. Columns. Contains a grid displaying the column definitions for the data on the input links. The grid has the following columns:
Column name. The name of the column. SQL type. The SQL data type. For details about the data types supported in mainframe jobs, see Appendix B, "Data Type Definitions and Mappings." Length. The data precision. This is the number of characters for Char data, the maximum number of characters for VarChar data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of Timestamp data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for Decimal data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
Input column definitions are read-only in the Link Collector stage. You must go back to the stages on your input links if you want to change the column definitions.
17-3
Note that the number of columns on each input link must be the same and must match the number of columns on the output link.
The Outputs page has the following field and two tabs: Output name. The name of the output link. Since only one output link is allowed, the link name is read-only. General. Contains an optional description of the link. Columns. Contains a grid displaying the column definitions for the data on the output link. This grid has the following columns:
Column name. The name of the column. SQL type. The SQL data type. For details about the data types supported in mainframe jobs, see Appendix B, "Data Type Definitions and Mappings." Length. The data precision. This is the number of characters for Char data, the maximum number of characters for VarChar data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of Timestamp data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for Decimal data, and zero for all other data types.
Mainframe Job Developers Guide
17-4
Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
You can Load columns from a table definition in the Repository, or enter column definitions manually and click Save As to save them as a table definition, a CFD file, or a DCLGen file. Click Clear All to start over. Note that the number of columns on the output link must be identical to the number of columns on each of the input links. For details on editing column definitions, see Appendix D, "Editing Column Meta Data."
Mapping Data
In Link Collector stages, input columns are automatically mapped to output columns based on position. Data types between input and output columns must be convertible, and data conversion is automatic.
Note If the Column push option is selected in Designer options and the output link columns do not exist, then the output columns are automatically created from the columns on the first input link when you click OK to exit the stage.
The order in which the input links are processed by the Link Collector stage depends on the job design. The stage usually sends all rows of one input link down the output link before processing another input link. Since the stage does not store input rows, it sends an input row down the output link as soon as the row is received. Therefore the order in which rows are sent down the output link depends on when the rows arrive on the input links. End-of-data rows are treated as normal input rows. If there are end-ofdata rows on multiple input links, they are sent down the output link in the order they come in. Therefore an end-of-data row is not necessarily the last row sent down the output link. If some of a Link Collector stages input links can be traced back to a common Transformer stage without any passive stage in between, then the order in which these input link rows are processed depends on the output link ordering in the Transformer stage.
17-5
17-6
18
Join Stages
This chapter describes Join stages, which are used to join data from two input tables and produce one output table. You can use the Join stage to perform inner joins, outer joins, or full joins. An inner join returns only those rows that have matching column values in both input tables. The unmatched rows are discarded. An outer join returns all rows from the outer table even if there are no matches. You define which of the two tables is the outer table. A full join returns all rows that match the join condition, plus the unmatched rows from both input tables. Unmatched rows returned in outer joins or full joins have NULL values in the columns of the other link.
18-1
Join Stages
When you edit a Join stage, the Join Stage dialog box appears:
This dialog box has three pages: Stage. Displays the name of the stage you are editing. The stage name is editable. This page has a General tab where you define the join specifications and enter an optional description of the stage. In the Join type area, you can select to perform an inner join, an outer join, or a full join. Inner join is the default option. In the Outer link drop-down list box, select the input link that will be the outer table if you are performing an outer join. The columns from this link, called the primary link, are preserved in the join. If you are performing an inner join, the other (nonselected) link, called the secondary link, is the inner table where the join technique is applied. The Join technique drop-down list box is where you specify the algorithm for performing the join. Four options are available:
Auto. The join technique is automatically chosen by Ascential DataStage based on the information you specify in the stage. This is the default option. Hash. An in-memory hash table is built on the secondary input table (i.e., the input link not selected as the outer link). This technique requires an equality join condition, where a column (or an expression based on a column) from the primary link equals a column (or an expression based on a column) from the secondary link. Compound equality join conditions are allowed.
18-2
Join Stages
For information on hash table memory requirements, see "Calculating Hash Table Memory Requirements" on page G-4.
Nested. Each row of the secondary input table is read sequentially to determine if the column value matches that of the primary input table. Two File Match. The primary and secondary input tables are read sequentially one time to determine if column values match. Both input tables must be sorted on the matching keys, and the primary table may not have duplicates. This technique requires an equality join condition, where a column (or an expression based on a column) from the primary link equals a column (or an expression based on a column) from the secondary link. A compound equality join condition is allowed.
Note If the join condition contains an expression, the input tables must be sorted on the expression result. For example, if a SUBSTRING expression is specified, the input tables must be sorted on the SUBSTRING portion of the column.
Inputs. Specifies the column definitions for the data input links. Outputs. Specifies the column definitions for the data output link. This page has a Join Condition tab where you define the join condition. The Mapping tab is used to define the mappings between input and output columns. Click OK to close this dialog box. Changes are saved when you save the job.
18-3
Join Stages
column definitions of the data are described on the Inputs page in the Join Stage dialog box:
The Inputs page has the following field and two tabs: Input name. The name of the input link to the Join stage. Select the link you want to edit from the Input name drop-down list. This list displays the two input links to the Join stage. General. Shows the input type and contains an optional description of the link. The Input type field is read-only and indicates whether the input link is the outer (primary) link or the inner (secondary) link, as specified on the Stage page. Columns. Displayed by default. Contains a grid displaying the column definitions for the data being written to the stage. This grid has the following columns:
Column name. The name of the column. SQL type. The SQL data type. For details about the data types supported in mainframe jobs, see Appendix B, "Data Type Definitions and Mappings." Length. The data precision. This is the number of characters for Char data, the maximum number of characters for VarChar data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of Timestamp data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for Decimal data, and zero for all other data types.
18-4
Join Stages
Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
Input column definitions are read-only in the Join stage. You must go back to the stages on your input links if you want to change the column definitions.
The Outputs page has the following field and four tabs: Output name. The name of the output link. Since only one output link is allowed, the link name is read-only. General. Contains an optional description of the link. Join Condition. Displayed by default. Contains the join condition. See "Defining the Join Condition" on page 18-6 for details on specifying the join condition. Mapping. Specifies the mapping of input columns to output columns. See "Mapping Data" on page 18-7 for details on defining mappings.
18-5
Join Stages
Columns. Contains the column definitions for the data on the output link. This grid has the following columns:
Column name. The name of the column. SQL type. The SQL data type. For details about the data types supported in mainframe jobs, see Appendix B, "Data Type Definitions and Mappings." Length. The data precision. This is the number of characters for Char data, the maximum number of characters for VarChar data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of Timestamp data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for Decimal data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
You can Load columns from a table definition in the Repository, or enter column definitions manually and click Save As to save them as a table definition, a CFD file, or a DCLGen file. Click Clear All to start over. For details on editing column definitions, see Appendix D, "Editing Column Meta Data."
18-6
Join Stages
Create an expression using the Join Condition grid: (. Select an opening parenthesis if needed. Column. Select a column from the drop-down list. The dropdown list displays the column names from both input links. Op. Select an operator or a logical function from the drop-down list. For definitions of these items, see Appendix A, "Programmers Reference." Column/Value. Select a column from the drop-down list or double-click in the cell to enter a value. Character values must be enclosed in single quotation marks. ). Select a closing parenthesis if needed. Logical. Select AND or OR from the drop-down list to continue the expression in the next row. All of these columns are editable. As you build the join condition, it appears in the Join condition field. Join conditions must be boolean expressions that return TRUE or FALSE. To validate the expression, click Verify. If errors are found, you must either correct the expression, click Clear All to start over, or cancel. You cannot save an incorrect join condition. Ascential DataStage follows SQL guidelines on orders of operators in expressions. After you verify a join condition, any redundant parentheses may be removed. For details, see "Operators" on page A-16.
Mapping Data
The Mapping tab is used to define the mappings between input and output columns being passed through the Join stage.
Note You can bypass this step if the Column push option is selected in Designer options. Output columns are automatically created for each output link, and mappings between corresponding input and output columns are defined, when you click OK to exit the stage.
18-7
Join Stages
This tab is divided into two panes, the left for the input links (and any job parameters that have been defined) and the right for the output link, and it shows the columns and the relationships between them:
You can drag the splitter bar between the two panes to resize them relative to one another. Vertical scroll bars allow you to scroll the view up or down the column lists, as well as up or down the panes. You can define column mappings from the Mapping tab in two ways: Drag and Drop. This specifies that an output column is directly derived from an input column. See "Using Drag and Drop" on page 18-9 for details. Auto-Match. This automatically sets output column derivations from their matching input columns, based on name or location. See "Using Column Auto-Match" on page 18-9 for details. Derivation expressions cannot be specified on the Mapping tab. If you need to perform data transformations, you must include a Transformer stage elsewhere in your job design. As mappings are defined, the output column names change from red to black. A relationship line is drawn between the input column and the output column.
Find Facility
If you are working on a complex job, there is a find facility to help you locate a particular column or expression. To use the find facility, do one of the following: Click the Find button on the Mapping tab.
18-8
Join Stages
Select Find from the link shortcut menu. The Find dialog box appears:
This dialog box has two tabs: Column Names. Allows you to find a particular column. Expression Text. Allows you to locate the occurrence of a particular string within an output column expression. To begin your search, go to the appropriate tab and select the link name from the Link name drop-down list. (You can search for expression text only on the output link.) Enter the text to search for in the Find what field. Select the Match case and Match whole word check boxes to narrow your search. On the Expression Text tab, select Empty Expression to search for the next empty expression.
Click the source cell to select it. Click the selected cell again and, without releasing the mouse button, drag the mouse pointer to the desired location within the target link. Release the mouse button to drop the selected cell.
You can also click the title bar displaying the name of the link and, without releasing the mouse button, drag the mouse pointer to the first Derivation cell within the target link. This will map all input columns to the output columns based on location.
18-9
Join Stages
To use auto-match:
1
Click the AutoMap button on the Mapping tab. The Column Auto-Match dialog box appears:
Click Location match or Name match from the Match type area. If you click Location match, this will set output column derivations to the input link columns in the equivalent positions. It starts with the first input link column going to the first output link column, and works its way down until there are no more input columns left. If you click Name match, you need to specify further information for the input and output columns as follows: Input Columns:
Match all columns or Match selected columns. Click one of these to specify whether all input link columns should be matched, or only those currently selected on the input link. Ignore prefix. Allows you to optionally specify characters at the front of the column name that should be ignored during the matching procedure. Ignore suffix. Allows you to optionally specify characters at the end of the column name that should be ignored during the matching procedure.
18-10
Join Stages
Join Examples
Output Columns:
Ignore prefix. Allows you to optionally specify characters at the front of the column name that should be ignored during the matching procedure. Ignore suffix. Allows you to optionally specify characters at the end of the column name that should be ignored during the matching procedure.
Ignore case. Select this check box to specify that case should be ignored when matching names. The setting of this also affects the Ignore prefix and Ignore suffix settings. For example, if you specify that the prefix IP will be ignored and select Ignore case, then both IP and ip will be ignored.
3
Note Auto-matching does not take into account any data type incompatibility between matched columns; the derivations are set regardless.
Join Examples
Join stages allow you to perform three types of joins: inner joins, outer joins, and full joins. The following example illustrates the different results produced by each type of join. Suppose you have a table containing information on sales orders. Each sales order includes the customer identification number, product, and order total, as shown in Table 18-1. Table 18-1 Sales Orders
Customer ID Product
10 20 30 30 40 50 90 Paint Primer Paintbrushes Rollers Wallpaper Masking Tape Drop cloths
Order Total
$25 $15 $10 $10 $50 $5 $15
18-11
Join Examples
Join Stages
Another table contains detailed customer information, as shown in Table 18-2. Table 18-2 Customers
Customer ID Customer Name
10 20 30 40 50 60 AAA Painting ABC Paint Pros Mural Art Ocean Design Co. Smith & Son Painters West Coast Interiors
City
San Jose Portland Sacramento Monterey Reno
State
California Oregon California California Nevada
You specify a join condition that matches the two tables on customer identification number and returns the customer and sales order information. An inner join returns the results shown in Table 18-3. Since the last row in each table is unmatched, both are discarded. Table 18-3 Inner Join Result
Customer Name
AAA Painting ABC Paint Pros Mural Art Mural Art Ocean Design Co.
City
San Jose Portland Sacramento Sacramento Monterey
State
California Oregon California California California Nevada
Product
Paint Primer Paintbrushes Rollers Wallpaper
Order Total
$25 $15 $10 $10 $50
Masking Tape $5
An outer join, where the customer table is the outer link, returns the six matching rows as well as the unmatched rows from the customer
18-12
Join Stages
Join Examples
table, shown in Table 18-4. Notice that the unmatched rows contain null values in the product and order total columns. Table 18-4 Outer Join Result
Customer Name
AAA Painting ABC Paint Pros Mural Art Mural Art Ocean Design Co.
City
San Jose Portland Sacramento Sacramento Monterey
State
California Oregon California California California Nevada
Product
Paint Primer Paintbrushes Rollers Wallpaper
Order Total
$25 $15 $10 $10 $50
By contrast, a full join returns all the rows that match the join condition, as well as unmatched rows from both input links. The results are shown in Table 18-5. Table 18-5 Full Join Result
Customer Name
AAA Painting ABC Paint Pros Mural Art Mural Art Ocean Design Co.
City
San Jose Portland Sacramento Sacramento Monterey
State
California Oregon California California California Nevada (Null)
Product
Paint Primer Paintbrushes Rollers Wallpaper
Order Total
$25 $15 $10 $10 $50
Smith & Son Painters Reno (Null) West Coast Interiors (Null)
18-13
Join Examples
Join Stages
18-14
19
Lookup Stages
This chapter describes Lookup stages, which allow you to perform table lookups. A singleton lookup returns the first single row that matches the lookup condition. A cursor lookup returns all rows that match the lookup condition. Ascential DataStage also allows conditional lookups, which are performed only when a pre-lookup condition is true.
19-1
Lookup Stages
When you edit a Lookup stage, the Lookup Stage dialog box appears:
This dialog box has three pages: Stage. Displays the name of the stage you are editing. The stage name is editable. This page has three tabs:
General. This is where you define the lookup specifications and enter an optional description of the stage. The Lookup type area lets you choose to perform a singleton or a cursor lookup. Singleton Lookup is the default. The Lookup technique drop-down list is where you select the Auto or Hash lookup technique. Auto lookups allow Ascential DataStage to choose the technique based on the information you specify. This is the default option. If you select Auto and the reference link is a Relational or Teradata Relational stage, Ascential DataStage passes the lookup condition to the database for processing. If the reference link is a Complex Flat File stage with a VSAM_KSDS file structure, it performs a serial read of the file, using the VSAM START command where possible to reduce the number of records read. In all other cases, selecting Auto results in a hash lookup if possible or else a serial read of the file. Hash lookups are performed using an in-memory hash table built on the reference link. This technique can only be used with an equality lookup condition, where a field from the primary link equals a field from the reference link. For information on hash table memory requirements, see "Calculating Hash Table Memory Requirements" on page G-4.
19-2
Lookup Stages
Pre-lookup Condition. This is where you specify a prelookup condition for conditional lookups. See "Performing Conditional Lookups" on page 19-3 for details on defining a pre-lookup condition. Lookup Condition. Contains the lookup expression. See "Defining the Lookup Condition" on page 19-5 for details on specifying the lookup condition.
Inputs. Specifies the column definitions for the data input links. Outputs. Specifies the column definitions for the data output link and the mappings between input and output columns. Click OK to close this dialog box. Changes are saved when you save the job.
19-3
Lookup Stages
In the Action if pre-lookup condition fails drop-down list, you specify how to handle data that does not meet the pre-lookup condition. There are three options: Skip Row. Prevents the row from being output from the stage. Use Previous Values. Sends the values from the previous lookup down the output link. This option is only available for singleton lookups. If the previous lookup failed or there was no previous lookup, then the action taken depends on your selection in the Action if lookup condition fails field on the Lookup Condition tab. See Table 19-9 on page 19-16 for more information on the results produced by various option combinations. Null Fill. Sends the row down the output link with the lookup values set to NULL if the pre-lookup condition fails. The default value is blank in the Action if pre-lookup condition fails field. This is allowed only if no pre-lookup condition is specified. You define the pre-lookup condition using the following fields on the expression grid: (. Select an opening parenthesis if needed. Column. Select a column from the primary input link, a job parameter, or the ENDOFDATA variable from the drop-down list. ENDOFDATA refers to the value from the primary input link. (See "ENDOFDATA" on page A-20 for more information on using this variable). Op. Select an operator or a logical function from the drop-down list. For definitions of these items, see Appendix A, "Programmers Reference." Column/Value. Select a column from the primary input link or double-click in the cell to enter a value. Character values must be enclosed in single quotation marks. ). Select a closing parenthesis if needed. Logical. Select AND or OR from the drop-down list to continue the expression in the next row. All of these columns are editable. The pre-lookup condition can reference job parameters, constants, and columns of the primary input link, but cannot use columns of the reference link. As you build the expression, it appears in the Pre-lookup condition field. Lookup conditions must be boolean expressions that return TRUE or FALSE. To validate the expression, click Verify . An error message will appear if errors are found. To start over, click Clear All. Ascential DataStage follows SQL guidelines on orders of operators in expressions. After you verify a lookup condition, any redundant
19-4
Lookup Stages
In the Action if lookup condition fails drop-down list, you select an option for handling a failed lookup. There are three options: Skip Row. Skips the row and goes to the next one. This is the default. Abort Program. Stops the program. Null Fill. Fills the columns of the reference link with null values and continues to the next stage with the row from the primary link. You define the lookup condition using the following fields in the expression grid: (. Select an opening parenthesis if needed. Column. Select a column from the drop-down list. The dropdown list displays the column names from both input links. Op. Select an operator or a logical function from the drop-down list. For definitions of these items, see Appendix A, "Programmers Reference."
19-5
Lookup Stages
Column/Value. Select a column from the drop-down list or double-click in the cell to enter a value. Character values must be enclosed in single quotation marks. ). Select a closing parenthesis if needed. Logical. Select AND or OR from the drop-down list to continue the expression in the next row. All of these columns are editable. As you build the lookup expression, it appears in the Lookup condition field. Lookup conditions must be boolean expressions that return TRUE or FALSE. To validate the expression, click Verify. If errors are found, you must either correct the expression, click Clear All to start over, or cancel. You cannot save an incorrect lookup condition. Ascential DataStage follows SQL guidelines on orders of operators in expressions. After you verify a lookup condition, any redundant parentheses may be removed. For details, see "Operators" on page A-16.
19-6
Lookup Stages
The Inputs page has the following field and two tabs: Input name. The name of the input link to the Lookup stage. Select the link you want to edit from the Input name drop-down list. This list displays the two input links to the Lookup stage. General. Shows the input type and contains an optional description of the link. The Input type field is read-only and indicates whether the input link is the stream (primary) link or the reference link. Columns. Displayed by default. Contains a grid displaying the column definitions for the data being written to the stage:
Column name. The name of the column. SQL type. The SQL data type. See Appendix B, "Data Type Definitions and Mappings" for details on the data types supported in mainframe jobs. Length. The data precision. This is the number of characters for Char data, the maximum number of characters for VarChar data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of Timestamp data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for Decimal data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
19-7
Lookup Stages
Input column definitions are read-only in the Lookup stage. You must go back to the stages on your input links if you want to change the column definitions.
The Outputs page has the following field and three tabs: Output name. The name of the output link. Since only one output link is allowed, the link name is read-only. General. Contains an optional description of the link. Mapping. Specifies the mapping of input columns to output columns. See "Mapping Data" on page 19-9 for details on defining mappings. Columns. Contains the column definitions for the data being output from the stage. This grid has the following columns:
Column name. The name of the column. SQL type. The SQL data type. For details about the data types supported in mainframe jobs, see Appendix B, "Data Type Definitions and Mappings."
19-8
Lookup Stages
Length. The data precision. This is the number of characters for Char data, the maximum number of characters for VarChar data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of Timestamp data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for Decimal data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
You can Load columns from a table definition in the Repository, or enter column definitions manually and click Save As to save them as a table definition, a CFD file, or a DCLGen file. Click Clear All to start over. For details on editing column definitions, see Appendix D, "Editing Column Meta Data."
Mapping Data
The Mapping tab is used to define the mappings between input and output columns being passed through the Lookup stage.
Note You can bypass this step if the Column push option is selected in Designer options. Output columns are automatically created for each output link, and mappings between corresponding input and output columns are defined, when you click OK to exit the stage.
This tab is divided into two panes, the left for the input links (and any job parameters that have been defined) and the right for the output link, and it shows the columns and the relationships between them.
19-9
Lookup Stages
You can drag the splitter bar between the two panes to resize them relative to one another. Vertical scroll bars allow you to scroll the view up or down the column lists, as well as up or down the panes. You can define column mappings from the Mapping tab in two ways: Drag and Drop. This specifies that an output column is directly derived from an input column. See "Using Drag and Drop" on page 19-11 for details. Auto-Match. This automatically sets output column derivations from their matching input columns, based on name or location. See "Using Column Auto-Match" on page 19-11 for details. Derivation expressions cannot be specified on the Mapping tab. If you need to perform data transformations, you must include a Transformer stage elsewhere in your job design. As mappings are defined, the output column names change from red to black. A relationship line is drawn between the input column and the output column.
Find Facility
If you are working on a complex job, there is a find facility to help you locate a particular column or expression. To use the find facility, do one of the following: Click the Find button on the Mapping tab. Select Find from the link shortcut menu.
19-10
Lookup Stages
This dialog box has two tabs: Column Names. Allows you to find a particular column. Expression Text. Allows you to locate the occurrence of a particular string within an output column expression. To begin your search, go to the appropriate tab and select the link name from the Link name drop-down list. (You can search for expression text only on the output link.) Enter the text to search for in the Find what field. Select the Match case and Match whole word check boxes to narrow your search. On the Expression Text tab, select Empty Expression to search for the next empty expression.
Click the source cell to select it. Click the selected cell again and, without releasing the mouse button, drag the mouse pointer to the desired location within the target link. Release the mouse button to drop the selected cell.
You can also click the title bar displaying the name of the link and, without releasing the mouse button, drag the mouse pointer to the first Derivation cell within the target link. This will map all input columns to the output columns based on location.
19-11
Lookup Stages
To use auto-match:
1
Click the AutoMap button on the Mapping tab. The Column Auto-Match dialog box appears:
Click Location match or Name match from the Match type area. If you click Location match, this will set output column derivations to the input link columns in the equivalent positions. It starts with the first input link column going to the first output link column, and works its way down until there are no more input columns left. If you click Name match, you need to specify further information for the input and output columns as follows: Input Columns:
Match all columns or Match selected columns. Click one of these to specify whether all input link columns should be matched, or only those currently selected on the input link. Ignore prefix. Allows you to optionally specify characters at the front of the column name that should be ignored during the matching procedure. Ignore suffix. Allows you to optionally specify characters at the end of the column name that should be ignored during the matching procedure.
19-12
Lookup Stages
Lookup Examples
Output Columns:
Ignore prefix. Allows you to optionally specify characters at the front of the column name that should be ignored during the matching procedure. Ignore suffix. Allows you to optionally specify characters at the end of the column name that should be ignored during the matching procedure.
Ignore case. Select this check box to specify that case should be ignored when matching names. The setting of this also affects the Ignore prefix and Ignore suffix settings. For example, if you specify that the prefix IP will be ignored and select Ignore case, then both IP and ip will be ignored.
3
Note Auto-matching does not take into account any data type incompatibility between matched columns; the derivations are set regardless.
Lookup Examples
Table lookups allow you to take a value that is a code in your source table and look up the information associated with that code in a reference table. For example, suppose you have a table containing information on products. For each product there is a supplier code. You have another table with supplier information. In this case you could use a table lookup to translate the supplier code into a supplier name. Table 19-1 provides a simple example of supplier codes on the primary link, and Table 19-2 provides a simple example of the supplier information on the reference link: Table 19-1 Primary Link
Product
Paint Primer Paintbrushes Wallpaper
Supplier Code
A B D E
19-13
Lookup Examples
Lookup Stages
A cursor lookup using the Auto technique and Skip Row option produces the results shown in Table 19-3. Table 19-3 Auto Cursor Lookup Result
Product
Paint Primer Primer Wallpaper
Supplier Name
Anderson Brown, C. Brown, M. Edwards
A cursor lookup using the Hash technique and Skip Row option produces the results shown in either Table 19-4 or Table 19-5, depending on how the hash table is built. Table 19-4 Hash Cursor Lookup Result (A)
Product
Paint Primer Primer Wallpaper
Supplier Name
Anderson Brown, C. Brown, M. Edwards
Supplier Name
Anderson Brown, M. Brown, C. Edwards
19-14
Lookup Stages
A singleton lookup using the Auto technique and Skip Row option produces the results shown in Table 19-6. Table 19-6 Auto Singleton Lookup Result
Product
Paint Primer Wallpaper
Supplier Name
Anderson Brown, C. Edwards
A singleton lookup using the Hash technique and Skip Row option produces the results shown in either Table 19-7 or Table 19-8, depending on how the hash table is built. Table 19-7 Hash Singleton Lookup Result (A)
Product
Paint Primer Wallpaper
Supplier Name
Anderson Brown, C. Edwards
Supplier Name
Anderson Brown, M. Edwards
In the singleton lookup examples, if you had chosen the Null Fill option instead of Skip Row as the action for a failed lookup, there would be another row in each table for the product Paintbrushes with a NULL for supplier name.
19-15
Lookup Stages
sense for some business cases. Table 19-9 describes the results of various option combinations. Table 19-9 Action if Lookup Fails Option Combinations
Result of Pre-lookup Condition
TRUE TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
Use Previous Values Successful Use Previous Values Failed Use Previous Values Failed Use Previous Values Failed
As an example, suppose you design a job that uses a conditional lookup to find supplier data that is missing from a product table. The product table is the primary link to the Lookup stage and the supplier data is the reference link, as shown in the following job design.
19-16
Lookup Stages
Data for the ProductData primary link is shown in Table 19-10. Notice that the column Supplier_Name has missing data. Table 19-10 Primary Link
Record #
1 2 3 4 5 6 7 8 9 10 11 12 13 14
Supplier_Code
A B B B C C D D E F X Z X Z
Supplier_Name Product
Anderson Brown Brown Paint Paint Primer Brushes Wallpaper Carson Wallpaper Paint Varnish Edwards Fisher Xcel Zack Wallpaper Brushes Stain Primer Varnish Brushes
19-17
Lookup Stages
Data for the SupplierInfo reference link is shown in Table 19-11: Table 19-11 Reference Link
Supplier_Code
A B C D E F G
Supplier_Name
Anderson Brown Carson Donner Edwards Fisher Green
The Lookup stage is configured such that if the supplier name is blank on the primary link, the lookup is performed to fill in the missing supplier information. The lookup type is Singleton Lookup and the lookup technique is Auto. The pre-lookup condition is:
ProductData.SUPPLIER_NAME =
On the Mapping tab of the Lookup stage, the columns Supplier_Code and Supplier_Name from the primary link and Supplier_Name from the reference link are mapped to the output link, as shown:
19-18
Lookup Stages
Next the data passes to a Transformer stage, where the columns are mapped to the output link. The column derivation for Supplier_Name uses IF THEN ELSE logic to determine the correct output:
IF LookupOut.SUPPLIER_NAME= ' ' THEN LookupOut.SUPPLIER_NAME_2 ELSE LookupOut.SUPPLIER_NAME END
In other words, if Supplier_Name from the primary link is blank, then the output is the value from the reference link. Otherwise it is the value from the primary link. The Transformer stage appears as follows:
Depending on your selections in the Action if pre-lookup condition fails and Action if lookup condition fails fields, both the lookup results and the final results of the job can vary greatly, as demonstrated in the following examples.
19-19
Lookup Stages
Records 1-3, 6, and 9-12 failed the pre-lookup condition but are passed through the stage due to the Null Fill action. In these records, the column Supplier_Name_2 is filled with a null value. Records 13 and 14 passed the pre-lookup condition, but failed the lookup condition because the supplier codes do not match. Since Skip Row is the specified action for a failed lookup, neither record is output from the stage. The final output after data passes through the Transformer stage is: Table 19-13 Final Output
Supplier_Code
A B B B C C D
Supplier_Name
Anderson Brown Brown Brown Carson Carson Donner
Product
Paint Paint Primer Brushes Wallpaper Wallpaper Paint
19-20
Lookup Stages
Supplier_Name
Donner Edwards Fisher Xcel Zack
Product
Varnish Wallpaper Brushes Stain Primer
Records 1-3, 6, and 9-12 from the primary link failed the pre-lookup condition and are not passed on due to the Skip Row action. Records 4, 5, 7, and 8 passed the pre-lookup condition and have successful lookup results. Records 13 and 14 passed the pre-lookup condition but failed in the lookup because the supplier codes do not match. They are omitted as output from the stage due to the Skip Row action for a failed lookup. The final output after data passes through the Transformer stage is: Table 19-15 Final Output
Supplier_Code
B C D D
Supplier_Name
Brown Carson Donner Donner
Product
Brushes Wallpaper Paint Varnish
19-21
Lookup Stages
Records 1-3 from the primary link failed the pre-lookup condition and are not passed on. This is because there are no previous values to use and the action for a failed lookup is Skip Row. Records 4, 5, 7, and 8 passed the pre-lookup condition and have successful lookup results. Records 6 and 9-12 failed the pre-lookup condition, however, in Records 9-12 the results include incorrect values in the column Supplier_Name_2 because of the Use Previous Values action. Records 13 and 14 are omitted because they failed the lookup condition and the action is Skip Row. The final output after data passes through the Transformer stage is: Table 19-17 Final Output
Supplier_Code
B C C D D
Supplier_Name
Brown Carson Carson Donner Donner
Product
Brushes Wallpaper Wallpaper Paint Varnish
19-22
Lookup Stages
Supplier_Name
Edwards Fisher Xcel Zack
Product
Wallpaper Brushes Stain Primer
19-23
Lookup Stages
This time the results of the Lookup stage are as follows: Table 19-19 Lookup Results
Record # Supplier_Code Supplier_Name Supplier_Name_2
1 2 3 4 5 6 7 8 9 10 11 12 B A B B C C D D E F X Z Edwards Fisher Xcel Zack Carson Anderson Brown Brown Brown Brown Brown Brown Carson Carson Donner Donner Donner Donner Donner Donner
Since the first record met the pre-lookup condition, a lookup was successfully performed and previous values were used until another lookup was performed. If the first lookup had failed, the results would be the same as in the last example. The final output after data passes through the Transformer stage is: Table 19-20 Final Output
Supplier_Code Supplier_Name Product
B A B B C C D D E F Brown Anderson Brown Brown Carson Carson Donner Donner Edwards Fisher Brushes Paint Paint Primer Wallpaper Wallpaper Paint Varnish Wallpaper Brushes
19-24
Lookup Stages
Notice that Records 1-3 are present even though there are not previous values to assign. This is the result of using Null Fill as the action if the lookup fails. Also notice that Records 13 and 14 are present even though they failed the lookup; this is also the result of the Null Fill option.
19-25
Lookup Stages
The final output after data passes through the Transformer stage is: Table 19-22 Final Output
Supplier_Code Supplier_Name Product
A B B B C C D D E F X Z X Z Anderson Brown Brown Brown Carson Carson Donner Donner Edwards Fisher Xcel Zack (Null) (Null) Paint Paint Primer Brushes Wallpaper Wallpaper Paint Varnish Wallpaper Brushes Stain Primer Varnish Brushes
19-26
Lookup Stages
Records 1-3, 6, and 9-12 fail the pre-lookup condition but are passed on due to the Null Fill action. Records 4, 5, 7, and 8 pass the prelookup condition and have successful lookup results. Records 13 and 14 pass the pre-lookup condition, fail the lookup condition, and are passed on due to the Null Fill action if the lookup condition fails. The final output after data passes through the Transformer stage is: Table 19-24 Final Output
Supplier_Code Supplier_Name Product
A B B B C C D D E F X Z X Z Anderson Brown Brown Brown Carson Carson Donner Donner Edwards Fisher Xcel Zack Paint Paint Primer Brushes Wallpaper Wallpaper Paint Varnish Wallpaper Brushes Stain Primer Varnish Brushes
19-27
Lookup Stages
19-28
20
Aggregator Stages
This chapter describes Aggregator stages, which group data from a single input link and perform aggregation functions such as count, sum, average, first, last, min, and max. The aggregated data is output to a processing stage or a target stage via a single output link.
20-1
Aggregator Stages
This dialog box has three pages: Stage. Displays the name of the stage you are editing. The stage name is editable. This page has a General tab which contains an optional description of the stage. Inputs. Specifies the column definitions for the data input link. Outputs. Specifies the column definitions for the data output link. This page has an Aggregation tab where you specify the aggregation functions. The Mapping tab is where you define the mappings between input and output columns. Click OK to close this dialog box. Changes are saved when you save the job.
The Inputs page has the following field and two tabs: Input name. The name of the input link to the Aggregator stage. Since only one input link is allowed, the link name is read-only. General. Contains an optional description of the link. Columns. Displayed by default. Contains a grid displaying the column definitions for the data being written to the stage:
20-2
Aggregator Stages
SQL type. The SQL data type. For details about the data types supported in mainframe jobs, see Appendix B, "Data Type Definitions and Mappings." Length. The data precision. This is the number of characters for Char data, the maximum number of characters for VarChar data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of Timestamp data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for Decimal data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
Input column definitions are read-only in the Aggregator stage. You must go back to the stage on your input link if you want to change the column definitions.
20-3
Aggregator Stages
The Outputs page has the following field and four tabs: Output name. The name of the output link. Since only one output link is allowed, the link name is read-only. General. Displayed by default. Select the aggregation type on this tab and enter an optional description of the link. The Type field contains two options:
Group by sorts the input rows and then aggregates the data. Control break aggregates the data without sorting the input rows. This is the default option.
Aggregation. Contains a grid specifying the columns to group by and the aggregation functions for the data being output from the stage. See "Aggregating Data" on page 20-5 for details on defining the data aggregation. Mapping. Specifies the mapping of input columns to output columns. See "Mapping Data" on page 20-7 for details on defining mappings. Columns. Contains the column definitions for the data on the output link. This grid has the following columns:
Column name. The name of the column. SQL type. The SQL data type. For details about the data types supported in mainframe jobs, see Appendix B, "Data Type Definitions and Mappings." Length. The data precision. This is the number of characters for Char data, the maximum number of characters for VarChar data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of Timestamp data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for Decimal data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
You can Load columns from a table definition in the Repository, or enter column definitions manually and click Save As to save them as a table definition, a CFD file, or a DCLGen file. Click Clear All to start over. For details on editing column definitions, see Appendix D, "Editing Column Meta Data."
20-4
Aggregator Stages
Aggregating Data
Your data sources may contain many thousands of records, especially if they are being used for transaction processing. For example, suppose you have a data source containing detailed information on sales orders. Rather than passing all of this information through to your data warehouse, you can summarize the information to make analysis easier. The Aggregator stage allows you to group by and summarize the information on the input link. You can select multiple aggregation functions for each column. In this example, you could average the values in the QUANTITY_ORDERED, QUANTITY_SOLD, UNIT_PRICE, and DISC_AMT columns, sum the values in the ITEM_ORDER_AMT, ITEM_SALES_AMT, and BACK_ORDER_QTY columns, return only the first values in PRODUCT_ID and PROD_DESC columns, and return only the last values in ORDER_YY and ORDER_MM columns. The Aggregation tab is used to select columns to group by and specify the aggregation functions to perform on the input data:
The grid on this tab has the following columns: Column name. The name of the column. Group By. Specifies whether to group by the data in the column. The default is to group by all columns except those being aggregated. The Group By box is automatically cleared when you select an aggregation function for a column.
Note Every column output from an Aggregator stage must be either grouped by or aggregated.
Mainframe Job Developers Guide 20-5
Aggregator Stages
Min. Returns the lowest value in the column. Max. Returns the highest value in the column. Count. Counts the number of values in the column. (Records containing null values do not increase the count.) Sum. Totals the values in the column. This function is only available for numeric SQL data types. Average. Averages the values in the column. This function is only available for numeric SQL data types. First. Returns the first value in the column. This function is only available with Control break aggregation. Last. Returns the last value in the column. This function is only available with Control break aggregation. SQL Type. The SQL data type. For details about the data types supported in mainframe jobs, see Appendix B, "Data Type Definitions and Mappings." You cannot change the SQL data type on the Aggregation tab. You must go back to the stage on your input link if you want to change the column definitions. Table 20-1 shows the meta data for the columns created by the aggregation functions. Table 20-1 Aggregation Column Meta Data
Function Column Name SQL Type Precision Scale
Min Max Count Sum Average x_MIN1 x_MAX x_COUNT x_SUM x_AVG Same as input Same as input Decimal Decimal Decimal Same as input Same as input 182 182 182 Same as input Same as input 0 Same as input Input column scale + 2 (max 18)2 Same as input Same as input
Nullable
Yes Yes No Yes Yes
First Last
x_FIRST x_LAST
Yes Yes
20-6
Aggregator Stages
2 If Support extended decimal is selected in project properties, then the precision (or the maximum scale of an average) is the maximum decimal size specified.
Mapping Data
The Mapping tab is used to define the mappings between input and output columns being passed through the Aggregator stage.
Note You can bypass this step if the Column push option is selected in Designer options. Output columns are automatically created for each output link, and mappings between corresponding input and output columns are defined, when you click OK to exit the stage.
This tab is divided into two panes, the left for the input link (and any job parameters that have been defined) and the right for the output link, and it shows the columns and the relationships between them:
In the left pane, the input column names are prefixed with the aggregation function being performed. If more than one aggregation function is being performed on a single column, the column name will be listed for each function being performed. Names of grouped columns are displayed without a prefix. In the right pane, the output column derivations are also prefixed with the aggregation function. The output column names are suffixed with the aggregation function.
20-7
Aggregator Stages
You can drag the splitter bar between the two panes to resize them relative to one another. Vertical scroll bars allow you to scroll the view up or down the column lists, as well as up or down the panes. You can define column mappings from the Mapping tab in two ways: Drag and Drop. This specifies that an output column is directly derived from an input column. See "Using Drag and Drop" on page 20-9 for details. Auto-Match. This automatically sets output column derivations from their matching input columns, based on name or location. See "Using Column Auto-Match" on page 20-9 for details. Derivation expressions cannot be specified on the Mapping tab. If you need to perform data transformations, you must include a Transformer stage elsewhere in your job design. As mappings are defined, the output column names change from red to black. A relationship line is drawn between the input column and the output column.
Find Facility
If you are working on a complex job, there is a find facility to help you locate a particular column or expression. To use the find facility, do one of the following: Click the Find button on the Mapping tab. Select Find from the link shortcut menu. The Find dialog box appears:
This dialog box has two tabs: Column Names. Allows you to find a particular column. Expression Text. Allows you to locate the occurrence of a particular string within an output column expression. To begin your search, go to the appropriate tab and select the link name from the Link name drop-down list. (You can search for expression text only on the output link.) Enter the text to search for in the Find what field. Select the Match case and Match whole word
20-8
Aggregator Stages
check boxes to narrow your search. On the Expression Text tab, select Empty Expression to search for the next empty expression.
Click the source cell to select it. Click the selected cell again and, without releasing the mouse button, drag the mouse pointer to the desired location within the target link. Release the mouse button to drop the selected cell.
You can also click the title bar displaying the name of the link and, without releasing the mouse button, drag the mouse pointer to the first Derivation cell within the target link. This will map all input columns to the output columns based on location.
Click the AutoMap button on the Mapping tab. The Column Auto-Match dialog box appears:
20-9
Aggregator Stages
If you click Location match, this will set output column derivations to the input link columns in the equivalent positions. It starts with the first input link column going to the first output link column, and works its way down until there are no more input columns left. If you click Name match, you need to specify further information for the input and output columns as follows: Input Columns:
Match all columns or Match selected columns. Click one of these to specify whether all input link columns should be matched, or only those currently selected on the input link. Ignore aggregate prefix. Select this check box to perform the match based on the column names, ignoring the aggregate prefix. Ignore prefix. Allows you to optionally specify characters at the front of the column name that should be ignored during the matching procedure. Ignore suffix. Allows you to optionally specify characters at the end of the column name that should be ignored during the matching procedure. Ignore prefix. Allows you to optionally specify characters at the front of the column name that should be ignored during the matching procedure. Ignore suffix. Allows you to optionally specify characters at the end of the column name that should be ignored during the matching procedure.
Output Columns:
Ignore case. Select this check box to specify that case should be ignored when matching names. The setting of this also affects the Ignore prefix and Ignore suffix settings. For example, if you specify that the prefix IP will be ignored and select Ignore case, then both IP and ip will be ignored.
3
Note Auto-matching does not take into account any data type incompatibility between matched columns; the derivations are set regardless.
20-10
21
Sort Stages
This chapter describes Sort stages, which perform sorting on input columns from a single input link. The sorted columns are output to a processing stage or a target stage via a single output link.
21-1
Sort Stages
This dialog box has three pages: Stage. Displays the name of the stage you are editing. The stage name is editable. This page has a General tab where you can enter an optional description of the stage. Inputs. Specifies the column definitions for the data input link. Outputs. Specifies the column definitions for the data output link. This page has a Sort By tab where you select the columns to be sorted and specify the sort order. The Mapping tab is where you define the mappings between input and output columns. Click OK to close this dialog box. Changes are saved when you save the job.
The Inputs page has the following field and two tabs: Input name. The name of the input link to the Sort stage. Since only one input link is allowed, the link name is read-only. General. Contains an optional description of the link. Columns. Displayed by default. Contains a grid displaying the column definitions for the data being written to the stage:
21-2
Sort Stages
SQL type. The SQL data type. For details about the data types supported in mainframe jobs, see Appendix B, "Data Type Definitions and Mappings." Length. The data precision. This is the number of characters for Char data, the maximum number of characters for VarChar data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of Timestamp data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for Decimal data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
Input column definitions are read-only in the Sort stage. You must go back to the stage on your input link if you want to change the column definitions.
The Outputs page has the following field and four tabs: Output name. The name of the output link. Since only one output link is allowed, the link name is read-only.
Mainframe Job Developers Guide 21-3
Sort Stages
General. Contains an optional description of the link. Sort By. Displayed by default. Contains a list of available columns to sort and specifies the sort order. See "Sorting Data" on page 21-4 for details on defining the sort order. Mapping. Specifies the mapping of input columns to output columns. See "Mapping Data" on page 21-5 for details on defining mappings. Columns. Contains the column definitions for the data on the output link. This grid has the following columns:
Column name. The name of the column. SQL type. The SQL data type. For details about the data types supported in mainframe jobs, see Appendix B, "Data Type Definitions and Mappings." Length. The data precision. This is the number of characters for Char data, the maximum number of characters for VarChar data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of Timestamp data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for Decimal data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
You can Load columns from a table definition in the Repository, or enter column definitions manually and click Save As to save them as a table definition, a CFD file, or a DCLGen file. Click Clear All to start over. For details on editing column definitions, see Appendix D, "Editing Column Meta Data."
Sorting Data
The data sources for your data warehouse may organize information in a manner that is efficient for managing day-to-day operations, but is not helpful for making business decisions. For example, suppose you want to analyze information about new employees. The data in your employee database contains detailed information about all employees, including their employee number, department, job title, hire date, education level, salary, and phone number. Sorting the data by hire date and manager will get you the information you need faster.
21-4
Sort Stages
The Sort stage allows you to sort columns on the input link to suit your requirements. Sort specifications are defined on the Sort By tab:
You can move a column from the Available columns list to the Selected columns list by double-clicking the column name or highlighting the column name and clicking >. To move all columns, click >>. You can remove single columns from the Selected columns list by double-clicking the column name or highlighting the column name and clicking <. Remove all columns by clicking <<. Click Find to search for a particular column in either list. After you have selected the columns to be sorted on the Sort By tab, you must specify the sort order. Click the Sort Order field next to each column in the Selected columns list. A drop-down list box appears with two sort options: Ascending. This is the default setting. Select this option if the input data in the specified column should be sorted in ascending order. Descending. Select this option if the input data in the specified column should be sorted in descending order. Use the arrow buttons to the right of the Selected columns list to change the order of the columns being sorted. The first column is the primary sort column and any remaining columns are sorted secondarily.
Mapping Data
The Mapping tab is used to define the mappings between input and output columns being passed through the Sort stage.
21-5
Sort Stages
Note You can bypass this step if the Column push option is selected in Designer options. Output columns are automatically created for each output link, and mappings between corresponding input and output columns are defined, when you click OK to exit the stage.
This tab is divided into two panes, the left for the input link (and any job parameters that have been defined) and the right for the output link, and it shows the columns and the relationships between them:
You can drag the splitter bar between the two panes to resize them relative to one another. Vertical scroll bars allow you to scroll the view up or down the column lists, as well as up or down the panes. You can define column mappings from the Mapping tab in two ways: Drag and Drop. This specifies that an output column is directly derived from an input column. See "Using Drag and Drop" on page 21-7 for details. Auto-Match. This automatically sets output column derivations from their matching input columns, based on name or location. See "Using Column Auto-Match" on page 21-8 for details. Derivation expressions cannot be specified on the Mapping tab. If you need to perform data transformations, you must include a Transformer stage elsewhere in your job design. As mappings are defined, the output column names change from red to black. A relationship line is drawn between the input column and the output column.
21-6
Sort Stages
Find Facility
If you are working on a complex job, there is a find facility to help you locate a particular column or expression. To use the find facility, do one of the following: Click the Find button on the Mapping tab. Select Find from the link shortcut menu. The Find dialog box appears:
This dialog box has two tabs: Column Names. Allows you to find a particular column. Expression Text. Allows you to locate the occurrence of a particular string within an output column expression. To begin your search, go to the appropriate tab and select the link name from the Link name drop-down list. (You can search for expression text only on the output link.) Enter the text to search for in the Find what field. Select the Match case and Match whole word check boxes to narrow your search. On the Expression Text tab, select Empty Expression to search for the next empty expression.
Click the source cell to select it. Click the selected cell again and, without releasing the mouse button, drag the mouse pointer to the desired location within the target link. Release the mouse button to drop the selected cell.
You can also click the title bar displaying the name of the link and, without releasing the mouse button, drag the mouse pointer to the
21-7
Sort Stages
first Derivation cell within the target link. This will map all input columns to the output columns based on location.
Click the AutoMap button on the Mapping tab. The Column Auto-Match dialog box appears:
Click Location match or Name match from the Match type area. If you click Location match, this will set output column derivations to the input link columns in the equivalent positions. It starts with the first input link column going to the first output link column, and works its way down until there are no more input columns left.
21-8
Sort Stages
If you click Name match, you need to specify further information for the input and output columns as follows: Input Columns:
Match all columns or Match selected columns. Click one of these to specify whether all input link columns should be matched, or only those currently selected on the input link. Ignore prefix. Allows you to optionally specify characters at the front of the column name that should be ignored during the matching procedure. Ignore suffix. Allows you to optionally specify characters at the end of the column name that should be ignored during the matching procedure. Ignore prefix. Allows you to optionally specify characters at the front of the column name that should be ignored during the matching procedure. Ignore suffix. Allows you to optionally specify characters at the end of the column name that should be ignored during the matching procedure.
Output Columns:
Ignore case. Select this check box to specify that case should be ignored when matching names. The setting of this also affects the Ignore prefix and Ignore suffix settings. For example, if you specify that the prefix IP will be ignored and select Ignore case, then both IP and ip will be ignored.
3
Note Auto-matching does not take into account any data type incompatibility between matched columns; the derivations are set regardless.
21-9
Sort Stages
21-10
22
External Routine Stages
This chapter describes External Routine stages, which are used to call COBOL subroutines in libraries external to Ascential DataStage Enterprise MVS Edition. Before you edit an External Routine stage, you must first define the routine in the DataStage Repository.
22-1
Creating a Routine
To create a new routine, do one of the following: In the Manager, select the Routines branch in the project tree and choose File New Mainframe Routine . In the Designer Repository window, right-click on the Routines branch and select New Mainframe Routine from the shortcut menu. The Mainframe Routine dialog box appears:
The General page is displayed by default. Enter general information about the routine, including: Routine name. Type the name (up to 8 characters) of the function or subroutine. In mainframe terms, the routine name is the name of an entry point in a member of a load or object library. The library member may also contain other entry points with other names. The routine name must match the external subroutine name if Dynamic invocation (the default) is selected, and automatically appears in the External subroutine name field. Type. Select the type of routine, in this case, External Routine. (External source routines are detailed in Chapter 13, "External Source Stages." External target routines are detailed in Chapter 14, "External Target Stages.") Category. Type or browse for a category name to store the routine under in the Repository. If you do not enter a name in this field, the routine is created under the main Routines branch. Platform. Select the operating system that the COBOL subroutine will run on. (OS/390 is the only platform currently supported.)
22-2
External subroutine name. Type the name of the load or object library member that contains the subroutine or function entry point. If dynamic invocation is selected, then the external subroutine name must match the routine name. If the invocation method is static, then the two names need not match. Invocation method. Select the invocation method for the routine. Dynamic invocation calls the routine at run-time. Static invocation embeds the routine within the program. Dynamic is the default. Library path. Type the pathname of the library that contains the routine member. JCL extension variables can be used. This field is required for static invocation. Short description. Type an optional brief description of the routine. The text entered in this field is displayed when you choose View Details from the DataStage Manager window or print a report. It also appears in the External Routine stage editor. Long description. Type an optional detailed description of the routine. Next, select the Creator page to enter creator information:
The Creator page allows you to specify information about the creator and version number of the routine, including: Vendor. Type the name of the company that created the routine. Author. Type the name of the person who created the routine. Version. Type the version number of the routine. This is used when the routine is imported. The Version field contains a threepart version number, for example, 2.0.0. The first part of this
22-3
number is an internal number used to check compatibility between the routine and the Ascential DataStage system, and cannot be changed. The second part of this number represents the release number. This number should be incremented when major changes are made to the routine definition or the underlying code. The new release of the routine supersedes any previous release. Any jobs using the routine use the new release. The last part of this number marks intermediate releases when a minor change or fix has taken place. Copyright. Type the copyright information. The last step is to define routine arguments by selecting the Arguments page:
Arguments are optional for mainframe routines. To load arguments from an existing routine, click Load. To create a new argument, type directly in the Arguments page grid or, if you need to specify COBOL attributes, do one of the following: Right-click in the column area and select Edit row from the shortcut menu. Press Ctrl-E.
22-4
The top pane contains the same fields that appear on the Arguments page grid. Enter the following information for each argument you want to define: Argument name. Type the name of the argument to be passed to the routine. I/O type. Select the direction to pass the data. There are three options:
Input. A value is passed from the data source to the external routine. The value is mapped to an input row element. Output. A value is returned from the external routine to the stage. The value is mapped to an output column. Both. A value is passed from the data source to the external routine and returned from the external routine to the stage. The value is mapped to an input row element, and later mapped to an output column.
Native type. Select the native data type of the argument value from the drop-down list. Length. Type a number representing the length or precision of the argument. Scale. If the argument is numeric, type a number to define the number of digits to the right of the decimal point. Description. Type an optional description of the argument.
22-5
The bottom pane of the Edit Routine Argument Meta Data dialog box displays the COBOL page by default. Use this page to enter any required COBOL information for the mainframe argument: Usage. Select the COBOL USAGE clause from the drop-down list. This specifies which COBOL format the column will be read in. These formats map to the formats in the Native type field, and changing one will normally change the other. Possible values are:
COMP Used with BINARY native types. . COMP-1. Used with single-precision FLOAT native types. COMP-2. Used with double-precision FLOAT native types. COMP-3. Packed decimal, used with DECIMAL native types. COMP-5. Used with NATIVE BINARY native types. DISPLAY. Zoned decimal, used with DISPLAY_NUMERIC or CHARACTER native types. DISPLAY-1. Double-byte zoned decimal, used with GRAPHIC_G or GRAPHIC_N.
Sign indicator. Select Signed or blank from the drop-down list to specify whether the argument can be signed or not. The default is Signed for numeric data types and blank for all other types. Sign option. If the argument is signed, select the location of the sign in the data from the drop-down list. Choose from the following:
LEADING. The sign is the first byte of storage. TRAILING. The sign is the last byte of storage. LEADING SEPARATE. The sign is in a separate byte that has been added to the beginning of storage. TRAILING SEPARATE. The sign is in a separate byte that has been added to the end of storage.
Selecting either LEADING SEPARATE or TRAILING SEPARATE will increase the storage length of the column by one byte. Sync indicator. Select SYNC or blank from the drop-down list to indicate whether the argument is a COBOL-SYNCHRONIZED clause or not. The default is blank. Storage length. Gives the storage length in bytes of the argument as defined. This field is derived and cannot be edited. Picture. Gives the COBOL PICTURE clause, which is derived from the argument definition and cannot be edited.
22-6
The buttons at the bottom of the Edit Routine Argument Meta Data dialog box allow you to continue adding or editing arguments, or to save and close. The buttons are: < Previous and Next >. Displays the meta data in the previous or next argument. These buttons are available only when a previous or next argument exists. If there are unsaved changes to the current argument, you are prompted to save them before continuing. Close. Closes the Edit Routine Argument Meta Data dialog box. If you have any unsaved changes, you are prompted to save them. Apply. Saves changes to the current argument. Reset. Removes all changes made to the argument since the last time you applied changes. Help. Starts the Help system. When you are finished, click Save in the Mainframe Routine dialog box to save the routine definition.
Select Properties from the shortcut menu. Click the Properties button on the toolbar. Double-click the subroutine in the display area. To view or edit existing routines in the Designer, either double-click the routine in the Repository window, or highlight the routine and select Properties from the short cut menu. The Mainframe Routine dialog box appears. You can edit any of the fields and options on any of the pages. If you make any changes, be sure to save them before closing the Mainframe Routine dialog box.
Copying a Routine
You can copy an existing routine in the Manager by selecting it in the display area and doing one of the following: Choose File Copy.
22-7
Click the Copy button on the toolbar. To copy a routine in the Designer, highlight the routine in the Routines branch of the Repository window and select CreateCopy from the shortcut menu. The routine is copied and a new routine is created under the same branch in the project tree. By default, the name of the copy is called CopyOfXXX, where XXX is the name of the chosen routine. An edit box appears allowing you to rename the copy immediately.
Renaming a Routine
You can rename an existing routine in either the DataStage Manager or the Designer. To rename an item, select it in the Manager display area or the Designer Repository window, and do one of the following: Click the routine again. An edit box appears and you can type a different name or edit the existing one. Save the new name by pressing Enter or by clicking outside the edit box. Select Rename from the shortcut menu. An edit box appears and you can enter a different name or edit the existing one. Save the new name by pressing Enter or clicking outside the edit box. Double-click the routine. The Mainframe Routine dialog box appears and you can edit the Routine name field. Click Save, then Close. Choose File Rename (Manager only). An edit box appears and you can type a different name or edit the existing one. Save the new name by pressing Enter or by clicking outside the edit box.
Note If you rename a routine and the Invocation method is dynamic, the external subroutine name is automatically set to match the routine name.
22-8
When you edit the External Routine stage, the External Routine Stage dialog box appears:
This dialog box has three pages: Stage. Displays the name of the stage you are editing. The stage name is editable. This page has a General tab which contains an optional description of the stage. Inputs. Specifies the column definitions for the data input link. Outputs. Specifies the column definitions for the data output link. This page has a Rtn. Mapping tab where you define the mappings between input columns and input arguments. The Mapping tab is where you define the mappings between input columns, output arguments, and output columns. Click OK to close this dialog box. Changes are saved when you save the job.
22-9
are described on the Inputs page in the External Routine Stage dialog box:
The Inputs page has the following field and two tabs: Input name. The name of the input link to the External Routine stage. Since only one input link is allowed, the link name is readonly. General. Contains an optional description of the link. Columns. Displayed by default. Contains a grid displaying the column definitions for the data being written to the stage:
Column name. The name of the column. SQL type. The SQL data type. For details about the data types supported in mainframe jobs, see Appendix B, "Data Type Definitions and Mappings." Length. The data precision. This is the number of characters for Char data, the maximum number of characters for VarChar data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of Timestamp data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for Decimal data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
22-10
Input column definitions are read-only in the External Routine stage. You must go back to the stage on your input link if you want to change the column definitions.
The Outputs page has the following field and four tabs: Output name. The name of the output link. Since only one output link is allowed, the link name is read-only. General. Displayed by default. This tab allows you to select the routine to be called and enter an optional description of the link. It contains the following fields:
Category. The category where the routine is stored in the Repository. Select a category from the drop-down list. Routine name. The name of the routine. The drop-down list displays all routines saved under the category you selected. Pass arguments as record. Select this check box to pass the routine arguments as a single record, with everything at the 01 level. Routine description. Displays a read-only description of the routine as defined in the Manager.
22-11
Rtn. Mapping. Specifies the mapping of input columns to input arguments. This tab is made available when you select a routine on the General tab. For details on defining routine mappings, see "Mapping Routines and Data" on page 22-12. Mapping. Specifies the mapping of input columns and output arguments to output columns. See "Mapping Routines and Data" on page 22-12 for details on defining mappings. Columns. Contains the column definitions for the data on the output link. This grid has the following columns:
Column name. The name of the column. SQL type. The SQL data type. For details about the data types supported in mainframe jobs, see Appendix B, "Data Type Definitions and Mappings." Length. The data precision. This is the number of characters for Char data, the maximum number of characters for VarChar data, the total number of digits for numeric data types, and the number of digits in the microsecond portion of Timestamp data. Scale. The data scale factor. This is the number of digits to the right of the decimal point for Decimal data, and zero for all other data types. Nullable. Indicates whether the column can contain a null value. Description. A text description of the column.
You can Load columns from a table definition in the Repository, or enter column definitions manually and click Save As to save them as a table definition, a CFD file, or a DCLGen file. Click Clear All to start over. For details on editing column definitions, see Appendix D, "Editing Column Meta Data."
22-12
(and any job parameters that have been defined), and the right for input arguments, and shows the relationships between them:
The Mapping tab is similarly divided into two panes. The left pane displays input columns, routine arguments that have an I/O type of Output or Both, and any job parameters that have been defined. The right pane displays output columns. When you simply want to move values that are not used by the external routine through the stage, you map input columns to output columns. As you define the mappings, relationship lines appear between the two panes:
Note If the Column push option is selected in Designer options, and you click OK on the Stage page without editing the
22-13
Mapping tab, Ascential DataStage automatically creates output columns and defines mappings from the input columns to the output columns. Any output arguments that exist are not mapped. On both the Rtn. Mapping and Mapping tabs you can drag the splitter bar between the two panes to resize them relative to one another. Vertical scroll bars allow you to scroll the view up or down the column lists, as well as up or down the panes. You can define mappings from the Rtn. Mapping and Mapping tabs in two ways: Drag and Drop. This specifies that the argument or column is directly derived from an input column or argument. See "Using Drag and Drop" on page 22-15 for details. Auto-Match. This automatically sets output column derivations from their matching input columns, based on name or location. See "Using Column Auto-Match" on page 22-15 for details. Derivation expressions cannot be specified on the Rtn. Mapping or Mapping tabs. If you need to perform data transformations, you must include a Transformer stage elsewhere in your job design. As mappings are defined, the output column names change from red to black. A relationship line is drawn between the input column and input argument on the Rtn. Mapping tab, or between the input column or output argument and the output column on the Mapping tab.
Find Facility
If you are working on a complex job, there is a find facility to help you locate a particular column or expression. To use the find facility, do one of the following: Click the Find button on the Mapping tab. Select Find from the link shortcut menu. The Find dialog box appears:
22-14
This dialog box has two tabs: Column Names. Allows you to find a particular column. Expression Text. Allows you to locate the occurrence of a particular string within an output column expression. To begin your search, go to the appropriate tab and select the link name from the Link name drop-down list. (You can search for expression text only on the output link.) Enter the text to search for in the Find what field. Select the Match case and Match whole word check boxes to narrow your search. On the Expression Text tab, select Empty Expression to search for the next empty expression.
Click the source cell to select it. Click the selected cell again and, without releasing the mouse button, drag the mouse pointer to the desired location within the target link. Release the mouse button to drop the selected cell.
You can also click the title bar displaying the name of the link and, without releasing the mouse button, drag the mouse pointer to the first Derivation cell within the target link. This will map all input columns to the output columns based on location.
22-15
To use auto-match:
1
Click the AutoMap button on the Mapping tab. The Column Auto-Match dialog box appears:
Click Location match or Name match from the Match type area. If you click Location match, this will set output column derivations to the input link columns in the equivalent positions. It starts with the first input link column going to the first output link column, and works its way down until there are no more input columns left. If you click Name match, you need to specify further information for the input and output columns as follows: Input Columns:
Match all columns or Match selected columns. Click one of these to specify whether all input link columns should be matched, or only those currently selected on the input link. Ignore prefix. Allows you to optionally specify characters at the front of the column name that should be ignored during the matching procedure. Ignore suffix. Allows you to optionally specify characters at the end of the column name that should be ignored during the matching procedure.
22-16
Output Columns:
Ignore prefix. Allows you to optionally specify characters at the front of the column name that should be ignored during the matching procedure. Ignore suffix. Allows you to optionally specify characters at the end of the column name that should be ignored during the matching procedure.
Ignore case. Select this check box to specify that case should be ignored when matching names. The setting of this also affects the Ignore prefix and Ignore suffix settings. For example, if you specify that the prefix IP will be ignored and select Ignore case, then both IP and ip will be ignored.
3
Note Auto-matching does not take into account any data type incompatibility between matched columns; the derivations are set regardless.
22-17
22-18
23
FTP Stages
This chapter describes FTP (file transfer protocol) stages, which are used to transfer files to another machine. This stage collects the information required to generate the job control language (JCL) to perform the file transfer. File retrieval from the target machine is not supported.
23-1
FTP Stages
When you edit an FTP stage, the FTP Stage dialog box appears:
This dialog box has the following pages: Stage. Displays the name of the stage you are editing. The stage name is editable. This page has a General tab that allows you to specify the attributes of the target machine where your file will be transferred. See "Specifying Target Machine Attributes" below for details. Inputs. Specifies the filename of the data input link, as well as the destination filename and platform type. Click OK to close this dialog box. Changes are saved when you save the job.
23-2
FTP Stages
Host name/IP address. The IP address or a fully qualified host name for the target machine. This field is automatically filled in if you select an existing machine profile. Port. The network port ID for the FTP or Connect:Direct connection. The default port is 21 for FTP or 1364 for Connect:Direct. User name. The user name or account to use for target system login. This field is automatically filled in if you select an existing machine profile. Password. The password associated with the user name for target system login. This field is automatically filled in if you select an existing machine profile. Transfer mode. The file transfer mode. The transfer mode must match the characteristic of the input data files. All input files must have the same mode, and only one mode can be utilized per transfer. You can enter your own transfer mode or choose one of the following options, depending on the file exchange method. FTP options are:
Block. Transfers files as a series of data blocks. The blocks are preceded by one or more header bytes which contain a descriptor code and a count field indicating the total length of the data block. Compress. Compresses files prior to transferring them. Stream. Transfers files as a stream of bytes. There is no restriction on the representation type used; record structures are allowed.
Compress. Compresses text data or single-character repetitive data prior to transfer. Compress Extended. Searches for repetitive strings of characters in the data and compresses them to codes. This option is recommended when line transmission speeds are limited, CPU is available, and data is repetitive.
Transfer type. The file transfer type. The transfer type must match the characteristic of the input data files. All input files must have the same type, and only one type can be utilized per transfer. You can enter your own transfer type or choose one of the following options:
ASCII. Used for text files. EBCDIC. Used for EBCDIC (Extended Binary Coded Decimal Interchange Code) data, which is generally found in IBM mainframe environments.
23-3
FTP Stages
Binary. Used for nontext files such as program files and images.
FTP Service. The FTP service type. Active FTP service is for an active connection, which is generally used when command processing is required. This is the default. The Passive option is available if you need to establish a connection through a firewall that does not allow inbound communication. Description. An optional description of the stage.
The Inputs page has the following field and tab: Input name. The name of the input link to the FTP stage. Select the link you want to edit from the Input name drop-down list. This list displays all the input links to the FTP stage. If there is only one input link, the field is read-only. General. Displays the input and destination filenames, the target platform, and an optional description of the link.
The File name field is read-only and displays the name of the file being passed from the previous stage in the job design. The Destination file name field is where you specify the name of the file on the target system.
23-4
FTP Stages
The Transfer to field allows you to select the type of machine where data will be transferred. The default is Mainframe.
23-5
FTP Stages
23-6
24
Code Generation and Job Upload
This chapter describes how to generate code for a mainframe job and upload the job to the mainframe machine. When you have edited all the stages in a job design, you can validate the job design and generate code. You then transfer the code to the mainframe to be compiled and run.
Generating Code
When you have finished developing a mainframe job, you are ready to generate code for the job. Mainframe job code is generated using the DataStage Designer. To generate code, open a job in the Designer and do one of the following: Choose File Generate Code.
24-1
Generating Code
This dialog box contains the following fields and buttons: Code generation path. The base location for the COBOL program and JCL files. Each mainframe job holds the COBOL program and JCL files in a subdirectory of the base location reflecting the server host name, project name, and job. For example, where the base location is:
C:\Program Files\ Ascential\DataStage\Gencode
You can also specify the code generation location in Designer options. If you have already entered a pathname there, it will automatically appear in the Code generation path field. If you have not, then a default pathname is created. You can edit this pathname. Cobol program file name. The name comprises up to eight alphanumeric characters. The first character must be alphabetic. The default name is DSn, where n is the internal job number. You can edit this name. Compile JCL file name. This can be up to eight alphanumeric characters. The default name is DSnC, where n is the internal job number. You can edit this name. Run JCL file name. This can be up to eight alphanumeric characters. The default name is DSnX, where n is the internal job number. You can edit this name.
24-2
Generating Code
Trace runtime information. Choose one of the options to produce run-time information regarding the program flow or data being read and written:
None. No information is generated. This is the default. Program flow. The COBOL program is generated with a DISPLAY of every paragraph name as it is executed. The paragraph names are indented to reflect the nesting of PERFORMs. Data flow. Data is printed as it is being read or written. For all source and target stages except Relational, the entire buffer is printed without columns being identified. For Relational stages, individual column values in the SELECT, INSERT, or UPDATE statements are printed. Program and Data flow. Both the program flow and the data flow are printed.
IMS Program Type. This field is available only if there is an IMS stage in the job. Select the type of IMS program to generate: BMP or DLI (the default). Generate COPY statements for customization. Select this check box if you want to customize the DataStage-generated COBOL program. You can use this option to perform a task at the beginning of the program, the end, or both. For details see "Code Customization" on page 24-5. Copy library prefix. This field allows you to manage several versions of the COPYLIB members used for code customization. For more information, see "Code Customization" on page 24-5. Generate. Click this button to validate your job design and generate the COBOL program and JCL files. Once you begin, the Generate button changes to a Cancel button, allowing you to stop the code generation. The Progress bar displays the progress of the code generation process, and relevant status messages about job validation and code generation appear in the Status window. View. Click this button to view the generated COBOL and JCL files. You can select the file you want to view from a pop-up menu that is available after code is successfully generated. Microsoft Notepad is the default viewer, but you can specify a different tool in Designer options. Choose Tools Options, select the Mainframe branch under Default in the options tree, and in the Source Viewer field, type or browse for the pathname of your preferred tool. Upload job . This button is available after you successfully generate code. It opens the Remote System dialog box, allowing you to connect to the target mainframe for job upload.
24-3
Generating Code
Close. Click this button to close the Code generation dialog box. The code generation path and the names of the generated COBOL and JCL files are automatically saved with the job. Help. Click this button to start the Help system.
Job Validation
Code generation first validates your job design. If all stages validate successfully, then code is generated. If validation fails, code generation stops and error messages are displayed for all stages that contain errors. Stages with errors are then highlighted in red on the Designer canvas. Status messages about validation are displayed in the Status window. Validation of a mainframe job design involves: Checking that all stages in the job are connected in one continuous flow, and that each stage has the required number of input and output links Checking the expressions used in each stage for syntax and semantic correctness Checking the column mappings to ensure they are data type compatible
Tip
During code generation Ascential DataStage sets flags indicating which stages validate successfully. If you generate code for a job, then you view a stage in your job design without making changes, click Cancel instead of OK to close the stage editor. Next time you generate code, job validation will bypass this stage, saving time. (This does not apply if you selected Autosave job before compile/ generate in Designer options.)
Generated Files
Three files are produced during code generation: A COBOL program file, which contains the actual COBOL code that has been generated. Only one COBOL program is generated for a job, regardless of how many stages it contains. A JCL compile file, which contains the JCL that controls the compilation of the COBOL code on the target mainframe machine. A JCL run file, which contains the JCL that controls the running of the job on the mainframe once it has been compiled.
24-4
Generating Code
After code generation is successful, the Status window displays the names and locations of the generated files, and indicates the database name and user name used by each relational stage.
Code Customization
There are three ways you can customize code in DataStage mainframe jobs: You can change the text associated with various warning and error messages. This text is in the ARDTMSG1, ARDTMSG2, ARDTIMSG, and RTLMSGS COPYLIB members. You can use the Generate COPY statements for customization check box in the Code generation dialog box to generate other COPY statements. This method allows you to insert your own code into the program by using the ARDTUFCT, ARDTUFDF ARDTUDAT, ARDTUBGN, ARDTUEND, and , ARDTUCOD COPYLIB members. You can use the Copy library prefix field in the Code generation dialog box to manage several versions of the COPYLIB members mentioned above. Note that these options are not dependent on one another. You can use any or all of these methods to customize the DataStage-generated code.
24-5
Generating Code
24-6
Generating Code
By default, the prefix for the COPY members is ARDT. If this prefix is used, the COPY statements are generated as described above. If you enter your own prefix in the Copy library prefix field, the COPY statements are generated as follows:
COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY prefixMSG1. prefixMSG2. prefixIMSG. prefixMSGS. prefixUFCT. prefixUFDF. prefixUDAT. prefixUBGN. prefixUEND. prefixUCOD.
The prefix must be 1-4 characters long and convertible to uppercase. The first character of the prefix must be A-Z, #, $, or @. The other characters must be A-Z, 0-9, #, $, or @. If you change the prefix, you must make sure that COPYLIB members exist with those names; note that COPYLIB members are subject to COBOL validation rules.
24-7
Uploading Jobs
Uploading Jobs
Once you have successfully generated code for a mainframe job, you can upload the files to the target mainframe, where the job is compiled and run. If you make changes to a job, you must regenerate code before you can upload the job. Jobs can be uploaded from the DataStage Designer or the DataStage Manager by doing one of the following: From the Designer, open the job and choose File Upload Job. Or, click Upload job in the Code generation dialog box after you have successfully generated code. From the Manager, select the Jobs branch in the project tree, highlight the job in the display area, and choose Tools Upload Job. The Remote System dialog box appears, allowing you to specify information about connecting to the target mainframe system:
This dialog box contains the following fields: Machine profile. A configured name that identifies the mainframe machine connection. Select a machine name from the drop-down list. This list box contains all the machine profiles defined under the Machine Profiles branch in the Repository. For details on creating new machine profiles, see "Working with Machine Profiles" on page 24-11. Platform. The mainframe platform type. Since OS/390 is the only platform currently supported, this field is read-only. IP Host name/address. The IP address or a fully qualified host name. User name. The user name or account to use for host system login.
24-8 Mainframe Job Developers Guide
Uploading Jobs
Password. The password associated with the user name for host system login. Source library. The library on the remote system where mainframe source jobs will be transferred. Compile JCL library. The library on the remote system where where JCL compile files will be transferred. Run JCL library. The library on the remote system where JCL run files will be transferred. Object library location. The library on the remote system where compiler output will be transferred. Load library location. The library on the remote system where executable programs will be transferred. DBRM library location. The library on the remote system where information about a DB2 program will be transferred. Jobcard accounting information. Identification information for the jobcard. FTP Service. The FTP service type. Active FTP service is for an active connection, which is generally used when command processing is required. This is the default. The Passive option is available if you need to establish a connection through a firewall that does not allow inbound communication. Port. The network port ID for the FTP connection. The default port is 21. Transfer type. The FTP transfer type. Select ASCII, BINARY, or quote type B 1, or enter your own transfer type using the FTP quote command. If you select an existing machine profile in the Remote System dialog box, the host name and address, user name and password, and library locations are automatically filled in. You can edit these fields, but your changes are not saved. When you are finished, click Connect to establish the mainframe connection.
24-9
Uploading Jobs
Once you have successfully connected to the target machine, the Job Upload dialog box appears, allowing you to actually upload the job:
This dialog box has two display areas: one for the Local System and one for the Remote System. It contains the following fields: Jobs. The names of the jobs available for upload. If you invoked Job Upload from the Designer, only the name of the job you are currently working on is displayed. If you invoked Job Upload from the Manager, the names of all jobs in the project are displayed and you can upload several jobs at a time. Files in job. The files belonging to the selected job. This field is read-only. Select Transfer Files. The files to upload. You can choose from three options:
All. Uploads the COBOL source, compile JCL, and run JCL files. JCL Only. Uploads only the compile JCL and run JCL files. COBOL Only. Uploads only the COBOL source file.
Source library. The name of the source library on the remote system that you specified in the Remote System dialog box. You can edit this field, but your changes are not saved. Compile library. The name of the compile library on the remote system that you specified in the Remote System dialog box. You can edit this field, but your changes are not saved. Run library. The name of the run library on the remote system that you specified in the Remote System dialog box. You can edit this field, but your changes are not saved.
24-10
Transferred files. The files transferred to the remote system. This field is read-only. When you are ready to start uploading a job, click Start Transfer. The names of the files in the job appear in the Files in job window. After the files are uploaded, the filenames appear in the Transferred files window.
Note Before uploading a job, check to see if the directory on the target machine is full. If the directory is full, the files cannot be uploaded. However, the filenames still appear in the Transferred files window if you click Start Transfer. Compressing the partitioned data sets on the target machine is recommended in this situation.
If you want to upload a job to another mainframe machine, click New Connection. The Remote System dialog box appears, allowing you to select a different machine connection.
24-11
There are three buttons in the Machine Profile dialog box: OK. Saves changes to the machine profile and closes the Machine Profile dialog box. Cancel. Discards changes to the machine profile and closes the Machine Profile dialog box. Help. Starts the Help system.
The General page is displayed by default. Enter general information about the machine profile, including: Machine profile name. Type the name of the machine profile. Category. Type a category name, or click the (browse) button to select a category in the Select Category dialog box. Platform type. Select the platform type. (OS/390 is the only platform currently supported.) Short description. Type an optional brief description of the machine profile. The text entered in this field is displayed when you choose View Details from the DataStage Manager window or print a report.
24-12
Long description. Type an optional detailed description of the routine. Next, select the Connection page to specify the connection parameters for the mainframe machine:
Enter mainframe connection parameters, including: IP Host name/address. Type the IP address or a fully qualified host name. Port. If necessary, change the network port ID for the FTP connection. The default port is 21. User name. Type the user name or account to use for host system login. FTP transfer type. Specify the file transfer type. Select ASCII for text files, Binary for non-text files, or enter your own transfer type. Password. Type the password associated with the user name for host system login. FTP Service. Select the FTP service type. There are two options:
Active. Active FTP connection. This is the default and is generally used when command processing is required. Passive. Establishes an FTP connection through a firewall that does not allow inbound communication.
The Mainframe operational meta data area allows you to specify details about the XML file that is created if you select Generate operational meta data in project or job properties. You can then use a machine profile to load these details in the Operational Meta Data
24-13
page of the Job Properties dialog box. There are two fields in this area: XML file target directory. Type the name of the target directory where the XML file should be placed for use in Ascential MetaStage. Specify the name in the appropriate DOS mode, including any slash marks required. If the directory name contains blanks, enclose the full name in single quotes. If you leave this field blank, the XML file will be placed in the default FTP directory on the Ascential MetaStage machine. Dataset name for XML file. Type the dataset name for the XML file on the mainframe machine. Be sure to create this file on the mainframe prior to running the COBOL program.
Note If you create a machine profile just for operational meta data, then no entries are needed in the fields on the Libraries page of the Machine Profile dialog box.
This page displays the names of the libraries on the mainframe machine where jobs will be transferred, including: Source library. Type the name of the library where the mainframe source jobs should be placed. Compile JCL library. Type the name of the library where JCL compile files should be placed. Run JCL library. Type the name of the library where JCL run files should be placed.
24-14
Object library. Type the name of the library where compiler output should be placed. DBRM library. Type the name of the library where information about a DB2 program should be placed. Load library. Type the name of the library where executable programs should be placed. Jobcard accounting information. Type identification information for the jobcard. Click OK to save the machine profile. You must enter a user name and password on the Connection page before you are allowed to save a new machine profile.
Select Properties from the shortcut menu. Click the Properties button on the toolbar. Double-click the machine profile in the display area. To view or edit existing machine profiles in the Designer, either double-click the machine profile in the Repository window, or rightclick and select Properties from the short cut menu. The Machine Profile dialog box appears. You can edit any of the fields and options on any of the pages. If you make any changes, be sure to save them before closing the Machine Profile dialog box.
Select Copy from the shortcut menu. Click the Copy button on the toolbar. To copy an existing machine profile in the Designer, right-click the machine profile in the Repository window and select CreateCopy from the shortcut menu.
24-15
The machine profile is copied and a new machine profile is created under the same branch in the project tree. By default, the name of the copy is called CopyOfXXX, where XXX is the name of the chosen machine profile. An edit box appears allowing you to rename the copy immediately.
24-16
Specify the type of job to compile on the Job selection criteria screen:
a
Mainframe is selected by default in the Select jobs of type area, along with other job types if you have other DataStage components installed. If you want to automatically select all jobs that have not been compiled, select the Only select uncompiled jobs check box. If you want to choose which jobs to compile, select the Show job selection page check box. If this check box is unselected, the wizard selects all jobs in the project, or all uncompiled jobs if you selected Only select uncompiled jobs.
b c
Click Next >. If you selected Show job selection page, the Job Selection Override screen appears, allowing you to select which jobs to compile. Otherwise the Compiler options screen appears.
24-17
In the Upload machine profile drop-down box, select the machine profile for job upload or click Dont Upload Job to skip job upload. If your jobs already have a code generation path specified in the Code generation dialog box, select Use Job-level code generation path to have the wizard use the existing path. Otherwise, clear this check box and specify a new path in the Code Generation Base Directory field. The default path is C:\Program Files\Ascential\DataStage. Click the Browse button to browse for a different path. If you change the path, your jobs will be saved with the new path. Click Next >. The Compile Process screen appears. Click the Start Compile button to begin compilation. As each job is compiled, status messages are displayed in the Compilation Status area. After compilation, the final status is displayed in the Status field.
24-18
Click Next >. The Job compilation report screen appears, showing the compilation start and finish times, the number of jobs that succeeded or failed, and compilation details for each job. Click Finish to close the wizard.
You can also compile multiple jobs from the command line of the DataStage client machine by invoking the file dscc.exe in the DataStage client directory. The dscc command takes several arguments. For details on using this command, see Ascential DataStage Designer Guide.
24-19
24-20
A
Programmers Reference
This appendix provides a programmers reference guide for Ascential DataStage Enterprise MVS Edition. It describes the programming components that are available for mainframe jobs.
Programming Components
There are different types of programming components used within mainframe jobs. They fall into two categories: Built-in. Ascential DataStage Enterprise MVS Edition comes with several built-in programming components that you can reuse within your mainframe jobs as required. These variables, functions, and constants are used to build expressions. They are only accessible from the Expression Editor, and the underlying code is not visible. External. You can use certain external components, such as COBOL library functions, from within Ascential DataStage Enterprise MVS Edition. This is done by defining a routine which in turn calls the external function from an External Source, External Target, or External Routine stage. The following sections discuss programming terms you will come across when programming mainframe jobs.
A-1
Programming Components
Programmers Reference
Constants
A constant is a value that is fixed during the execution of a program, and may be reused in different contexts. Table A-1 describes the constants that are available in mainframe jobs. Table A-1 Mainframe Job Constants
Constant
CURRENT_DATE CURRENT_TIME
Definition
Returns the current date at the time of execution. Returns the current time at the time of execution.
CURRENT_TIME(<Precision>) Returns the current time to the specified precision at the time of execution. CURRENT_TIMESTAMP CURRENT_TIMESTAMP (<Precision>) DSE_NOERROR1 DSE_TRXCONSTRAINT1 DSE_TRXLINK1 NULL2 HIGH_VALUES3 LOW_VALUES3 X Returns the current timestamp at the time of execution. Returns the current timestamp to the specified precision at the time of execution. The row was successfully inserted into the link. The link constraint test failed. The database rejected the row. The value is null. A string value in which all bits are set to 1. A string value in which all bits are set to 0. A string literal containing pairs of hexadecimal digits, such as X0D0A. Follows standard SQL syntax for specifying a binary string value.
1 Only available in constraint expressions to test the variable REJECTEDCODE. See "Variables" on page A-19 for more information. 2 Only available in derivation expressions. 3 Only available by itself in output column derivations, as the initial value of a stage variable, or as the argument of a CAST function. The constant cannot be used in an expression except as the argument of a CAST function. The data type of the output column or stage variable must be Char or VarChar.
Constraints
A constraint is a rule that determines what values can be stored in the columns of a table. Using constraints prevents the storage of invalid data in a table.
A-2
Programmers Reference
Programming Components
Constraints are boolean expressions that return TRUE or FALSE. Constraints are defined on: the Transformer Stage Constraints dialog box the Constraints tab in Complex Flat File, Multi-Format Flat File, IMS, Fixed-Width Flat File, Delimited Flat File, and External Source stages the Where tab in Relational, Teradata Relational, and Teradata Export stages Transformer stage constraints are defined using the Expression Editor, which provides access to all of Ascential DataStages built-in constants, functions, variables, and operators. Source stage constraints and WHERE clauses are built using a grid, which provides access to Ascential DataStages operators and most built-in logical functions. You can make selections in the grid, or you can manually type the constraint by double-clicking in one of the cells. Manually-specified constraints can include any of Ascential DataStages built-in functions except for IF THEN ELSE, IS DATE, IS NOT DATE, and IS NUMERIC. See "Functions" on page A-4 for detailed descriptions of these functions.
Expressions
An expression is an element of code that defines a value. The word expression is used both as a specific part of SQL3 syntax, and to describe portions of code that you can enter when defining a job. Expressions can contain: Column names Variables Functions Parameters String or numeric constants Operators In mainframe jobs, expressions are used to define constraints, column derivations, stage variable derivations, SQL clauses, and key expressions. Table A-2 describes how and where you enter expressions in mainframe job stages.
A-3
Programming Components
Programmers Reference
Expression Editor
Expression Grid
Constraint tab Constraint tab Constraint tab Constraint tab Constraint tab Constraint tab Where tab, Group By tab, Having tab, Order By tab Where tab, Group By tab, Having tab, Order By tab Where tab, Group By tab, Having tab Where tab
Business Rule
Join Lookup
Details on defining expressions are provided in the chapters describing the individual stage editors.
Functions
Functions take arguments and return a value. The word function is applied to two components in DataStage mainframe jobs: Built-in functions. These are special SQL3 functions that are specific to Ascential DataStage Enterprise MVS Edition. You can access these built-in functions via the Built-in Routines branch of the Item type project tree, which is available in the Expression Editor or on the Definition tab of the Business Rule Stage dialog box. These functions are defined in the following sections.
A-4
Programmers Reference
Programming Components
DB2 functions. These are functions supported only in DB2 data sources. When defining computed columns in Relational, Teradata Relational, and Teradata Export stages, you can access the DB2 functions by clicking the Functions button in the Computed Column dialog box. Refer to your DB2 documentation for function definitions.
Description
Converts the value of <Operand> to Char data type. Converts the value of <Operand> to VarChar data type. Converts the value of <Operand> to SmallInt data type. Converts the value of <Operand> to Integer data type. Converts the value of <Operand> to Decimal data type with the specified precision and scale. Converts the value of <Operand> to Date data type.1 Converts the value of <Operand> to Time data type with the specified precision.2 Converts the value of <Operand> to Timestamp data type with the specified precision.3 Converts the value of <Operand> to NChar data type.4 Converts the value of <Operand> to NVarChar data type.4
CAST
CAST
CAST(<Operand>AS TIME (<TimePrecision>)) CAST(<Operand>AS TIMESTAMP(<TimestampPrecision>)) CAST(<Operand>AS NCHAR (<Length>)) CAST(<Operand>AS NCHAR VARYING (<Length>))
CAST
CAST
CAST
1 The format of <Operand> must be consistent with the default date format specified in project or job properties. 2 The format of <Operand> must be in Ascential DataStage Enterprise MVS Editions internal time form, HH:MM:SS.
A-5
Programming Components
Programmers Reference
3 The format of <Operand> must be in Ascential DataStage Enterprise MVS Editions internal timestamp form, CCYY-MM-DD HH:MM:SS.NNNNNN. If the date portion does not exist, the result is set to the current date. If the time portion does not exist, the result is set to 00:00:00. 4 The data type of <Operand> must be NChar or NVarChar.
Syntax
DATE yyyy-mm-dd
Description
Treats the constant specified by yyyy-mm-dd as a Date data type rather than a Char data type. Returns the numeric value of the year from <DateTime>.1 Returns the numeric value of the month from <DateTime>.1,2 Returns the numeric value of the day from <DateTime>.1 Returns the numeric value of the hour from <DateTime>.3 Returns the numeric value of the minute from <DateTime>.3 Returns the numeric value of the second (including fractional seconds) from <DateTime>.3 Treats the constant specified by hh:mm:ss as a Time data type rather than a Char data type. Treats the constant specified by yyyy-mm-dd hh:mm:ss as a Timestamp data type rather than a Char data type.
EXTRACT
EXTRACT(YEAR FROM <DateTime>) EXTRACT(MONTH FROM <DateTime>) EXTRACT(DAY FROM <DateTime>) EXTRACT(HOUR FROM <DateTime>) EXTRACT(MINUTE FROM <DateTime>) EXTRACT(SECOND FROM <DateTime>)
EXTRACT EXTRACT
EXTRACT EXTRACT
EXTRACT
TIME
TIME hh:mm:ss
TIMESTAMP
1 The data type of <DateTime> must be Date or Timestamp. 2 If the value of MONTH or DAY in <DateTime> is less than 10, and you CAST the extracted value as Char(2), the leading zero is dropped. Use the concatenation function to restore it if necessary. 3 The data type of <DateTime> must be Time or Timestamp.
A-6
Programmers Reference
Programming Components
Logical Functions
Table A-5 describes the built-in logical functions that are available in mainframe jobs. IF THEN ELSE can stand alone or can be nested within other IF THEN ELSE statements. The rest of the logical functions can only be used as the argument of an IF THEN ELSE statement. Table A-5 Logical Functions
Function
BETWEEN
Syntax
<Expression1>BETWEEN <Expression2>AND <Expression3>
Description
Returns TRUE if <Expression2> is less than or equal to <Expression1> and <Expression1> is less than or equal to <Expression3>. Otherwise, it returns FALSE. Returns TRUE if <Expression1> is less than <Expression2> or <Expression1> is greater than <Expression3>. Otherwise, it returns FALSE. If <BooleanExpression> is true, returns the value of <Expression1>. Otherwise, it returns the value of <Expression2>. Returns TRUE if the value of <Expression1> is in the list of values. Otherwise, it returns FALSE. Returns TRUE if the value of <Expression1> is not in the list of values. Otherwise, it returns FALSE. Returns TRUE if the value of <Expression> is a DATE. Otherwise it returns FALSE. Returns TRUE if the value of <Expression> is not a DATE. Otherwise it returns FALSE. Returns TRUE if the value of <Expression> is false. Otherwise it returns FALSE. Returns TRUE if the value of <Expression> is not false. Otherwise it returns FALSE.
NOT BETWEEN
IF THEN ELSE
IN
<Expression1>IN (<Expression2>, <Expression3>,..., <ExpressionN>) <Expression1>NOT IN (<Expression2>, <Expression3>,..., <ExpressionN>) <Expression>IS DATE
NOT IN
IS DATE
IS NOT DATE
IS FALSE
<Expression>IS FALSE
IS NOT FALSE
A-7
Programming Components
Programmers Reference
<String>IS NOT LOW_VALUES <BooleanExpression>IS NULL <BooleanExpression>IS NOT NULL <String> IS NUMERIC or <Decimal> IS NUMERIC
IS NOT NULL
IS NUMERIC
IS TRUE
<Expression>IS TRUE
IS NOT TRUE
A-8
Programmers Reference
Programming Components
Numerical Functions
Table A-6 describes the built-in numerical function that is available in mainframe jobs. Table A-6 Numerical Functions
Function
ROUND
Syntax
ROUND(<Expression>, <Integer_value>)
Description
<Expression> is rounded to <Integer_value> places right of the decimal point. If <Integer_value> is negative, <Expression> is rounded to the absolute value of <Integer_value> places to the left of the decimal point.1,2
1 The data type of <Expression> must be BINARY or DECIMAL. (Note that DISPLAY NUMERIC and FLOAT data types are automatically converted to Decimal type after being read from a flat file.) 2 If <Expression> is null, the result is the null value.
ROUND Examples The ROUND function can be used to round a constant value, a single column value, a simple expression, or any intermediate value within a complex expression. For decimal data, it rounds a value to the right or left of a decimal point. For binary data, it rounds a value to the left of the decimal point. If the absolute value of <Integer_value> is larger than the number of digits to the left of the decimal point, the result will be zero. If the absolute value of <Integer_value> is larger than the number of digits to the right of the decimal point, no rounding will occur. If <Expression> is a BINARY data type and <Integer_value> is positive, no rounding will occur. The first example shows how the same number is rounded to different decimal places using the ROUND function:
Expression
ROUND(876.543,2) ROUND(876.543,1) ROUND(876.543,0) ROUND(876.543,-1) ROUND(876.543,-2) ROUND(876.543,-3) ROUND(876.543,-4)
Result
876.54 876.5 877 880 900 1000 0
A-9
Programming Components
Programmers Reference
The next example demonstrates how positive and negative numbers are rounded using zero decimal places:
Expression
ROUND(6.9,0) ROUND(6.1,0) ROUND(-6.1,0) ROUND(-6.9,0)
Result
7 6 -6 -7
The last example shows how the ROUND function operates in an expression. The results vary depending on whether you round the intermediate values within the expression or only the result. Suppose you want to calculate the sum of two columns multiplied by a third column. For example:
(COL1 + COL2) * COL3
You can round the result only, the sum of COL1 and COL2 only, or all three numbers plus the result. Suppose COL1 is 35.555555, COL2 is 15.55, and COL3 is .555000. The results would vary as shown:
Expression
ROUND((COL1 + COL2) * COL3, 2) ROUND(ROUND(COL1 + COL2), 2) * COL3, 2) ROUND((ROUND(COL1, 2) + ROUND(COL2, 2)) * ROUND(COL3, 2), 2)
Result
28.36 28.37 28.62
String Functions
Table A-7 describes the built-in string functions that are available in mainframe jobs. Table A-7 String Functions
Function
AND_BITS
Syntax
AND_BITS(<String1>, <String2>) CHARACTER_LENGTH (<String>) LOWER(<String>)
Description
Returns a value that is the result of a bitwise AND-ing of <String1> and <String2>.1 Returns the number of characters in <String>.2 Returns the value of <String> converted to lowercase.2
A-10
Programmers Reference
Programming Components
Syntax
LPAD(<String1>, <StringLength>, <String2>)
Description
Returns a string of <StringLength> characters that consists of <String1> padded to the left with <String2> characters. If <String2> is omitted, the default is to pad with blanks.3 Returns a value that is the result of a bitwise OR-ing of <String1> and <String2>.1 Returns the first position at which <String1> occurs within <String2>.4 Returns a string of <StringLength> characters that consists of <String1> padded to the right with <String2> characters. If <String2> is omitted, the default is to pad with blanks.3 Returns the portion of <String> that begins at the byte indicated by <StartPosition> and ends at the end of <String>.5 Returns the portion of <String> that begins at the byte indicated by <StartPosition> and continues for <StringLength> bytes or to the end of <String> if <StringLength> is omitted.5 Returns the portion of <String> with leading and trailing blanks removed.6 Returns the portion of <String> with both leading and trailing <Character> removed.6 Returns the portion of <String> with both leading and trailing blanks removed.6 Returns the portion of <String> with both leading and trailing <Character> removed.6 Returns the portion of <String> with leading blanks removed.6
OR_BITS
OR_BITS(<String1>, <String2>)
POSITION
POSITION(<String1>IN <String2>)
RPAD
SUBSTRING
SUBSTRING(<String> FROM<StartPosition>)
SUBSTRING
TRIM
TRIM(<String>)
TRIM
TRIM(<Character>FROM <String>) TRIM(BOTH FROM <String>) TRIM(BOTH<Character> FROM<String>) TRIM(LEADING FROM <String>)
TRIM
TRIM
TRIM
A-11
Programming Components
Programmers Reference
Syntax
TRIM(LEADING <Character>FROM <String>) TRIM(TRAILING FROM <String>) TRIM(TRAILING <Character>FROM <String>) UPPER(<String>) XOR_BITS(<String1>, <String2>)
Description
Returns the portion of <String> with leading <Character> removed.6 Returns the portion of <String> with trailing blanks removed.6 Returns the portion of <String> with trailing <Character> removed.6 Returns the value of <String> converted to uppercase.2 Returns a value that is the result of a bitwise exclusive OR-ing of <String1> and <String2>.1
TRIM
TRIM
UPPER XOR_BITS
1 The data type of <String1> and <String2> must be Char or VarChar. If both arguments are Char, the data type of the result is Char; otherwise it is VarChar. If both arguments are non-nullable, the result is non-nullable; otherwise it is nullable. The precision of the result is equal to the smaller precision of the two arguments. Note that the precision of the result dictates the number of bytes used in the operation and the number of bytes returned by the function; also note that it is expressed as a number of bytes, not bits. NULL is returned by the function if either argument is NULL. 2 The data type of <String> must be Char, VarChar, NChar, or NVarChar. 3 If the data type of <Expression> is not Char, VarChar, NChar, or NVarChar, then <Expression> is converted to VarChar data type with a maximum length of <StringLength> before padding occurs. If the data type of <Expression> is NChar or NVarChar, then the data type of <String> must also be NChar or NVarChar. <StringLength> must be an integer greater than zero. 4 The data types of <String1> and <String2> must be Char, VarChar, NChar, or NVarChar. 5 The data type of <String> must be Char, VarChar, NChar, or NVarChar. The data types of <StartPosition> and <StringLength> must be numeric with a scale of 0. If <String>, <StartPosition>, or <StringLength> is NULL, the result is NULL. If <StringLength> is less than or equal to zero, the result is NULL. 6 The data type of <String> and <Character> must be Char, VarChar, NChar, or NVarChar. The length of <Character> must be 1.
A-12
Programmers Reference
Programming Components
Syntax
CHARACTER_LENGTH_MB (<String>) LOWER_MB(<String>) POSITION_MB(<String1> IN<String2>)
Description
Returns the number of characters in <String>.1,2 Returns the value of <String> converted to lowercase.1 Returns the first position at which <String1> occurs within <String2>.2,3 Returns the portion of <String> that begins at the character indicated by <StartPosition> and ends at the end of <String>.4 Returns the portion of <String> that begins at the character indicated by <StartPosition> and continues for <StringLength> characters.4 Returns the portion of <String> with leading and trailing blanks removed.5 Returns the portion of <String> with both leading and trailing <Character> removed.5 Returns the portion of <String> with both leading and trailing blanks removed.5 Returns the portion of <String> with both leading and trailing <Character> removed.5 Returns the portion of <String> with leading blanks removed.5 Returns the portion of <String> with leading <Character> removed.5
SUBSTRING_MB
SUBSTRING_MB(<String> FROM<StartPosition>)
SUBSTRING_MB
TRIM_MB
TRIM_MB(<String>)
TRIM_MB
TRIM_MB(<Character> FROM<String>) TRIM_MB(BOTH FROM <String>) TRIM_MB(BOTH<Character> FROM<String>) TRIM_MB(LEADING FROM <String>) TRIM_MB(LEADING <Character>FROM <String>)
TRIM_MB
TRIM_MB
TRIM_MB
TRIM_MB
A-13
Programming Components
Programmers Reference
Syntax
TRIM_MB(TRAILING FROM <String>) TRIM_MB(TRAILING <Character>FROM <String>) UPPER_MB(<String>)
Description
Returns the portion of <String> with trailing blanks removed.5 Returns the portion of <String> with trailing <Character> removed.5 Returns the value of <String> converted to uppercase.1
TRIM_MB
UPPER_MB
1 The data type of <String> must be Char, VarChar, NChar, or NVarChar. 2 The number for these functions is expressed in terms of characters, not bytes. Embedded SHIFT-OUT or SHIFT-IN keys are ignored. 3 The data types of <String1> and <String2> must be Char, VarChar, NChar, or NVarChar. 4 The data type of <String> must be Char, VarChar, NChar, or NVarChar. The data types of <StartPosition> and <StringLength> must be numeric with a scale of 0. If <String>, <StartPosition>, or <StringLength> is NULL, the result is NULL. If <StringLength> is less than or equal to zero, the result is NULL. 5 The data type of <String> and <Character> must be Char, VarChar, NChar, or NVarChar. The length of <Character> must be 1.
LPAD and RPAD Examples The LPAD and RPAD string padding functions are useful for rightjustifying character data or constructing date strings in the proper format. For example, suppose you wanted to convert an integer field to a right-justified character field with a width of 9 characters. You would use the LPAD function in an expression similar to this:
LPAD(ItemData.quantity,9)
Another example is to convert integer fields for year, month, and day into a character field in YYYY-MM-DD date format. The month and day portions of the character field must contain leading zeroes if their integer values have less than two digits. You would use the RPAD function in an expression similar to this:
CAST(Item.Data.ship_year AS CHAR(4))|| LPAD(ItemData.ship_month,2,0)||-|| LPAD(ItemData.ship_day,2,0)
To right-justify a DECIMAL(5,2) value to a width of 10 characters, you would specify the LPAD function as follows:
LPAD(value,10)
A-14
Programmers Reference
Programming Components
Result
12.12 100.00 -13.13 -200.00
To include a plus sign for positive numbers, you would specify the expression as follows:
IF value > 0 THEN LPAD(+ || CAST(value AS VARCHAR(6)),10) ELSE LPAD(value,10) END
Result
+12.12 +100.00 -13.13 -200.00
SUBSTRING Rules The SUBSTRING and SUBSTRING_MB functions perform substring extraction according to SQL3 guidelines. The operations are identical, but the orientations are different. Use the SUBSTRING_MB function when you want to perform character-oriented substring extraction. This function handles multi-byte characters, so if your string contain multi-byte character data, use this function. Use the SUBSTRING function when you want to do byte-oriented substring extraction. The SUBSTRING function is implemented using COBOL statements, whereas the SUBSTRING_MB function is implemented as a call to a run-time library routine. The implications of this are that the byteoriented SUBSTRING function performs better than the characteroriented SUBSTRING_MB function. If the <StartPosition> or the implied end position is outside the bounds of <String>, these functions return only the portion that is within the bounds. For example:
SUBSTRING(ABCDE SUBSTRING(ABCDE SUBSTRING(ABCDE SUBSTRING(ABCDE FROM FROM FROM FROM 1) 0) -1) -2) returns returns returns returns ABCDE ABCDE ABCDE ABCDE
A-15
Programming Components
Programmers Reference
SUBSTRING(ABCDE SUBSTRING(ABCDE SUBSTRING(ABCDE SUBSTRING(ABCDE SUBSTRING(ABCDE SUBSTRING(ABCDE SUBSTRING(ABCDE SUBSTRING(ABCDE SUBSTRING(ABCDE SUBSTRING(ABCDE SUBSTRING(ABCDE SUBSTRING(ABCDE
FROM FROM FROM FROM FROM FROM FROM FROM FROM FROM FROM FROM
-3) 1 FOR 4) 0 FOR 4) -1 FOR 4) -2 FOR 4) -3 FOR 4) 1 FOR 23) 0 FOR 23) -1 FOR 23) -2 FOR 23) -3 FOR 23) -21 FOR 23)
returns returns returns returns returns returns returns returns returns returns returns returns
Operators
An operator performs an operation on one or more expressions (the operands). DataStage mainframe jobs support the following types of operators: Arithmetic operators String concatenation operator Relational operators Logical operators Ascential DataStage follows SQL guidelines on orders of operators in expressions. Specifically, AND has higher precedence than OR. Any redundant parentheses may be removed after verification. This applies to constraints in flat file source stages, WHERE clauses in relational source stages, join conditions, and lookup conditions. For example, if you define the following expression:
(A AND B) OR (C AND D)
Ascential DataStage removes all of the parentheses in this case, since it first evaluates A AND B, then C AND D, and finally compares the results of the two. The expression will appear like this:
A AND B OR C AND D
Ascential DataStage does not remove the parentheses here because the result of the expression (B OR C) is evaluated first.
A-16
Programmers Reference
Programming Components
Table A-9 describes the operators that are available in mainframe jobs and their location. Table A-9 Mainframe Job Operators
Operator
( ) || < > <= >= = <> AND OR NOT BETWEEN
Definition
Opening parenthesis Closing parenthesis Concatenate Less than Greater than Less than or equal to Greater than or equal to Equality Inequality And Or Not Between
Expression Editor
Expression Grid
1 1 1 1 1 1
NOT BETWEEN Not between IN NOT IN IS NULL IS NOT NULL + * / In Not in NULL Not NULL Addition Subtraction Multiplication Division
1 These operators are available in the Functions\Logical branch of the Item type project tree.
A-17
Programming Components
Programmers Reference
Parameters
Job parameters represent processing variables. They are defined, edited, and deleted on the Parameters page of the Job Properties dialog box. The actual parameter values are placed in a separate file that is uploaded to the mainframe and accessed when the job is run. See Ascential DataStage Designer Guide for details on specifying mainframe job parameters. You can use job parameters in column derivations and constraints. They appear in the Expression Editor, on the Definition tab in Business Rule stages, on the Mapping tab in active stages, and in the Constraint grid in Complex Flat File, Delimited Flat File, Fixed-Width Flat File, IMS, Multi-Format Flat File, and External Source stages. In Relational and Teradata Relational stages, you can use job parameters on the Where tab of the Inputs page, but not on the Where tab of the Outputs page. This is because job parameters are available only when the stage is used as a target. If you want to use a job parameter in the SQL SELECT statement of a Relational or Teradata Relational source stage, add a Transformer stage after the Relational or Teradata Relational stage in your job design, and define a constraint that compares a source column to the job parameter. The source column and job parameter must have the same data type and length, no implicit or explicit casting can occur, and there cannot be an ORDER BY clause in the SQL SELECT statement. If these requirements are met, Ascential DataStage pushes the constraint back to the SELECT statement and the filtering is performed by the database. If the source column and job parameter are not the same data type and length, you can convert them using one of the following techniques: Create a computed column in the Relational or Teradata Relational stage that has the same data type and length as the job parameter. Define an expression for the computed column using one of the DB2 or Teradata functions to convert the original column to the correct data type and length. You can then use the computed column in the Transformer stage constraint. Convert the job parameter to the data type and length of the Relational or Teradata Relational source column. Use the CAST function to convert the job parameter to the correct data type and length in the Transformer stage constraint. When code is generated, the EXEC SQL statement will include the job parameter in the WHERE clause.
A-18
Programmers Reference
Programming Components
Routines
In mainframe jobs, routines specify a COBOL function that exists in a library external to Ascential DataStage. Mainframe routines are stored in the Routines branch of the DataStage Repository, where you can create, view, or edit them using the Mainframe Routine dialog box. For details on creating routines, see Chapter 22, "External Routine Stages."
Variables
Variables are used to temporarily store values in memory. You can then use the values in a series of operations. This can save programming time because you can easily change the values of the variables as your requirements change. Ascential DataStages built-in job variables are described in Table A-10. You can also declare and use your own variables in Transformer and Business Rule stages. Such variables are accessible only from the Transformer stage or Business Rule stage in which they are declared. For details on declaring local stage variables, see Chapter 15, "Transformer Stages" and Chapter 16, "Business Rule Stages." Table A-10 describes the built-in variables that are available for mainframe jobs. Table A-10 Mainframe Job Variables
Variable
linkname.REJECTEDCODE linkname.DBMSCODE ENDOFDATA
Definition
Returns the Ascential DataStage error code or DSE_NOERROR if not rejected. Returns the DBMS error code. Returns TRUE if the last row of data has been processed or FALSE if the last row of data has not been processed. Returns 0 if data was successfully written to an output link. A nonzero value indicates an error.
SQLCA.SQLCODE
REJECTEDCODE and DBMSCODE These variables are available only in Transformer stages. They are displayed under the Variables branch of the Expression Editor for all output links except the first link in the execution order. They are used to check the results of links that have already been executed. For example, if you have three output links, only the last two can be used to evaluate results. The second link can check the results of the first
A-19
Programming Components
Programmers Reference
link, and the third link can check the results of the first two links. Click the Output Link Execution Order button on the Transformer Editor toolbar to reorder the output links to meet your requirements. There are three ways to use the variable REJECTEDCODE in constraint expressions: If link1.REJECTEDCODE = DSE_TRXCONSTRAINT, the data on link1 does not satisfy the constraint. This expression can be used when any stage type follows the Transformer stage in the job design. If link1.REJECTEDCODE = DSE_NOERROR, the constraint on link1 was satisfied, regardless of the stage type that follows the Transformer stage in the job design. However, when this expression is used in a job where a Relational stage follows the Transformer stage in the job design, then it not only indicates that the constraint on link1 was satisfied, it also indicates that the row was successfully inserted or updated into the database. If link1.REJECTEDCODE = DSE_TRXLINK, the row was rejected by the next stage, which must be a Relational stage. You can check the value of DBMSCODE to find the cause of the error. For more information on using REJECTEDCODE and DBMSCODE in Transformer stage constraints, see "Defining Constraints and Handling Rejects" on page 15-18. ENDOFDATA ENDOFDATA can be used in the following places: Output column derivations in Transformer stages Stage variable derivations in Transformer stages Constraint expressions in Transformer stages SQL business rule logic in Business Rule stages Pre-lookup condition expressions in Lookup stages The syntax for ENDOFDATA varies depending on the type of expression. For column and stage variable derivations, use the IS TRUE or IS FALSE logical function to test ENDOFDATA as shown:
IF ENDOFDATA IS TRUE THEN B ELSE A END IF ENDOFDATA IS FALSE THEN B ELSE A END
For constraint expressions, SQL business rule logic, and pre-lookup conditions, use the following syntax:
ENDOFDATA IS TRUE ENDOFDATA IS FALSE
A-20
Programmers Reference
Programming Components
When the end-of-data indicator is passed to an active stage, the way it is handled varies depending on the stage type. In Transformer, Business Rule, Link Collector, and Lookup stages, the end-of-data row is processed just like any other row. In Join, Aggregator, Sort, and External Routine stages, the end-of-data row is not processed along with the rest of the data but is simply passed through the stage. Endof-data rows are ignored on the reference link to Lookup stages and on the inner link to Join stages. SQLCA.SQLCODE SQLCA.SQLCODE is available in the same places as ENDOFDATA: Output column derivations in Transformer stages Stage variable derivations in Transformer stages Constraint expressions in Transformer stages SQL business rule logic in Business Rule stages Pre-lookup condition expressions in Lookup stages Typically this variable is used to determine whether data is successfully written to an output link. In a Business Rule stage, you would add SQLCA.SQLCODE after the INSERT statement in the business rule logic to check whether an output link to a Relational stage succeeded. You can also use it to detect a lookup failure. In this case you would check the value of SQLCA.SQLCODE before doing an INSERT into an output link.
A-21
Programming Components
Programmers Reference
A-22
B
Data Type Definitions and Mappings
This appendix describes the data types supported in Ascential DataStage Enterprise MVS Edition, the permissible data type mappings, and how data type mappings are implemented.
Description
A string of characters
Precision
The number of characters
Scale
Zero
Date Mask
Any date mask whose length precision None
VarChar
A 2-byte binary integer plus a string of characters A string of DBCS characters A 2-byte binary integer plus a string of DBCS characters
The maximum number of characters in the string The number of characters The maximum number of characters in the string
Zero
NChar NVarChar
Zero Zero
None None
B-1
Description
A 2-byte binary integer A 4-byte binary integer
Precision
The number of decimal digits (1 n 4) The number of decimal digits (5 n 9) The number of decimal digits (1 n 18)1
Scale
Zero
Date Mask
None
Integer
Zero
Any numeric date mask whose length precision If scale = 0, then any numeric date mask whose length precision; if scale > 0, then none None (default date format assumed) None
Decimal
Date
Three 2-byte binary numbers (for CCYY, MM, DD) Three 2-byte binary numbers (for HH, MM, SS)
10
Zero
Time
Zero
Timestamp Six 2-byte binary numbers (for CCYY, MM, DD, HH, MM, SS) and a 4-byte binary number (for microseconds)
26
Zero
None
1 If Support extended decimal is selected in project properties, then the precision and scale can be up to the maximum decimal size specified.
B-2
Table B-2 Ascential DataStage Enterprise MVS Edition Data Type Mappings
TARGET
Char
SOURCE
Char VarChar NChar NVarChar SmallInt Integer Decimal Date Time Timestamp COBOL COBOL
NChar
NVar Char
Time
Timestamp
DSC2I DSC2I
DSC2D DSC2D
COBOL COBOL COBOL COBOL DSSI2C DSSI2C DSI2C DSD2C COBOL COBOL COBOL DSI2C DSD2C COBOL COBOL COBOL COBOL COBOL COBOL COBOL COBOL COBOL COBOL COBOL COBOL COBOL COBOL COBOL COBOL COBOL COBOL COBOL COBOL COBOL COBOL COBOL COBOL COBOL
Processing Rules
Mapping a nullable source to a non-nullable target is allowed. However, the assignment of the source value to the target is allowed only if the source value is not actually NULL. If it is NULL, then a message is written to the process log and program execution is halted. When COBOL MOVE and COMPUTE statements are used during the assignment, the usual COBOL rules for these statements apply. This includes data format conversion, truncation, and space filling rules.
B-3
Implementation
COBOL statements The source is moved to the target. Truncation occurs if the length of the target is less than the length of the source. Spaces are padded in the target if the length of the target is greater than the length of the source. COBOL statements The Char value is moved to the VarChar value. Truncation occurs if the maximum length of the VarChar is less than the length of the Char. The length of the VarChar is set to the lesser of the length of the Char or the maximum length of the VarChar. This mapping is not allowed. This mapping is not allowed. DSC2SI Convert a character string to a small integer. The Char is scanned for an integer number string of this pattern: zero or more spaces, an optional plus or minus sign, one or more decimal digits, zero or more spaces. Any unexpected character that is found disrupts the pattern and terminates the scan for the number. If the scan is terminated before any decimal digits are found, then zero is assigned to the SmallInt. If the number is too big to fit into a SmallInt, the high-order digits are truncated. DSC2I Convert a character string to an integer. The Char is scanned for an integer number string of this pattern: zero or more spaces, an optional plus or minus sign, one or more decimal digits, zero or more spaces. Any unexpected character that is found disrupts the pattern and terminates the scan for the number. If the scan is terminated before any decimal digits are found, then zero is assigned to the Integer. If the number is too big to fit into an Integer, the high-order digits are truncated. DSC2D Convert a character string to a packed decimal number. The Char is scanned for a decimal number string of this pattern: zero or more spaces; an optional plus or minus sign; either: (a) one or more decimal digits, (b) one or more decimal digits, a decimal point, and one or more decimal digits, or (c) a decimal point and one or more decimal digits; and finally zero or more spaces. Any unexpected character that is found disrupts the pattern and terminates the scan for the number. If the scan is terminated before any decimal digits are found, then zero is assigned to the Decimal. If the number is too big to fit into the Decimal, the high-order digits are truncated. If the Char has more digits to the right of the decimal point than are specified in the scale of the Decimal, only the number of digits specified in the scale are used. DSC2DT Convert a character string to a date. The Char must have a length of at least 10 and be consistent with the default date format, left-aligned in the Char area. (The separator characters need not be dashes.)
Char
VarChar
Char
Integer
Char
Decimal
Char
Date
B-4
Implementation
DSC2TM Convert a character string to a time. The Char must be in time form, HH:MM:SS, left-aligned in the Char area. (The separator characters need not be periods.)
Char
Timestamp DSC2TS Convert a character string to a timestamp. The Char must be in timestamp form, CCYY-MM-DD HH:MM:SS.NNNNNN, left-aligned in the Char area. (The separator characters need not be dashes and periods.)
Implementation
COBOL statements The actual VarChar value is moved to the Char. Truncation occurs if the actual length of the VarChar is greater than the length of the Char. Spaces are padded in the Char if the length of the Char is greater than the actual length of the VarChar. COBOL statements The source value is moved to the target value. Truncation occurs if the actual length of the source is greater than the maximum length of the target. The length of the target is set to the lesser of the actual length of the source or the maximum length of the target. This mapping is not allowed. This mapping is not allowed. DSC2SI Convert a character string to a small integer. The VarChar is scanned for an integer number string of this pattern: zero or more spaces, an optional plus or minus sign, one or more decimal digits, zero or more spaces. Any unexpected character that is found disrupts the pattern and terminates the scan for the number. If the scan is terminated before any decimal digits are found, then zero is assigned to the SmallInt. If the number is too big to fit into a SmallInt, the high-order digits are truncated. DSC2I Convert a character string to an integer. The VarChar is scanned for an integer number string of this pattern: zero or more spaces, an optional plus or minus sign, one or more decimal digits, zero or more spaces. Any unexpected character that is found disrupts the pattern and terminates the scan for the number. If the scan is terminated before any decimal digits are found, then zero is assigned to the Integer. If the number is too big to fit into an Integer, the high-order digits are truncated.
VarChar
VarChar
VarChar
Integer
B-5
Implementation
DSC2D Convert a character string to a packed decimal number. The VarChar is scanned for a decimal number string of this pattern: zero or more spaces; an optional plus or minus sign; either: (a) one or more decimal digits, (b) one or more decimal digits, a decimal point, and one or more decimal digits, or (c) a decimal point and one or more decimal digits; and finally zero or more spaces. Any unexpected character that is found disrupts the pattern and terminates the scan for the number. If the scan is terminated before any decimal digits are found, then zero is assigned to the Decimal. If the number is too big to fit into the Decimal, the high-order digits are truncated. If the Char has more digits to the right of the decimal point than are specified in the scale of the Decimal, only the number of digits specified in the scale are used. DSC2DT Convert a character string to a date. The VarChar must consistent with the default date format, left-aligned in the VarChar area. (The separator characters need not be dashes.) DSC2TM Convert a character string to a time. The VarChar must be in time form, HH:MM:SS, left-aligned in the VarChar area. (The separator characters need not be periods.)
VarChar
Date
VarChar
Time
VarChar
Timestamp DSC2TS Convert a character string to a timestamp. The VarChar must be in timestamp form, CCYY-MM-DD HH:MM:SS.NNNNNN, left-aligned in the VarChar area. (The separator characters need not be dashes and periods.) There may be from zero to six digits to the right of the decimal point; if there are zero digits, there should not be a decimal point.
B-6
Implementation
This mapping is not allowed. This mapping is not allowed. COBOL statements The source is moved to the target. Truncation occurs if the length of the target is less than the length of the source. Spaces are padded in the target if the length of the target is greater than the length of the source. COBOL statements The NChar value is moved to the NVarChar value. Truncation occurs if the maximum length of the NVarChar is less than the length of the NChar. The length of the NVarChar is set to the lesser of the length of the NChar or the maximum length of the NVarChar. This mapping is not allowed. This mapping is not allowed. This mapping is not allowed. This mapping is not allowed. This mapping is not allowed.
NChar
NVarChar
Implementation
This mapping is not allowed. This mapping is not allowed. COBOL statements The actual NVarChar value is moved to the NChar. Truncation occurs if the actual length of the NVarChar is greater than the length of the NChar. Spaces are padded in the NChar if the length of the NChar is greater than the actual length of the NVarChar. COBOL statements The source value is moved to the target value. Truncation occurs if the actual length of the source is greater than the maximum length of the target. The length of the target is set to the lesser of the actual length of the source or the maximum length of the target. This mapping is not allowed. This mapping is not allowed.
NVarChar
NVarChar
NVarChar NVarChar
SmallInt Integer
B-7
Implementation
This mapping is not allowed. This mapping is not allowed. This mapping is not allowed.
Implementation
DSSI2C Convert a small integer to a character string. The SmallInt is converted to a string of digits (with a minus sign as the first character if the number is negative). This string is left-aligned in the Char area. If the length of the string is less than the length of the Char area, spaces are used to pad on the right. If the length of the string is greater than the length of the Char area, the high-order digits are truncated. DSSI2C Convert a small integer to a character string. The SmallInt is converted to a string of digits (with a minus sign as the first character if the number is negative). This string is left-aligned in the VarChar area. If the length of the string is greater than the length of the VarChar area, the highorder digits are truncated. This mapping is not allowed. This mapping is not allowed. COBOL statements Move source to target. COBOL statements Move source to target. COBOL statements Move source to target. If the SmallInt value is greater than the maximum or less than the minimum of the Decimal, a warning message is printed in the process log. This mapping is not allowed. This mapping is not allowed.
SmallInt
VarChar
Date Time
B-8
Implementation
DSI2C Convert an integer to a character string. The Integer is converted to a string of digits (with a minus sign as the first character if the number is negative). This string is leftaligned in the Char area. If the length of the string is less than the length of the Char area, spaces are used to pad on the right. If the length of the string is greater than the length of the Char area, the high-order digits are truncated. DSI2C Convert an integer to a character string. The integer is converted to a string of digits (with a minus sign as the first character if the number is negative). This string is leftaligned in the VarChar area. If the length of the string is greater than the length of the VarChar area, the high-order digits are truncated. This mapping is not allowed. This mapping is not allowed. COBOL statements Move source to target. If the integer value is greater than the maximum or less than the minimum of the SmallInt, a warning message is printed in the process log. COBOL statements Move source to target. COBOL statements Move source to target. If the integer value is greater than the maximum or less than the minimum of the Decimal, a warning message is printed in the process log. COBOL statements If the Integer has a date mask, the Date is computed from the Integer according to the mask. If the Integer has no date mask, the Integer is assumed to represent a day number (where days are numbered sequentially from 0001-01-01, which is day number 1) and is converted to a Date. COBOL statements The Integer is assumed to represent a second number (where seconds are numbered sequentially from midnight, so 00.00.00 is 0, 00.00.01 is 1, and so on) and is converted to a Time.
Integer
VarChar
Integer Integer
Integer Decimal
Integer
Date
Integer
Time
Integer
B-9
Implementation
DSD2C Convert a decimal to a character string. The string is left-aligned in the Char area and has this format: a minus sign if the number is negative, followed by zero or more decimal digits, and, if the packed decimal has a nonzero scale value, a decimal point followed by scale number of digits. If the length of the string is less than the length of the Char area, spaces are used to pad on the right. If the length of the string is greater than the length of the Char area, the high-order digits are truncated. DSD2C Convert a decimal to a character string. The string is left-aligned in the VarChar area and has this format: a minus sign if the number is negative, followed by zero or more decimal digits, and, if the packed decimal has a nonzero scale value, a decimal point followed by scale number of digits. If the length of the string is greater than the maximum length of the VarChar area, the high-order digits are truncated. This mapping is not allowed. This mapping is not allowed. COBOL statements Move source to target. If the value of the Decimal is greater than the maximum or less than the minimum of the SmallInt, a warning message is printed in the process log. COBOL statements Move source to target. If the value of the Decimal is greater than the maximum or less than the minimum of the Integer, a warning message is printed in the process log. COBOL statements Move source to target. If the value of the source Decimal is greater than the maximum or less than the minimum of the target Decimal, a warning message is printed in the process log. COBOL statements If the Decimal has a date mask, the Date is computed from the Decimal according to the mask. If the Decimal has no date mask, the Decimal is assumed to represent a day number (where days are numbered sequentially from 0001-01-01, which is day number 1) and is converted to a Date. COBOL statements This mapping converts a Decimal to a Time that represents the number of seconds since midnight. The precision of the Decimal must be at least 5. (For example, 0 becomes 00.00.00 which is midnight, 61 becomes 00.01.01, 86399 becomes 23.59.59)
Decimal
VarChar
Decimal
Integer
Decimal
Decimal
Decimal
Date
Decimal
Time
B-10
Implementation
Timestamp COBOL statements This mapping converts a Decimal to a Timestamp that represents the number of seconds since midnight on 0001-01-01. The precision of the Decimal should be at least 18, or the maximum size specified in project properties if extended decimal support is selected. If you want to include milliseconds, the scale of the Decimal should be no more than 6.
Implementation
COBOL statements If the Char has a date mask, the Date is formatted into the Char area according to that format. If the target does not have a date mask, the length of the Char must be at least 10 and the Date is formatted into the Char area consistent with the default date format. If the Char area is larger than the length needed according to the date mask, the Date is left-aligned in the Char area and padded on the right with spaces. COBOL statements The maximum length of the VarChar must be at least 10. The Date is formatted into the VarChar area consistent with the default date format. This mapping is not allowed. This mapping is not allowed. This mapping is not allowed. COBOL statements If the Integer has a date mask, the Date is moved to the Integer and formatted according to the mask. If the Integer has no date mask, the Date is converted to an Integer that represents the day number, where days are numbered sequentially from 0001-01-01 (which is day number 1). COBOL statements If the Decimal has a date mask, the Date is moved to the Decimal and formatted according to the mask. If the Decimal has no date mask, the Date is converted to a day number, where days are numbered sequentially from 0001-0101 (which is day number 1). If the day number is greater than the maximum or less than the minimum of the target Decimal, a warning message is printed in the process log. COBOL statements Move source to target. This mapping is not allowed.
Date
VarChar
Date
Decimal
Date Time
B-11
Implementation
COBOL statements The time is formatted into the Char area according to the HH:MM:SS format. The length of the Char area must be at least 8. If the Char area is larger than 8, the time is left-aligned in the Char area and padded on the right with spaces. COBOL statements The time is formatted into the VarChar area according to the HH:MM:SS format. The maximum length of the VarChar area must be at least 8. This mapping is not allowed. This mapping is not allowed. This mapping is not allowed. COBOL statements This mapping converts a Time to an Integer that represents the number of seconds since midnight. (For example, 00.00.00 is midnight and becomes 0, 00.01.01 becomes 61, 23.59.59 becomes 86399.) COBOL statements This mapping converts a Time to a Decimal that represents the number of seconds since midnight. The precision of the Decimal must be at least 5. (For example, 00.00.00 is midnight and becomes 0, 00.01.01 becomes 61, 23.59.59 becomes 86399.) This mapping is not allowed. COBOL statements Move source to target.
Time
VarChar
Time
Decimal
Date Time
Implementation
COBOL statements The Timestamp is formatted into the Char area according to the CCYY-MM-DD HH:MM:SS.NNNNNN format. The length of the Char area must be at least 26. If the length of the Char area is greater than 26, the Timestamp is left-aligned in the Char area and padded on the right with spaces. COBOL statements The Timestamp is formatted into the VarChar area according to the CCYY-MM-DD HH:MM:SS.NNNNNN format. The maximum length of the VarChar area must 26. This mapping is not allowed.
Timestamp
VarChar
Timestamp
NChar
B-12
Mapping Dates
Implementation
This mapping is not allowed. This mapping is not allowed. This mapping is not allowed. COBOL statements The Timestamp is formatted into the Decimal area as a floating point value that represents the number of seconds since midnight on 0001-01-01. The precision of the Decimal should be 18, or the maximum size specified in project properties if extended decimal support is selected. If you want to include milliseconds, the scale of the Decimal should be no more than 6. Since float is not precise, you may lose precision in the value being converted. This mapping is not allowed. This mapping is not allowed.
Date Time
Mapping Dates
Table B-13 describes some of the conversion rules that apply when dates are mapped from one format to another. Table B-13 Date Mappings
Input Format
MMDDYY
Output Format
Rule
Example
140199 010120 1999 2020 01-UNK-1999 01-JAN-2020 99 20
CCYY
YY
CCYY
Depends on the century break year specified in job properties. If YY < century break year, CC = 20; if YY century break year, CC = 19.
Any input column with a date mask becomes a Date data type and is converted to the job-level default date format.
B-13
Mapping Dates
No conversions apply when months, days, and years are mapped to the same format (i.e., MM to MM or CCYY to CCYY). If the input dates are invalid, the output dates will also be invalid.
B-14
C
Native Data Types
This appendix describes the native data types that Ascential DataStage Enterprise MVS Edition supports in mainframe source and target stages.
Source Stages
Table C-1 describes the native data types supported in Complex Flat File, Fixed-Width Flat File, Multi-Format Flat File, External Source, and External Routine stages. Table C-1 Complex Flat File, Fixed-Width Flat File, Multi-Format Flat File, External Source, and External Routine Stage Native Types
Native Data Type
BINARY
Description
COBOL supports three sizes of binary integers: 2-byte, 4byte, and 8-byte. The COBOL picture for each of these sizes is S9(p)COMP where p is the precision specified in the , column definition. COBOL allocates a 2-byte binary integer when the precision is 1 to 4, a 4-byte binary integer when the precision is 5 to 9, and an 8-byte binary integer when the precision is 10 to 18 (or higher if extended decimal support is selected in project properties). Tables can be defined with columns of any size binary integer. The DataStage-generated COBOL programs can read all three sizes, but internally they are converted to packed decimal numbers with the specified precision for further processing. If a column of BINARY type has a date format specified, then the column value is converted to internal date form and the column type is changed to Date for further processing.
C-1
Source Stages
Table C-1 Complex Flat File, Fixed-Width Flat File, Multi-Format Flat File, External Source, and External Routine Stage Native Types
Native Data Type
CHARACTER
Description
Ascential DataStage Enterprise MVS Edition supports reading strings of character data. If a column of CHARACTER type has a date format specified, then the column value is converted to internal date form and the column type is changed to Date for further processing.
DECIMAL
DECIMAL numbers are numbers in packed decimal format. Ascential DataStage Enterprise MVS Edition provides support for these numbers. If a column of DECIMAL type has a date format specified, then the column value is converted to internal date form and the column type is changed to Date for further processing.
DISPLAY NUMERIC
The DataStage-generated COBOL programs can read DISPLAY NUMERIC numbers, but internally they are converted to packed decimal numbers for further processing. The precision and scale of the numbers are not changed, so no precision is lost in doing this conversion. If a column of DISPLAY NUMERIC type has a date format specified, then the column value is converted to internal date form and the column type is changed to Date for further processing.
FLOAT
The DataStage-generated COBOL programs can read singleand double-precision floating point numbers, but internally they are converted to packed decimal numbers for further processing. The precision and scale of the column definition are used for the packed decimal number. This means that precision can be lost when moving a FLOAT to this number. For example, suppose C is defined to be a single-precision floating point column (i.e., its COBOL picture is COMP-1) having a precision of 5 and scale of 2. This would cause a packed decimal number to be created as PIC S9(3)V9(2) COMP-3. Suppose that the file contains three records with values of 54.0, -2266.46, and .0078125 for C. No precision is lost when the first value is moved to the packed decimal. The second value becomes -266.46, thus losing the precision on the left. The third value becomes .00, losing the precision on the right.
GRAPHIC-G
The DataStage-generated COBOL programs can read data with picture clause symbol G and USAGE DISPLAY-1. The associated data must be DBCS characters in the range from X00 through XFF. The DBCS data can be defined explicitly or implicitly. Internally, they are converted to NChar for further processing. The picture clause in the column definition represents the length in the correct format, DBCS length.
C-2
Source Stages
Table C-1 Complex Flat File, Fixed-Width Flat File, Multi-Format Flat File, External Source, and External Routine Stage Native Types
Native Data Type
GRAPHIC-N
Description
The DataStage-generated COBOL programs can read data with picture clause symbol N. USAGE DISPLAY-1 is assumed and does not need to be specified. The associated data must be DBCS characters in the range from X00 through XFF. The DBCS data can be defined explicitly or implicitly. Internally, they are converted to NChar for further processing. The picture clause in the column definition represents the length in the correct format, DBCS length.
GROUP
This data type is available only in Complex Flat File, MultiFormat Flat File, External Source, and External Routine stages. Ascential DataStage Enterprise MVS Edition treats groups as character strings. The length of the character string is the size of the group, which is the sum of the sizes of all elements of the group. This is in accordance with standard COBOL usage. The DataStage-generated COBOL programs can read native binary data with 2, 4, or 8 bytes. The COBOL picture clause is S9(p)COMP-5, where p is the precision specified in the column definition. A scaling factor can be specified as well. COBOL allocates a 2-byte binary integer when the precision is 1 to 4, a 4-byte binary integer when the precision is 5 to 9, and an 8-byte binary integer when the precision is 10 to 18 (or higher if extended decimal support is selected in project properties). Numeric values are not limited to the value implied by the number of nines in the picture clause. Internally NATIVE BINARY data is converted to packed decimal numbers for further processing. If the precision is 1 to 4, the data is converted to Decimal(5), if the precision is 5 to 9, the data is converted to Decimal(10, and if the precision is 10 to 18, the data is converted to Decimal(18). If a column of NATIVE BINARY type has a date format specified, then the column value is converted to internal date form and the column type is changed to Date for further processing.
NATIVE BINARY
VARCHAR
Ascential DataStage Enterprise MVS Edition supports reading variable-length strings of character data. If a column of VARCHAR type has a date format specified, then the column value is converted to internal date form and the column type is changed to Date for further processing.
C-3
Source Stages
Table C-1 Complex Flat File, Fixed-Width Flat File, Multi-Format Flat File, External Source, and External Routine Stage Native Types
Native Data Type
VARGRAPHIC_G
Description
The DataStage-generated COBOL programs can read data with picture clause symbol G and USAGE DISPLAY-1. The associated data must be DBCS characters in the range from X00 through XFF. The DBCS data can be defined explicitly or implicitly. Internally, they are converted to NVarChar for further processing. The picture clause in the column definition represents the length in the correct format, DBCS length.
VARGRAPHIC_N
The DataStage-generated COBOL programs can read data with picture clause symbol N. USAGE DISPLAY-1 is assumed and does not need to be specified. The associated data must be DBCS characters in the range from X00 through XFF. The DBCS data can be defined explicitly or implicitly. Internally, they are converted to NVarChar for further processing. The picture clause in the column definition represents the length in the correct format, DBCS length.
Table C-2 describes the native data types supported in Delimited Flat File source stages. Table C-2 Delimited Flat File Source Stage Native Types
Native Data Type Description
CHAR DECIMAL A string of characters with blank characters trimmed from the right. A value in this format: a minus sign if the value is negative, a string of decimal digits, and, if the scale of the number is nonzero, then a decimal point followed by a string of digits. A minus sign if the value is negative, followed by a string of decimal digits. A string of DBCS characters. A variable-length string of DBCS characters. The same format as an INT value. The same format as a CHAR value.
C-4
Source Stages
Table C-3 describes the native data types that Ascential DataStage Enterprise MVS Edition supports for selecting columns in DB2 tables. Table C-3 Relational Source Stage Native Types
Native Data Type Description
CHARACTER DATE Ascential DataStage Enterprise MVS Edition supports selecting strings of characters. Ascential DataStage Enterprise MVS Edition supports the ISO (CCYY-MM-DD), USA (MM/DD/YY), and European (DD.MM.CCYY) date formats supported by DB2. The default date format of the job must equal the date format of the DB2 subsystem used. Further date processing is done using the internal form. When a DATE column value is processed by Ascential DataStage Enterprise MVS Edition, it is selected from DB2 in the default date form, and then converted to an internal form that is independent of the original format of the DATE. Further date processing is done using the internal form. DECIMAL numbers are numbers in packed decimal format. Ascential DataStage Enterprise MVS Edition provides full support for these numbers. If you selected Support extended decimal in project properties, and you import a DCLGen file containing DECIMAL data with precision greater than the maximum decimal size specified, Ascential DataStage changes the precision of the DECIMAL to the maximum size specified. This is a string of DBCS characters and is supported in Ascential DataStage Enterprise MVS Edition. This represents a 4-byte binary integer and is supported in Ascential DataStage Enterprise MVS Edition. When importing DCLGen files, Ascential DataStage captures INTEGER data with precision up to 10. However, due to COBOL restrictions, the precision is changed to 9 when loading such data into mainframe jobs. NUMERIC is a synonym for DECIMAL. This represents a 2-byte binary integer. The DataStagegenerated COBOL programs can select columns of SMALLINT type, but internally they are converted to 4-byte binary integers for further processing. No precision is lost in the conversion. When importing DCLGen files, Ascential DataStage captures SMALLINT data with precision up to 5. However, due to COBOL restrictions, the precision is changed to 4 when loading such data into mainframe jobs. When Ascential DataStage Enterprise MVS Edition processes a TIME column value, it selects it from DB2 in the standard form (HH.MM.SS) and then converts it to an internal form. Further time processing is done using the internal form.
DECIMAL
GRAPHIC INTEGER
NUMERIC SMALLINT
TIME
C-5
Source Stages
VARCHAR VARGRAPHIC
Table C-4 describes the native data types supported in Teradata Export and Teradata Relational source stages. Table C-4 Teradata Export Stage and Teradata Relational Source Stage Native Types
Native Data Type Description
BYTEINT CHAR DATE This represents a 1-byte binary integer and is converted to a 2-byte integer for processing. Ascential DataStage Enterprise MVS Edition supports selecting strings of character data. Ascential DataStage Enterprise MVS Edition uses the ISO (CCYY-MM-DD) format supported by Teradata. When a DATE column value is processed by Ascential DataStage Enterprise MVS Edition, it is selected from Teradata and then converted to an internal form that is independent of the original format of the DATE. Further date processing is done using the internal form. DECIMAL numbers are numbers in packed decimal format. Ascential DataStage Enterprise MVS Edition provides full support for these numbers. This is a double-precision floating point number and is supported in Ascential DataStage Enterprise MVS Edition. This is a string of DBCS characters and is supported in Ascential DataStage Enterprise MVS Edition. This represents a 4-byte binary integer and is supported in Ascential DataStage Enterprise MVS Edition.
DECIMAL
C-6
Target Stages
Table C-4 Teradata Export Stage and Teradata Relational Source Stage Native Types (Continued)
Native Data Type Description
SMALLINT This represents a 2-byte binary integer. Ascential DataStage Enterprise MVS Edition generates COBOL programs that can select columns of SMALLINT type, but internally it converts them to 4-byte binary integers for further processing. No precision is lost in the conversion. When Ascential DataStage Enterprise MVS Edition processes a TIME column value, it selects it from Teradata in the standard form (HH.MM.SS) and then converts it to an internal form. Further time processing is done using the internal form. When Ascential DataStage Enterprise MVS Edition processes a TIMESTAMP column value, it selects it from Teradata in the standard form (CCYY-MM-DDHH.MM.SS.NNNNNN) and then converts it to an internal form. Further timestamp processing is done using the internal form. Ascential DataStage Enterprise MVS Edition supports variable-length strings of characters. This is a variable-length string of DBCS characters. Ascential DataStage Enterprise MVS Edition support selecting strings of this type, but internally it converts them to NVarChar type for further processing.
TIME
TIMESTAMP
VARCHAR VARGRAPHIC
Target Stages
Table C-5 describes the native data types that Ascential DataStage Enterprise MVS Edition supports for writing data to Fixed-Width Flat File and External Target stages. Table C-5 Fixed-Width Flat File Target Stage and External Target Stage Native Types
Native Data Type Description
BINARY CHARACTER DECIMAL DISPLAY NUMERIC FLOAT Depending on the precision of the column, this is a 2-byte, 4-byte, or 8-byte binary integer. A string of characters. A packed decimal number. A display numeric number. A single- or double-precision floating point number.
C-7
Target Stages
Table C-5 Fixed-Width Flat File Target Stage and External Target Stage Native Types (Continued)
Native Data Type Description
GRAPHIC-G GRAPHIC-N A DBCS data type when picture clause symbol G is used and USAGE DISPLAY-1 is specified. A DBCS data type when picture clause symbol N is used. USAGE DISPLAY-1 is assumed and does not need to be specified. Depending on the precision of the column, this is a 2-byte, 4-byte, or 8-byte native binary integer.
NATIVE BINARY
When a fixed-width flat file column of one of these data types is defined as nullable, two fields are written to the file: A one-byte null indicator The column value When the indicator has a value of 1, the column value is null and any value in the next field (i.e., the column value) is ignored. When the indicator has a value of 0, the column is not null and its value is in the next field. Table C-6 describes the native data types that Ascential DataStage Enterprise MVS Edition supports for writing data to delimited flat files. Table C-6 Delimited Flat File Target Stage Native Types
Native Data Type Description
CHAR DECIMAL A string of characters with blank characters trimmed from the right. A value in this format: a minus sign if the value is negative, a string of decimal digits, and, if the scale of the number is nonzero, then a decimal point followed by a string of digits. A minus sign if the value is negative, followed by a string of decimal digits. A string of DBCS characters. A variable-length string of DBCS characters. The same format as an INT value. The same format as a CHAR value.
C-8
Target Stages
Table C-7 describes the native data types that Ascential DataStage Enterprise MVS Edition supports for writing data to a DB2 load-ready flat file. Table C-7 DB2 Load Ready Flat File Stage Native Types
Native Data Type
CHARACTER DATE EXTERNAL DECIMAL PACKED DECIMAL ZONED GRAPHIC INTEGER NUMERIC SMALLINT TIME EXTERNAL
Description
A string of characters. A date consistent with the default date format. A packed decimal number. A display numeric number. A string of DBCS characters. A 4-byte binary integer. A synonym of DECIMAL. A 2-byte binary integer. A time of the format HH.MM.SS.
TIMESTAMP EXTERNAL A timestamp of the format CCYY-MM-DDHH.MM.SS.NNNNNN. VARCHAR A 2-byte binary integer containing the length of the string, followed by a string of characters of the same length. Variable-length graphic string. This is a sequence of DBCS characters. The length control field indicates the maximum number of DBCS characters, not bytes.
VARGRAPHIC
Table C-8 describes the native data types that Ascential DataStage Enterprise MVS Edition supports for inserting and updating columns of DB2 tables. Table C-8 Relational Target Stage Native Types
Native Data Type Description
CHARACTER DATE DECIMAL GRAPHIC INTEGER NUMERIC SMALLINT TIME A string of characters. A date consistent with the default date format. A packed decimal number. A string of DBCS characters. A 4-byte binary integer. A synonym of DECIMAL. A 2-byte binary integer. A time in DB2 format: HH.MM.SS.
C-9
Target Stages
Table C-9 describes the native data types that Ascential DataStage Enterprise MVS Edition supports for writing data to a Teradata file. Table C-9 Teradata Target Stage Native Types
Native Data Type Description
BYTEINT CHARACTER DATE DECIMAL GRAPHIC INTEGER NUMERIC SMALLINT TIME TIMESTAMP VARCHAR VARGRAPHIC A 1-byte binary integer. A string of characters. A date consistent with the default date format. A packed decimal number. A string of DBCS characters. A 4-byte binary integer. A synonym of DECIMAL. A 2-byte binary integer. A time in Teradata format: HH:MM:SS.NNNNNN. A timestamp in Teradata format: CCYY-MM-DD HH:MM:SS.NNNNNN. A variable-length string of characters. A variable-length string of DBCS characters.
C-10
Storage Lengths
Storage Lengths
Table C-10 through Table C-12 describe the SQL type conversion, precision, scale, and storage length for COBOL native data types, DB2 native data types, and Teradata native data types. Table C-10 COBOL Native Types
Native Data Type
BINARY
SQL Type
SmallInt Integer Decimal Char Decimal Decimal
Precision (p)
1 to 4 5 to 9 10 to 18 n p+s p+s
Scale (s)
n/a n/a n/a n/a s s
8
CHARACTER DECIMAL DISPLAY_ NUMERIC FLOAT (single) 4 (double) 8 GRAPHIC_G GRAPHIC_N GROUP n*2 n*2 n (sum of all the column lengths that make up the group) 2 4 8 n+2 (n*2)+2 (n*2)+2 n (p+s)/2+1 p+s
NATIVE BINARY
PIC S9 to S9(4) COMP-5 SmallInt PIC S9(5) to S9(9) COMP-5 Integer PIC S9(10) to S9(18) COMP-5 Decimal PIC S9(4) COMP PIC X(n) PIC S9(4) COMP PIC G(n) DISPLAY-1 PIC S9(4) COMP PIC N(n) VarChar
1 to 4 5 to 9 10 to 18 n+2
1 The COBOL PICTURE clauses shown in the table are for signed numbers, however, unsigned numbers are handled in a similar manner.
C-11
Storage Lengths
SQL Type
Char Date Decimal NChar Integer Decimal SmallInt Time
Precision (p)
n 10 p+s n 9 p+s 2 8
Scale (s)
n/a n/a s n/a n/a s n/a n/a n/a n/a n/a
1 This is used only when DB2 table definitions are loaded into a flat file stage.
SQL Type
Integer Char Date Decimal Decimal NChar Integer SmallInt Time
Precision (p)
3 n 10 p+s p+s (default 18) n 9 2 8
Scale (s)
n/a n/a n/a s
C-12
SQL Type
NVarChar
Precision (p)
n+2
Scale (s)
n/a
1 This is used only when Teradata table definitions are loaded into a flat file stage.
C-13
In all cases, the COBOL code generator may adjust the result size if the calculated precision exceeds the maximum size supported by the COBOL compiler. In other words, if the result precision (Pn) is greater than the maximum decimal size defined for the project, any intermediate resultant variable will be defined as a double-precision float (COMP-2 in COBOL terms) instead of packed decimal (COMP-3 in COBOL terms) of the calculated precison (Pn) and scale (Sn). Doubleprecision float is imprecise, so there may be a loss of digit precision. Another, more complicated, example provides further explanation: Final = ((D1 + D2) * (D3 / D4)) * D5 where D1 is DECIMAL(5,1) D2 is DECIMAL(5,3) D3 is DECIMAL(5,1) D4 is DECIMAL(5,3) D5 is DECIMAL(6,4) Result1 = D1 + D2 Result1 scale = MAX(S1, S2) = 3 Result1 precision = MAX(M1, M2) + Result1 scale + 1 bit = 8 Result1 is DECIMAL(8,3) Result2 = D3 / D4 Result2 scale = S3 + M4 = 3 Result2 precision = P3 + P4 = 10 Result2 is DECIMAL(10,3) Result3 = Result1 * Result2 Result3 scale = Result1 scale + Result2 scale = 6 Result3 precision = Result1 precision + Result2 precision = 18 Result3 is DECIMAL(18,6) Result4 = Result3 * D5 Result4 scale = Result3 scale + S5 = 10 Result4 precision Result3 precision + P5 = 24 If COBOL compiler maximum decimal support is 18, then Result4 is a double-precision float.
C-14
If COBOL compiler maximum decimal support is 31, the Result4 is DECIMAL(24,10). Result4 will be stored in Final (the target variable). If Final is not large enough to accomodate the value of Result4, a warning message is issued and COBOL truncates the data value.
C-15
C-16
D
Editing Column Meta Data
This appendix describes how to enter and edit column meta data in mainframe jobs. Additional information on loading and editing column definitions is in Ascential DataStage Manager Guide and Ascential DataStage Designer Guide.
in Complex Flat File, Fixed-Width Flat File, Delimited Flat File, and DB2 Load Ready Flat File stages, on the Columns tab on the Stage page in Multi-Format Flat File stages, on the Records tab on the Stage page in Relational, Teradata Relational, and Teradata Export source stages, on the Columns tab on the Outputs page (only if you have modified the SQL statement)
D-1
in Relational, Teradata Relational, and Teradata Load target stages, on the Columns tab on the Inputs page in Business Rule, Link Collector, Join, Lookup, Aggregator, Sort, and External Routine stages, on the Columns tab on the Outputs page in Transformer stages, in the output link meta data area
All of these areas have a grid with fields for each of the column attributes. You can enter or edit meta data directly in the grid by double-clicking a cell, or you can use the Edit Column Meta Data dialog box, which is described on page D-4.
Select the group of columns for the propagation, with the last column selected being the desired source column. Press the Ctrl or Shift key while making your selections. Be sure that the source column attributes are correct before proceeding, as they cannot be changed in the next step. Right-click on the source column and select Propagate valuesfrom the shortcut menu. The Propagate column values dialog box appears, displaying the attributes of the source column:
D-2
3 4
Select the check box next to each attribute you want to propagate to the target group of columns. Click OK.
Before propagating the selected values, Ascential DataStage validates that the target column attributes are compatible with the changes. Table D-1 describes the propagation rules for each column attribute: Table D-1 Column Value Propagation Rules
Attribute
Data type
Propagation Rules
If the data type is changed from character to numeric, Ascential DataStage Enterprise MVS Edition maintains the precision and date mask of the target column. If the precision of the source column exceeds the maximum limit for the target column, the target is set to the maximum. If the source column has a character date mask and the target is numeric, propagation does not occur. If the source column is character and the target column is numeric, and the length of the source exceeds the maximum for the target, then the length of the target is set to the maximum. If the source column is decimal and the target is integer, and the length of the decimal exceeds the maximum for the integer, then the length of the target is set to the maximum. Both the source and target columns must be numeric for propagation to occur. The scale of the target column cannot exceed its length. No restrictions. No restrictions. Propagation is subject to the COBOL file definition. The source and target columns must both be character or both be numeric for propagation to occur. If the length of the target column is not 10, it is set to 10. Propagation is dependent on COBOL rules. Propagation is dependent on COBOL rules. Propagation is dependent on COBOL rules. Propagation is dependent on COBOL rules.
Length
Scale
During validation, a message is displayed for any columns that do not meet validation requirements; these columns are left unchanged. For columns that pass validation, propagation occurs and a message confirms that the changes were successfully applied.
D-3
There are different versions of this dialog box, depending on the type of mainframe stage you are editing. The top half of the dialog box contains fields that are common to all data sources, except where noted: Column name. The name of the column. This field is mandatory. Key. Indicates if the input column is a record key. This field applies only to Complex Flat File stages. Native type. The native data type. For details about the native data types supported in mainframe source and target stages, see Appendix C, "Native Data Types." Length. The length or data precision of the column. Scale. The data scale factor if the column is numeric. This defines the number of decimal places. Nullable. Specifies whether the column can contain a null value. Date format. The date format for the column. Description. A text description of the column.
D-4
The bottom half of this dialog box has a COBOL tab containing fields specific to certain mainframe data sources. Depending on the stage you are editing and the information specified at the top of the Edit Column Meta Data dialog box, the COBOL tab displays some or all of the following fields: Level number. Type the COBOL level number where the data is defined. The default value is 05. Occurs. Type the number of the COBOL OCCURS clause. Usage. Select the COBOL USAGE clause from the drop-down list. This specifies which COBOL format the column will be read in. These formats map to the formats in the Native type field, and changing one will normally change the other. Possible values are:
COMP Used with BINARY native types. . COMP-1. Used with single-precision FLOAT native types. COMP-2. Used with double-precision FLOAT native types. COMP-3. Packed decimal, used with DECIMAL native types. COMP-5. Used with NATIVE BINARY native types. DISPLAY. Zoned decimal, used with DISPLAY_NUMERIC or CHARACTER native types. DISPLAY-1. Double-byte zoned decimal, used with GRAPHIC_G or GRAPHIC_N.
Sign indicator. Select Signed or blank from the drop-down list to specify whether the argument can be signed or not. The default is Signed for numeric data types and blank for all other types. Sign option. If the argument is signed, select the location of the sign in the data from the drop-down list. Choose from the following:
LEADING. The sign is the first byte of storage. TRAILING. The sign is the last byte of storage. LEADING SEPARATE. The sign is in a separate byte that has been added to the beginning of storage. TRAILING SEPARATE. The sign is in a separate byte that has been added to the end of storage.
Selecting either LEADING SEPARATE or TRAILING SEPARATE will increase the storage length of the column by one byte. Sync indicator. Select SYNC or blank from the drop-down list to indicate whether the argument is a COBOL-SYNCHRONIZED clause or not. The default is blank.
D-5
Redefined field. Optionally specify a COBOL REDEFINES clause. This allows you to describe data in the same storage area using a different data description. The redefining argument must be the same length, or smaller, than the argument it redefines. Both arguments must have the same level number, and an argument can only redefine the immediately preceding argument with that level. Depending on. Optionally specify a COBOL OCCURS DEPENDING ON clause from the drop-down list. Storage length. Gives the storage length in bytes of the argument as defined. This field is derived and cannot be edited. Picture. Gives the COBOL PICTURE clause, which is derived from the argument definition and cannot be edited. The buttons at the bottom of the Edit Column Meta Data dialog box allow you to continue adding or editing columns, or to save and close. The buttons are: < Previous and Next >. Displays the meta data in the previous or next row. These buttons are available only when a previous or next row exists. If there are outstanding changes to the current row, you are asked whether you want to save them before moving on. Close. Closes the Edit Column Meta Data dialog box. If you have any unsaved changes, you are prompted to save them. Apply. Saves changes to the current row. Reset. Removes all changes made to the row since the last time you applied changes. Help. Starts the Help system. In the Designer, click OK to save the columns definitions before closing the stage editor. You can also click Save As on the Columns tab to save columns as a table definition in the Repository, a CFD file, or a DCLGen file. In the Manager or the Designer Repository window, click OK in the Table Definition dialog box to save the column definitions before closing.
D-6
E
JCL Templates
Job control language (JCL) provides instructions for executing a job on the mainframe. JCL divides a job into one or more steps. Each step identifies: The program to be executed The libraries containing the program The files required by the program and their attributes Any inline input required by the program Conditions for performing a step Ascential DataStage Enterprise MVS Edition comes with a set of JCL templates that you customize to produce the JCL specific to your job. The templates are used to generate compile and run JCL. This appendix describes these JCL templates and explains how to customize them.
E-1
JCL Templates
Description
Creates a new, empty file. Deletes a possible nonexistent file. Deletes an existing file. Non-database compile and link edit. Basic statements needed to run a Connect:Direct file exchange step. The default version of this template is designed for UNIX platforms, but it can be customized for other platforms using JCL extension variables.
DB2CompileLinkBind1 Database compile, link edit, and bind. DB2IMSRun DB2Load DB2Run DeleteFile FTP IMSRun Jobcard NewFile OldFile OMXfr PreSort Run Sort TDCompileLink1 TDFastExport TDFastLoad TDMultiLoad TDRun TDTPump Basic statements needed to run both a database step and an IMS program. Database load utility. Basic statements needed to run a database step. Deletes a file using the mainframe utility IDCAMS. Basic statements needed to run an FTP step. Basic statements needed to run an IMS program. Basic job card used at the beginning of every job (compile or execution). Defines a new file. Defines an existing file. JCL statements needed to transfer operational meta data XML file to the MetaStage client machine. Basic statements needed to run an external sort step. Basic statements needed to run the main processing step. Statements necessary for sorting. Teradata compile and link. Teradata FastExport utility. Teradata FastLoad utility. Teradata MultiLoad utility. Teradata run. Teradata TPump utility.
E-2
JCL Templates
1 Ascential DataStage uses the APOST, LIB, NONAME, NODYNAM, and RENT COBOL compiler options when compiling the generated COBOL source. For a complete explanation of each option, refer to the latest edition of IBM COBOL for OS/390 and VM Programming Guide.
Usage
One. One. DB2CompileLinkBind is used for jobs that have at least one DB2 Relational stage, TDCompileLink is used for jobs that have at least one Teradata Relational stage, and CompileLink is used for all other jobs.
Usage
One. One for each target Fixed-Width Flat File, Delimited Flat File, DB2 Load Ready Flat File, or Teradata Export stage, where Normal EOJ handling is set to DELETE. One for each target Fixed-Width Flat File, Delimited Flat File, or DB2 Load Ready Flat File stage, where the Write option is set to Delete and recreate existing file. One for each Complex Flat File stage or Fixed-Width Flat File stage where sort control statements have been specified on the Pre-sort tab. One for each target Fixed-Width Flat File, Delimited Flat File, DB2 Load Ready Flat File, or Teradata Load stage, where Normal EOJ handling is set to DELETE. One for each Teradata Export stage.
DeleteFile
PreSort
AllocateFile
TDFastExport
E-3
JCL Templates
Usage
One. DB2Run is used for jobs that have at least one DB2 Relational stage, IMSRun is used for jobs that have at least one IMS stage, DB2IMSRun is used for jobs that have both DB2 Relational and IMS stages, TDRun is used for jobs that have at least one Teradata Relational stage, and Run is used for all other jobs. One for each target Fixed-Width Flat File, Delimited Flat File, DB2 Load Ready Flat File, or Teradata Load stage, where Normal EOJ handling is not set to DELETE. One for each source Fixed-Width Flat File, Complex Flat File, or Teradata Export stage, and one for each target Fixed-Width Flat File, Delimited Flat File, DB2 Load Ready Flat File, or Teradata Load stage, where Normal EOJ handling is set to DELETE. One for each Sort stage and one for each Aggregator stage where Type is set to Group by. One for each FTP stage, depending on the file exchange method selected. One if operational meta data is being generated. One for each DB2 Load Ready Flat File stage or Teradata Load stage, depending on the load utility selected. One for each target Fixed-Width Flat File, Delimited Flat File, DB2 Load Ready Flat File, or Teradata Load stage, where Normal EOJ handling is set to DELETE.
NewFile
OldFile
There are two ways to view and edit Ascential DataStages JCL templates: Using a standard editing tool such as Microsoft Notepad Using the JCL Templates dialog box in the DataStage Manager
E-4 Mainframe Job Developers Guide
JCL Templates
You can open the JCL Templates dialog box by choosing Tools JCL Templates in the DataStage Manager:
This dialog box contains the following fields and buttons: Platform type. Displays the platform type. Since OS/390 is the only platform currently supported, this field is read-only. Template name. Contains a list of available JCL templates in a drop-down list. See Table E-1 for template descriptions. Short description. Provides a short description of the selected template. Template. Displays the code that the selected template contains. Save. The Save button is made available if you edit the code or if you subsequently reset a modified template to the default code. Click Save to save your changes. Reset. Resets the template code back to that of the master, readonly default template. Close. Closes the JCL Templates dialog box. If you have any unsaved changes, you are prompted to save them. Help. Starts the Help system.
E-5
JCL Templates
modified or deleted within the JCL templates. They are automatically assigned values when you generate code for a mainframe job. Table E-4 JCL Template Variables
Variable
%abnormal
Definition
File handling for abnormal end of job Allocation unit
Specification Level
Fixed-Width Flat File, DB2 Load Ready Flat File, Delimited Flat File stages Fixed-Width Flat File, DB2 Load Ready Flat File, Delimited Flat File stages Project
Specification Location
Designer: Stage|Options| Abnormal EOJ handling Designer: Stage|Options| Allocation type Administrator: Project Properties dialog box| Mainframe|Max. Blocking Factor, Max. Block Size
%allocunit
%blocksize
Block size for new files, calculated based on record size and the constraints defined in the Max. Blocking Factor and Max. Block Size fields Command syntax for various utilities DBRM library used for job upload
%commands
Job
%dblib
Project
%dbpass
DB2 password
Job Properties
Administrator: DataStage Administration window| Projects|Properties| Mainframe|DBMS Password Designer: Stage|Bulk Loader|DB2 sub-system id
%dbsubsys
E-6
JCL Templates
Specification Level
Job Properties
Specification Location
Designer: Job Properties dialog box|Environment| System name
Administrator: DataStage Administration window|Projects| Properties|Mainframe| DBMS System Name Designer: Stage|Bulk Loader|Table name Designer: Stage|Bulk Loader|User name Designer: Job Properties dialog box|Environment|User name
%dbtable
%dbuser
(if not available from above, then this value is used) (if not available from above, then this value is used)
Job Properties
Administrator: DataStage Administration window| Projects|Properties| Mainframe|DBMS User Name Designer: Stage|General|DD name
%ddname
Complex Flat File, Fixed-Width Flat File, DB2 Load Ready Flat File, Delimited Flat File stages DB2Run, DB2IMSRun, Run, or TDRun JCL template
%ddstmts
Data definition statements added to a run JCL template, allowing extra steps to be added to the run JCL
Inserted by the user in the run JCL step that executes the DataStagegenerated COBOL program. This is followed by userspecified JCL which allows other steps to be executed.1
E-7
JCL Templates
Definition
Deletion of an existing file
Specification Level
Fixed-Width Flat File, DB2 Load Ready Flat File, Delimited Flat File stages
Specification Location
Designer: Stage|General|File name (used only when the write option is Delete and recreate existing file) Designer: Stage|Options|UNIT
%deviceunit
Device unit for new files or work datasets Disposition for a file
Fixed-Width Flat File, DB2 Load Ready Flat File, Delimited Flat File stages Complex Flat File, Fixed-Width Flat File, DB2 Load Ready Flat File, Delimited Flat File stages
%disp
Determined by the system. For Complex Flat File and Fixed-Width Flat File source stages, SHR is used. For Fixed-Width Flat File, DB2 Load Ready Flat File, and Delimited Flat File target stages, the value depends on the write option specified: NEW is used when creating new files, OLD is used when overwriting an existing file, MOD is used when appending to an existing file, and REPL is used when deleting and recreating an existing file. Designer: Stage|Options| Expiration date or Stage|File|Expiration date (Teradata Load)
%expdate
Fixed-Width Flat File, DB2 Load Ready Flat File, Delimited Flat File, Teradata Load stages
%extdec
Project
Administrator: DataStage Administration window| Projects|Properties| Mainframe|Support extended decimal. When this field is selected, EXTEND is used, otherwise COMPAT is used.
E-8
JCL Templates
Definition
File to name
Specification Level
Complex Flat File, Fixed-Width Flat File, DB2 Load Ready Flat File, Delimited Flat File stages FTP stage
Specification Location
Designer: Stage|General|File name
%ftpfromfile
%ftphost
FTP stage
%ftpmode
FTP stage
%ftppassword
FTP stage
Designer: Stage|General|Password
%ftpport
FTP stage
Designer: Stage|General|Port
%ftptofile
FTP stage
%ftptype
FTP stage
%ftpuser
FTP user ID
FTP stage
Job
%imsid
IMS stage
Designer: Stage|View|IMS id
%imspsb
IMS stage
Designer: Stage|View|PSB
%jobacctg
Project
E-9
JCL Templates
Definition
DB2 database load utility control statements
Specification Level
DB2 Load Ready Flat File stage
Specification Location
Determined by the system based on column definitions specified in Designer: Stage|Columns
%loadlib
Project
%normal
File handling for normal end of job Object library used for job upload
Fixed-Width Flat File, DB2 Load Ready Flat File, Delimited Flat File stages Project
Designer: Stage|Options|Normal EOJ handling Manager: Machine Profile dialog box|Libraries|Object library
%objlib
%omfile
Job Properties
Designer: Job Properties dialog box|Operational meta data|Dataset name for XML file
%omipaddr
Target machine IP address for operational meta data XML file Target machine password for operational meta data XML file
Job Properties
%ompass
Job Properties
Designer: Job Properties dialog box|Operational meta data|Password Designer: Job Properties dialog box|Operational meta data|XML file target directory Designer: Job Properties dialog box|Operational meta data|User name
%omtarget
Target directory Job Properties for operational meta data XML file
%omuser
Target machine user name for operational meta data XML file
Job Properties
E-10
JCL Templates
Definition
Filename for operational meta data XML file Program name
Specification Level
Job
Specification Location
Determined by the system based on the execution time of the COBOL program Manager: Job Properties dialog box|Advanced|COBOL program name
%pgmname
Job Properties
%presort
Complex Flat File, Fixed-Width Flat File stages Fixed-Width Flat File, DB2 Load Ready Flat File, Delimited Flat File stages Fixed-Width Flat File, DB2 Load Ready Flat File, Delimited Flat File stages
Designer: Stage|Pre-sort| Statement editor Designer: Stage|Options|Primary allocation amount Determined by the system. For Fixed-Width Flat File and DB2 Load Ready Flat File stages, FB is used. For Delimited Flat File stages, VB is used. Determined by the system based on column definitions specified in Designer: Stage|Columns
%primamt
%recfm
%reclen
Fixed-Width Flat File, DB2 Load Ready Flat File, Delimited Flat File stages
%retnperiod
Fixed-Width Flat File, DB2 Load Ready Flat File, Delimited Flat File, Teradata Load stages
%secamt
Fixed-Width Flat File, DB2 Load Ready Flat File, Delimited Flat File stages Sort stages
Sort stages
E-11
JCL Templates
Definition
Sort record length Presort processing Source library used for job upload
Specification Level
Sort stages Complex Flat File, Fixed-Width Flat File stages Project
Specification Location
Determined by the system Determined by the system Manager: Machine Profile dialog box|Libraries|Source library2
%srclib
%tblowner
Designer: Stage|Bulk Loader|Table owner Designer: Job Properties dialog box|Environment| Teradata Password
%tdpass
Teradata password
Job Properties
(if not specified here, then the above value is used) %tdtdp Teradata database identifier (if not specified here, then the above value is used) %tduser Teradata user id
Job Properties
Job Properties
(if not specified here, then the above value is used) %volser Volume serial name
Fixed-Width Flat File, DB2 Load Ready Flat File, Delimited Flat File stages
E-12
JCL Templates
Definition
Dynamically called external routine name
Specification Level
Project
Specification Location
Manager: Mainframe Routine dialog box|General| Routine name Manager: Mainframe Routine dialog box| General| External subroutine name Manager: Mainframe Routine dialog box| General| Library path Manager: Mainframe Routine dialog box| General| Routine name
%xtrnincs
Statically called Project external routine INCLUDE statements for linkage editor External routine library name Project
%xtrnlibrary
%xtrnname
1 This variable cannot be used within a %.if ... %.endif block. The userspecified JCL inserted after the variable can include stage or JCL extension variables. 2 This variable cannot be used in conjunction with JCL extension variables.
E-13
JCL Templates
on the JCL tab of the External Source and External Target stage editors JCL extension variables cannot be used in machine profiles or during job upload. They also cannot be used in conjunction with the variable %srclib in the JCL templates.
Names of JCL extension variables can be any length, must begin with an alphabetic character, and can contain only alphabetic or numeric characters. They can also be mixed upper and lower case, however, the name specified in job properties must exactly match the name used in the locations discussed on page E-13. In the example shown above, the variable qualid represents the owner of the object and load libraries, and rtlver represents the runtime library version. These variables are then inserted in the SYSLIB, SYSLIN, SYSLMOD, and OBJLIB lines of the CompileLink JCL template, as shown on the next page.
E-14
JCL Templates
You must prefix the variable name with %+. Notice that two periods (..) separate the extension variables from the other JCL variables. This is required for proper JCL generation. When JCL is generated for the job, all occurrences of the variable %+qualid will be replaced with KVJ1, and all occurrences of the variable %+rtlver will be replaced by COBOLGEN.V100. The other JCL variables in the SYSLIN, SYSLMOD, and OBJLIB lines are replaced by the values specified in the Machine Profiles dialog box during job upload.
In this case, +varname is formatted as +varname rather than %+varname. Do not use the % in these names; use only the +. The names must begin with an alphabetic character and can contain only
E-15
JCL Templates
alphabetic or numeric characters. They can also be mixed upper and lower case. Each %. conditional construct must start in column 1 of the JCL template being modified. You can use more than one conditional statement in a single JCL template, however, you cannot have multiple levels, or nested conditional statements. When an operator and a value are included in the %.if construct, one or more spaces are allowed before, between, and after each element. The operator can be = or <>. The format of the value can be: string_value or %+string_ext_var. If +varname has a non-blank, non-null value assigned on the Extensions page of the Job Properties dialog box, the test is true and the statements following %.if and preceding %.else will be generated during JCL generation. Otherwise the statements following %.else will be generated during JCL generation. As an example, you can use this capability to determine whether to use a production or test data set in a job. The JCL statements could be:
%.if +qual //%ddname DD DISP=%disp,DSN=%+qual..%filename %.else //%ddname DD DISP=%disp,DSN=PROD.%filename %.endif
If the extension variable qual has the value TEST specified on the Extensions page of the Job Properties dialog box, and the filename from the stage is CUSTOMER.DATA, the DSN that will be generated is TEST.CUSTOMER.DATA. If qual has no value, the DSN will be PROD.CUSTOMER.DATA.
E-16
JCL Templates
Ascential DataStage will then remove the second occurrence of % in each place that it appears.
E-17
JCL Templates
E-18
F
Operational Meta Data
This appendix describes how to generate and use operational meta data in mainframe jobs. If you have installed Ascential MetaStage, you can investigate this meta data to better understand the data and processes involved in your data warehouse.
F-1
Note that DataStage mainframe jobs undergo optimization. The operational meta data may not have one-to-one correspondence with the job design.
Open the Administrator and click the Projects page of the DataStage Administration window. Select the project and click the Properties button. (If you are starting a new project, click Add to specify the name and location of the project, then click Properties.) Click Mainframe to bring this page to the front of the Project Properties window. Select the Generate operational meta data check box.
3 4
F-2
Click OK to save your changes, then click Close to exit the DataStage Administrator.
Operational meta data will be captured for all new jobs in your project unless you change the setting at the job level.
Open a job in the Designer and do one of the following: Choose Edit Job Properties. Click the Job Properties button on the toolbar. The Job Properties dialog box appears with the General page displayed.
F-3
Click OK.
Whenever you create a new job, the operational meta data setting in the Job Properties dialog box defaults to the project-level setting.
Open the Job Properties dialog box and click Operational meta data to move this page to the front. Enter machine connection details as follows:
a
Machine profile. Type a name that identifies the MetaStage machine or select an existing machine profile from the dropdown box. If you load an existing machine profile, the rest of the fields on this page are automatically filled in. IP address. Type the IP address of the MetaStage machine. File exchange method. Select FTP or Connect Direct. User name. Type the user name for logging in to the MetaStage machine. Password. Type the password associated with the user name for MetaStage machine login.
b c d e
F-4
XML file target directory. Type the name of the target directory, relative to the default FTP directory, where the XML file should be placed. Specify the name in the appropriate DOS mode, including any slash marks required. If the directory name contains blanks, enclose the full name in single quotes. If you leave this field blank, the XML file will be placed in the default FTP directory on the MetaStage machine.
Dataset name for XML file. Type the dataset name for the XML file on the mainframe machine. Be sure to create this file on the mainframe prior to running the COBOL program. If you want the system to generate a unique dataset name each time a job runs, add (+1) after the name you specify. See "Using GDG to Generate Unique Dataset Names" on page F-6 for more information.
When you are finished, the Operational meta data page should look similar to this:
During code generation, the XML file is generated on the mainframe as a dataset. The XML filename is determined by the system based on the date and time of COBOL program execution, such as 20030304133249-0.xml. You must enable FTP and the default FTP directory on the MetaStage machine before the XML file can be transferred to it. After the transfer is complete, you import the XML file into the MetaStage repository.
F-5
Operational meta data will still be collected during code generation, but will not be written to the XML file. When you are ready to create the XML file, change the value of GENXMLFILE to YES. The operational meta data is then written to the XML file and transferred to the MetaStage machine.
Add (+1) to the dataset name you specify for the XML file on the Operational meta data page in job properties or on the Connection page of the Machine Profile dialog box. For example:
USERID.XML.OUT(+1)
Use IDCAMS to define the GDG base entry on the mainframe. For example:
USERID.XML.OUT
Locate the file runimport.cfd in the RunImport folder of your Ascential MetaStage installation (for example, C:\Program Files\ Ascential\MetaStage\RunImport\runimport.cfg). Open runimport.cfg in a text editor and specify values for the following variables in the file:
a
MetaStageDirectory. Type the name of the MetaStage directory you want to import the operational meta data into (for example, MetaStageDirectory=DS390Jobs.) The Run Importer imports to only one directory at a time. Change this entry whenever you need to import meta data to a different directory. There is no default. User. Type the user name required to access the directory, or leave blank if there is none (for example, User=Admin or User= ). Password. Type the password required to access the directory or leave blank if there is none (for example, EncryptedPassword=Admin or EncryptedPassword= ).
Save and close runimport.cfg. From the command line of the MetaStage machine, go to the directory where the Run Importer is installed. The default location is C:\Program Files\Ascential\Metastage\Runimport>. Type a command that invokes runimport.exe and provides the necessary paths to the configuration file and the XML files. For example:
runimport.exe -config C:\Program Files\Ascential\ MetaStage\RunImport\runimport.cfg C:\XMLRunFiles\*.xml
This specifies that C:\Program Files\Ascential\MetaStage\ Runimport\runimport.cfg is the path to the configuration file and C:\XMLRunFiles\*.xml is the path to the XML files. If you did not specify a target directory for the XML files in job properties, use the default FTP directory on the MetaStage machine. To import a single XML file, specify the actual XML filename such as C:\XMLRunFiles\20030304-133249-0.xml. For detailed instructions on importing operational meta data, see the chapter Capturing Operational Meta Data in Ascential MetaStage Users Guide.
F-7
Understanding Events
To use MetaStages analysis tools, you first need to understand how Ascential MetaStage views data warehousing events. When a DataStage job runs, its software components (such as a stage or a link) emit events when they run. The operational meta data XML file describes the sequence of events that were created during the job run. Each event identifies an action that occurred on physical data, such as database tables or flat files, or on program elements that process data. There are four types of events: Read. Describes a data source read. Includes start and finish times, number of records read, and the output link name. For flat file sources, it also includes the mainframe dataset names. For relational sources, it includes the SQL SELECT statement. For External Source stages, it includes the name of the external source routine. If stage columns are created by loading multiple tables in flat file stages, then multiple Read events (one for each loaded table) are generated. Similarly, if the output columns in a Relational source stage are generated from multiple tables, multiple Read events (one for each table) are generated for the link. In addition, if there are multiple output links from a source stage, multiple Read events are generated. Note that link names are generated as part of the Read event and do not match the actual link names in the job. Write. Describes a write to a data target. Includes start and finish times, number of records written, and the input link name. For flat file targets, it also includes the mainframe dataset names. For
F-8
relational sources, it includes the table name and the INSERT statement. For External Target stages, it includes the name of the external target routine. If flat file stage columns are built by loading multiple tables, then multiple Write events (one for each loaded table) are generated. If there are multiple input links to a target stage, multiple Write events are generated. Note that link names are generated as part of the Write event and do not match the actual link names in the job. Reference. Describes a reference to a lookup table. Includes the start and finish times, row count, mainframe system information, and link name. Fail. Describes the failure of a software component. Read and Write events contain two resource locators, or paths that identify objects stored in a MetaStage directory. The software resource locator refers to the link which carries rows out of a stage. It includes the names of the computer, software product, project, job, stage, and link. The data resource locator represents the mainframe dataset name or the logical table name used by the stage. It includes table locator information such as the computer name, software product name, data schema, table category, and table name. If you push columns from one stage to another, or if you cut, copy, and paste columns or stages from one job to another, there may be duplicate table locator information in the XML file. To avoid this, be sure to save these columns as a separate table definition in the Repository whenever you use the push, cut, copy, and paste functions. No events are generated for mainframe processing stages. However, a Read event connects the stages input link to its output link. For Link Collector stages, a Read event is generated for each of the input links to the stage. For Lookup stages, a Read event is generated for the primary link and a Reference event is generated for the reference link. For Join stages, Read events are generated for both the inner and outer links to the stage. For Complex Flat File stages, the number of rows read from the file and the number of rows going out on the output link may not match if arrays are normalized. For Aggregator stages, the number of rows on the stages input and output links may differ due to the aggregation operation itself. Besides events, the operational meta data also includes design, deployment, and run components. The design component provides system information for the DataStage client, the project name, the job name, and the names and values of any job parameters. The
Mainframe Job Developers Guide F-9
deployment component describes the deployment of a software component, including mainframe system information, the project name, and the job name. The run component describes the DataStage job run, including the job start and finish times, the job name, the COBOL program name, and the job status. The status code is 0 if the job runs successfully, 1 if the job run fails with an exit condition, or 2 if the job runs with warnings.
Process Analysis
Process Analysis lets you examine the execution history of warehouse activity processes, such as DataStage job runs. You can discover details about when jobs run, what parameters they use, and whether or not they are successful. Process Analysis focuses on the path between job designs and the events they generate. There are two types of Process Analysis paths: Find Runs. These paths start with a specified software executable and continue through sets of events to the resources touched. A job design is a software executable. Find Executables. These paths start from a specified event or activity (a run or component run) and continue to the software executable from which it originated. The following simple mainframe job demonstrates the results of Process Analysis. This job reads data from a flat file, transforms it, and writes it to another flat file. In the Designer, the job looks similar to this:
The source stage filename is XQA1.CUSTOMERS.FWFF The target . stage filename is XQA6.ACTCUST. The operational meta data XML file name is 20030304-133249-0.xml.
F-10
For this job, a Find Executables Process Analysis produces these results:
The leftmost icon shows the instance of the job run. There are three items connected to this run: a software executable (the COBOL program) and two component runs (the source file read and the target file write). The lines between notes in a path represent relationships between objects and events. The text label on each line specifies the name of an object, or the date and time an event occurred. The following flow of data is represented in the diagram: Design. The design flow. From left to right, this path includes the following objects: The program run The COBOL program filename The project name The software product The computer on which the job was designed
F-11
Deployment. The deployment of the software executable. From left to right, this path includes: The program run The project name The software product The mainframe where the COBOL program ran Read. The source file read. There are two paths from the component run: One to the source stage output link (DSLink1000), which corresponds to the CustomersOut link in the job design. One to the Read event. This touches the data collection resource called XQA1.CUSTOMER. FWFF , which is the filename specified in the Customers source stage. Write. The write to the target file.There are three paths from the component run: One to the target stage input link (DSLink1001), which corresponds to TransformOut link in the job design. One to the Write event. This touches the data collection resource called XQA6.ACTCUST, which is the filename specified in the Active-Customers target stage. One to the Read event. This touches the Transformer stage input link (DSLink1000), which corresponds to the CustomersOut link in the job design.
Data Lineage
Data Lineage describes the history of an item of data, such as where it comes from, when it was last modified, and its status. It focuses on source tables in a warehouse job and the events and steps that connect it to a target table.
F-12
For the sample mainframe job, a Data Lineage path produces these results:
From left to right, this represents the data flow from source to target. It shows that 90 records were read from the source file, XQA1.CUSTOMER.FWFF and were written to the output link , DSLink1000, which corresponds to the CustomersOut link in the job design. The 90 records were then sent down another link, DSLink1001, which corresponds to the TransformOut link in the job design. Notice that although the Transformer stage is not represented in this diagram, its input and output links are included in the data flow. The 90 records were then written to the target file, XQA6.ACTCUST.
Impact Analysis
Impact Analysis helps you identify the impact of making a change to a data warehouse object. It shows the relationships between objects and their dependencies. For example, data resource locators relate the tables used in job designs to the tables stored in the DataStage Repository. There are two types of Impact Analysis paths: Depends On. Displays the object the path was created from, all the objects it depends on or contains, all the objects connected to any objects in this path, and all the relationships between objects. Where Used. Displays the object the path was created from, all the objects that depend on or contain it, all the objects connected to any objects in this path, and all the relationships between objects.
F-13
Following is an example of a Where Used Impact Analysis path for the XQA1.CUSTOMER.FWFF source file in the mainframe job:
This shows that the data collection XQA1.CUSTOMER.FWFF is contained by a file (/XQA1.CUSTOMER.FWFF) that is hosted by a computer (INTEGRAL). The second path shows that this data collection is touched by a Read event (2003-03-04 05:18:36), which was emitted by an activity (a component run, 2003-03-04 05:18:36), which was produced by the program run on the mainframe (2003-03-04 05:18:36).
F-14
G
Run-time Library
This appendix describes the Ascential DataStage run-time library (RTL) for mainframe jobs. The RTL contains routines that are used during mainframe job execution. Depending on your job design, the COBOL program for the job may invoke one or more of these routines. RTL routines are used to sort data, create hash tables, create DB2 load-ready files, create delimited flat files, and run utilities. The RTL is installed during DataStage server installation. It must be installed on the execution platform before jobs are link edited. Make sure you have completed RTL setup by following the instructions during installation.
Sort Routines
Table G-1 describes the functions that are called to initialize and open a sort so that records can be inserted. These functions are called once. Table G-1 Start Sort Functions
Function
DSSRINI DSSROPI
Description
Initialization. Open for inserting records into the sort.
G-1
Sort Routines
Run-time Library
Table G-2 describes the functions that are called for each record inserted into a sort. Table G-2 Record Insert Functions
Function
DSSRSWB DSBFWKA DSBFWKD DSSRWKF DSBFWDT DSSRINS
Description
Set write (insert) buffer. Write key ascending. This is called for each ascending key field. Write key descending. This is called for each descending key field. Write key finish. This is called after all key fields have been processed. Write data. This is called for each data (nonkey) field. Insert record into sort.
Table G-3 describes the functions that are called after all records have been inserted into a sort. Table G-3 Sort Execution Functions
Function
DSSROPF DSSRSRB
Description
Invoke sort. This launches the actual sorting and then opens it for fetching. Set read (fetch) buffer.
Table G-4 describes the functions that are called for each record fetched from a sort. Table G-4 Record Fetching Functions
Function
DSSRGET DSBFRKA DSBFRKD DSSRRKF DSBFRDT
Description
Get (fetch) record from sort. Read key ascending. This is called for each ascending key field. Read key descending. This is called for each descending key field. Read key finish. This is called after all key fields have been processed. Read data. This is called for each nonkey field.
G-2
Run-time Library
Hash Routines
Table G-5 describes the function that is called to close a sort. Table G-5 Close Sort Function
Function
DSSRCLS
Description
Close.
Hash Routines
Table G-6 describes the function that is called to initialize a hash table. This function is called once for each hash table. Table G-6 Hash Table Initialization Function
Function
DSHSINI
Description
Initialization.
Table G-7 describes the functions that are called to insert records into a hash table. These functions are called once for each record. Table G-7 Record Insert Functions
Function
DSHSGEN DSHSNEW DSHSSET
Description
Compute a hash value based on the right hash key. These functions work together to add a new record to a hash table.
Table G-8 describes the functions that are called to retrieve a record from a hash table. Table G-8 Retrieve Record Functions
Function
DSHSRST DSHSGNL DSHSGET
Description
Reset so that the first matching hash record is retrieved by DSHSGET. Generate a hash value based on the left hash key. Get the next hash record (or the first record if DSHSRST was called).
G-3
Hash Routines
Run-time Library
Table G-9 describes the functions that are called to perform a full join using a hash table. Table G-9 Full Join Functions
Function
DSHSNXMT DSHSNOMH
Description
Get the next unhashed record from the hash table. Make the record unhashed in the hash table.
Table G-10 describes the function that is called to close a hash table. Table G-10 Close Hash Table Function
Function
DSHSCLN
Description
Clean up the hash table.
Click the View button in the Code generation dialog box and select Cobol program file. Look for a call to the DSHSINI RTL function. There are two arguments to this call:
a
The first argument is the hash control structure and is at an 01 level. It describes the hash keys. The structure has a name such as HASHn or HJn where n is an integer. The second argument describes the non-key data being hashed and is also at an 01 level. The name of this structure may be HJn-INFO, HASHTBLn, or a DD name.
Find the initialization code for the first argument by searching the COBOL program for statements that move values to the RKEYLENGTH field of the first argument. Then perform the following computation:
a b
Add the RKEYLENGTH values for all of the hash key fields. Multiply the number of hash key fields by 2 (which represents two bytes of overhead for each fields length and null indicator). Add the results of steps a and b to get a total.
G-4
Run-time Library
Next locate the initialization code for the second argument by searching for statements that move values to the OUTLENGTH field of the second argument. Then perform the following computation:
a b c
Add the OUTLENGTH values for all of the fields. Multiply the number of fields by 2. Add the results of steps a and b to get a total.
5 6 7
Add the results of steps 3 and 4, plus 21. This is the amount of space required for each hashed row. Multiply the result of step 5 by the number of rows being hashed. Add 4 KB to the total. (This represents the space required for the hash table itself, regardless of the number of rows.)
The result is the space required for the hash table. Repeat these calculations for each hash table in your job.
Description
Open the file for reading. Open the file for writing. Read a record, parse the record based on the delimiter information, and perform data type conversions. Write a record. Close the file.
G-5
Utility Routines
Run-time Library
Utility Routines
Table G-12 describes the functions that are called to perform certain utilities. Table G-12 Utility Functions
Function
DSINIT DSHEXVAL DSUTDAT DSUTPAR DSUTPOS DSUTSBS DSUTADR DSUTNUL
Description
Initialize the run-time library. Return the hexadecimal value of a variable. Dump a record or variable in hexadecimal and EBCDIC format. Return the indented COBOL paragraph name. POSITION function. SUBSTRING function. Return the address of a variable. Set null indicator(s) and set value to space or zero.
Description
Convert a character string to a small integer. Convert a character string to an integer. Convert a character string to a packed decimal number. Convert a character string to a date. Convert a character string to a time. Convert a character string to a timestamp. Convert a small integer to a character string. Convert an integer to a character string. Convert a decimal to a character string. Convert a character string to a date in USA date format. Convert a character string to a date in European date format.
G-6
Run-time Library
Description
Convert a binary integer to a character string. Convert a long integer to a character string.
Description
Read GENXMLFILE parameter from JCL to create the operational meta data XML file. Write operational meta data to the XML file.
G-7
Run-time Library
G-8
H
Reserved Words
This appendix lists COBOL and SQL reserved words. SQL reserved words cannot be used in the names of stages, links, tables, columns, stage variables, or job parameters.
BOTTOM BY
H-1
Reserved Words
ENDING ENTER ENTRY ENVIRONMENT EOP EQUAL ERROR ESI EVALUATE EVERY EXCEPTION EXIT EXTEND EXTERNAL FOR FROM FUNCTION
H-2
Reserved Words
H I
J K L
H-3
Reserved Words
VARYING
H-4
Reserved Words
ZEROS
B C
BY
CONCATENATE COND CORRESPONDING COUNT CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP CURSOR DIRECTIVE_ERROR DISTINCT DO DOUBLE DOUBLEGREATETHAN EXPAND EXTRACT
F G H
FULL
GROUP_BY HOUR
H-5
Reserved Words
J L
MONTH
NULL NUMERIC
P R S
U V W X Y
H-6
Index
A
aggregating data aggregation functions 206 in Aggregator stages 205 types of aggregation control break 204 group by 204 Aggregator stages aggregation column meta data 206 aggregation functions 206 control break aggregation 204 editing 201 group by aggregation 204 input data to 202 Inputs page 202 mapping data 207 output data from 203 Outputs page 204 specifying aggregation criteria 205 Stage page 202 arguments, routine 134, 144, 224 arrays flattening 36, 46, 54, 1313 normalizing 36, 46, 1313 OCCURS DEPENDING ON 36, 46, 64, 134, 1313, 144 selecting as output nested normalized columns 315 nested parallel normalized columns 316 parallel normalized columns 315 single normalized columns 314 Ascential Developer Net viii Assembler file definitions, importing 28 auto joins 182 lookups 192
B
batch job compilation 2416 boolean expressions constraints 1518 HAVING clauses 911, 1011, 119 join conditions 187 lookup conditions 194, 196 WHERE clauses 97, 910, 107, 1010, 118, 126 Business Rule stages defining business rule logic 164 defining stage variables 162 editing 161 input data to 169 Inputs page 1610 mapping data 165 output data from 1610 Outputs page 1611 SQL constructs 166 Stage page 162
C
call interface external source routines 1310 external target routines 149 CFDs, importing 22 Char data type definition B1 mappings B4 COBOL compiler options 2411, E3 FDs, importing 22 program filename 242 reserved words H1 code customization 245 Code generation dialog box 242 code generation, see generating code
Index-1
Index
column auto-match facility in Transformer stages 1513 on Mapping tab 189, 1911, 209, 218, 2215 column definitions editing D1 propagating values D2 saving D6 column push option in Aggregator stages 207 in Business Rule stages 166 in Complex Flat File stages 312 in Delimited Flat File stages 710 in External Routine stages 2213 in External Source stages 1315 in Fixed-Width Flat File stages 612 in IMS stages 55 in Join stages 187 in Link Collector stages 175 in Lookup stages 199 in Multi-Format Flat File stages 48 in Sort stages 216 compiler options 2411, E3 compiling multiple jobs 2416 Complex file load option dialog box 36, 46, 1313 Complex Flat File stages array handling 36 create fillers option 35 data access types 32 defining constraints 313 editing 31 end-of-data indicator 32, 52 file view layout 33 output data from 311 Outputs page 312 pre-sorting data 37 selecting normalized array columns as output 314 specifying sort file parameters 310 stage column definitions 33 Stage page 32 start row/end row option 33 Computed Column dialog box 912, 1012, 1110 computed columns in Relational stages 912 in Teradata Export stages 1110 in Teradata Relational stages 1012 conditional lookups 191, 1915
conditional statements, in JCL templates E15 ConnectDirect in FTP stages 232 JCL template E2 constants A2 constraints A2 in Complex Flat File stages 313 in Delimited Flat File stages 711 in External Source stages 1315 in Fixed-Width Flat File stages 613 in IMS stages 56 in Multi-Format Flat File stages 49 in Transformer stages 157, 15181520 control break aggregation 204 conventions documentation vi user interface vii conversion functions, data type A5 create fillers option in Complex Flat File stages 35 in Fixed-Width Flat File stages 65 in Multi-Format Flat File stages 45 creating machine profiles 2412 routine definitions external 222 external source 132 external target 142 cursor lookups definition 191 examples 1914 Customer Care viii Customer Care, telephone viii customizing COBOL code 245 JCL templates E4
D
data type conversion functions A5 data types allowable mappings B2 definitions B1 mapping implementations B3 native in source stages C1 in target stages C7 storage lengths C11 DataStage Batch Job Compilation Wizard 2416 date and time functions A6
Index-2
Index
Date data type definition B2 mappings B11 date mappings B13 DB2 Load Ready Flat File stages editing 81 input data to 88 Inputs page 89 output data from 810 Outputs page 810 specifying DB2 bulk loader parameters 84 delimiter information 85 load data file parameters 86 stage column definitions 83 Stage page 82 write option 82 DBMSCODE variable 1520, A19 DCLGen files, importing 25 decimal arithmetic C13 Decimal data type definition B2 mappings B10 defining business rule logic 164 computed columns 912, 1012, 1110 constraints in Complex Flat File stages 313 in Delimited Flat File stages 711 in External Source stages 1315 in Fixed-Width Flat File stages 613 in IMS stages 56 in Multi-Format Flat File stages 49 in Transformer stages 15181520 expressions A3 JCL extension variables E14 join conditions 186 lookup conditions 195 output column derivations 1512 pre-lookup conditions 193 stage variables in Business Rule stages 162 in Transformer stages 1521 Delimited Flat File stages defining constraints 711 delimiter settings 75 editing 71 end-of-data indicator 72 input data to 78 Inputs page 79 output data from 710
Outputs page 710 specifying stage column definitions 73 target file parameters 77 Stage page 72 start row/end row option 73 write option 73 Designer Diagram window 14 Repository window 14 status bar 14 toolbar 14 Diagram window 14 documentation conventions vi drag and drop in Transformer stages 158 on Mapping tab 189, 1911, 209, 217, 2215
E
Edit Column Meta Data dialog box D4 Edit Routine Argument Meta Data dialog box 135, 145, 225 editing Aggregator stages 201 Business Rule stages 161 column meta data D1 Complex Flat File stages 31 DB2 Load Ready Flat File stages 81 Delimited Flat File stages 71 External Routine stages 228 External Source stages 1310 External Target stages 149 Fixed-Width Flat File stages 61 FTP stages 231 IMS stages 51 job properties 19 Join stages 171, 181 Link Collector stages 171 Lookup stages 191 Multi-Format Flat File stages 41 Relational stages 91 Sort stages 211 Teradata Export stages 111 Teradata Load stages 121 Teradata Relational stages 101 Transformer stages 158 end-of-data indicator in Complex Flat File stages 32, 52 in Delimited Flat File stages 72
Index-3
Index
in External Source stages 1311 in Fixed-Width Flat File stages 62 in IMS stages 52 in Multi-Format Flat File stages 42 in Relational stages 92 in Teradata Relational stages 102 ENDOFDATA variable A19, A20 expiration date, for a new data set in DB2 Load Ready Flat File stages 87, 1211 in Delimited Flat File stages 78 in Fixed-Width Flat File stages 311, 610, 115 in Teradata Load stages 1211 Expression Editor A4, A17 in Business Rule stages 166 in Relational stages 96 in Teradata Load stages 125 in Teradata Relational stages 106 in Transformer stages 15241526 expression grid A4, A17 expressions 1526 definition A3 entering 1524 validating 1525 extension variables, JCL E13 External Routine stages creating routine definitions 222 editing 228 input data to 229 Inputs page 2210 mapping routines 2212 output data from 2211 Outputs page 2211 external routines 221228 copying 227 creating 222 renaming 228 viewing and editing 227 external source routines 1311310 call interface 1310 copying 139 creating 132 renaming 139 viewing and editing 138 External Source stages array handling 1313 creating source routine definition 132 defining constraints 1315 editing 1310 end-of-data indicator 1311
file view layout 1312 output data from 1314 Outputs page 1314 specifying external source routine 1312 Stage page 1311 external target routines 141149 call interface 149 copying 148 creating 142 renaming 148 viewing and editing 147 External Target stages creating target routine definition 142 editing 149 file view layout 1410 input data to 1412 Inputs page 1412 specifying external target routine 1411 Stage page 1410
F
FastExport, Teradata 111 FastLoad, Teradata 122 file view layout in Complex Flat File stages 33 in External Source stages 1312 in External Target stages 1410 in Fixed-Width Flat File stages 63 in Table Definition dialog box 219 filler creation, see create fillers option find facility, on Mapping tab 188, 1910, 208, 217, 2214 find/replace facility, in Transformer stages 159 Fixed-Width Flat File stages create fillers option 65 defining constraints 613 editing 61 end-of-data indicator 62 file view layout 63 input data to 610 Inputs page 611 output data from 612 Outputs page 612 pre-sorting data 65 specifying stage column definitions 64 target file parameters 69 Stage page 62 start row/end row option 63 write option 63
Index-4
Index
FTP stages editing 231 file exchange method 232 input data to 234 Inputs page 234 specifying target machine attributes 232 Stage page 232 transfer mode options 233 transfer type options 233 full joins definition 181 example 1813 functions aggregation 206 data type conversion A5 date and time A6 definition A4 logical A7 multi-byte string A13 numerical A9 string A10
I
importing Assembler file definitions 28 COBOL FDs 22 DCLGen files 25 IMS definitions 219 PL/I file definitions 211 Teradata tables 217 IMS Database (DBD) dialog box 224 IMS definitions importing 219 viewing and editing 223 IMS Segment/Associated Table Mapping dialog box 226 IMS stages defining constraints 56 editing 51 end-of-data indicator 52 flattening arrays 54 output data from 53 selecting columns 55 selecting segments 54 Outputs page 53 processing partial paths 54 Stage page 52 IMS Viewset (PSB/PCB) dialog box 225 inner joins definition 181 example 1812 input data to Aggregator stages 202 to Business Rule stages 169 to DB2 Load Ready Flat File stages 88 to Delimited Flat File stages 78 to External Routine stages 229 to External Target stages 1412 to Fixed-Width Flat File stages 610 to FTP stages 234 to Join stages 172, 183 to Link Collector stages 172 to Lookup stages 196 to Relational stages 93 to Sort stages 212 to Teradata Load stages 1212 to Teradata Relational stages 103 Integer data type definition B2 mappings B9
G
generating code 19, 241244 base location, specifying 242 COBOL program 242 compile JCL 242, E3 compiling multiple jobs 2416 customizing code 245 files produced 244 job validation 244 run JCL 242, E3 tracing runtime information 243 generating operational meta data F2 group by aggregation 204 GROUP BY clause 910, 1010, 118
H
hash joins 182 lookups 192 hash table memory requirements G4 HAVING clause 910, 1010, 118 Help system, one-line help 14 HTML file saving file view layout as 33, 63, 1312, 1410 saving records view layout as 43
Index-5
Index
J
JCL compile JCL 242, E3 definition E1 run JCL 242, E3 JCL extension variables E13 JCL templates % variables E5 conditional statements E15 customizing E4 preserving % symbol E16 usage E3 JCL Templates dialog box E5 job parameters 19 job properties, editing 19 Job Upload dialog box 2410 jobs, see mainframe jobs Join stages defining the join condition 186 editing 171, 181 examples 1811 full joins 181, 1813 inner joins 181, 1812 input data to 172, 183 Inputs page 173, 184 join techniques 182 mapping data from 175, 187 outer joins 181, 1812 outer link 182 output data from 174, 185 Outputs page 174, 185 Stage page 172, 182 joins defining join conditions 186 full joins definition 181 example 1813 inner joins definition 181 example 1812 outer joins definition 181 example 1812 outer link 182 techniques auto 182 hash 182 nested 183 two file match 183
L
Link Collector stages editing 171 input data to 172 Inputs page 173 mapping data 174 output data from 174 Outputs page 174 Stage page 172 links between mainframe stages 18 execution order, in Transformer stages 1520 local stage variables in Transformer stages 1521 logical functions A7 Lookup stages action if lookup fails options 195 conditional lookups 191, 193, 1915 cursor lookups 191, 1914 defining lookup condition 195 pre-lookup condition 193 editing 191 examples 1913 input data to 196 Inputs page 197 lookup techniques 192 mapping data 199 output data from 198 Outputs page 198 singleton lookups 191, 1915 sorting the reference link 196 Stage page 192 lookups cursor definition 191 examples 1914 defining lookup conditions 195 pre-lookup conditions 193 singleton definition 191 examples 1915 techniques auto 192 hash 192 LPAD examples A14
Index-6
Index
M
Machine Profile dialog box Connection page 2413 General page 2412 machine profiles 24112416 copying 2415 creating 2412 renaming 2416 viewing and editing 2415 mainframe jobs creating 12 editing job properties 19 generating code 19, 241, 2416 linking stages 18 overview 11 programming components A1 programming resources 111 stage types 15 tool palette 14, 1517 uploading 110, 248, 2416 validating 244 Mainframe Routine dialog box Arguments page 134, 144, 224 Creator page 133, 143, 223 General page 132, 142, 222 JCL page 138, 147 mapping data from Aggregator stages 207 from Business Rule stages 165 from External Routine stages 2212 from Join stages 175, 187 from Link Collector stages 174 from Lookup stages 199 from Sort stages 215 from Transformer stages 1512 data types B2 dates B13 routines 2212 meta data editing D1 importing 21 operational F1 multi-byte string functions A13 Multi-Format Flat File stages array handling 46 create fillers option 45 data access types 42 defining constraints 49 editing 41 end-of-data indicator 42
master record 44 maximum file record size 42 output data from 48 Outputs page 48 record ID 47 records view layout 43 selecting normalized array columns as output 411 specifying stage record definitions 43 Stage page 42 start row/end row option 42 MultiLoad, Teradata 122
N
native data types in source stages C1 in target stages C7 storage lengths C11 NChar data type definition B1 mappings B7 nested joins 183 numerical functions A9 NVarChar data type definition B1 mappings B7
O
OCCURS DEPENDING ON clause in Complex Flat File stages 36 in DB2 Load Ready Flat File stages 84 in Delimited Flat File stages 74 in external source routines 134 in External Source stages 1313 in external target routines 144 in Fixed-Width Flat File stages 64 in Multi-Format Flat File stages 46 operational meta data controlling XML file creation F6 definition F1 generating F2 using in MetaStage F8 operators A16 ORDER BY clause 911, 1011, 119 outer joins definition 181 example 1812 outer link, Join stages 182 output data from Aggregator stages 203 from Business Rule stages 1610
Index-7
Index
from Complex Flat File stages 311 from DB2 Load Ready Flat File stages 810 from Delimited Flat File stages 710 from External Routine stages 2211 from External Source stages 1314 from Fixed-Width Flat File stages 612 from IMS stages 53 from Join stages 174, 185 from Link Collector stages 174 from Lookup stages 198 from Multi-Format Flat File stages 48 from Relational stages 98 from Sort stages 213 from Teradata Export stages 116 from Teradata Relational stages 108 output links, execution order in Transformer stages 1520 overview, mainframe jobs 11
P
parameters 19, A18 PL/I file definitions, importing 211 post-processing stage 17 pre-sorting data in Complex Flat File stages 37 in Fixed-Width Flat File stages 65 processing stages 16 programming components A1A21 constants A2 constraints A2 expressions A3 functions A4A16 operators A16 parameters A18 routines A19 variables A19 programming, in mainframe jobs 111 propagating column values D2
R
records view layout in Multi-Format Flat File stages 43 reference link, sorting in Lookup stages 196 reject links, in Transformer stages 15181520 REJECTEDCODE variable 1519, 164, A19 Relational stages defining computed columns 912 editing 91 end-of-data indicator 92 input data to 93
Inputs page 93 output data from 98 Outputs page 98 SQL statement GROUP BY clause 910 HAVING clause 910 modifying 914 ORDER BY clause 911 viewing 911, 119 WHERE clause 99 Stage page 92 update action 93 updating input columns 95 WHERE clause 97 Remote System dialog box 248 Repository window 14 reserved words COBOL H1 SQL H5 retention period, for a new data set in DB2 Load Ready Flat File stages 88, 1211 in Delimited Flat File stages 78 in Fixed-Width Flat File stages 311, 610, 115 in Teradata Load stages 1211 ROUND examples A9 routines definition A19 external 221 external source 131 external target 141 RPAD examples A14 RTL, see run-time library runtime information, tracing 243 run-time library G1 data type conversion routines G6 delimited flat file creation routines G4 hash routines G3 operational meta data routines G7 sort routines G1 utility routines G6
S
semantic checking 1526 shortcut menus, in Transformer Editor 153155 singleton lookups definition 191 examples 1915
Index-8
Index
SmallInt data type definition B2 mappings B8 Sort stages editing 211 input data to 212 Inputs page 212 mapping data 215 output data from 213 Outputs page 213 specifying sort order 215 Stage page 212 sorting data in Relational stages 911 in Sort stages 214 in Teradata Export stages 119 in Teradata Relational stages 1011 source stages 15 SQL constructs, in Business Rule stages 166 SQL reserved words H5 SQL statement modifying in Relational stages 914 in Teradata Export stages 1111 in Teradata Relational stages 1014 viewing in Relational stages 911 in Teradata Export stages 119 in Teradata Relational stages 1011 SQLCA.SQLCODE variable 164, 167, A19, A21 stage variables in Transformer stages 1521 stage in Business Rule stages 162 stages editing Aggregator 201 Business Rule 161 Complex Flat File 31 DB2 Load Ready Flat File 81 Delimited Flat File 71 External Routine 228 External Source 1310 External Target 149 Fixed-Width Flat File 61 FTP 231 IMS 51 Join 171, 181 Link Collector 171 Lookup 191
Multi-Format Flat File 41 Relational 91 Sort 211 Teradata Export 111 Teradata Load 121 Teradata Relational 101 Transformer 158 links allowed 18 types, in mainframe jobs 15 start row/end row option in Complex Flat File stages 33 in Delimited Flat File stages 73 in Fixed-Width Flat File stages 63 in Multi-Format Flat File stages 42 status bar, Designer 14 storage lengths, data type C11 string functions A10 SUBSTRING rules A15 syntax checking, in expressions 1525
T
Table Definition dialog box 218 table definitions importing 21 saving columns as 21 viewing and editing 218 target file parameters in DB2 Load Ready Flat File stages 86 in Delimited Flat File stages 77 in Fixed-Width Flat File stages 69 in Teradata Load stages 1210 target stages 16 Teradata Export stages defining computed columns 1110 editing 111 output data from 116 Outputs page 116 specifying FastExport execution parameters 113 file options 114 Teradata connection parameters 112 SQL statement GROUP BY clause 118 HAVING clause 118 modifying 1111 ORDER BY clause 119 WHERE clause 117 Teradata FastExport 111 Teradata FastLoad 122 Teradata Load stages editing 121
Index-9
Index
input data to 1212 Inputs page 1212 specifying file options 1210 stage column definitions 124 Teradata connection parameters 123 Teradata load utility parameters 127 Stage page 122 table preparation 122 update action 122 updating input columns 124 WHERE clause 126 Teradata MultiLoad 122 Teradata Relational stages defining computed columns 1012 editing 101 end-of-data indicator 102 input data to 103 Inputs page 103 output data from 108 Outputs page 108 SQL statement GROUP BY clause 1010 HAVING clause 1010 modifying 1014 ORDER BY clause 1011 viewing 1011 WHERE clause 109 Stage page 102 update action 103 updating input columns 105 WHERE clause 107 Teradata tables, importing 217 Teradata TPump 122 Time data type definition B2 mappings B12 Timestamp data type definition B2 mappings B12 tool palette, mainframe jobs 14, 1517 toolbar Designer 14 Transformer Editor 152 TPump, Teradata 122 tracing runtime information 243 Transformer Editor 152 link area 152 meta data area 153 shortcut menus 153155 toolbar 152
Transformer stages 151 basic concepts 156 column auto-match facility 1513 defining constraints 15181520 editing 158 Expression Editor 15241526 find/replace facility 159 input links 157 mapping data 1512 output columns creating and deleting 1511 defining derivations 1512 editing meta data 1512 editing multiple derivations 1515 moving 1512 output links 157 reject links 15181520 select facilities 1510 specifying output link order 1520 stage properties 156 stage variables 1521 two file match joins 183
U
update action in Relational stages 93 in Teradata Load stages 122 in Teradata Relational stages 103 updating input columns in Relational stages 95 in Teradata Load stages 124 in Teradata Relational stages 105 uploading jobs 110, 248, 2416 user interface conventions vii
V
validating expressions 1525 jobs 244 VarChar data type definition B1 mappings B5 variables built-in A19 definition A19 JCL extension E13 JCL template E5 stage in Business Rule stages 162 in Transformer stages 1521
Index-10
Index
W
WHERE clause 97, 99, 107, 109, 117, 126 wizard, DataStage Batch Job Compilation 2416 write option in DB2 Load Ready Flat File stages 82 in Delimited Flat File stages 73 in Fixed-Width Flat File stages 63
X
XML file, operational meta data F2, F5, F6
Index-11
Index
Index-12