Copyright 2007, Information Builders. Slide 1 JOIN, MATCH and MORE– Making the Connections Walter F. Blood Technical Director, FOCUS Division June, 2009.

Slides:



Advertisements
Similar presentations
Sometimes you need to use data from more than one table. In example1, the report displays data from two separate tables. Employee IDs exist in the EMPLOYEES.
Advertisements

A Guide to SQL, Seventh Edition. Objectives Use joins to retrieve data from more than one table Use the IN and EXISTS operators to query multiple tables.
MULTIPLE-TABLE QUERIES
FOCUS to DB2 By: Meadow Heath.
Relational Algebra, Join and QBE Yong Choi School of Business CSUB, Bakersfield.
Copyright 2007, Information Builders. Slide 1 Relational Efficiencies: Part II Overview and JOIN / Sort Scenarios Renee Teatro Information Builders.
Copyright 2007, Information Builders. Slide 1 Walter Brengel Information Builders New Jersey User Forum – June 2008 FOCUS to SQL DeMystified.
McGyver for Dynamic Subtotals/Subfoots Presented by David Smith of Brinker International.
Copyright 2007, Information Builders. Slide 1 Walter Brengel & Cesare Petrizio Unintended Consequences or…. Why Did FOCUS Do THAT!
Chapter 3 Data Modeling Copyright © 2014 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent.
Copyright 2007, Information Builders. Slide 1 Non-Relational Efficiencies Walter F. Blood Technical Director Information Builders, Inc.
INSERT BOOK COVER 1Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Access 2010 by Robert Grauer, Keith Mast,
Tutorial 3 Queries and Table Relationships
Concepts of Database Management Sixth Edition
Concepts of Database Management Seventh Edition
Copyright 2007, Information Builders. Slide 1 Internals of Retrieval for TABLE/TABLEF/MATCH FILE Cesare Petrizio Information Builders.
Walter F. Blood Information Builders Nashville User Forum February 23, 2012 THINKing in WEBFOCUS.
1 Reporting Internals From a Reports Point of View Renee Teatro Customer Support Services.
Copyright 2007, Information Builders. Slide 1 Tips and Techniques From the FOCWIZARDs Art Greenhaus & Noreen Redden FOCWIZARDS Tech Summit, 2008.
XP New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 5 1 Microsoft Office Excel 2003 Tutorial 5 – Working With Excel Lists.
1 Chapter 2 Reviewing Tables and Queries. 2 Chapter Objectives Identify the steps required to develop an Access application Specify the characteristics.
Introduction to Query Part 2. Query Topics Joining Files Defining Result Fields Complex Record Selection Formatting Output Creating Reports Using Multiple.
Welcome to SAS…Session..!. What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.
XP 1 Microsoft Office Excel 2003 Tutorial 3 – Working With Excel Lists.
1 JOIN: Rules, Roles, and Conventions Floria Foote June 2008.
Eyad Alshareef 1 Creating Database Reports. 2Eyad Alshareef Creating reports.
Copyright 2007, Information Builders. Slide 1 FOR and the FML Syntax Noreen Redden Information Builders FOCUS Users of New England.
Copyright 2007, Information Builders. Slide 1 JOIN, MATCH and MORE– Making the Connections Walter F. Blood Technical Director, FOCUS Division May, 2011.
ASP.NET Programming with C# and SQL Server First Edition
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
“You Asked For It, You Got It!” Best New [Backend ] Features of WebFOCUS Walter Blood Noreen Redden Joel Starkman Information Builders, Inc. August,
WebFOCUS Tips and Techniques WebFOCUS Tips and Techniques The Next Generation.
XP Agenda Video Last Class Excel Tutorial 5: Working with Excel Lists Agenda for Next Class 1 New Perspectives on Microsoft Office Excel 2003 Tutorial.
 A database is a collection of data that is organized so that its contents can easily be accessed, managed, and updated. What is Database?
Management Information Systems MS Access MS Access is an application software that facilitates us to create Database Management Systems (DBMS)
1 FOCUS Internals: Part 1 Update for 7.6.x Renee Teatro FUN Conference August 2008 Internals of Retrieval for TABLE/TABLEF/MATCH FILE.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 9 – Building Links,
Copyright 2007, Information Builders. Slide 1 Tips and Techniques From the FOCWIZARDs Noreen Redden Technical Director, Advanced Technical Support August.
1 By: Nour Hilal. Microsoft Access is a database software where data is stored in one or more Tables. A Database is a group of related Tables. Access.
Concepts of Database Management Seventh Edition
Access Chapter 2: Relational Database Objectives Design data Create tables Understand table relationships Understand data types, key, & field properties.
CIS 250 Advanced Computer Applications Introduction to Access.
MS Access 2007 Management Information Systems 1. Overview 2  What is MS Access?  Access Terminology  Access Window  Database Window  Create New Database.
DAY 19: MICROSOFT ACCESS – CHAPTER 3 CONTD. Aliya Farheen March 17, 2015.
Part II. Query Types On the design query table pane, right click and the cascading window will appear.
XP Chapter 3 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Analyzing Data For Effective Decision Making Chapter.
BUSINESS DRIVEN TECHNOLOGY Plug-In T5 Touring Access.
FILTERS and FUNCTIONS: Hidden Gems Walter F. Blood Technical Director, FOCUS Division June, 2008.
1/62 Introduction to and Using MS Access Database Management and Analysis Yunho Song.
1 The Master That Tells All Floria Foote Information Builders June 2008.
Copyright 2007, Information Builders. Slide 1 FOCUS Internals: Part 2 Update for 7.6.x Renee Teatro FUN Conference August 2008 Internals of Output Processing.
WebFOCUS Magnify: Search Based Applications Dr. Rado Kotorov Technical Director of Strategic Product Management.
The Advantage Series © 2004 The McGraw-Hill Companies, Inc. All rights reserved Creating Select Queries Chapter 6 Microsoft Office Access 2003.
Lesson 2: Designing a Database and Creating Tables.
Lesson 13 Databases Unit 2—Using the Computer. Computer Concepts BASICS - 22 Objectives Define the purpose and function of database software. Identify.
Copyright 2007, Information Builders. Slide 1 Hidden Gems Walter F. Blood Technical Director Information Builders, Inc.
Microsoft Access Database Creation and Management.
Advance Database Systems Query Optimization Ch 15 Department of Computer Science The University of Lahore.
JOIN Syntax and Techniques Noreen Redden Information Builders Copyright 2011, Information Builders. Slide 1.
Databases Competency Explain advanced database concepts and functions.
DAY 18: MICROSOFT ACCESS – CHAPTER 3 CONTD. Akhila Kondai October 21, 2013.
Copyright 2007, Information Builders. Slide 1 TABLE FILE: The Basics Noreen Redden FOCWizard June, 2008.
Copyright 2007, Information Builders. Slide 1 Cesare Petrizio June, 2008 The File Is Too Large.
Retele de senzori Curs 2 - 1st edition UNIVERSITATEA „ TRANSILVANIA ” DIN BRAŞOV FACULTATEA DE INGINERIE ELECTRICĂ ŞI ŞTIINŢA CALCULATOARELOR.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
MICROSOFT ACCESS – CHAPTER 3 CONTD. Sravanthi Lakkimsetty Mar 09, 2016.
The Basics of FOCUS Reporting Syntax
What Happens When You Run A Report
Creating Database Reports
ESRM 250/CFR 520 Autumn 2009 Phil Hurvitz
Presentation transcript:

Copyright 2007, Information Builders. Slide 1 JOIN, MATCH and MORE– Making the Connections Walter F. Blood Technical Director, FOCUS Division June, 2009

Copyright 2007, Information Builders. Slide 2 JOIN, MATCH and MORE Basic Choices Employee Data Department Data Job Data Customer Data Invoices Product Data Support Data Purchase Orders Inventory Data When your report requires data from many different sources… …you need JOIN, MATCH or MORE to make the connections!

Copyright 2007, Information Builders. Slide 3 JOIN, MATCH and MORE JOIN - Basic Characteristics JOIN treats multiple structures as one Employee Data Department Data Job Data Customer Data Invoices Product Data Support Data Purchase Orders Inventory Data  Connects data sources based on fields or conditions  Creates a vertical concatenation  Excludes only comma, tab and token delimited files  Maximum 63 active JOINS  JOINed structure maximum 256 segments  JOINed record maximum 32K

Copyright 2007, Information Builders. Slide 4 JOIN, MATCH and MORE Basic Choices ? Equal fields or Conditions ? Real Fields or Virtual Fields ? One-to-One or One-to-Many ? Inner JOIN or Outer JOIN ? FOCUS Managed or Interface Managed Each JOIN relationship involves these choices:

Copyright 2007, Information Builders. Slide 5 JOIN, MATCH and MORE Equal JOIN Syntax LONG FORM JOIN field1 [ AND field2 …] [TAG tagname] IN file1 TO [ALL] fielda [AND fieldb…] IN file2 [TAG tagname] AS joinname END SHORT FORM JOIN field1 IN file1 TO [ALL] field2 IN file2 AS name Employee Data Departm entData Job Data Customer Data Invoices Product Data Support Data Purchase Orders Inventory Data JOIN EMPID IN EMPLOYEE TO EMPID IN DEPARTMENT AS JEMP

Copyright 2007, Information Builders. Slide 6 JOIN, MATCH and MORE Equal JOIN Syntax - DEFINE LONG FORM JOIN field1 WITH fieldname [TAG tagname] IN file1 TO [ALL] fielda IN file2 [TAG tagname] AS joinname END SHORT FORM JOIN field1 WITH field IN file1 TO [ALL] field2 IN file2 Employee Data Departm entData Job Data Customer Data Invoices Product Data Support Data Purchase Orders Inventory Data JOIN INVID WITH PRDID IN PRODUCT TO INVID IN INVOICES AS INV DEFINE FILE PRODUCT INVID/A25=EDIT(&YMD) | PRDID; … JOIN INVID WITH PRDID IN PRODUCT TO INVID IN INVOICES AS INV DEFINE FILE PRODUCT INVID/A25=EDIT(&YMD) | PRDID; …

Copyright 2007, Information Builders. Slide 7 JOIN, MATCH and MORE JOINS – Direct INNER/LEFT OUTER Join JOIN {LEFT_OUTER/INNER} field {AND field …} IN hostfile {TAG tagname} TO {UNIQUE/MULTIPLE} crfield {AND crfield … } IN crfile {TAG tagname} AS joinname END JOIN {LEFT_OUTER/INNER} field {AND field …} IN hostfile {TAG tagname} TO {UNIQUE/MULTIPLE} crfield {AND crfield … } IN crfile {TAG tagname} AS joinname END Equal JOIN JOIN {LEFT_OUTER/INNER} deffield WITH field IN hostfile {TAG tagname} TO {UNIQUE/MULTIPLE} crfield IN crfile {TAG tagname} AS joinname END JOIN {LEFT_OUTER/INNER} deffield WITH field IN hostfile {TAG tagname} TO {UNIQUE/MULTIPLE} crfield IN crfile {TAG tagname} AS joinname END Equal JOIN – DEFINE based

Copyright 2007, Information Builders. Slide 8 JOIN, MATCH and MORE Equal JOIN Rules TO sqltable  Multiple target fields may be specified  Indexes are not required, but preferred  Many-to-many supported TO sqltable  Multiple target fields may be specified  Indexes are not required, but preferred  Many-to-many supported TO FOCUS/XFOCUS file  Only single target field may be specified  Target field must be indexed  Many-to-many NOT supported TO FOCUS/XFOCUS file  Only single target field may be specified  Target field must be indexed  Many-to-many NOT supported All rules are determined by the SUFFIX of the TO file

Copyright 2007, Information Builders. Slide 9 JOIN – Making the Connection Equal JOIN Rules TO Indexed Files  Target field -- primary key/alternate index  Multiple target fields may be specified  High-order elements of key or alternate index  Many-to-many supported TO Indexed Files  Target field -- primary key/alternate index  Multiple target fields may be specified  High-order elements of key or alternate index  Many-to-many supported TO FIX/sequential files  Multiple target fields NOT supported  Many-to-many NOT supported  Both files must be sorted in ascending order on the JOIN keys TO FIX/sequential files  Multiple target fields NOT supported  Many-to-many NOT supported  Both files must be sorted in ascending order on the JOIN keys All rules are determined by the SUFFIX of the TO file

Copyright 2007, Information Builders. Slide 10 JOIN, MATCH and MORE Equal JOIN Syntax  Multiple Fields - Field1 AND field2 …  Up to four fields may be specified  TAG tagname  Tagname becomes a prefix for fully qualifying fields in specified file  joinname (default is blank)  Identifies JOIN for the session  Another JOIN with the same name will overlay  Specified JOIN can be CLEARed

Copyright 2007, Information Builders. Slide 11 JOIN, MATCH and MORE DEFINE-Based JOIN JOIN fieldname WITH field IN file1 …  Multiple field JOIN not supported  WITH field must be a “real” field in the host file  DEFINE field ONLY on the host file – must be real field on the cross-reference file  SET KEEPDEFINES = ON to use a dynamic DEFINE specified before the JOIN SET KEEPDEFINES = ON DEFINE FILE CAR CONT/A10 = … END JOIN CONT WITH COUNTRY IN CAR TO CONTINENT IN WORLD AS AJ SET KEEPDEFINES = ON DEFINE FILE CAR CONT/A10 = … END JOIN CONT WITH COUNTRY IN CAR TO CONTINENT IN WORLD AS AJ

Copyright 2007, Information Builders. Slide 12 JOIN, MATCH and MORE Conditional JOINs Syntax JOIN FILE from_file AT from_field [TAG from_tag ] TO {ALL|ONE} FILE to_file AT to_field [TAG to_tag] [AS as_name] [WHERE expression1 ; WHERE expression2 ;... ; ] END Employee Data Departm entData Job Data Customer Data Invoices Product Data Support Data Purchase Orders Inventory Data JOIN FILE EMPLOYEE AT EMPID TO ALL FILE CAR AT SEATS AS J1 WHERE RETAIL_COST LE SALARY * 3; END JOIN FILE EMPLOYEE AT EMPID TO ALL FILE CAR AT SEATS AS J1 WHERE RETAIL_COST LE SALARY * 3; END

Copyright 2007, Information Builders. Slide 13 JOIN, MATCH and MORE JOINS –Direct INNER/LEFT OUTER Join JOIN {LEFT_OUTER/INNER} hostfile AT hfld1 {TAG tagname} TO {UNIQUE/MULTIPLE} crfile AT crfld {TAG tagname} AS joinname {WHERE expression1; {WHERE expression2:} END JOIN {LEFT_OUTER/INNER} hostfile AT hfld1 {TAG tagname} TO {UNIQUE/MULTIPLE} crfile AT crfld {TAG tagname} AS joinname {WHERE expression1; {WHERE expression2:} END Conditional JOIN

Copyright 2007, Information Builders. Slide 14 JOIN, MATCH and MORE Conditional JOINs Rules and Caveats The conditional JOIN is supported for  FOCUS  VSAM  ADABAS  IMS  All relational data sources Optimization of the conditional JOIN syntax depends on  Specific data sources involved in the JOIN  Complexity of the WHERE criteria Where possible, use EQ-JOIN  Index/Key always used  No TABLE Scan Conditional JOIN  JOIN large file to small  Pages may remain in memory EQ-JOIN  JOIN small file to LARGE  Reduced I/O for non-matches

Copyright 2007, Information Builders. Slide 15 JOIN, MATCH and MORE Conditional JOINs - Insurance Rates JOIN FILE EMPDATA1 AT BIRTHDATE TO ALL FILE RATES AT AGE AS J1 WHERE EMPDATA1.BAGE GE RATES.AGE; WHERE EMPDATA1.BAGE LE RATES.EAGE; END TABLE FILE EMPDATA1 HEADING "To: <FIRSTNAME <LASTNAME " "</1 Thank you for choosing our company for your <0X insurance needs." "Thank you for choosing our company for your insurance needs.” "Since your birth date is <BIRTHDTATE,your current rate is<0X <RATE_PER_THOUSAND per" "unit of coverage. This is your rate through age <EAGE. “ ON TABLE SET PAGE OFF BY PIN NOPRINT PAGE-BREAK END JOIN FILE EMPDATA1 AT BIRTHDATE TO ALL FILE RATES AT AGE AS J1 WHERE EMPDATA1.BAGE GE RATES.AGE; WHERE EMPDATA1.BAGE LE RATES.EAGE; END TABLE FILE EMPDATA1 HEADING "To: <FIRSTNAME <LASTNAME " "</1 Thank you for choosing our company for your <0X insurance needs." "Thank you for choosing our company for your insurance needs.” "Since your birth date is <BIRTHDTATE,your current rate is<0X <RATE_PER_THOUSAND per" "unit of coverage. This is your rate through age <EAGE. “ ON TABLE SET PAGE OFF BY PIN NOPRINT PAGE-BREAK END Greater than Minimum Age Less than Maximum Age

Copyright 2007, Information Builders. Slide 16 JOIN, MATCH and MORE Conditional JOINs - Insurance Rates and Letters To: DANIEL VALINO Thank you for choosing our company for your insurance needs. Since your birth date is 07/20/1959, your current rate is $11 per unit of coverage. This is your rate through age 42. To: DANIEL VALINO Thank you for choosing our company for your insurance needs. Since your birth date is 07/20/1959, your current rate is $11 per unit of coverage. This is your rate through age 42. To: MICHAEL BELLA Thank you for choosing our company for your insurance needs. Since your birth date is 07/27/1952, your current rate is $24 per unit of coverage. This is your rate through age 53. To: MICHAEL BELLA Thank you for choosing our company for your insurance needs. Since your birth date is 07/27/1952, your current rate is $24 per unit of coverage. This is your rate through age 53.

Copyright 2007, Information Builders. Slide 17 JOIN, MATCH and MORE FOCUS or Interface Managed? Interface Managed  Both HOST and Cross-Reference are same SUFFIX  OPTIMIZATION is ON  See Trace for optimization FOCUS Managed  Different file types  OPTIMIZATION is turned OFF  FOCUS turns off optimization (explained in TRACEs)

Copyright 2007, Information Builders. Slide 18 JOIN, MATCH and MORE JOINS – One to Many Relationships JOIN PIN IN EMPDATA TO ALL PIN IN KIDS AS JOIN1 END PIN LASTNAME FIRSTNAME MIDINITIAL EMPDATA EMP_ID LASTNAME CHILDNAME MIDINITIAL EMP_ID LASTNAME CHILDNAME MIDINITIAL KIDS OUTERINNER Employee Data Departm entData Job Data Customer Data Invoices Product Data Support Data Purchase Orders Inventory Data

Copyright 2007, Information Builders. Slide 19 JOIN, MATCH and MORE JOINS – One to Many - Inner JOIN using SET ALL SET ALL = OFF EMP_ID PIN Retrieves only matching pairs

Copyright 2007, Information Builders. Slide 20 JOIN, MATCH and MORE JOINS – One to Many - Left-Outer with SET ALL SET ALL = ON EMP_ID PIN Retrieves all records in Host showing the short paths

Copyright 2007, Information Builders. Slide 21 JOINS – One to Many Left Outer JOIN using SET ALL PIN LASTNAME FIRSTNAME CHILDNAME VALINO DANIEL ASTRIC ARTHUR ANNE ANTHONY BELLA MICHAEL CASSANOVA LOIS JOHN ADAMS RUTH MARY ADDAMS PETER PATEL DORINA SAM SANCHEZ EVELYN SAMANTHA SO PAMELA PULASKI MARIANNE ANDERSON TIM. PIN LASTNAME FIRSTNAME CHILDNAME VALINO DANIEL ASTRIC ARTHUR ANNE ANTHONY BELLA MICHAEL CASSANOVA LOIS JOHN ADAMS RUTH MARY ADDAMS PETER PATEL DORINA SAM SANCHEZ EVELYN SAMANTHA SO PAMELA PULASKI MARIANNE ANDERSON TIM. Short Paths

Copyright 2007, Information Builders. Slide 22 JOIN, MATCH and MORE JOIN - Unique Relationship JOIN PIN IN EMPDATA TO PIN IN SPICE AS JOIN1 END PIN LASTNAME FIRSTNAME MIDINITIAL EMPDATA PIN LASTNAME SPOUSENAME SSN SPICE Employee Data Departm entData Job Data Customer Data Invoices Product Data Support Data Purchase Orders Inventory Data

Copyright 2007, Information Builders. Slide 23 JOIN, MATCH and MORE Unique Relationship and SET ALL SET ALL = OFF or SET ALL = ON PIN PIN EMP_ID

Copyright 2007, Information Builders. Slide 24 JOINs – One to One Left Outer JOIN using SET ALL PIN LASTNAME FIRSTNAME VALINO ARTHUR BELLA CASSANOVA JOHN ADAMS MARY ADDAMS PATEL SAM SANCHEZ SAMANTHA SO PULASKI ANDERSON PIN LASTNAME FIRSTNAME VALINO ARTHUR BELLA CASSANOVA JOHN ADAMS MARY ADDAMS PATEL SAM SANCHEZ SAMANTHA SO PULASKI ANDERSON Blanks

Copyright 2007, Information Builders. Slide 25 JOIN, MATCH and MORE MATCH - Basic Characteristics MATCH merges files sequentially one at a time Employee Data Department Data Job Data Customer Data Invoices Product Data Support Data Purchase Orders Inventory Data  Merges data sources based on common fields  Creates a vertical concatenation  Connection based upon BY fields  Maximum 16 files connected in one MATCH request  Produces only HOLD output  Output controlled with AFTER MATCH  Offers Right-Outer and Full-Outer capabilities

Copyright 2007, Information Builders. Slide 26 MATCH FILE file1. BY FLD RUN FILE file2. BY FLD1 AS FLD [AFTER MATCH merge_phrase1] RUN FILE file3. BY FLD2 AS FLD [AFTER MATCH merge_phrase2] END JOIN, MATCH and MORE MATCH - Syntax BY fields connect filesMerge phrase selects

Copyright 2007, Information Builders. Slide 27  OLD-OR-NEW – all records from first and second files. This is the default if the AFTER MATCH line is omitted. (The UNION of the sets.)  OLD-AND-NEW – only records common to both files. (The INTERSECTION of the sets.)  OLD-NOT-NEW – records from the first file with no match in the second file. mergetype Specifies which of the retrieved records from the files are to be selected JOIN, MATCH and MORE MATCH – Mergetype and Output

Copyright 2007, Information Builders. Slide 28  NEW-NOT-OLD - records from second file with no match in the first file.  OLD-NOR-NEW - non-matching records from both files - records from the first file with no match in the second file, and records from the second file with no match in the first file.  OLD – records from the first file with matching records in the second file.  NEW – records from the second file with matching records in the first file. JOIN, MATCH and MORE MATCH – Mergetype and Output

Copyright 2007, Information Builders. Slide 29 JOIN, MATCH and MORE MATCH – Fine-Tuning Fine tune control using the display verbs  SUM – summarizes data to one record  PRINT – prints each individual record Four combinations  SUM / SUM  1 st (summarized) 2 nd (summarized)  SUM / PRINT  1 st (summarized) 2 nd (detail)  PRINT / SUM  1 st (detail) 2 nd (summarized)  PRINT / PRINT  1 st (detail) 2 nd (detail)

Copyright 2007, Information Builders. Slide 30 JOIN, MATCH and MORE MATCH – Fine-Tuning 2 N Country DCost 1 England England Japan Japan 4000 N Car RCost 1 Jaguar Jensen Datsun Toyota 7000 SUM  SUM 1 England 3000 Jensen Japan 7000 Toyota PRINT  SUM 1 England 2000 Jensen Japan 4000 Toyota SUM  PRINT 1 England 3000 Jaguar England 3000 Jensen Japan 7000 Datsun Japan 7000 Toyota 7000 PRINT  PRINT 1 England 1000 Jaguar England 2000 Jensen Japan 3000 Datsun Japan 4000 Toyota 7000 MATCH FILE F1 COUNTRY DCOST BY N RUN FILE F2 CAR RCOST BY N AFTER MATCH HOLD OLD-OR-NEW

Copyright 2007, Information Builders. Slide 31 JOIN, MATCH and MORE MORE - Basic Characteristics MORE concatenates files sequentially one at a time Employee Data Department Data Job Data Customer Data Invoices Product Data Support Data Purchase Orders Inventory Data  Requires data sources with common fields with the same formats  Creates a horizontal concatenation  Concatenate records of different file types  Can be used with TABLE, GRAPH, and MATCH  Similar to UNION functionality

Copyright 2007, Information Builders. Slide 32  Concatenate different file types:  FOCUS  DB2/SQL  IMS  VSAM  Fix files  Based on corresponding fields with:  Same name  Same FORMAT  Data appears as if from a single source  Currently supported in:  TABLE  GRAPH  MATCH FILE Retrieval of data from unlike data sources JOIN, MATCH and MORE MORE - Basic Characteristics

Copyright 2007, Information Builders. Slide 33 Order of Processing Main request  Identifies data fields  Identifies sorting criteria  Identifies output format of data Subrequests  Identify file(s)  Identify data fields to be concatenated to data in main request JOIN, MATCH and MORE MORE Processing

Copyright 2007, Information Builders. Slide 34 Order of processing: OUTPUT SORT 1 DATA FOCUS 2 DATA VSAM 3 DATA FIX JOIN, MATCH and MORE MORE Processing

Copyright 2007, Information Builders. Slide 35 FIX Data Retrieval (DEFINE/IF) FOCUS MORE VSAM Data Retrieval (DEFINE/IF) MORE FIX Data Retrieval (DEFINE/IF) EOF Y N EOF Y N FOCSORT EOF Y N COMPUTE/IF TOTAL OUTPUT JOIN, MATCH and MORE MORE Processing

Copyright 2007, Information Builders. Slide 36 File 1  Main Request  Supported TABLE, GRAPH, MATCH FILE syntax e.g. BY WHERE, IF, COMPUTE File 3  Subrequest  ONLY WHERE/IF syntax FIX File 2  Subrequest  ONLY WHERE/IF syntax VSAM FOCUS JOIN, MATCH and MORE MORE Processing

Copyright 2007, Information Builders. Slide 37 TABLE, GRAPH, MATCH FILE (Files) BY, WHERE, etc. MORE FILE (File 2) Subrequest (ONLY IF/WHERE) MORE FILE (File 3) Subrequest (ONLY IF/WHERE) END (after the last subrequest) JOIN, MATCH and MORE MORE Syntax

Copyright 2007, Information Builders. Slide 38  Based on fields in main request  Corresponding to fields In:  Subrequest, based on  Fieldname  Format  All fields in main request must be available to:  Files in the subrequest  Real fields  Defined fields JOIN, MATCH and MORE MORE Usage Notes

Copyright 2007, Information Builders. Slide 39 Alpha  Type and length must be equal INTEGER, floating point, DECIMAL  Type must be the same PACKED  Type and scale must be equal DATE (SMART)  Always correspond DATE (Legacy)  Edit options must be the same TEXT Fields are NOT supported JOIN, MATCH and MORE MORE Supported Datatypes

Copyright 2007, Information Builders. Slide 40 Which One Do We Use and Why JOIN, MATCH and MORE Which one? Use With JOIN EQ JOIN COND MATCHMORE Indexed Field YesNoN/A Like fieldUse DEFINE Yes Use DEFINE No common fields NoYesNoUse DEFINE

Copyright 2007, Information Builders. Slide 41 JOIN, MATCH and MORE Making the Connections Employee Data Department Data Job Data Customer Data Invoices Product Data Support Data Purchase Orders Inventory Data

Copyright 2007, Information Builders. Slide 42 JOINS – One to Many EMPDATA - Master FILENAME=EMPDATA, SUFFIX=FOC SEGNAME=EMPDATA, SEGTYPE=S1 FIELDNAME=PIN, ALIAS=ID, FORMAT=A9, INDEX=I,$ FIELDNAME=LASTNAME, ALIAS=LN, FORMAT=A15, $ FIELDNAME=FIRSTNAME, ALIAS=FN, FORMAT=A10, $ FIELDNAME=MIDINITIAL, ALIAS=MI, FORMAT=A1, $ FIELDNAME=DIV, ALIAS=CDIV, FORMAT=A4, $ FIELDNAME=DEPT, ALIAS=CDEPT, FORMAT=A20, $ FIELDNAME=JOBCLASS, ALIAS=CJCLAS, FORMAT=A8, $ FIELDNAME=TITLE, ALIAS=CFUNC, FORMAT=A20, $ FIELDNAME=SALARY, ALIAS=CSAL, FORMAT=D12.2M, $ FIELDNAME=HIREDATE, ALIAS=HDAT, FORMAT=YMD, $ FILENAME=EMPDATA, SUFFIX=FOC SEGNAME=EMPDATA, SEGTYPE=S1 FIELDNAME=PIN, ALIAS=ID, FORMAT=A9, INDEX=I,$ FIELDNAME=LASTNAME, ALIAS=LN, FORMAT=A15, $ FIELDNAME=FIRSTNAME, ALIAS=FN, FORMAT=A10, $ FIELDNAME=MIDINITIAL, ALIAS=MI, FORMAT=A1, $ FIELDNAME=DIV, ALIAS=CDIV, FORMAT=A4, $ FIELDNAME=DEPT, ALIAS=CDEPT, FORMAT=A20, $ FIELDNAME=JOBCLASS, ALIAS=CJCLAS, FORMAT=A8, $ FIELDNAME=TITLE, ALIAS=CFUNC, FORMAT=A20, $ FIELDNAME=SALARY, ALIAS=CSAL, FORMAT=D12.2M, $ FIELDNAME=HIREDATE, ALIAS=HDAT, FORMAT=YMD, $

Copyright 2007, Information Builders. Slide 43 JOINS - One to Many EMPDATA - Data PIN LASTNAME FIRSTNAME VALINO DANIEL BELLA MICHAEL CASSANOVA LOIS ADAMS RUTH ADDAMS PETER PATEL DORINA SANCHEZ EVELYN SO PAMELA PULASKI MARIANNE ANDERSON TIM PIN LASTNAME FIRSTNAME VALINO DANIEL BELLA MICHAEL CASSANOVA LOIS ADAMS RUTH ADDAMS PETER PATEL DORINA SANCHEZ EVELYN SO PAMELA PULASKI MARIANNE ANDERSON TIM

Copyright 2007, Information Builders. Slide 44 JOINS – One to Many Kids - Master FILENAME=KIDS, SUFFIX=FOC SEGNAME=CHILDSEG, SEGTYPE=S1 FIELDNAME=EMP_ID, ALIAS=PIN, FORMAT=A9, INDEX =I,$ FIELDNAME=LASTNAME, ALIAS=SLN, FORMAT=A15,$ FIELDNAME=CHILDNAME, ALIAS=SFN, FORMAT=A10,$ FIELDNAME=DATE_OF_BIRTH, ALIAS=DOB, FORMAT=MDYY,$ FILENAME=KIDS, SUFFIX=FOC SEGNAME=CHILDSEG, SEGTYPE=S1 FIELDNAME=EMP_ID, ALIAS=PIN, FORMAT=A9, INDEX =I,$ FIELDNAME=LASTNAME, ALIAS=SLN, FORMAT=A15,$ FIELDNAME=CHILDNAME, ALIAS=SFN, FORMAT=A10,$ FIELDNAME=DATE_OF_BIRTH, ALIAS=DOB, FORMAT=MDYY,$

Copyright 2007, Information Builders. Slide 45 JOINS – One to Many Kids - Data EMP_ID LASTNAME CHILDNAME DATE_OF_BIRTH VALINO ANTHONY 12/31/ VALINO ANNE 11/09/ VALINO ARTHUR 06/01/ VALINO ASTRIC 05/03/ CASSANOVA JOHN 05/07/ ADAMS MARY 08/01/ PATEL SAM 07/05/ SANCHEZ SAMANTHA 08/04/1997 EMP_ID LASTNAME CHILDNAME DATE_OF_BIRTH VALINO ANTHONY 12/31/ VALINO ANNE 11/09/ VALINO ARTHUR 06/01/ VALINO ASTRIC 05/03/ CASSANOVA JOHN 05/07/ ADAMS MARY 08/01/ PATEL SAM 07/05/ SANCHEZ SAMANTHA 08/04/1997

Copyright 2007, Information Builders. Slide 46 JOINs – One to One Spice - Master FILENAME=SPICE, SUFFIX=FOC SEGNAME=SPOUSEI, SEGTYPE=S1 FIELDNAME=PIN, ALIAS=ID, FORMAT=A9, INDEX=I,$ FIELDNAME=LASTNAME, ALIAS=SLN, FORMAT=A15,$ FIELDNAME=SPOUSENAME, ALIAS=SFN, FORMAT=A10,$ FIELDNAME=SPOUSESSN, ALIAS=SSN, FORMAT=A9,$ FILENAME=SPICE, SUFFIX=FOC SEGNAME=SPOUSEI, SEGTYPE=S1 FIELDNAME=PIN, ALIAS=ID, FORMAT=A9, INDEX=I,$ FIELDNAME=LASTNAME, ALIAS=SLN, FORMAT=A15,$ FIELDNAME=SPOUSENAME, ALIAS=SFN, FORMAT=A10,$ FIELDNAME=SPOUSESSN, ALIAS=SSN, FORMAT=A9,$

Copyright 2007, Information Builders. Slide 47 JOINs – One to One Spice - Data PIN LASTNAME SPOUSENAME SPOUSESSN VALINO ABIGAIL CASSANOVA EDWARD ADAMS BRIAN PATEL KEITH SANCHEZ EDWARD PULASKI DAVID PIN LASTNAME SPOUSENAME SPOUSESSN VALINO ABIGAIL CASSANOVA EDWARD ADAMS BRIAN PATEL KEITH SANCHEZ EDWARD PULASKI DAVID

Copyright 2007, Information Builders. Slide 48 Using Conditional JOINs Insurance Rates File TABLE FILE RATES PRINT * AGE EAGE RATE_PER_THOUSAND $ $ $ $ $ $ $ $42 AGE EAGE RATE_PER_THOUSAND $ $ $ $ $ $ $ $42

Copyright 2007, Information Builders. Slide 49 Non Unique Relationships One-to-Many

Copyright 2007, Information Builders. Slide 50 Unique Relationships One-to-One

Copyright 2007, Information Builders. Slide 51 Using Conditional JOINs

Copyright 2007, Information Builders. Slide 52 JOINS – One to Many Inner JOIN using SET ALL PIN LASTNAME FIRSTNAME CHILDNAME VALINO DANIEL ASTRIC ARTHUR ANNE ANTHONY CASSANOVA LOIS JOHN ADAMS RUTH MARY PATEL DORINA SAM SANCHEZ EVELYN SAMANTHA PIN LASTNAME FIRSTNAME CHILDNAME VALINO DANIEL ASTRIC ARTHUR ANNE ANTHONY CASSANOVA LOIS JOHN ADAMS RUTH MARY PATEL DORINA SAM SANCHEZ EVELYN SAMANTHA

Copyright 2007, Information Builders. Slide 53 JOINS – One to Many Direct INNER/LEFT OUTER Join Availability  WEBFOCUS Release 7.1 and above  FOCUS Release 7.6 and above Files/databases supported  FOCUS, XFOCUS  Relational  VSAM  ADABAS

Copyright 2007, Information Builders. Slide 54 JOINs – One to One Unique JOIN with SET ALL EMP_ID PIN Reguires WHERE test to screen out short path records

Copyright 2007, Information Builders. Slide 55 Conditional JOINs Insurance Rates – Another Approach JOIN FILE EMPDATA1 AT BIRTHDATE TO ONE FILE RATES AT AGE AS J1 WHERE EMPDATA1.BAGE GE RATES.AGE; END -RUN -STEP2 TABLE FILE EMPDATA1 PRINT PIN BIRTHD BAGE RATE BY AGE AS 'MINIMUM AGE' END JOIN FILE EMPDATA1 AT BIRTHDATE TO ONE FILE RATES AT AGE AS J1 WHERE EMPDATA1.BAGE GE RATES.AGE; END -RUN -STEP2 TABLE FILE EMPDATA1 PRINT PIN BIRTHD BAGE RATE BY AGE AS 'MINIMUM AGE' END

Copyright 2007, Information Builders. Slide 56 Conditional JOINs Insurance Rates – Listing MINIMUM AGE PIN BIRTHDATE BAGE RATE_PER_THOUSAND /24/ $ /17/ $ /07/ $ /20/ $ /06/ $ /10/ $ /08/ $ /08/ $ /24/ $ /17/ $ W 02/19/ $ /21/ $ /16/ $ /20/ $ /08/ $11 MINIMUM AGE PIN BIRTHDATE BAGE RATE_PER_THOUSAND /24/ $ /17/ $ /07/ $ /20/ $ /06/ $ /10/ $ /08/ $ /08/ $ /24/ $ /17/ $ W 02/19/ $ /21/ $ /16/ $ /20/ $ /08/ $11