HP NonStop Data Transformation Engine Design Studio Tutorial Abstract This manual provides instructional material for working with the HP NonStop™ Data Transformation Engine (NonStop DTE) Design Studio. Product Version NonStop Data Transformation Engine 6.7.
Document History Part Number Product Version Published 528256-001 NonStop Data Transformation Engine 6.7.1 June 2004 528256-002 NonStop Data Transformation Engine 6.7.
Contents About This Document Related References.......................................................................................... 10 Introduction Integration Broker Suite .................................................................................... 12 Design Studio Overview..................................................................................... 12 Tutorial Objectives.......................................................................................... 13 Help Overview.......
Contents Scenario ....................................................................................................... 53 FullContact Record ..................................................................................... 53 Label Output ............................................................................................ 54 Starting the Type Designer................................................................................. 54 Exploring the Contact Type Tree ...........................
Contents Scenario ..................................................................................................... Copying an Input Card to a New Map................................................................... Copying an Input Card to an Output Card ............................................................. Editing a Card .............................................................................................. Summary ......................................................................
Contents Scenario ..................................................................................................... 154 Modifying the Customer.mtt Type Tree ............................................................... 154 Region Data.............................................................................................155 Record Group Type Represents Region Records..................................................155 RegionRecordsFile Group Type Represents the File .............................
Contents Files Provided for Chapter 10 .......................................................................197 Files You Create or Modify for Chapter 10 ........................................................197 Scenario - Data Value Changes .......................................................................... 198 Control.mtt Type Tree.................................................................................... 199 Adding a Component Rule for Distinguishability ..............................
Contents F_MakePO Functional Map ...........................................................................245 F_MakeDetail Functional Map .......................................................................247 CreatePO Executable Map................................................................................ 247 Generating the PO.txt Output File ..................................................................... 248 Summary .........................................................................
Contents Exported Map Rules ...................................................................................271 Exported Map Settings ................................................................................271 Exported Card Settings ...............................................................................272 Summary .................................................................................................... 272 Chapter 17 - Importing a Map Objectives................................
About This Document This document contains information about the Mercator Design Studio. This document assumes that the reader knows the Windows environment, has used the Mercator Design Studio, and understands words such as mapping, type trees, and other basic Mercator terminology. Related References The Mercator Online Library contains information about all products. Refer to the following references for more information about topics frequently discussed in this document.
About This Document Related References Related Reference Description Functions and Expressions Reference Guide Creating component rules in the Type Designer and map rules in the Map Designer using expressions, functions, and reserved words.
Introduction The Design Studio Tutorial provides a practical hands-on learning experience for the components of the Design Studio. The Introduction to the Design Studio book is a prerequisite for using this tutorial and is a part of the Mercator Online Library, which is delivered on the product CD. The concepts of using the Mercator Design Studio and terms such as mapping, type trees, and other Design Studio terminology are presented in the Introduction to the Design Studio.
Introduction Tutorial Objectives These applications perform the design-time functions of the Mercator Integration Broker Suite. The design-time functions of the Integration Broker Suite define how your data will be transformed. Design-time tasks include: ♦ Defining data definitions. ♦ Defining data transformation rules. ♦ Defining business process models. ♦ Defining other specifications. The run-time functions are the execution of maps and systems of maps in a production environment.
Introduction Help Overview Help Overview The Mercator Design Studio’s extensive and versatile Help system provides you with immediate assistance and reference information. There are several ways to access Help while using the Design Studio. To access Help Choose one of the following access methods: ♦ From the Help menu, choose Contents. The complete Integration Broker Help system appears. ! Locate a topic in the contents. ! Click the Index tab to search by keyword.
Introduction Command Syntax Notation Command Syntax Notation Throughout this document, the following command syntax notation is used: literal Literal characters appear in boldface and should be entered exactly as they appear. variable Variables appear in italics and are placeholders that represent user-supplied information. [A] Options appear in brackets. Do not type the brackets as part of the option. B… Ellipses indicate an element that can repeat.
Introduction Installation Installation This tutorial requires that the Design Studio applications be installed on your system. Mercator’s Integration Broker products include a simple installation program. The Design Studio applications are installed as one of the components of the installation program. Refer to the Getting Started book for details about installing or removing this product from your system.
Introduction Your Working Folders Your Working Folders To provide a personal work area for use with the exercises, create your own working folder under the c:\mercator\tutorial folder. For example, if your name is Mary, create the c:\mercator\tutorial\Mary folder. Create Your Working Folders Create a chapter-specific structure of folders under your personal folder. Exercises are presented in each chapter.
Introduction Your Working Folders Design Studio Tutorial Solutions Solutions for the maps and type trees created and referenced in this book are located in the c:\mercator\tutorial\solutions folder. The solutions for the exercises are provided as self-extracting zip files for each chapter: SolutionsCh01.exe, SolutionsCh02.exe, and so on. For example, you can extract the files from the c:\mercator\tutorial\solutions\Ch01\SolutionsCh01.exe zip file to the c:\mercator\tutorial\solutions\Ch01 folder.
Chapter 1 - Mapping Basics In this exercise, you will open, build, and run a map in the Map Designer. You will also examine the data structure of the input and output files. Objectives This exercise introduces basic mapping skills used in the Map Designer. By completing the exercises for Chapter 1, you will learn how to: ♦ Identify map file types and map file name extensions. ♦ Open a map source file. ♦ Select a map in the Navigator. ♦ Expand and collapse maps in the Navigator.
Chapter 1 - Mapping Basics Files Used in this Chapter Files Used in this Chapter Your working folder is c:\mercator\tutorial\MyFolder\Ch01. Files Provided for Chapter 1 The following table describes the files provided for this chapter. Use the files provided in Ch01.zip. Icon File type Name Description Text file Contact.txt Input data text file that contains a single contact record of information about one customer Type tree Contact.
Chapter 1 - Mapping Basics Icon Scenario File type Name Description Map source options file Mail.mopt Map options file created automatically during the Save process Backup type tree and map files *.bak Backup type tree files and map source files created automatically during the Save process The default behavior is to create backup files with the filename extension .bak when each type tree file or map source file is saved.
Chapter 1 - Mapping Basics Scenario In the Contact.mtt type tree: ♦ The input data is a file that consists of a single contact record. The data object that represents the file containing the contact record is ContactFile. ♦ The input data is also a contact record consisting of many data fields delimited by commas. The data object that represents the contact record is Contact. Adams,James,ABC Co.
Chapter 1 - Mapping Basics Scenario The ContactFile group type represents the file that contains records of contacts. Group types contain components. A component represents a data object that is part of another data object. The Contact group type is a component of the ContactFile group. The ContactFile group represents the entire file of contact records. The Contact group represents a contact record. Multiple contact records may exist in the same file.
Chapter 1 - Mapping Basics Scenario The components of the Contact group type are defined in the Contact group window. Each component represents a field of the Contact record. The Contact group contains the components of the contact record in the order they appear in the data stream.
Chapter 1 - Mapping Basics Scenario The Contact group window is displayed by double-clicking the group type in the Contact.mtt type tree window. The title bar in the group window shows the compositional hierarchy. For example, the title bar of Contact group window illustrates that Contact is a subtype of Data. In the Contact.txt input file, commas are used to separate (delimit) the fields. Use any text editor to view the Contact.txt input data file.
Chapter 1 - Mapping Basics Scenario Label Record The Label.txt output file you want to generate will consist of one mailing label. The label consists of four data fields, each on a separate line. Adams, James FullName ABC Co. Company Street 29 Frankford Rd CityStateZip Bloomington,IL,60525 Label The Label.mtt type tree defines the data in a classification hierarchy for the output file. The LabelFile group type represents the file that contains the label record.
Chapter 1 - Mapping Basics Starting the Map Designer The components of the Label group type are defined in the Label group window. Each component represents a portion of the Label record. The Label group contains the components of the label record in the order they appear in the data stream. The Label.mtt type tree defines the data of the Label record, as shown in the following illustration. Starting the Map Designer Start the Map Designer to open the Mail.mms map source file.
Chapter 1 - Mapping Basics 3 Starting the Map Designer Click OK. The Open dialog box appears. 4 Navigate to your Chapter 1 personal working folder: c:\mercator\tutorial\MyFolder\Ch01. 5 Select the Mail.mms map source file and click Open. The Map Designer opens and the Mail.mms map source file is displayed in the main window and the Navigator. Note The installation program adds an entry for the Map Designer to the Mercator program folder.
Chapter 1 - Mapping Basics Starting the Map Designer Exploring the ContactToLabel Map The ContactToLabel map is contained in the Mail.mms map source file. The ContactToLabel map contains input and output cards that transform data content from the Contact record source format to the Label target format according to the map rules contained in the map. The Mail.mms map source file is a file that is created and saved using the commands on the File menu in the Map Designer and has a file name extension of .
Chapter 1 - Mapping Basics Starting the Map Designer A map defines input and output specifications. The ContactToLabel map uses the Contact.txt input file and produces the Label.txt output file. Each input and output card represents one data object, identified by selecting a type from a type tree. A card may represent an object in a row, a row in a record, the entire record, or the entire file. Each card specifies a type tree and a type as part of the card definition.
Chapter 1 - Mapping Basics Starting the Map Designer The ContactFile input card contains the definition of the input for the ContactToLabel map including information such as source identification (Contact.txt file), retrieval specifics, and the behavior that should occur during processing. The ContactFile input card definition is shown below.
Chapter 1 - Mapping Basics Starting the Map Designer The Label output card defines how the output is generated. The Target specifies the output be written to the File specified for the FilePath setting. If a path is not specified for the FilePath, the map source file location is used. The settings of the Label output card, shown below, specify the output file Label.txt be written to the map source file folder, in this case c:\mercator\tutorial\Mary\Ch01.
Chapter 1 - Mapping Basics Starting the Map Designer The Map Designer is the application in the Design Studio that specifies data transformation logic in the form of map rules. The map rules for the data objects on the Label output card specify the data transformation logic used to generate a mailing label. The compositional hierarchy of the output card defines the structure of the output data. The Label output card represents the Label group type.
Chapter 1 - Mapping Basics Starting the Map Designer Link between the Map Designer and Type Designer The Schema card settings (CardName, TypeTree, and Type) define the content of the card. This card definition is the link between the Map Designer and the Type Designer. The ContactFile input card #1 in the ContactToLabel map (created and managed in the Map Designer) specifies the ContactFile group type and the Contact.mtt type tree.
Chapter 1 - Mapping Basics Viewing Components in the ContactToLabel Map Viewing Components in the ContactToLabel Map The ContactToLabel map name and map icon ( the Mail.mms map. ) appear in the Navigator of In the Navigator, map source files can be expanded to view all of the maps they contain. Maps can be expanded to view the input and output cards. Icons that display a plus sign (+) may be expanded. Icons that display a minus sign (-) may be contracted.
Chapter 1 - Mapping Basics Viewing Components in the ContactToLabel Map To resize the Navigator window 1 Position the cursor on the right edge of the Navigator and resize by dragging. To expand the ContactToLabel map in the Navigator 1 The List view of the Navigator is the default view. If you are not viewing the Navigator in List view, click the List tab. 2 Click the plus sign (+) to the left of the ContactToLabel map icon. The names of the input and output cards appears.
Chapter 1 - Mapping Basics Viewing Components in the ContactToLabel Map ContactToLabel Map Cards The input and output cards of maps appear in the From and To windows. Each icon in a card represents a type. The composition of the cards shows the contents of the type definitions. Types on cards are arranged in a compositional hierarchy that shows the structure, layout, and composition of the data. Types are arranged on the input and output cards in the order they appear in the data stream.
Chapter 1 - Mapping Basics Viewing Components in the ContactToLabel Map The output card #1 Label appears in the To window. The To window represents the output data to which you are mapping. The output card #1 Label is displayed in the To window. The output card Label represents the Label group type defined in the Label.mtt type tree. In the To window, the Label type on the output card #1 Label is currently expanded to display the map rules on the data objects contained in the Label card.
Chapter 1 - Mapping Basics Map Rules To contract the icon in the Label output card 1 Click the minus sign (-) to the left of the Label group type to hide its components. The components of the Label group are contracted. Map Rules Map rules are used in output cards of a map to define how output data is built. Map rules are required for output data generation. If there is no map rule, there is no output data. Each output card has a rule column in which you enter map rules.
Chapter 1 - Mapping Basics Map Rules Data Object Names in Map Rules In map rules, type names separated by a colon indicate a component relationship. Type names separated by a space indicate a subtype relationship. For example, City Field:Contact indicates that City is a subtype of Field. City Field is a component of Contact. Viewing the Map Rules on the ContactToLabel Map The Label output card generates the data based on the map rules entered for each data object.
Chapter 1 - Mapping Basics Map Rules Using the Navigator The Navigator window and icons graphically represent all of your opened map source files and the maps that they contain. It also provides a graphical representation of the input and output cards in the maps. The Navigator can be shown or hidden using the Navigator command on the View menu or the context menu on the top of the Navigator (as shown in the following illustration). The Navigator can be presented as a docked window or a floated window.
Chapter 1 - Mapping Basics 3 Building the ContactToLabel Map After selecting Allow Docking, you can toggle between a docked window and a floated window by double-clicking the top border of the Navigator. Note The Rule Bar can also be docked or floated. Experiment with moving, docking, and floating the Rule Bar. Building the ContactToLabel Map The Mail.mms map source file maintains the ContactToLabel map in source format. The ContactToLabel map must be built in order to execute it.
Chapter 1 - Mapping Basics Building the ContactToLabel Map To build the ContactToLabel map 1 In the Navigator, select the ContactToLabel map. 2 From the Map menu, choose Build. Or click (Build map) on the toolbar. The message Building a map appears briefly in a message box, which closes automatically. Results If no errors occur, executing the Build command generates the following files in the same folder as the map source file: ♦ ContactToLabel.mmc (compiled map file) ♦ ContactToLabel.
Chapter 1 - Mapping Basics Running the ContactToLabel Map Build results of a map provide information on errors and warnings that occur during the map build process. Use Windows Explorer to view the files generated during the build process. Running the ContactToLabel Map Now that you have built the map, you can run the ContactToLabel map from within the Map Designer. The Map Designer uses the Command Server to run maps and displays build results in the Mercator Command Server dialog box.
Chapter 1 - Mapping Basics Running the ContactToLabel Map The Mercator Command Server dialog box displays the map name, the map execution, the total number of input objects found, and the total number of output objects built. These statistics are shown to indicate progress and results. 3 Click Cancel to close the Mercator Command Server dialog box. Results Executing the Run command generates the Label.txt output text file.
Chapter 1 - Mapping Basics 3 Running the ContactToLabel Map Click OK. Each data source and target appears in its own window.
Chapter 1 - Mapping Basics Tip Running the ContactToLabel Map To quickly view all run results of a map, press Ctrl + Shift and click (View run results).
Chapter 1 - Mapping Basics Summary Closing Multiple Run Results Windows You can quickly close all run results of a map. To close all run results of a map 1 Select the map in the Navigator. 2 Click (Close all run results). Note The (Close all run results) tool is available on the toolbar only when the corresponding map is selected in the Navigator and run results windows are displayed. The position of the run results windows is retained for each map.
Chapter 1 - Mapping Basics Summary The Contact input card on the ContactToLabel map represents the Contact group type. Therefore, the structure of the input card is the same as the structure of the Contact group type as defined in the Contact group window. In the Type Designer In the Map Designer The Contact group window contains the components of the Contact record in the order they appear in the data stream. The Contact input card definition specifies the Contact.
Chapter 1 - Mapping Basics Summary ContactToLabel Map Target ♦ The label.txt file containing a label contact record is the output of the ContactToLabel map. ♦ The structure of this Label record is defined in the Label.mtt type tree. ♦ The Label group type defines the components of the Label record. ♦ The components of the Label group type are arranged in the order they appear in the data stream. The Label output card on the ContactToLabel map represents the Label group type.
Chapter 2 - Modifying the Contact Type Tree Objectives Chapter 2 - Modifying the Contact Type Tree The ContactToLabel map introduced in Chapter 1 uses a single Customer record to generate a single mailing label. The Contact.mtt type tree represents the input data. The Customer record in Chapter 1 did not have a middle name or initial. In this exercise, you modify the input Contact.mtt type tree to add a definition for the middle name field.
Chapter 2 - Modifying the Contact Type Tree Files Used in this Chapter Files Used in this Chapter You will be working in the c:\mercator\tutorial\MyFolder\Ch02 folder. Files Provided for Chapter 2 The following table describes the files provided for this chapter. Use the files provided in Ch02.zip. Icon File type Name Description Type tree Contact.mtt Type tree describing the contact data (input). Text file FullContact.
Chapter 2 - Modifying the Contact Type Tree Scenario Scenario You have a Contact text file consisting of multiple records that contain information about a customer. Using the file of multiple records as input, you need to generate one mailing label for each contact record in the input data. The input data contains optional data objects; the records of some customers contain middle names or initials. You need to modify the type tree that represents the input data to contain a middle name field.
Chapter 2 - Modifying the Contact Type Tree Starting the Type Designer Label Output The output data is a file of mailing labels. We want to generate one label for every contact record in the input. The labels will consist of four data fields, each on a separate line. The labels should look like the following: James P. Adams ABC Co. 29 Frankford Rd Bloomington, IL 60525 Maria B. Miller Conrad Corp 1234 Smith St Buffalo Grove, CA 60089 Fred A. Smith Sand Inc.
Chapter 2 - Modifying the Contact Type Tree Starting the Type Designer Exploring the Contact Type Tree The Contact.mtt type tree contains data definitions for the data objects in the FullContact.txt input file. The Contact.mtt type tree is a file that is created and saved using the commands on the File menu in the Type Designer. Type tree files have a file name extension of .mtt. The full path of the Contact.mtt type tree file appears on the title bar of the Type Designer.
Chapter 2 - Modifying the Contact Type Tree Starting the Type Designer To view the components of the Contact group type 1 In the type tree window, double-click the Contact group type. The Contact group window opens. The group window displays until you close it.
Chapter 2 - Modifying the Contact Type Tree Tip Type Properties An uncomplicated way to close a group window is to use the standard Windows upper left corner window controls. To close the Contact group window 1 Double-click the green icon in the left side of the group window title bar. Type Properties The properties and definitions of all data objects are defined in the type tree.
Chapter 2 - Modifying the Contact Type Tree Viewing Type Properties To view the properties of the Contact group type 1 In the type tree window, select the Contact group type. 2 Click (Properties) on the toolbar. The Properties for Contact Data window appears. The Properties window may be sized, docked, or floated as needed. The default position of the Properties window for new type trees is docked. The title bar for docked windows is not displayed. To view the title bar, undock the window.
Chapter 2 - Modifying the Contact Type Tree Properties of the Contact Group Type Properties of the Contact Group Type Described in the following table are some of the properties that define the Contact group type. Property Value Description Group Subclass Sequence Each component of this group is validated sequentially. Format Explicit The format of this group relies on syntax to separate components. Each component can be identified by its position, or by a delimiter in the data.
Chapter 2 - Modifying the Contact Type Tree Components of Contact Components of Contact The Contact group window defines the components of the Contact input data. The components of the Contact group type define the data objects for the contact records in the order they appear in the data stream. In the Contact group window composition hierarchy shown below, there is not a data definition for the Middle Name Field. Classification Hierarchy The classification hierarchy shown in the Contact.
Chapter 2 - Modifying the Contact Type Tree Classification Hierarchy Adding a New Type To add a component to the Contact group type, an item type must be added to the Contact.mtt type tree. To add the Middle Name item type 1 In the Contact.mtt type tree window, select the Name item type. 2 From the Type menu, choose Add. The confirmation dialog box appears. 3 Click Yes. A new type is added as a subtype of Name. The new type is highlighted in the type tree with the default name NewType1.
Chapter 2 - Modifying the Contact Type Tree Classification Hierarchy 4 In the type tree window, enter Middle as the name of the new type. 5 Press Enter. The new type name Middle appears and the Name type is selected. The Properties window, displaying the properties of Name, also appears.
Chapter 2 - Modifying the Contact Type Tree Classification Hierarchy To view the Middle type properties 1 In the type tree window, select the Middle type. 2 From the Type menu, choose Properties. The Properties window appears. (If the Properties window is already open, the properties are updated for the selected type.) 3 Click the plus sign (+) to expand the Item Subclass property.
Chapter 2 - Modifying the Contact Type Tree 4 Adding Components to Group Types Expand the Size (content) property. The size of an item includes separators and signs, but not initiator, terminator, release, or pad characters. The Min property defines the minimum number of bytes of the item. The Middle Name Field has a minimum size of 1 byte. The Min value of 1 was inherited from the Name type. The property was inherited from the selected Name type when the Middle type was created as a subtype of Name.
Chapter 2 - Modifying the Contact Type Tree Adding Components to Group Types To add the Middle component to the Contact group type 1 In the type tree window, double-click the Contact group type. The Contact group window appears. 2 Resize, move, and arrange windows to view the Contact group window and the type tree window. If the Properties window is still open, move it or close it as needed. 3 Drag the Middle type from the type tree window to the correct position in the Contact group window.
Chapter 2 - Modifying the Contact Type Tree Adding Components to Group Types The Middle Name Field item type is positioned in the group window where the data object appears in the data stream. Component Ranges The component range of a data object defines the number of consecutive occurrences of that component. If a component range is other than the default (1:1), it appears in the group window after the component name in parenthesis. The component rule bar appears on group and category windows.
Chapter 2 - Modifying the Contact Type Tree Adding Components to Group Types Component rule bar 2 From the Component menu, choose Set Range. The Set Range dialog box appears with the default component range of (1:1). 3 In the Min field, enter 0. 4 Click OK. The optional component range of (0:1) appears next to Middle Name Field.
Chapter 2 - Modifying the Contact Type Tree Adding Components to Group Types 5 Close the Contact Data group window to save the addition of the Middle component. 6 When prompted for confirmation, click Yes to save changes. Saving the Contact.mtt type tree Type trees must be analyzed and saved to retain any changes. The type tree analyzer validates the data definitions for internal consistency.
Chapter 2 - Modifying the Contact Type Tree Summary To analyze and save the Contact.mtt type tree 1 With current focus on the Contact type tree window, from the Tree menu, choose Analyze > Logic Only. The Analyze Tree (Logic Only) window appears showing the results of the analysis. 2 Click Close. 3 From the File menu, choose Save. Summary The contact records for each customer may include a middle name. The data object that represents the middle name must be defined in the Contact. mtt type tree.
Chapter 3 - Modifying the Mail.mms Map Source File The ContactToLabel map introduced in Chapter 1 used a single customer record to generate a single mailing label. In this exercise, you copy the ContactToLabel map to a new name in the same Mail.mms map source file. You map multiple records that may contain the optional middle names to multiple labels. After you complete the exercises in this chapter, the Mail.
Chapter 3 - Modifying the Mail.mms Map Source File Files Used in this Chapter Files Used in this Chapter You will be working in the c:\mercator\tutorial\MyFolder\Ch03 folder. Files Provided for Chapter 3 The following table describes the files provided for this chapter. Use the files provided in Ch03.zip. Icon File type Name Description Text file FullContact.txt Input data text file that contains multiple contact records of information about customers. Type tree Contact.
Chapter 3 - Modifying the Mail.mms Map Source File Files Used in this Chapter Files You Create or Modify for Chapter 3 The following table describes the files that you create or modify while you perform the exercises for this chapter. Icon File type Name Description Text file Label.txt Output data text file that contains multiple label records produced by the ContactToLabel map. Text file FullLabel.txt Output data text file generated by the ContactToLabel map.
Chapter 3 - Modifying the Mail.mms Map Source File Scenario Scenario You have a file that consists of multiple records containing information about your customers. This source data is the FullContact.txt text file. The FullContact.txt file of records contains optional data objects; the records of some customers contain middle names or middle initials. Using the FullContact.txt file of multiple records as input, you want to generate one mailing label for each contact record in the input data.
Chapter 3 - Modifying the Mail.mms Map Source File 4 Copying an Input Card For the Into fields: ♦ Leave Mail.mms in the File field. ♦ Enter ContactToFullLabel for the Map field. Note Copying a card to a new map automatically copies the input card and generates the new map at the same time. The ContactToFullLabel map does not exist, so it will be created. 5 The Copy Card As setting must be Input. 6 Enter ContactFile as the name of the new input card in the Name field. 7 Click OK.
Chapter 3 - Modifying the Mail.mms Map Source File Modifying the ContactToFullLabel Map Modifying the ContactToFullLabel Map The Mail.mms map source file should now contain two maps: ContactToLabel and ContactToFullLabel. Select the ContactToFullLabel map in the Navigator. Selecting the ContactToFullLabel map 1 In the Navigator, double-click the ContactToFullLabel map to select it. The title bar of the Map Designer displays the ContactToFullLabel map name.
Chapter 3 - Modifying the Mail.mms Map Source File Modifying the ContactToFullLabel Map Creating the Label Output Card You must create an output card for the ContactToFullLabel map. To map multiple contact records to multiple label records, the #1 Label output card must represent the entire file of label records. You must specify the CardName, TypeTree, and Type for the new output card. ♦ The CardName should describe the data object the card represents: LabelFile.
Chapter 3 - Modifying the Mail.mms Map Source File Modifying the ContactToFullLabel Map To create the Label output card 1 In the ContactToFullLabel map, select the To window. 2 From the Card menu, choose New. The Add Output Card dialog box appears. 3 For the CardName, enter LabelFile. 4 For the TypeTree, click (browse). The Select type tree dialog box appears. 5 Select the Label.mtt type tree and click Select. 6 For the Type, click (browse). The Select Type dialog box appears.
Chapter 3 - Modifying the Mail.mms Map Source File Modifying the ContactToFullLabel Map 7 Select the LabelFile group type. 8 Click OK to close the Select Type dialog box. 9 For the Target, the default File is correct. Note The Target is the destination of the output data after it is built by the map.
Chapter 3 - Modifying the Mail.mms Map Source File Modifying the ContactToFullLabel Map 10 For the FilePath, enter FullLabel.txt. Note The target output file name is entered (not selected) because it does not exist and will be generated by the map. 11 Click OK. The #1 LabelFile output card appears in the To window. Editing the ContactFile Input Card Define the data source of the ContactFile input card as the FullContact.txt text file.
Chapter 3 - Modifying the Mail.mms Map Source File Executable and Functional Maps Note The Label data object has a component range of (s), which indicates some unknown number of Labels. The component range of (s) appears on cards next to the type name. Creating the Map Rule for Label(s) When an output group has a range that indicates more than one occurrence, you must determine how many occurrences of that output should be generated.
Chapter 3 - Modifying the Mail.mms Map Source File Executable and Functional Maps entire files, database tables, messages, applications, and so on. Think of an executable map as the main map, the top-level map. Executable maps are compiled and run. In the Navigator, the icon for an executable map is blue . Functional Map: A functional map is referenced by another map through a map rule. A functional map maps just a portion of the entire data.
Chapter 3 - Modifying the Mail.mms Map Source File Executable and Functional Maps General Functional Map Guidelines ♦ The map rule that references the functional map is entered for the data object to be generated on the output card of the executable map. For example, the Label group type on the #1 LabelFile output card. ♦ Enter the map rule in the rule cell of the data object that requires additional data processing. For example, the Label group type on the #1 LabelFile output card.
Chapter 3 - Modifying the Mail.mms Map Source File Executable and Functional Maps The output of the functional map is the single data object to be generated. ♦ The output argument of the functional map is the data object that represents a single label, the Label group type. To enter the map rule to call the functional map 1 On the ContactFile input card, locate the Contact group type. This is the data object that represents the single contact.
Chapter 3 - Modifying the Mail.mms Map Source File 5 Executable and Functional Maps Press Enter to commit the map rule. The map rule for the Label group type appears in the Rule Bar and in the rule cell on the output card. Label Map Rule The map rule: =F_MakeLabels(Contact:ContactFile) specifies: ♦ F_MakeLabels is the name of the functional map. ♦ The input data object is Contact, which is a component of ContactFile.
Chapter 3 - Modifying the Mail.mms Map Source File Executable and Functional Maps Functional Map Wizard In this exercise, you will use the Functional Map Wizard to create a functional map to generate one Label for each Contact. The maps created by the Wizard contain input cards and an output card, but do not contain map rules.
Chapter 3 - Modifying the Mail.mms Map Source File Executable and Functional Maps 3 Select the Out output card and click the Edit button. 4 In the Card Attributes dialog box, assign a meaningful name to the output card. Shown below, the name of the functional map output card is changed to LabelsOut in the Card Name field.
Chapter 3 - Modifying the Mail.mms Map Source File Executable and Functional Maps 5 Click OK to close the Card Attributes dialog box for the output card. 6 Edit the input card and assign a meaningful name: ContactsIn. The green face icon ( ) indicates successful funcational map type tree and type selections. 7 Click Create. The F_MakeLabels functional map is created. The contents of the Functional Map Wizard dialog box are automatically cleared after a functional map is successfully created.
Chapter 3 - Modifying the Mail.mms Map Source File Entering Map Rules On the Composition tab of the Navigator, functional maps appear underneath the executable map that calls it. Entering Map Rules The data objects on the LabelsOut output card on the F_MakeLabels functional map need map rules to generate the output data. A map rule defines how a particular data object is generated. Each component of the #1 LabelsOut output card has a corresponding rule cell.
Chapter 3 - Modifying the Mail.mms Map Source File Entering Map Rules Mapping to the Company Field The Company Field of LabelsOut should look like the Company Field of ContactsIn. Therefore, map the Company Field from the input card to the Company Field on the output card. The format of the Company Field in the contact record and the label record is shown below. Adams,James,P,ABC Co.,29 Frankford d,Bloomington,IL,60525,708,3525555 James P Adams ABC Co.
Chapter 3 - Modifying the Mail.mms Map Source File Entering Map Rules The equal sign (=) and the Company Field:ContactsIn data object name appear in the rule cell. (They will appear in the Rule Bar after the map rule is committed.) 4 Place current focus in the Rule Bar or the rule cell and press Enter to commit the map rule. Note When dragging a data object into a rule cell, the equal sign is automatically inserted.
Chapter 3 - Modifying the Mail.mms Map Source File Entering Map Rules Data Object Name Reminder A space between two data object names represents a subtype relationship. Company Field means Company is a subtype of Field. A colon (:) between two data object names represents a component relationship. The Company Field:ContactsIn data object name signifies the Company Field data object is a component of the data object the ContactsIn output card represents (in this case, the Contact group type).
Chapter 3 - Modifying the Mail.mms Map Source File Entering Map Rules Mapping to the Street Field Map the Street Field in ContactsIn to the Street Field in LabelsOut. Adams,James,P,ABC Co.,29 Frankford Rd,Bloomington,IL,60525,708,3525555 James P. Adams ABC Co. 29 Frankford Rd Bloomington, IL 60525 To enter the map rule for Street Field 1 Select the object Street Field on the input card. 2 Drag it into the rule cell for Street Field on the output card.
Chapter 3 - Modifying the Mail.mms Map Source File Entering Map Rules Note Syntax errors in the Rule Bar are indicated with underlines. While the map rule is under construction it is normal to see underlines. To enter the map rule for CityStateZip Field 1 Select City Field on the input card. 2 Drag City Field into the rule cell of CityStateZip Field. =City Field:ContactsIn appears in the Rule Bar. 3 Click in the Rule Bar to the right of City Field:ContactsIn and type a space.
Chapter 3 - Modifying the Mail.mms Map Source File Entering Map Rules Mapping to the FullName Field Map the First, Middle, and Last Name Fields from the ContactsIn input card to the FullName Field in the LabelsOut output card. Remember that the Middle Name Field is optional and does not have to appear in the data. If the contact record does not have a middle name, the Middle Name Field should not be mapped. Use a map rule that verifies that Middle Name Field is present.
Chapter 3 - Modifying the Mail.mms Map Source File Entering Map Rules Another way to express the IF function syntax would be: IF (condition, do this if the condition is met [, optionally do this if the condition is not met]) The braces that surround the third argument [, result_if_false] indicate that the comma and the third argument are optional. Mapping the FullName Field A description of the map rule is: “If the Middle Name Field is present, map the First, Middle, and Last Name Fields.
Chapter 3 - Modifying the Mail.mms Map Source File 3 Tip Entering Map Rules Select the IF function in the Functions list. Placing current focus in the Functions list and typing the letter I jumps directly to the I functions. 4 Click Insert. =IF( ) appears in the Rule Bar. The cursor is positioned between the parentheses, ready for the first argument of the function. 5 Click Close to close the Insert Function dialog box.
Chapter 3 - Modifying the Mail.mms Map Source File Entering Map Rules 10 After the ending parenthesis of the PRESENT function, type a comma (,) and a space. Note Underlines in map rules indicate syntax errors. Check the syntax of the map rule if you see underlines in your map rule. Mapping the Second Argument of the IF function The following steps create the second argument of the IF function. The first argument was the Middle Name Field:ContactsIn, if present.
Chapter 3 - Modifying the Mail.mms Map Source File 8 Entering Map Rules Type a comma and a space after the Last Name Field:ContactsIn and before the closing parenthesis ). Mapping the Third Argument of the IF function The following steps create the third argument of the IF function. This is the value of Full Name if a Middle Name is not present. 1 Drag First Name Field into the Rule Bar, after the space just typed. 2 Type + “ ” + 3 Type a space after the plus sign (+). This space is required.
Chapter 3 - Modifying the Mail.mms Map Source File Entering Map Rules The map rule can be formatted so that it is more easily read. If desired, create a new line in the Rule Bar where you want one. New lines may be entered outside of object names, and outside of literals enclosed in quotation marks. Adding a new line within quotation marks is not valid. Note How a new line is entered depends on the Commit rules with setting. The Enter key is the default commit key.
Chapter 3 - Modifying the Mail.mms Map Source File Saving the Mail.mms Map Source File Note Non-printable characters are not displayed in the Rule Bar, but appear in the rule cell on the To window as ". Saving the Mail.mms Map Source File The ContactToFullLabel map is contained in the Mail.mms map source file. To save the changes you made to the ContactToFullLabel map, save the Mail.mms map source file. To save the Mail.mms map source file 1 In the Navigator, select the Mail.mms map source file.
Chapter 3 - Modifying the Mail.mms Map Source File Running the ContactToFullLabel Map Running the ContactToFullLabel Map After the map is built, the map can be run. To run the ContactToFullLabel map 1 In the Navigator, select the ContactToFullLabel map. 2 From the Map menu, choose Run. The Mercator Command Server window appears.
Chapter 3 - Modifying the Mail.mms Map Source File Running the ContactToFullLabel Map 3 To view only the output, clear the check box next to #1 ContactFile. 4 Click OK.
Chapter 3 - Modifying the Mail.mms Map Source File Running the ContactToFullLabel Map The results window for the #1 LabelFile output card on the ContactToFullLabel map appears. Note that the middle initials appear in the output file where needed, and that Mary Jones of McCormick Enterprises has no middle name. Check the output results in the Map Designer and in the destination directory using the Explorer.
Chapter 3 - Modifying the Mail.mms Map Source File Summary Summary The Mail.mms map source file contains the original ContactToLabel map. ♦ You copied this ContactToLabel map to create a new map named ContactToFullLabel. The ContactToFullLabel map has the same cards as the ContactToLabel map. ♦ You edited the #1 LabelFile output card so the data object represented by this card is the entire file of labels: the LabelFile group type. The Label group type is a component of LabelFile.
Chapter 4 - Using the UNIQUE Function The ContactToFullLabel map created in Chapter 3 maps a file of multiple contact records to a file of multiple labels. After analyzing the output, it is clear that some of the contact records in the address file occur multiple times. Objectives This exercise copies and modifies an existing map, and introduces the UNIQUE function. By completing the exercises for Chapter 4, you will learn how to: ♦ Modify an existing map. ♦ Copy an input card to create a new map.
Chapter 4 - Using the UNIQUE Function Files Used in this Chapter Files Used in this Chapter You will be working in the c:\mercator\tutorial\MyFolder\Ch04 folder. Files Provided for Chapter 4 The following table describes the files provided for this chapter. Use the files provided in Ch04.zip. Icon File type Name Description Text file FullContact.txt Input data text file that contains multiple contact records of information about customers. Type tree Contact.
Chapter 4 - Using the UNIQUE Function Files Used in this Chapter Files You Create or Modify for Chapter 4 The following table describes the files that you create or modify while you perform the exercises for this chapter. Icon File type Name Description Text file Unique.txt Output data text file containing unique records (no duplicates). Compiled map file UniqueContacts.mmc Compiled map file that creates a file of unique records. Map build analysis results file UniqueContacts.
Chapter 4 - Using the UNIQUE Function Scenario Scenario The FullContact.txt file that contains your customer records contains duplicate records. You must generate an output file that contains only the unique contact records. The output file containing only the unique records can then be used as the input file to generate the label file. Copying an Input Card to a New Map Use the Map Designer to copy the input card from the ContactToFullLabel map to an input card in a new map.
Chapter 4 - Using the UNIQUE Function 4 Copying an Input Card to an Output Card Click OK. The UniqueContacts map is created with the ContactFile input card. Copying an Input Card to an Output Card An input card can be copied to an output card to enable reuse of the data objects. Because the output of the UniqueContacts map is also going to be a file of contacts, copy the ContactFile input card to an output card in the UniqueContacts map.
Chapter 4 - Using the UNIQUE Function Copying an Input Card to an Output Card To copy the ContactFile input card to an output card using the Navigator 1 Expand the UniqueContacts map in the Mail.mms map source file in the List view of the Navigator. 2 Expand Input Cards for the UniqueContacts map to display the ContactFile input card in the Navigator. 3 Click the ContactFile card, then press Ctrl and drag ContactFile to Output Cards. The confirmation dialog box appears.
Chapter 4 - Using the UNIQUE Function 4 Editing a Card Click Yes to confirm that you want to copy the card as an output card. A new card appears in the Navigator under Output Cards, named ContactFile_1. Editing a Card Thenewly created ContactFile_1 output card should be renamed to represent the output it generates. In the Edit Output Card dialog box, change the setting to direct the output of the UniqueLabels map to a text file named unique.txt.
Chapter 4 - Using the UNIQUE Function Editing a Card ♦ Right-click the ContactFile_1 card in the Navigator and select Edit from the context menu. The Edit Output Card dialog box appears. 3 For CardName, enter UniqueContactsFile. 4 For FilePath, enter unique.txt. 5 Click OK.
Chapter 4 - Using the UNIQUE Function Editing a Card When the data objects are expanded on the ContactFile input card and the UniqueContactsFile output card, the cards should look like this: In this map, you want to map only the unique contact records. Use the UNIQUE function, which evaluates a series of objects, belonging to some type. The UNIQUE function returns the unique data objects in that series.
Chapter 4 - Using the UNIQUE Function 6 Editing a Card View the run results. The input file FullContact.txt and the output file unique.txt appear in separate windows. The UNIQUE function eliminated duplicate contact records in the output file. Save the Mail.mms map source file to retain changes to the UniqueContacts map.
Chapter 4 - Using the UNIQUE Function Summary Summary The Mail.mms map source file now contains three executable maps and one functional map. Map Name Type of map Target = File Output Generated ContactToLabel Executable Contact.txt A single mailing label. ContactToFullLabel Executable FullContact.txt A file containing multiple mailing labels. F_MakeLabels Functional n/a A mailing label record for each contact record. Executable Unique.
Chapter 5 - Using the EXTRACT Function The ContactToFullLabel map in the Mail.mms map source file can be modified to extract only the Florida addresses. Objectives This exercise modifies an existing map, and introduces the EXTRACT function. By completing the exercises for Chapter 5, you will learn how to: ♦ Modify an existing map. ♦ Use the right-click context menu to edit a card. ♦ Use the EXTRACT function to extract data for which a specified condition is true. ♦ Copy a map.
Chapter 5 - Using the EXTRACT Function Icon Files Used in this Chapter File type Name Description Type tree Label.mtt Type tree describing the label data (output). Map source file Mail.mms Map source file containing three executable and one functional map. Files You Create or Modify for Chapter 5 The following table describes the files that you create or modify while you perform the exercises for this chapter. Icon File type Name Description Text file FloridaContacts.
Chapter 5 - Using the EXTRACT Function Scenario Copies of the files created during the exercises are provided for all chapters in the Tutorials\Solutions folder. The structure and use of these files is described in the Design Studio Tutorial Solutions section on page 18. Scenario From the FullContact.txt input file, you need to generate a list of labels for the Florida addresses only. Extracting Contacts for a Specific State Modify the ContactToFullLabel map contained in the Mail.mms map source file.
Chapter 5 - Using the EXTRACT Function 4 Copying the ContactToFullLabel Map Click OK. The FloridaLabels map appears in the Navigator.
Chapter 5 - Using the EXTRACT Function Copying the ContactToFullLabel Map Defining a New Input File In Chapter 4, the ContactToFullLabel map generated a file containing only the unique contact records. In the new FloridaLabels map, edit the input card to define the unique.txt file as the input file for the ContactFile input card. Tip The input file is defined by the value of the Source > FilePath setting on the ContactFile input card.
Chapter 5 - Using the EXTRACT Function Entering a Map Rule to Extract Specific Records Entering a Map Rule to Extract Specific Records To map only the contacts that have Florida addresses, use the EXTRACT function on the Contact:ContactFile data object specified in the map rule that calls the F_MakeLabels functional map. Currently, the F_MakeLabels functional map is used to map every contact to a label.
Chapter 5 - Using the EXTRACT Function Entering a Map Rule to Extract Specific Records To use the EXTRACT function in the call to the F_MakeLabels functional map 1 Display the map rule for the Label data object on the FloridaLabelFile output card. 2 Click in the Rule Bar between the open parenthesis and Contact:ContactFile. 3 Insert the EXTRACT function. EXTRACT( ) appears in the map rule.
Chapter 5 - Using the EXTRACT Function Entering a Map Rule to Extract Specific Records The second argument of the EXTRACT function requires a condition. Our condition is whether a state is Florida. 7 To extract the contact records that have a state equal to Florida, enter ="FL" 8 The first ) closes the EXTRACT function. Type ) to complete the map rule. Note Map rule syntax requires a close parenthesis for every open parenthesis.
Chapter 5 - Using the EXTRACT Function 9 Entering a Map Rule to Extract Specific Records Press Enter to commit the map rule. With a floated Rule Bar, the map should look like this: 10 Build and run the map. 11 View the run results. The unique.txt input file and the FloridaContacts.txt output file are displayed in separate windows. Each label that was generated has the value FL for the State Field. Two records contain Florida addresses. 12 Save the Mail.mms map source file.
Chapter 5 - Using the EXTRACT Function Summary Summary The Mail.mms map source file now contains the FloridaLabels executable map. The FloridaLabels executable map was created as a copy of the ContactToFullLabel map. You changed the source of the input card. You defined a new target for the output card. You defined a map rule to extract the contact records for Florida addresses. The FloridaLabels.txt file was generated with two Florida addresses. Note Close all maps, type trees, and text files.
Chapter 6 - Using the OR Function with a Lookup File You need to generate labels for only the preferred customers in the address file. Objectives This exercise introduces creating type trees and the concept of creating a lookup file. By completing the exercises for Chapter 6, you will learn how to: ♦ Create a type tree that represents preferred customers. ♦ Change type properties in the Properties window. ♦ Use type inheritance for creating subtypes. ♦ Define group types as Explicit or Implicit.
Chapter 6 - Using the OR Function with a Lookup File Icon Files Used in this Chapter File type Name Description Map source file Mail.mms Map source file. Type tree Contact.mtt Type tree describing the contact data (input). Type tree Label.mtt Type tree describing the label data (output). Files You Create or Modify for Chapter 6 The following table describes the files that you create or modify while you perform the exercises for this chapter.
Chapter 6 - Using the OR Function with a Lookup File Icon Scenario File type Name Description Map build analysis results file *.mme Map build analysis results file generated from the build process. Map source options file *.mopt Map options file created automatically during the Save process. Backup type tree and map files *.bak Backup type tree files and map source files are created automatically during the Save process.
Chapter 6 - Using the OR Function with a Lookup File Using the Type Designer Using the Type Designer Create a type tree for the following lookup file of preferred customers. ABC Co./\35abc/\970322 Sand Inc./\529heu/\970912 Andromeda Co./\577ecc/\960506 The data structure of this lookup file must be defined in a type tree.
Chapter 6 - Using the OR Function with a Lookup File Creating the Preferred Type Tree first and define the common properties in the Field properties window. Then create the Company and ID types created as subtypes of Field. These types inherit the properties of Field. The PurchaseDate type can also be created as a subtype of Field, although the Item Subclass property must be Date. These item types have Class = Item, Partitioned = No, and the default Order subtypes = Ascending.
Chapter 6 - Using the OR Function with a Lookup File Creating the Preferred Type Tree The type tree window is displayed with a root type of ROOT. The ROOT type has a red icon, indicating ROOT is a category type. A category type is used for organizing other types in a type tree. The root category type of a type tree is named ROOT by default. You may change this name to any name suitable for your purpose.
Chapter 6 - Using the OR Function with a Lookup File Creating the Preferred Type Tree Next, create the group types. Generally, the order in which types are created does not matter. For this tutorial, however, please follow these steps. Create the group types Customer and PreferredFile. ♦ The Customer group type represents the contact records. ♦ The PreferredFile group type represents the file that contains these records. To create the Customer group type 1 From the Type menu, choose Add.
Chapter 6 - Using the OR Function with a Lookup File Creating the Preferred Type Tree Note You use the Properties window to view and change the type properties as required. 4 Change the Name of the type to Customer by typing it in the Name field. Note If the NewType1 name is selected in the type tree window, typing any other name replaces NewType1. 5 Change the Class to Group by selecting the Group class from the Class drop-down list. The confirmation dialog box appears.
Chapter 6 - Using the OR Function with a Lookup File Creating the Preferred Type Tree Creating the Field Item Types Create the Field item type and assign to it the properties that are common to all the field types. The other field types created as subtypes of Field automatically inherit these properties. To create the Field types 1 Add a new item type as a subtype of the Data root type. 2 Change the properties of the new type in the Properties window: ♦ Change the Name to Field.
Chapter 6 - Using the OR Function with a Lookup File Creating the Preferred Type Tree Defining the PurchaseDate Item Properties The Item Subclass of PurchaseDate item type must be changed to Date & Time. The Format for the Date & Time must be changed to {YYMMDD}. To change the Item Subclass of PurchaseDate 1 Display the PurchaseDate item type properties. 2 For the Item Subclass property, select Date & Time.
Chapter 6 - Using the OR Function with a Lookup File 2 For the Date format select YYMMDD. 3 Click OK. Creating the Preferred Type Tree Defining the Customer Group Type The Customer group type requires the definition of components and changes to properties in the Properties window. The Customer group type contains the records. ♦ The item types that represent the records must be defined as components of the Customer group type.
Chapter 6 - Using the OR Function with a Lookup File Creating the Preferred Type Tree 2 Drag the components from the type tree window to the Customer group window. 3 Arrange the components of Customer Data in the order they appear in the data: Company Field, ID Field, and then PurchaseDate Field. 4 Close and save the Customer group window. To define the terminator of each record 1 Display the Customer group type properties. 2 For the Type Syntax > Terminator property, select Literal.
Chapter 6 - Using the OR Function with a Lookup File 6 Click OK. The Terminator > Value = .
Chapter 6 - Using the OR Function with a Lookup File Creating the Preferred Type Tree To define the delimiter between record fields 1 For the Component Syntax property, select Delimited. 2 For the Delimiter property, select Literal. 3 For the Delimiter > Value, enter the literal forward and backward slashes /\. Note The literal delimiter text does not require quotation marks.
Chapter 6 - Using the OR Function with a Lookup File Creating the Preferred Type Tree Defining the PreferredFile Group Type The PreferredFile group type represents the file of records. The Customer group type represents the records within the file. ♦ The Customer group type must be defined as a component of the PreferredFile group type. The number of records is unknown; therefore the range of records must be defined as some unknown number (s).
Chapter 6 - Using the OR Function with a Lookup File Creating the Preferred Type Tree To define the Customer group component range 1 Right-click the Customer group type in the PreferredFile group window and select Set Range from the context menu. 2 Set the range with a minimum of 0 and a maximum of s.
Chapter 6 - Using the OR Function with a Lookup File 3 MakePreferredData Map Click OK. The range (s) appears after the Customer component name. 4 Close and save the PreferredFile group window. Saving and Analyzing the Preferred Type Tree You must analyze and save the type tree after you have: ♦ Created the Preferred.mtt type tree. ♦ Defined the types. ♦ Defined the containment of the types with the group windows. MakePreferredData Map You have created the Preferred.
Chapter 6 - Using the OR Function with a Lookup File MakePreferredData Map Creating the PreferredFile Output Card The Schema of the card defines the CardName, TypeTree, and Type. The Target and Target > FilePath define the output generated by this card. ♦ Create an output card named PreferredFile to represent the PreferredFile data object. ♦ Define the output of this card as a text file named lookup.txt.
Chapter 6 - Using the OR Function with a Lookup File MakePreferredData Map To generate a specific number of occurrences of the Customer group type, you can index Customer on the output card. When indexed, the object name on the output card refers to a particular occurrence of that data object. The index of the occurrence appears in square brackets immediately after its name. After you have indexed an item output, you can enter a map rule for it.
Chapter 6 - Using the OR Function with a Lookup File MakePreferredData Map To enter the literal map rules 1 For the Company Field component of Customer, enter the literal company names enclosed in quotation marks. 2 For the ID Field component, enter the literal text enclosed in quotation marks. 3 For the PurchaseDate Field, you must enter the literal text for the date and convert this to a date time format using the TODATETIME function (detailed instructions on page 145).
Chapter 6 - Using the OR Function with a Lookup File 2 MakePreferredData Map In the parentheses, enter: ♦ The text_to_convert ♦ A comma (,) ♦ The date_time_format_string enclosed in quotation marks " " The map rule for the first occurrence of the PurchaseDate Field is: =TODATETIME ("010322","yymmdd") Generating Customer[2] and Customer[3] Output The text literals must be entered in the map rules for the second and third occurrence of Customer.
Chapter 6 - Using the OR Function with a Lookup File Extracting Contacts that are Preferred Building and Running the MakePreferredData Map ♦ Build and run the MakePreferredData map. ♦ View the run results. The lookup.txt output file is displayed. Extracting Contacts that are Preferred The ContactToFullLabel map generates the full list of customer records. ♦ Add an input card to the ContactToFullLabel map with the lookup.txt file as the data source. ! The CardName should describe the input.
Chapter 6 - Using the OR Function with a Lookup File Extracting Contacts that are Preferred In this case, you want to test if the Company Field in the Contact group (which is a component of ContactFile) is equal to the Company Field in the Customer group (a component of LookupFile). Your map rule should look like this: Note To view help on any function, place current focus on that function in the Insert Function dialog box and press F1.
Chapter 6 - Using the OR Function with a Lookup File Summary The run results of the modified ContactToFullLabel map show two input files (FullContact.txt and lookup.txt) and one output file (PreferredLabels.txt). Note Close all maps, type trees, and text files. Summary You created the MakePreferredData map to generate the lookup.txt file. You modified the ContactToFullLabel map by adding an input card to use the preferred.txt, changing the filename of the output file.
Chapter 7 - Using Cross-Referenced Data This chapter explains how to decide which function to use when cross-referencing data, and how to use that function. A map example using each of these functions is provided. Objectives This chapter defines how to cross-reference data from another source and incorporate it into the output. By completing the exercises for Chapter 7, you will learn how to: ♦ Create group types to represent records. ♦ Create group types to represent files of records.
Chapter 7 - Using Cross-Referenced Data Files Used in this Chapter Files Used in this Chapter You will be working in the c:\mercator\tutorial\MyFolder\Ch07 folder. Files Provided for Chapter 7 The following table describes the files provided for this chapter. Use the files provided in Ch07.zip. Icon File type Name Description Text file Region.txt Cross-reference data file containing a list of zip codes and the region to which each belongs. Text file Region_desc.
Chapter 7 - Using Cross-Referenced Data Files Used in this Chapter Files You Create or Modify for Chapter 7 The following table describes the files that you create or modify while you perform the exercises for this chapter. Icon File type Name Description Map source file Customer.mms Map source file containing the RegionReport map that creates a file of sales records. Compiled map file CreateRegionFile.mmc Compiled map file that generates a file of zip codes and regions. Text file Region.
Chapter 7 - Using Cross-Referenced Data Icon Files Used in this Chapter File type Name Description Compiled map file RegionReport_ SEARCHUP.mmc [Optional] Compiled map file that generates a region report file of customer contacts, company name, and region. Text file RegionReportUP.txt Output data file produced by the RegionReport_SEARCHUP map. Compiled map file RegionReport_ SEARCHDOWN.mmc Compiled map file that generates a region report file of customer contacts, company name, and region.
Chapter 7 - Using Cross-Referenced Data Scenario Scenario You have the unique.txt file of unique contacts. This data is not in any particular sequence. The geographical region information is not contained in this input file. You need to generate a cross-reference region.txt file that contains records identifying the name of each customer contact, their company, and their geographical region. You need to generate the regionreport.txt file that contains the contact name, company name, and the region.
Chapter 7 - Using Cross-Referenced Data Modifying the Customer.mtt Type Tree Field Item Types The item types for the fields have already been created for you in Customer.mtt. Region Data The data is a file you will generate as an output of the Customer map. You want to generate the region.txt file to contain the zip code and the region for each record. This data file is delimited with two spaces between fields.
Chapter 7 - Using Cross-Referenced Data Modifying the Customer.mtt Type Tree ♦ The location of the delimiter in the region.txt file is between the data objects, therefore the Delimiter > Location = Infix. An infix delimiter appears between each component.
Chapter 7 - Using Cross-Referenced Data Modifying the Customer.mtt Type Tree Components of Record Define ZipCode Field and Region Field as components of Record. RegionRecordsFile Group Type Represents the File Create a group type to represent the file that contains the region records. Name the group type RegionRecordsFile. Properties of RegionRecordsFile Define the properties of RegionRecordsFile. The RegionRecordsFile group type has a Format of Implicit.
Chapter 7 - Using Cross-Referenced Data Output Types Component of RegionRecordsFile Define the Record group type as a component or RegionRecordsFile. Define the component range of Record. It is unknown how many records are in the data. Save the Customer.mtt Type Tree Save the changes to properties and components for the Record and RegionRecordsFile group types. Analyze and save the Customer.mtt type tree. Output Types You need to generate an output file that consists of sales records.
Chapter 7 - Using Cross-Referenced Data Using the Map Designer to Generate Region Reports Each sales record contains the contact person, the company name, and the region. ♦ The Contact Field, Company Field, and Region Field item types represent these fields in each sales record. ! Analyze and save the type tree. Using the Map Designer to Generate Region Reports Create the Customer.
Chapter 7 - Using Cross-Referenced Data Using the Map Designer to Generate Region Reports Creating the CreateRegionFile Map Create the CreateRegionFile executable map to generate the region.txt input data: 60525 60089 33321 60012 19444 44444 North West South North West South ♦ The CreateRegionFile map has no input card. ♦ The CreateRegionFile map has a single output card. ! Name the ouput card RegionFile. ! Enter map rules in the output card to generate the region.txt data file.
Chapter 7 - Using Cross-Referenced Data Using the Map Designer to Generate Region Reports ♦ Generate no output for the last object on the card. ♦ Build and run this map to generate the region.txt output file. ♦ Save the CreateRegionFile map.
Chapter 7 - Using Cross-Referenced Data Creating the RegionReport Map Creating the RegionReport Map Create an executable map called RegionReport to generate the regionreport.txt output file. The regionreport.txt file will contain customer records where each record contains the customer contact and the region. ♦ Define the unique.txt contact file as the data source for input card #1. ♦ Define the region.txt lookup file as the data source for input card #2.
Chapter 7 - Using Cross-Referenced Data Creating the F_MakeSalesRecord Functional Map The map rule for the SalesRecord object on the output card is: =F_MakesSalesRecord (Contact:ContactFile, LOOKUP (Record:RegionLookupFile, ZipCode Field:Record:RegionLookupFile = ZipCode Field:Contact:ContactFile )) Using the Functional Map Wizard Use the Functional Map Wizard to create the F_MakeSalesRecord functional map to use two data sources.
Chapter 7 - Using Cross-Referenced Data Creating the F_MakeSalesRecord Functional Map 4 [Optional] In the Functional Map Wizard dialog box, edit the card names to provide meaningful names. 5 Click Create to build the F_MakeSalesRecord functional map. 6 Click Close. Modify the F_MakeSalesRecord Functional Map The functional map wizard creates the F_MakeSalesRecord functional map but does not enter the map rules on the output card.
Chapter 7 - Using Cross-Referenced Data Generating the Output of SalesRecord ♦ Map Region Field from the LookupRecord input card #2 to Region Field on the SalesRecord output card. Generating the Output of SalesRecord Build and run the RegionReport map to generate the regionreport.txt output file, which contains the contact name, company name, and the region.
Chapter 7 - Using Cross-Referenced Data Using the SORTDOWN Function Using the SORTDOWN Function The SORTDOWN function returns a series containing the values from an input series in descending order. The syntax of the SORTDOWN function is: SORTDOWN (item_series_to_sort) The item_series_to_sort is the record containing the zip code and region. Creating the SortRegion_Descending Map ♦ Create the SortRegion_Descending executable map in the Customer.mms map source file.
Chapter 7 - Using Cross-Referenced Data Creating the SortRegion_Descending Map ♦ Copy the new RegionLookupFile input card #1 to an output card in the same RegionReport map. Name the new output card SortRegionLookupFile. ♦ Define the SortRegionLookupFile output card to generate the region_desc.txt file.
Chapter 7 - Using Cross-Referenced Data Optional Exercise Build and run the SortRegion_Descending map. The run results are sorted in descending order. Optional Exercise Create a SortRegion_Ascending map and use the SORTUP function to generate results in ascending order. Use the region_asc.txt file as the data source of the input card. Using the SEARCHUP Function Use the SEARCHUP function when the cross-reference file is in ascending order.
Chapter 7 - Using Cross-Referenced Data Creating the RegionReport_SEARCHUP Map Creating the RegionReport_SEARCHUP Map ♦ Copy the RegionReport executable map in the Customer.mms map source file to create the new RegionReport_SEARCHUP executable map. ♦ Modify the input card #2 RegionLookupFile to use the region_asc.txt as the data source.
Chapter 7 - Using Cross-Referenced Data Creating the RegionReport_SEARCHUP Map Optional Exercise ♦ Copy the RegionReport executable map in the Customer.mms map source file to create the new RegionReport_SEARCHDOWN executable map. ♦ Modify the input card #2 RegionLookupFile to use the region_desc.txt as the data source. ♦ Modify the map rule that calls the functional map to use the SEARCHDOWN function instead of LOOKUP function. ♦ Modify the output card to generate the RegionReportDOWN.txt.
Chapter 8 - Using the CHOOSE Function This chapter explains how to decide which function to use when cross-referencing data, and how to use that function. A map example using each of these functions is provided. Objectives This chapter defines how to locate an object in a certain position in a series. By completing the exercises for Chapter 8, you will learn how to: ♦ Use the CHOOSE function to locate an object in a certain position in a series.
Chapter 8 - Using the CHOOSE Function Files Used in this Chapter Files You Create or Modify for Chapter 8 The following table describes the files that you create or modify while you perform the exercises for this chapter. Icon File type Name Description Type tree Raffle.mtt Type tree describing the winner data (input), the prize data (input) and the congratulation data (output). Map source file Raffle.
Chapter 8 - Using the CHOOSE Function Scenario Copies of the files created during the exercises are provided for all chapters in the Tutorials\Solutions folder. The structure and use of these files is described in the Design Studio Tutorial Solutions section on page 18. Scenario You have the results of a raffle drawing. The winners.txt file lists the winners in the raffle. The first person in the file won first place, the second person won second place, and so on. The winners.
Chapter 8 - Using the CHOOSE Function Raffle.mtt Type Tree The syntax of the CHOOSE function is: CHOOSE (from_these_objects, pick_the_nth_one) The CHOOSE function has two arguments and selects an object from a series. ♦ The first argument is the series of prize objects to choose from: from_these_objects ♦ The second argument is the index number of the object chosen: pick_the_nth_one Raffle.mtt Type Tree Open the Raffle.
Chapter 8 - Using the CHOOSE Function Raffle.mtt Type Tree PrizeRecord Group Type The PrizeFile group type represents the data file prizes.txt. ♦ Create the PrizeRecord group type to represent the data in the prizes.txt file. ♦ Define the components of PrizeRecord. The contents of the prizes.txt file show that two components are required: Prize and Place. The Prize Field and Place Field item types exist in the Raffle.mtt.
Chapter 8 - Using the CHOOSE Function Raffle.mtt Type Tree WinnerFile Group Type ♦ Define the WinnerFile group type to represent the winners.txt data. ♦ Define the Winner item type as a component of WinnerFile. ♦ Define the component range of Winner. CongratulationsRecord Group Type ♦ Create the CongratulationsRecord group type to represent the congratulations message.
Chapter 8 - Using the CHOOSE Function Raffle.mtt Type Tree ♦ Define the components of the CongratulationsRecord group type. There is text, the winner's name, more text, and the prize won. CongratulationsFile Group Type ♦ Create the CongratulationsFile group type to represent the file. ♦ Define CongratulationsRecord as a component of CongratulationsFile. ♦ Define the component range of the CongratulationsRecord group type.
Chapter 8 - Using the CHOOSE Function Raffle Map Raffle Map Create a map source file called Raffle that uses the prizes and winner files as inputs. Create the RaffleCongrats executable map to use two input cards. Sources for these cards are: ♦ The source of input card #1 PrizesFile is the prizes.txt input data file that contains a list of the prizes for each place. ♦ The source of input card #2 WinnersFile is the winners.
Chapter 8 - Using the CHOOSE Function Summary Use the Functional Map Wizard to create the F_Congratulate functional map. For the map rules on the F_Congratulate functional map enter the text literals that compose the congratulations message. Remember to include the punctuation as text literals. Build and run the RaffleCongrats executable map. The results show that each winner is matched with a prize. Note Close all maps, type trees, and text files.
Chapter 9 - Data Breaks by Object Count Physical characteristics of data include delimiters and established values of fixed length objects. These physical characteristics are used to determine where data objects begin and end. If the data has delimiters or is of a fixed length, these characteristics can be defined in the type properties in the Type Designer. If data is not of fixed length or it does not contain delimiters, other methods are required to define a break in the data.
Chapter 9 - Data Breaks by Object Count Files Used in this Chapter Files Used in this Chapter You will be working in the c:\mercator\tutorial\MyFolder\Ch09 folder. Files Provided for Chapter 9 The following table describes the files provided for this chapter. Use the files provided in Ch09.zip. Icon File type Name Description Text file Address.txt Input data file containing multiple contacts. Type tree Address.mtt Type tree describing the contact and label data.
Chapter 9 - Data Breaks by Object Count Icon Files Used in this Chapter File type Name Description Compiled map file CompanyMap.mmc Compiled map generated from the CompanyMap executable map in the Company.mms map source file. Type tree analysis message file *.dbe Type analysis message generated from the type tree analysis. Map build analysis results file *.mme Map build analysis results file generated from the build process. Map source options file *.
Chapter 9 - Data Breaks by Object Count Scenario – Counting Objects Scenario – Counting Objects A break in the data pattern can be recognized when the count of a certain object reaches a specific value. You have a set of four contact records that need to be mapped to a single record. As shown in the illustration, the AddressFile data source contains multiple ContactSets. Each ContactSet contains four Contacts. The CompanyFile data target contains multiple Records.
Chapter 9 - Data Breaks by Object Count Merging the Contact Group Type Merging the Contact Group Type In the address.mtt type tree, merge the Contact group type to create a new type tree. The components of the Contact group type are copied as a function of the merge command. Using the Merge Type command instead of the Copy Type command excludes types that are not needed. This includes types such as Label, LabelFile, and so on. To merge the Contact group type to a new tree 1 Open the address.
Chapter 9 - Data Breaks by Object Count Merging the Contact Group Type 4 Select Contact in address.mtt. 5 Select Type > Merge and click in the Address2.mtt type tree window. In the Merge Type dialog box, the To tree field displays Address2.mtt. 6 Click Merge. 7 Click Close. The new Address2.mtt type tree now contains only the Contact object and the fields that are its components. 8 Close address.mtt.
Chapter 9 - Data Breaks by Object Count 9 Merging the Contact Group Type In the Address2.mtt, create two new group types ContactSet and NewContactFile as sequence group types with an implicit format and no syntax. 10 Add the Contact group type as a component to ContactSet. 11 Define a component range for Contact.
Chapter 9 - Data Breaks by Object Count Merging the Contact Group Type 12 Add the ContactSet group type as a component to the NewContactFile group type. 13 Define a component range for ContactSet. Adding a Component Rule Add a component rule on the Contact component of ContactSet(s) to ensure that a ContactSet contains up to four Contacts. Use the COUNT function on the Contact group type.
Chapter 9 - Data Breaks by Object Count Merging the Contact Group Type If the number of Contacts in the file is not divisible by four, the last Contacts are still considered a ContactSet, because the component rule allows for sets with less than four. To enter the component rule, use the Insert Function command to insert the COUNT function, use the ($) shorthand notation for the current object, enter the less than and equal sign operators (<=), and the count value of 4.
Chapter 9 - Data Breaks by Object Count Merging the Contact Group Type 3 Enter the ($) shorthand notation to indicate the objects_to_count are the Contact records. 4 Enter the less than and equal sign operators (<=) and the count value of 4. This diagram illustrates how the transformation server behaves as it proceeds through the data: The output type CompanyFile consists of Record(s). A Record consists of four Company fields. ♦ Create the CompanyFile group and add Record as a component.
Chapter 9 - Data Breaks by Object Count Merging the Contact Group Type In the output data, Record has an explicit, fixed format. Each Record contains the same number of characters of data. In the output data, each Company field in Record is padded to take up a fixed size of 25 characters. To account for this use of Company Field, some changes need to be made to its type definition by defining a pad character.
Chapter 9 - Data Breaks by Object Count Merging the Contact Group Type When Company Field is used in Contact (a delimited group) it will be of a variable length according to the data it contains.
Chapter 9 - Data Breaks by Object Count Using the Map Designer Using the Map Designer Map the file of ContactSet(s) to the company file of Record(s). Within each Record, there are four Company fields. Create the Company.mms map source file. Create the CompanyMap executable map. The ContactFile input card uses the new Address2.mtt type tree and the NewContactFile Data type. The input file is the address.txt file.
Chapter 9 - Data Breaks by Object Count Using the Map Designer The CompanyFile output card specifies the CompanyFile Data type in the Address2.mtt type tree and generates the company.txt file. Enter the map rule for the Record data object on the CompanyFile output card to specify generation of the F_RecordMap function map. Use the Functional Map Wizard to generate the F_RecordMap function map.
Chapter 9 - Data Breaks by Object Count Tip Using the Map Designer The Navigator window shown below and the Rule Bar shown previously are floated. Right-click in the area under the title bar as shown to dock or float the Navigator or Rule Bar window. In the F_RecordMap function map, the Company field of each Contact is mapped to the Company field in the Record. Build and run the map. Note that each Record in the output file consists of four Company fields from the input.
Chapter 9 - Data Breaks by Object Count Summary Summary You learned how to count objects to determine breaks in the data.
Chapter 10 - Data Break by Value Breaks in data can be determined when the value of a certain item changes. A break in the data pattern can be recognized when the value of a certain item type changes. This change in the value of a certain field determines the end of one object and the beginning of the next object. Objectives The input file contains a specific number of purchase orders. You want to generate a file that contains a field that gives the count of the purchase orders in the input file.
Chapter 10 - Data Break by Value Files Used in this Chapter Files Used in this Chapter You will be working in the c:\mercator\tutorial\MyFolder\Ch10 folder. Files Provided for Chapter 10 The following table describes the files provided for this chapter. Use the files provided in Ch10.zip. Icon File type Name Description Text file cntrl.txt Input data file containing multiple purchase order records. Type tree control.mtt Type tree describing the purchase order data.
Chapter 10 - Data Break by Value Icon Scenario - Data Value Changes File type Name Description Map build analysis results file *.mme Map build analysis results file generated from the build process. Map source options file *.mopt Map options file created automatically during the Save process. Backup type tree and map files *.bak Backup type tree files and map source files are created automatically during the Save process.
Chapter 10 - Data Break by Value Control.mtt Type Tree In the data, each line item record contains a PO number (item type PO#), a quantity (item type Quantity), item description (item type Item), and price (item type Price) field: P P 12345 12345 12345 14478 14478 500 1000 300 275 500 dress pants suit pants suit 065.99 032.50 200.70 032.50 200.70 Control.mtt Type Tree The Control.mtt type tree is not defined to recognize the distinguishability of the PO data object. Open and analyze the Control.
Chapter 10 - Data Break by Value Control.mtt Type Tree The purchase order is decribed by the PO group type. We know that one purchase PO can be distinguished from the next purchase order PO by the value of the purchase order number. Adding a Component Rule for Distinguishability Add a component rule to bind together, into a single PO, all of the records (group type Record) that have the same value in the PO# Field.
Chapter 10 - Data Break by Value Control.mtt Type Tree 5 Press Alt and drag the Record group type from the type tree window into the component rule. 6 Enter a space, an equal sign (=), and another space. 7 Drag the PO# Field item type as a component of the Record item type. 8 Enter the index value [LAST]. 9 Press Enter to commit the component rule. Note Shading in a component rule that is under construction is an indication of syntax error.
Chapter 10 - Data Break by Value Control.mtt Type Tree Using Shorthand Notation in a Component Rule For the Record component rule, you can also use shorthand notation. To use shorthand notation 1 Substitute $ for the Record object name in the component rule. Analyze and save the type tree. Data Handling The first record is processed and the component rule is validated as true or false. Note The index value [LAST] is interpreted as [1] when no previous occurrences exist. In the ctrl.
Chapter 10 - Data Break by Value Creating the MakeCountFile Map The second record is then processed: Is PO# Field:Record[2] = PO# Field:Record[LAST]? Is 12345 = 12345? Yes The following diagram shows how the component rule is evaluated for the first four records in the data. As a result, the first three records are determined to make up a single PO. Creating the MakeCountFile Map Create the Control.mms map source file. Create the MakeCountFile executable map.
Chapter 10 - Data Break by Value Summary For the output card, enter a map rule on the #POs data object. Use the COUNT function to count the purchase orders (PO) in the input file. You want the map to generate a file that contains just one field that gives the count of the purchase orders in the input file. Build and run the MakeCountFile map. View the run results. The content of the countpo.txt indicates there are two (2) purchase orders. Note Close all maps, type trees, and text files.
Chapter 11 - Partitioning Types to Simplify Map Rules This chapter defines how to partition types to simplify map rules. Partitioning is a method of subdividing data objects into mutually exclusive subtypes. Data that can be divided into mutually exclusive subtypes can be partitioned. Partitioning is required when components are randomly or partially ordered. You may decide to use partitioning in a type tree to build additional logic into the definition of the data.
Chapter 11 - Partitioning Types to Simplify Map Rules Files Used in this Chapter Files Used in this Chapter You will be working in the c:\mercator\tutorial\MyFolder\Ch11 folder. Use the files provided in Ch11.zip. Files Provided for Chapter 11 The following table describes the files provided for this chapter. Icon File type Name Description Text file Deliver.txt Input data file multiple records of different types – Invoice, Forecast, and PO. Type tree Deliver.
Chapter 11 - Partitioning Types to Simplify Map Rules Files Used in this Chapter Files You Create or Modify for Chapter 11 The following table describes the files that you create or modify while you perform the exercises for this chapter. Icon File type Name Description Text file Acct.txt Output data file for accounting that contains the invoice records in the input data. Text file Order.
Chapter 11 - Partitioning Types to Simplify Map Rules Icon Scenario File type Name Description Map source options file *.mopt Map options file created automatically during the Save process. Backup type tree and map files *.bak Backup type tree files and map source files are created automatically during the Save process. Copies of the files created during the exercises are provided for all chapters in the Tutorials\Solutions folder.
Chapter 11 - Partitioning Types to Simplify Map Rules Scenario Partitioned Type Names The names of partitioned data objects may appear in map rules and component rules. Type names separated by a colon (:) indicate a component relationship. As seen in a map rule or component rule: Qualifier Field:ACME indicates Qualifier Field is a component of the ACME group type. Type names separated by angle brackets (<>) indicate a partition relationship.
Chapter 11 - Partitioning Types to Simplify Map Rules Deliver.mtt Type tree Deliver.mtt Type tree The type tree deliver.mtt defines both the input and output data. The Record group type has three partitions: ♦ Forecast ♦ Invoice ♦ PO The Forecast and PO group types are also partitioned.
Chapter 11 - Partitioning Types to Simplify Map Rules Deliver.mtt Type tree Assigning the Identifier Attribute To determine the type of record, assign the identifier attribute to the ApplicationID component. The identifier attribute is assigned to a component of a group in the group window in the Type Designer. The identifier attribute identifies the components that can be used to identify the type to which a data object belongs.
Chapter 11 - Partitioning Types to Simplify Map Rules Deliver.mtt Type tree Entering Component Rules Enter a component rule to define the ApplicationID Field component of the Partner partition as a forecast (F), purchase order (P), or invoice record (I). Use quotation marks (") to indicate the literal values of F, P, or I. Use the shorthand notation of $ to indicate the current object (ApplicationID Field).
Chapter 11 - Partitioning Types to Simplify Map Rules Deliver.mtt Type tree On the next level of partitioning, the types can be distinguished by the first component. For example, the first component of a Distributor Forecast record is Distributor Partner, and the first component of a Customer Forecast record is Customer Partner.
Chapter 11 - Partitioning Types to Simplify Map Rules Deliver.mtt Type tree The components of the Record types are defined as shown: The Partner group type is the first component of each record. It is partitioned by Customer, Distributor, and Supplier, and then by specific companies. The component rules on each company’s partner type provide the values for each field. The component rule makes ACME customer record distinguishable from the Bob record.
Chapter 11 - Partitioning Types to Simplify Map Rules Viewing Component Numbers Viewing Component Numbers By default, component numbers do not display in the group window in the Type Designer. When the Show component number option is enabled, a sequential component number displays in the group window. This component number is especially useful for viewing nested components. Use the Tools > Options dialog box to configure the display of the group window.
Chapter 11 - Partitioning Types to Simplify Map Rules Viewing Component Numbers Distributor Partner has two partitions: FastSheets and OHLA. In the Distributor Partner Data group window, the Qualifier Field is component 1 and PartnerID Field is component 2.
Chapter 11 - Partitioning Types to Simplify Map Rules Viewing Component Numbers In the Distributor Forecast Record Data group window, when Distributor Partner is expanded, the nested component numbers are shown. To view component numbers in the group window 1 From the Tools menu, choose Options. The Options dialog box appears. 2 Select Group Window. The group windows options appear. 3 Enable the Show component number check box. 4 Click OK.
Chapter 11 - Partitioning Types to Simplify Map Rules Deliver Map Source File Deliver Map Source File You need to create the Deliver.mms map source file to contain two executable maps: ♦ OrdersByDept ♦ ActivityReport Create the Deliver.mms map source file. OrdersByDept Executable Map The OrdersByDept map uses one data source (deliver.txt) and generates two output files (acct.txt and order.txt). ♦ Create the OrdersByDept map in the Deliver.mss map source file. ♦ Use the Deliver.mtt type tree.
Chapter 11 - Partitioning Types to Simplify Map Rules Deliver Map Source File Generating the Acct.txt File Name the first output card Accounting. To generate the records in the Accounting output, map the Invoice records from the input. The input Record is the same as the output Record, which is partitioned. ♦ Drag the Invoice type from the input card to the rule cell for Record on the output card.
Chapter 11 - Partitioning Types to Simplify Map Rules Deliver Map Source File ♦ The type name appears in the rule cell with the partition (<>) and component (:) separators: =Invoice<>Record:Collection.
Chapter 11 - Partitioning Types to Simplify Map Rules Deliver Map Source File Generating the Order.txt File Name the second output card OrderEntry. To generate the records for the OrderEntry output, you want Forecast records and PO records. You do not want Invoice records. ♦ Drag Forecast records from the input card to the rule cell for Forecast on the output card. ♦ Do the same for PO. ♦ In this file, Invoice records are not desired, so enter =NONE in that rule cell.
Chapter 11 - Partitioning Types to Simplify Map Rules Deliver Map Source File ActivityReport Executable Map The executable map ActivityReport uses the same input file and generates the Report.txt file that contains an activity report with statistics about the records in the input data. ♦ Create the ActivityReport map in the Deliver.mss map source file. ♦ Use the Deliver.mtt type tree. The input data source is the same - the deliver.txt file. Name the output card Report.
Chapter 11 - Partitioning Types to Simplify Map Rules Deliver Map Source File ♦ Use the COUNT function to count the following records: #CustomerPOs =COUNT ( Customer<>PO<>Record:Collection ) #CustomerForecasts =COUNT ( Customer<>Forecast<>Record:Collection ) #DistributorPOs =COUNT ( Distributor<>PO<>Record: Collection ) #DistributorForecasts =COUNT ( Distributor<>Forecast<>Record:Collection ) #SupplierInvoice =COUNT ( Invoice<>Record:Collection ) For the %CustomerPOs and %DistributorPOs data obj
Chapter 11 - Partitioning Types to Simplify Map Rules Deliver Map Source File The Report output card should look like: Build and run the ActivityReport map to generate The Report.txt contains statistics about the records in the input data. Note Close all maps, type trees, and text files.
Chapter 11 - Partitioning Types to Simplify Map Rules Summary Summary In the Deliver.mtt type tree, the record types are partitioned for six different types of records: You used two executable maps to generate three output files. You used arithmatic operators with data objects to calcuate percentages.
Chapter 12 - Mapping Optional Inputs Some data objects are not always present in the input file. Objectives This exercise maps optional input data objects. By completing the exercises for Chapter 12, you will learn how to: ♦ Map optional inputs. ♦ Use category types to organize related types. Files Used in this Chapter You will be working in the c:\mercator\tutorial\MyFolder\Ch12 folder. Files Provided for Chapter 12 The following table describes the files provided for this chapter.
Chapter 12 - Mapping Optional Inputs Files Used in this Chapter Files You Create or Modify for Chapter 12 The following table describes the files that you create or modify while you perform the exercises for this chapter. Icon File type Name Description Text file Output.txt Output data file that holds records for each state containing the state ID and the population for that state. Map source file States.
Chapter 12 - Mapping Optional Inputs Scenario Scenario A data file of statistics on states in the United States may include population density, median household income, average summer temperature, average winter temperature, and average yearly rainfall. You need to generate a file that contains only the population statistics. Input Data The input data is provided in the Sts.txt file.
Chapter 12 - Mapping Optional Inputs States.mtt Type Tree You need to generate an output file that consists of a series of StatePops, each containing a StateID and the state Population. OH,257*IL,196* States.mtt Type Tree The States.mtt type tree is provided. Note the Input, Output and Statistic category types organize related types. Item and group types are subtypes of the category types.
Chapter 12 - Mapping Optional Inputs Component Ranges The Region Input Data group type is a component of UnitedStates Input Data. Define the component range to indicate some unknown number of files. The Region Input Data group type components are: ♦ The RegionID item type. ♦ The State group type. The number of states is unknown. Define the component range of State. The components of the State group type are: ♦ The StateID item type. ♦ The Human group type. ♦ The Weather group type.
Chapter 12 - Mapping Optional Inputs Component Ranges The Human component of State is optional. Define the component range of (0:1) to indicate a minimum of zero occurrences and a maximum of one occurrence of this data. The components of the Human group type are also optional. Indicate these as optional components. In the input data, optional components may not be present.
Chapter 12 - Mapping Optional Inputs Component Ranges The Region Input Data is an Explicit group type. The colon (:) delimiter explicitly identifies the states within each region. The State group type is a component of Region Input Data.
Chapter 12 - Mapping Optional Inputs Component Ranges View the State type properties to see that fields within each state are delimited with a forward slash (/).
Chapter 12 - Mapping Optional Inputs Using the Map Designer The Human group type is a component of State. The components of Human are separated by a comma delimiter. Missing population statistics are indicated by the absence of Human data. Midwest:OH/257,3738/74,31,37:IL/,4285/76,26,33:IN/142,3687/75,29,39 Mountain:MT/5,3130/68,19,11:ID/8,2953/75,29,11:WY/3,3353/70,26,15 Plains:MN/48,3635/73,12,25:IA/,3549/74,20,33:MO/67,3458/78,32,35 Using the Map Designer Create the States map source file.
Chapter 12 - Mapping Optional Inputs Using the Map Designer The input for Master is the Sts.txt file, described in the type tree by the UnitedStates Input Data type. Name the input card USData. To generate each StatePop in the output, create the F_MapState functional map. The map rule to generate the StatePop group type specifies two input data objects: State and Population. Generate StateID only if StateID data is present in the input data.
Chapter 12 - Mapping Optional Inputs Summary For the F_MapState functional map, drag StateID and Population Statistic from the input card to create the map rules for StateID Input and Population Statistic Input data objects. The output.txt output file shows that a StatePop was not created for the states having no Population Statistic. For example, IL had no Population Statistic, and no IL data was created in the output. Summary You learned how to indicate optional input by using component ranges.
Chapter 13 - Mapping Multiple Files to One File This chapter defines how to map two input files into one output file. Objectives This chapter uses two input files to create one output file. By completing the exercises for Chapter 13, you will learn how to: ♦ Map two input files (one header and one detail file) into one output file. ♦ Use ellipses to shorten object names in component rules. ♦ Use nested functional maps.
Chapter 13 - Mapping Multiple Files to One File Scenario Files You Create or Modify for Chapter 13 The following table describes the files that you create or modify while you perform the exercises for this chapter. Icon File type Name Description Text file PO.txt Output data file that contains POs made up of a header record and multiple detail records. Map source file TwoFiles.mms Map source file containing the Executable map. Compiled map file CreatePO.
Chapter 13 - Mapping Multiple Files to One File Using Ellipses also have a detail file made up of detail records. The detail records include a purchase order number, an item ID, a quantity, and a unit price. You need to create an output file made up of purchase orders. Each PO has a header and a set of details. The Detail.txt detail input file is sorted to correspond with the data in the header file.
Chapter 13 - Mapping Multiple Files to One File To enable the Use ellipses option in the Type Designer 1 From the Tools menu, choose Options. 2 In the Options dialog box, select Group Window. 3 Enable the Use ellipses check box.
Chapter 13 - Mapping Multiple Files to One File TwoFiles.mtt Type Tree To enable the Use ellipses option in the Map Designer 1 From the Tools menu, choose Options. 2 In the Options dialog box, select Rule Bar. 3 Enable the Use ellipses check box. The Use Ellipses option does not affect object names that already exist in component or map rules; it only affects object names that are entered after the option is enabled. TwoFiles.
Chapter 13 - Mapping Multiple Files to One File TwoFiles.mtt Type Tree For the Detail Record component of DetailSet: ♦ Define the component range for Detail Record. ♦ Define the component rule for Detail Record: ! Use control-break logic to identify how the sets are organized: when the PO# changes, a new set begins. ! Use the index value [LAST] to refer to the occurrence of the last header record. ! Use $ shorthand notation to refer to the current Detail Record.
Chapter 13 - Mapping Multiple Files to One File TwoFiles.mtt Type Tree ♦ Because the number of records in the header file is some unknown number, in the Header File Input Data group window, define the component range of Header Record. Output PO The PO Output Data group type describes the PO.txt output file. There is one Header record and some unknown number of Detail records.
Chapter 13 - Mapping Multiple Files to One File Using the Map Designer Create the TwoFiles.mms map source file. Create the CreatePO executable map. CreatePO Input Both input files are defined in the TwoFiles.mtt type tree. ♦ Name input card #1 HeaderFile. ♦ The Type for input card #1 is Header File Input Data. ♦ Name input card #2 DetailSet. ♦ The Type for input card #2 is Detail File Input Data.
Chapter 13 - Mapping Multiple Files to One File Using the Map Designer Generating the CreatePO Output ♦ Name output card #1 POOutputFile. ♦ The Type for POOutputFile is File Output Data. ♦ Specify the creation of the F_MakePO functional map on the map rule for the PO data object. This functional map generates each PO in the output. The arguments to the F_MakePO functional map are a Header Record, and the corresponding DetailSet. Pick the DetailSet whose index matches the Header Record’s index.
Chapter 13 - Mapping Multiple Files to One File Using the Map Designer For the Header records in the F_MakePO functional map: ♦ Drag the corresponding input data object to create the map rule for Company Field. ♦ Use text literals to create the label for the PO numbers and drag the corresponding input data object to create the map rule for PO# Field. ♦ Drag the corresponding input data object to create the map rule for PODate Field.
Chapter 13 - Mapping Multiple Files to One File CreatePO Executable Map F_MakeDetail Functional Map ♦ Drag the corresponding input items to create the map rules for the detail Description and Qty output items. CreatePO Executable Map The CreatePO executable map uses two functional maps. The F_MakePO functional map creates the header record and calls the F_MakeDetail functional map that creates the corresponding detail records.
Chapter 13 - Mapping Multiple Files to One File Generating the PO.txt Output File Generating the PO.txt Output File Build and run the CreatePO executable map. The PO.txt file contains a header record for the associated detail records. Summary The two input files generated one output file. You used nested functional maps to use the corresponding detail and header records. In the functional map F_MakePO, the Header information in the output is mapped from the Header in the input.
Chapter 14 - Detail Records Not Sorted by PO In Chapter 13, the detail records in the Detail.txt file were in the same order as the corresponding header records in the Header.txt file. Your data may be in random order and not be sorted or organized into sets. Objectives This exercise associates randomly ordered detail records with the correct header record. By completing the exercises for Chapter 14, you will learn how to: ♦ Associate randomly sorted detail records with header records.
Chapter 14 - Detail Records Not Sorted by PO Icon Files Used in this Chapter File type Name Description Type tree TwoFiles.mtt Type tree describing the file of header records and the output data (file of purchase orders). Type tree RandomDetails.mtt Type tree describing the detail input data file (file of randomly sorted detail records). Files You Create or Modify for Chapter 14 The following table describes the files that you create or modify while you perform the exercises for this chapter.
Chapter 14 - Detail Records Not Sorted by PO Icon Scenario File type Name Description Text file PO2.txt Output data file of details and associated header records. Map source file RandomDetails.mms Map source file containing the RandomFiles executable map. Compiled map file RandomDetails.mmc Compiled map file that generates a list of PO from randomly ordered detail and header record input files. Type tree analysis message file *.
Chapter 14 - Detail Records Not Sorted by PO RandomDetails.mtt Type Tree Each header record includes a customer number, an account number, a purchase order number, and a date. You also have a detail file made up of detail records. The detail records include a purchase order number, an item ID, a quantity, and a unit price. You need to create an output file made up of purchase orders. Each PO has a header and a set of details. The detail file is not organized into sets of detail records.
Chapter 14 - Detail Records Not Sorted by PO RandomDetails Input Both input files are defined in the TwoFiles.mtt type tree. ♦ Name input card #1 HeaderFile. ♦ The Type for input card #1 is Header File Input Data. ♦ Name input card #2 DetailSet. ♦ The Type for input card #2 is Detail File Input Data.
Chapter 14 - Detail Records Not Sorted by PO Using the Map Designer Generating the RandomDetails Output ♦ Name the output card #1 POFile. ♦ The Type for the POFile output card is File Output Data. ♦ Specify the creation of the F_MakePO2 functional map on the map rule for the PO data object. The arguments to the F_MakePO2 functional map are a Header Record in a HeaderFile, and the DetailFile.
Chapter 14 - Detail Records Not Sorted by PO Using the Map Designer For the Detail records in the F_MakePO2 functional map: ♦ Use another functional map call and the EXTRACT function to create the F_MakeDetail2 functional map to extract a detail record from the detail file when the PO# of the detail record is equal to the PO# of the header record.
Chapter 14 - Detail Records Not Sorted by PO RandomDetails Executable Map RandomDetails Executable Map The RandomDetails executable map uses two functional maps. The F_MakePO2 functional map creates the header record and calls the F_MakeDetail2 functional map that extracts a detail record from the detail file when the purchase order number of the detail record is equal to the purchase order number of the header record. Generating the PO2.txt Output File Build and run the RandomDetails executable map.
Chapter 14 - Detail Records Not Sorted by PO Summary To close all the RandomDetails run results 1 Tip With current focus in the Navigator window on the RandomDetails executable map (map must be selected), from the Map menu, choose Close All Run Results. For quick command access, click run results) tools on the toolbar. (View run results) and click (Close all The position of the windows associated with map source files is stored in a mmsname.mopt file. The RandomDetails.
Chapter 15 - Creating a Trace File The trace file is a text file that records the progress during the execution of a map. You can choose to trace the input data, the output data or both. The trace file is a debugging aid used to diagnose invalid data or incorrect type definitions. Objectives This exercise creates a trace file that can be used for debugging purposes. By completing the exercises for Chapter 15, you will learn how to: ♦ Create a trace file.
Chapter 15 - Creating a Trace File Icon Files Used in this Chapter File type Name Description Type tree Math.mtt Type tree describing the output data. Map source file New_POS Map source file containing the Executable map. Files You Create or Modify for Chapter 15 The following table describes the files that you create or modify while you perform the exercises for this chapter. Icon File type Name Description Text file Output.txt Output data file of purchase orders.
Chapter 15 - Creating a Trace File Scenario Copies of the files created during the exercises are provided for all chapters in the Tutorials\Solutions folder. The structure and use of these files is described in the Design Studio Tutorial Solutions section on page 18. Scenario You want more information on your data validation.
Chapter 15 - Creating a Trace File Viewing the Trace File Creating a Trace File Turn on the trace file only for debugging purposes. The trace file can slow down execution. To create a trace file for the Executable map 1 Open the New_POS map source file. 2 Select the Executable map in the Navigator. 3 From the Map menu, choose Settings. 4 Right-click MapTrace and choose Expand All to view the map trace settings. 5 For the ContentTrace > Switch setting, choose ON. 6 Click OK.
Chapter 15 - Creating a Trace File Viewing the Trace File To view the trace file for the Executable map 1 Select the Executable map in the Navigator. 2 On the toolbar, click 3 Click the Trace tab on the Organizer window and size the window as needed. (Organizer) to view the Organizer window. The input data trace messages are at the beginning of the file.
Chapter 15 - Creating a Trace File Floating the Trace File in the Main Window Customer# Type Properties The properties of the Customer# item type describe the trace messages. If you view these properties, you will see that the length is 6, because Customer# is padded to a length of 6. Floating the Trace File in the Main Window The Trace tab on the Organizer window can be floated in the main window. This allows you to view other tabs on the Organizer window simultaneously.
Chapter 15 - Creating a Trace File Data Validation The Header.txt file is the source of input card #1 HeaderFile. The first data item in the Header.txt file is the customer number (in this case customer number 4500) as described by Customer# Field item type in the TwoFiles.mtt. The trace file message for customer number 4500 is: (Level 2: Offset 0, len 6, comp 1 of 4, #1, DI 00000001:) Data at offset 0 ('4500 ') was found to be of TYPE X'0008' (Customer# Field Data).
Chapter 15 - Creating a Trace File Data Validation Trace Message Description Offset 0 The offset of the data object in the data stream. No offset for Customer# Field Data. len 6 The length of the data object. Customer# Field Data has a size length of 6 bytes. comp 1 of 4 The component number. Customer# Field Data is the first of four components of the Header group type. #1 The index of the component. This is the first occurrence of Customer# Field Data.
Chapter 15 - Creating a Trace File Data Validation After all of the components of a group have been found, a message in the trace file indicates that the group itself was found. For example, the Header group type trace message: (Level 1: Offset 0, len 32, comp 1 of 1, #1, DI 00000005:) Data at offset 0 ('4500 kes11 1') was found to be of TYPE X'0006' (Header Record Input Data) indicates that the Header Record Input Data is valid.
Chapter 15 - Creating a Trace File Invalid Data Invalid Data When a data object does not match the definition of the type to which it presumably belongs, it could be invalid.
Chapter 16 - Exporting a Map Exporting a map source file enables you to store map definitions in xml format in a repository directory. The resulting xml file contains information on map settings, card settings, and map rules. Objectives This chapter exports the New_POS map source file. By completing the exercises for Chapter 16, you will learn how to: ♦ Export a map source file. Files Used in this Chapter You will be working in the c:\mercator\tutorial\MyFolder\Ch16 folder. Use the files provided in Ch16.
Chapter 16 - Exporting a Map XML Format for Maps and Map Rules Files You Create or Modify for Chapter 16 The following table describes the files that you create or modify while you perform the exercises for this chapter. Icon File type Name Description XML file New_POS.xml XML file generated with the Map > Export command that includes detailed information about the map. Copies of the files created during the exercises are provided for all chapters in the Tutorials\Solutions folder.
Chapter 16 - Exporting a Map 5 Exporting the New_PO Click OK. The resulting New_POS.xml file can be opened with a text editor. Note To view the exported xml file in a browser, you must use the mapsettings.dtd and the mms.dtd files provided in the install_dir\Examples\mapimportexport\dtd folder. XML DTD The mapsettings.dtd and the mms.dtd files are required to view the exported xml file in a browser. These *.dtd files are provided in the install_dir\Examples\mapimportexport\dtd folder.
Chapter 16 - Exporting a Map 6 Exporting the New_PO Click OK. The resulting New_POS.xml file can be opened with a browser. Viewing the Exported XML File The mapname.xml file generated with the Export command includes detailed information about the map: ♦ Map information and map settings ♦ Input card name and input card settings ♦ Output card name, output card settings, and map rules Exported Map Rules Exported map rules provide an xml text version of the map rules compiled in the exported map.
Chapter 16 - Exporting a Map Summary Exported Card Settings Exported card settings provide a text version of the card settings compiled in the exported map. Exported output card settings also contain map rules. The input card #1 Header exported card settings is shown here: header.
Chapter 17 - Importing a Map The xml files generated with the Map > Export command can be imported into the Map Designer to create a map source file. Objectives This chapter imports a map source xml file. By completing the exercises for Chapter 17, you will: ♦ Create a map source file from an xml file. Files Used in this Chapter You will be working in the c:\mercator\tutorial\MyFolder\Ch17 folder. Use the files provided in Ch17.zip.
Chapter 17 - Importing a Map Importing a Map Files You Create or Modify for Chapter 17 The following table describes the files that you create or modify while you perform the exercises for this chapter. The associated type trees are included with the solutions file to avoid errors when viewing the map source file. Icon File type Name Description Type tree TwoFiles.mtt Type tree describing the detail and header data. Type tree Math.mtt Type tree describing the output data.
Chapter 17 - Importing a Map 7 Summary Click Select. The Mercator Map Designer view confirmation dialog box appears. 8 Click No when prompted to view the map source file. The map is imported. Note To view the map source file, the associated type trees must be present where specified in the map cards. If the type trees are not in the directory specified in the map cards, errors occur. In this example, the type trees are defined to be in the same directory.
Chapter 18 - Mapping Invalid Data Invalid data can be rejected from the input data file by using the REJECT function. This rejected data can be then mapped to an error file to provide useful information that identifies errors in the input data. Objectives This chapter maps invalid data using the REJECT function. By completing the exercises for Chapter 18, you will view a working map that: ♦ Maps invalid data. ♦ Uses the restart attribute. ♦ Uses the REJECT function to create an error output file.
Chapter 18 - Mapping Invalid Data Icon Files Used in this Chapter File type Name Description Type tree CustomerErrors.mtt Type tree describing the output error data. Map source file MyCustomers.mms Map source file containing the MyCustomers map. Files You Create or Modify for Chapter 18 The following table describes the files that you create or modify while you perform the exercises for this chapter. Icon File type Name Description Text file Names.
Chapter 18 - Mapping Invalid Data Icon File type CustomerErrors.mtt Type Tree Name Description Map build analysis results file *.mme Map build analysis results file generated from the build process. Map source options file *.mopt Map options file created automatically during the Save process. Backup type tree and map files *.bak Backup type tree files and map source files are created automatically during the Save process.
Chapter 18 - Mapping Invalid Data Restart Attribute This BadData item type is used to map an invalid customer. The ErrorReport group type contains a Header and some unknown number of BadData items as components. Restart Attribute The restart attribute is used to identify valid data objects that contain objects in error. The restart attribute is assigned to components of group types in the Type Designer.
Chapter 18 - Mapping Invalid Data MyCustomers Executable Map The Customers.mms map source file contains the MyCustomers executable map. ♦ The input for MyCustomers map is the Names.txt file. ♦ The data object for the input card #1 ContactList is the ContactList Data type, which represents the Names.txt file of customers. The Customer component of ContactList has the restart attribute. MyCustomers Executable Map The MyCustomers map generates a summary file of customer information.
Chapter 18 - Mapping Invalid Data Generating the Error File Generating the Error File Build and run the MyCustomers map. View the run results. The Cust_Summary.txt file contains the summary information for all customers in the input file. The Errors.txt file contains the invalid customers.
Chapter 18 - Mapping Invalid Data Summary Summary Mapping invalid data provides mechanisms to identify and isolate invalid input data. Use the restart attribute to allow invalid data to be processed. Use the error functions to identify the invalid data. The Error Handling category on the Insert Function dialog box identifies the error handling functions you can use to map invalid data.
Chapter 19 - Incrementing Output Data Output objects can be incremented. There are three methods of incrementing the position of an output object. Objectives This chapter provides an overview of the three methods of incrementing the position of an output object. By completing the exercises for Chapter 19, you run maps that: ♦ Increment output objects using the INDEX function. ♦ Increment output objects using the COUNT function. ♦ Increment output objects using the index value [LAST].
Chapter 19 - Incrementing Output Data Icon Files Used in this Chapter File type Name Description Type tree Increment.mtt Type tree describing both files of the input data (file of header records and file of detail records) and the output data (file of purchase orders). Map source file Increment.mms Map source file containing the Executable map, which creates the output file based on the input data in the header file and detail file.
Chapter 19 - Incrementing Output Data Icon Scenario File type Name Description Compiled map file ExecutableUsingINDEX.mmc Compiled map file that generates the IndexedOutput.txt file. Text file IndexedOutput.txt Output data file that contains indexed purchase orders with a header record, multiple detail records, and a trailer record. Map build analysis results file *.mme Map build analysis results file generated from the build process. Map source options file *.
Chapter 19 - Incrementing Output Data Increment.mtt Type Tree Increment.mtt Type Tree The IndexOfPO item type is defined as an integer with a minimum size of 0 and no maximum size. The IndexOfPO item type is the last component of the Header group type.
Chapter 19 - Incrementing Output Data Using the INDEX Function The File Output Data group type contains the PO group type, whose components are the Header and the Detail group type (whose components are the fields in the output file): Using the INDEX Function The ExecutableUsingINDEX map uses INDEX function to index the output. On the OutputFile output card, the map rule for the PO group type calls the MakePO functional map.
Chapter 19 - Incrementing Output Data Using the COUNT Function MakePO Functional Map The map rule for the PO object specified three input items (details, headers, and purchase order); three input cards were created for the MakePO functional map. In the MakePO functional map, the card object for input card #3 Increment is the IndexOfPO item type. Build and run the ExecutableUsingINDEX executable map. In the IndexedOutput.
Chapter 19 - Incrementing Output Data Using the Index Value [LAST] When the first purchase order is created, the count of PO is 0, so 1 is added to 0 to make it 1. When the second purchase order is created, the count of PO is 1, so 1 is added to make it 2, and so on. The map rule uses the CHOOSE function for details, the INDEX function for headers, and the COUNT function for the purchase orders.
Chapter 20 - Creating a Validation Map Validation maps provide a method of confirming your input type definitions are accurate. Validation maps are used when you are developing type trees. Objectives This chapter provides an overview of creating a validation map. By completing the exercises for Chapter 20, you will learn to: ♦ Create a map to validate your type definitions. Files Used in this Chapter You will be working in the c:\mercator\tutorial\MyFolder\Ch20 folder. Use the files provided in Ch20.zip.
Chapter 20 - Creating a Validation Map Files Used in this Chapter Files You Create or Modify for Chapter 20 The following table describes the files that you create or modify while you perform the exercises for this chapter. Icon File type Name Description Text file Contact.txt Input data text file that contains a single contact record of information about one customer. Type tree Contact.mtt Type tree describing the contact data. Map source file Contact.
Chapter 20 - Creating a Validation Map Scenario Copies of the files created during the exercises are provided for all chapters in the Tutorials\Solutions folder. The structure and use of these files is described in the Design Studio Tutorial Solutions section on page 18. Scenario A validation map can be created to validate your input and output type definitions. Creating a Validation Map ♦ Create a map source file. Since you are validating a contact record, name it Contact.mms.
Chapter 20 - Creating a Validation Map Summary ♦ Create the ContactRecordOut output card. Map each input item to the corresponding output item by dragging it from the input card to the output card. Build and run the map. Compare your output file to your input file. The number of input objects and output objects should match exactly. If your output type definitions need changing, use a different type and use the same method of comparision.
Index build, 100 executable map definition of, 80 exporting map, 268 EXTRACT function, 121 $ $, 187 . .
Index L window, 41 LAST, 200 on an output card, 144 INDEX function, 287 infix delimiter, 156 inheritance of type properties, 129 Insert Function command, 95 introduction, 12 invalid data mapping, 276 O output objects incrementing, 283 P partitioned types mapping, 218 partitioning types to simplify map rules, 205 PRESENT function, 94 properties inheriting, 129 L lookup file defining, 129 LOOKUP function, 162 R M REJECT function, 276 related references, 10 restart attribute, 276 rule map definition of
Index U run results, 45, 101 trace file, 261 Type creating groups, 132 definitions analyzing structure, 68 W wizard using the Functional Map Wizard, 85 U UNIQUE function, 113 X XML format for maps and map rules, 269 V viewing Design Studio Tutorial 296