1 reporting internals from a reports point of view renee teatro customer support services
TRANSCRIPT
Copyright 2007, Information Builders. Slide 2
Author: Cesare Petrizio Company: Information Builders Presentation Title: Reporting Internals From a Reports Point of View Abstract: This presentation looks at what FOCUS is doing under the
covers when a TABLE is executed in FOCUS on any platform, or through WEBFOCUS. Also, the TABLE could be against a FOCUS file, MSS TABLE, VSAM, etc. Application developers can create more efficient requests when they understand how FOCUS sets up to retrieve data from FOCUS files, Relational TABLEs, and other non-FOCUS data sources. Learn the answers to such questions as: When would an index be more efficient? One pass or two? DEFINE vs. COMPUTE? What is AUTOPATH and AUTOINDEX, and what do they mean in terms of efficiency?
Presentation Information
Copyright 2007, Information Builders. Slide 3
Agenda
Reporting Internals Retrieval Internals
Analysis Phase Retrieval Phase Internal Matrix Generation
q
Copyright 2007, Information Builders. Slide 4
Analysis Phase
Open and CHECK Master File Descriptions
Verify DBA access to file(s)
Determine I/O access modules required
q
Copyright 2007, Information Builders. Slide 5
CHECK FILE EMPLOYEE NUMBER OF ERRORS= 0 NUMBER OF SEGMENTS= 2 ( REAL= 2 VIRTUAL= 0 ) NUMBER OF FIELDS= 6 INDEXES= 0 FILES= 1 TOTAL LENGTH OF ALL FIELDS= 46
CHECK FILE KIDS NUMBER OF ERRORS= 0 NUMBER OF SEGMENTS= 1 ( REAL= 1 VIRTUAL= 0 ) NUMBER OF FIELDS= 3 INDEXES= 0 FILES= 1 TOTAL LENGTH OF ALL FIELDS= 33
CHECK FILE SPICE NUMBER OF ERRORS= 0 NUMBER OF SEGMENTS= 1 ( REAL= 1 VIRTUAL= 0 ) NUMBER OF FIELDS= 2 INDEXES= 1 FILES= 1 TOTAL LENGTH OF ALL FIELDS= 29
Analysis Phase The CHECK FILE
Is This A Good Sign?
q
Copyright 2007, Information Builders. Slide 6
Analysis Phase The Files
FILE=EMPLOYEE,SUFFIX=FOC
SEGNAME=SEG1,SEGTYPE=S1
FIELD=EMP_ID, EID,A9,$
FIELD=FIRST_NAME, FN,A15,$
FIELD=LAST_NAME, LN,A15,$
SEGNAME=INSSEG,SEGTYPE=SH2
FIELD=COVER_DT, ,YMD,$
FIELD=TYPE_COVER, ,A3,$
FIELD=FAMILY, ,A1,$
FILE=KIDS,SUFFIX=SQLMSS
SEGNAME=SEGK,SEGTYPE=S2
FIELD=EMP_ID, EID ,A9,$
FIELD=CHILD_DOB, CDOB ,YYMD,$
FIELD=CHILD_NAME, CNAME ,A20,$
FILE=SPICE,SUFFIX=XFOC
SEGNAME=SEGS,SEGTYPE=S1
FIELD=EMP_ID, EID, A9, INDEX=I,$
FIELD=SPOUSE,SPOUSE_NME,A20,$
q
Any DBA Specified?
What Type Of File Access Method(s)
Copyright 2007, Information Builders. Slide 7
Retrieval Internals
Retrieve
DEFINE
JOIN
Screening
FOCUS or External Sort
Aggregation
COUNT/MIN/MAX
TOTAL Screens
COMPUTE
Format
Extracts
Analysis Report
Generator
Sort File
OutputGenerator
RETYPE
REPLOT
HOLD
q
Copyright 2007, Information Builders. Slide 8
Retrieval InternalsThe Files XFOCUS
FILE=SPICE,SUFFIX=FOC
SEGNAME=SEGS,SEGTYPE=S1
FIELD=EMP_ID, EID, A9, INDEX=I,$
FIELD=SPOUSE,SPOUSE_NME,A20,$
FILE=SPICE,SUFFIX=XFOC
SEGNAME=SEGS,SEGTYPE=S1
FIELD=EMP_ID, EID, A9, INDEX=I,$
FIELD=SPOUSE,SPOUSE_NME,A20,$
Are Any Of The Following Different?
DEFINEs
Selection Test
JOINs
q
FILE=SPICE,SUFFIX= SQLMSS
SEGNAME=SEGS,SEGTYPE=S0
FIELD=EMP_ID, EID, A9, A9 ,$
FIELD=SPOUSE,SPOUSE_NME,A20 ,A20,$
Copyright 2007, Information Builders. Slide 9
Retrieval InternalsExample
SH2KU
KEMP_ID
SPOUSE
JOIN EMP_ID IN EMPLOYEE TO EMP_ID IN SPICE AS AJ
EMP_ID
FIRST_NAME
LAST_NAME
COVER_DT
TYPE_COVER
FAMILY
JOIN EMP_ID IN EMPLOYEE TO ALL EMP_ID IN KIDS AS BJ
EMP_ID
CHILD_DOB
CHILD_NAME
K
KM
q
JOIN SYNTAX
Copyright 2007, Information Builders. Slide 10
JOIN field1 [WITH rfield] IN hostfile [TAG tag1] TO [ALL] field2 IN crfile [TAG tag2] [AS name][END]
where:field1, field2 - Are the fields common to both Master Files. WITH rfield1 - Use only if field1 is a virtual field; assigns a logical home with a real field in the host file. hostfile - Is the host Master File. TAG tag1 - Is a tag name of up to eight characters (usually the name of the Master File), which is used as a
unique qualifier for fields and aliases in the host file. The tag name for the host file must be the same in all the JOIN commands of a joined structure. ALL - Use if non-unique relationships exist in the target file. crfile - Is the target or cross-referenced Master File. TAG tag2 - Is a tag name of up to eight characters (usually the name of the Master File), which is used as a unique qualifier for fields and aliases in the cross-referenced file. In a recursive joined structure, if no tag name is provided, all field names and aliases are prefixed with the first four characters of the join name. AS name - Assigns a name to the JOIN structure. You must assign a unique name to a join structure if:
• You want to ensure that a subsequent JOIN command will not overwrite it. • You want to clear it selectively later. • The structure is recursive, and you do not specify tag names.
END q
RETRIEVAL VIEW OF FOCJNT FILE EMPLOYEE ON 03/16/09 AT 09.04.14 SEG01 01 S1 ************** *PIN ** *FIRSTNAME ** *LASTNAME ** * ** * ** *************** ************** I I I I SEGS 02 I KU .............. :EMP_ID :K :SPOUSE : : : : : : : :............: JOINEDI SPICE I +-----------------+ I I I KIDS01 I INSSEG 03 I KM 04 I SH2 .............. ************** :EMP_ID ::K *COVER_DATE ** :CHILD_DOB :: *TYPE_COVER ** :CHILD_NAME :: *FAMILY ** : :: * ** : :: * ** :............:: *************** .............: ************** JOINED KIDS
Copyright 2007, Information Builders. Slide 11
JOIN EMP_ID IN EMPLOYEE TO EMP_ID IN SPICE AS AJJOIN EMP_ID IN EMPLOYEE TO ALL EMPID IN KIDS AS BJ
STRUCTURE OF FOCJNT FILE EMPLOYEE ON 03/16/09 AT 09.05.56 SEG01 01 S1 ************** *PIN ** *FIRSTNAME ** *LASTNAME ** * ** * ** *************** ************** I +-----------------+-----------------+ I I I I SEGS I KIDS01 I INSSEG 02 I KU 03 I KM 04 I SH2 .............. .............. ************** :EMP_ID :K :EMP_ID ::K *COVER_DATE ** :SPOUSE : :CHILD_DOB :: *TYPE_COVER ** : : :CHILD_NAME :: *FAMILY ** : : : :: * ** : : : :: * ** :............: :............:: *************** JOINED SPICE .............: ************** JOINED KIDS
Retrieval InternalsExample
q
Copyright 2007, Information Builders. Slide 12
PIN FIRSTNAME LASTNAME EMP_ID SPOUSE EMP_ID CHILD_DOB CHILD_NAME000000010 DANIEL VALINO 000000010 SANDY 000000010 2000/01/31 Nick
000000020 MICHAEL BELLA 000000020 NANCY 000000020 1979/12/31 Alan
000000020 MICHAEL BELLA 000000020 NANCY 000000020 1980/01/31 Walter
000000020 MICHAEL BELLA 000000020 NANCY 000000020 1999/03/31 Betty
000000030 LOIS CASSANOVA 000000030 WILLIAM 000000030 1976/01/31 CASSIE
000000040 RUTH ADAMS 000000040 BOB 000000040 2003/01/31 ANN
000000050 PETER ADDAMS 000000050 CAROL 000000050 2006/01/31 JACK
000000060 DORINA PATEL 000000060 ALFRED 000000060 2000/12/31 WILLY
000000070 EVELYN SANCHEZ 000000070 JAMES 000000070 2008/08/30 JOSE
000000080 PAMELA SO . . .
000000090 MARIANNE PULASKI . . .
000000100 TIM ANDERSON . . .
SET ALL=ONJOIN EMP_ID IN EMPLOYEE TO EMP_ID IN SPICE AS AJJOIN EMP_ID IN EMPLOYEE TO ALL EMPID IN KIDS AS BJTABLE FILE EMPLOYEEPRINT *END
Retrieval InternalsExample
q
Copyright 2007, Information Builders. Slide 13
Updated JOIN syntax
q
JOIN [LEFT_OUTER|INNER] hfld1 [AND hfld2 ...] IN hostfile [TAG tag1] TO [UNIQUE|MULTIPLE]crfield [AND crfld2 ...] IN crfile [TAG tag2] [AS joinname]END
where:INNER - LEFT_OUTER - Specifies an left outer join or inner join.
hfld1 - AND hfld2... Is the name of a field(s) in the host file
IN hostfile - Is the name of the host file.
TAG tag1 - is a tag name of up to eight characters which is used as a unique qualifier for fields
TO [UNIQUE|MULTIPLE] crfld1 - Is the name of a field in the cross-referenced file
AND crfld2... - Is the name of a field in the cross-referenced file with values in common with hfld2.
IN crfile - Is the name of the cross-referenced file.
TAG tag2 - Is a tag name of up to eight characters
AS joinname - Is an optional name of up to eight characters that you may assign to the join structure.
Copyright 2007, Information Builders. Slide 14
Analysis
Retrieve DEFINE field expressions for pertinent files
Read and parse the request
Check DBA and set up access restrictions at SEGMENT and FIELD levels
q
Copyright 2007, Information Builders. Slide 15
DEFINE
Segment is determined by: WITH field Fields used in expression
Constant expressions are evaluated when file is opened (segment 0)
DEFINEs are evaluated ONLY if required by requestDEFINEs are evaluated at detail level only
Each DEFINE field is associated with a specific segment
q
Copyright 2007, Information Builders. Slide 16
Analysis
Activate fields (real and DEFINEd) Read USE list and/or check Access Files and
FILEDEF/ALLOCATES Open and Verify files Invoke the Data adapter
Activate segments: referenced subtree(s) – smallest subtree which contains “root” and every segment referenced directly or indirectly (HEADING PARENT AND GRAND CHILD)
q
Copyright 2007, Information Builders. Slide 17
Retrieval InternalsThe Files
SEG1 01 S1 ************** *EMP_ID ** *FIRST_NAME ** *LAST_NAME ** * ** * ** *************** ************** I I I I INSSEG 02 I SH2 ************** *COVER_DT ** *TYPE_COVER ** *FAMILY ** * ** * ** *************** **************
SEGK 01 S2 ************** *EMP_ID ** *CHILD_DOB ** *CHILD_NAME ** * ** * ** *************** **************
SEGS 01 S1 ************** *EMP_ID **I*SPOUSE ** * ** * ** * ** *************** **************
KIDS EMPLOYEE SPICE
q
Copyright 2007, Information Builders. Slide 18
SEG1 01 S1 ************** *EMP_ID ** *FIRST_NAME ** *LAST_NAME ** * ** * ** *************** ************** I +-----------------+-----------------+ I I I I SEGS I SEGK I INSSEG 02 I KU 03 I KM 04 I SH2 .............. .............. ************** :EMP_ID :K :EMP_ID ::K *COVER_DT **:SPOUSE : :CHILD_DOB :: *TYPE_COVER **: : :CHILD_NAME :: *FAMILY **: : : :: * **: : : :: * **:............: :............:: *************** JOINED SPICE .............: ************** JOINED KIDS
Retrieval Internals
JOIN EMP_ID IN EMPLOYEE TO EMP_ID IN SPICE AS J1
SEG1 01 S1 ************** *EMP_ID ** *FIRST_NAME ** *LAST_NAME ** * ** * ** *************** ************** I +-----------------+ I I I SEGS I INSSEG 02 I KU 03 I SH2 .............. ************** :EMP_ID :K *COVER_DT **:SPOUSE : *TYPE_COVER **: : *FAMILY **: : * **: : * **:............: *************** JOINED SPICE **************
JOIN EMP_ID IN EMPLOYEE TO ALL EMP_ID IN KIDS AS J2
q
Copyright 2007, Information Builders. Slide 19
Retrieval Internals
DEFINE FILE EMPLOYEE
INS_TYPE/A6 = DECODE TYPE_COVER(DDS 'DENTAL'
EYE 'VISION' MDS 'HEALTH' ELSE 'OTHER');
TODAY/YYMD = '&YYMD';
AGE/I3 = (TODAY - CHILD_DOB) / 365.25;
END TABLE FILE EMPLOYEE
PRINT INS_TYPE
CHILD_NAME AGE
BY LAST_NAME BY FIRST_NAME
BY SPOUSE
IF AGE LE 20
END
Seg 4 Define Based on TYPE_COVER
Seg 0 Define (No Reference) Seg 3 Define Based on
CHILD_DOB
q
Copyright 2007, Information Builders. Slide 20
SEG1 01 S1 ************** *EMP_ID ** *FIRST_NAME ** *LAST_NAME ** * ** * ** *************** ************** I +-----------------+-----------------+ I I I I SEGS I SEGK I INSSEG 02 I KU 03 I KM 04 I SH2 .............. .............. ************** :EMP_ID :K :EMP_ID ::K *COVER_DT **:SPOUSE : :CHILD_DOB :: *TYPE_COVER **: : :CHILD_NAME :: *FAMILY **: : : :: * **: : : :: * **:............: :............:: *************** JOINED SPICE .............: ************** JOINED KIDS
Retrieval InternalsSegment Activation
TABLE FILE EMPLOYEE PRINT INS_TYPE
CHILD_NAME AGE
BY LAST_NAME BY FIRST_NAME
BY SPOUSE
IF AGE LE 20 END
Seg 1 Activated by FIRST_NAME and LASTNAME
Seg 2 Activated by SPOUSE
Seg 3 Activated by CHILD_DOB and CHILD_NAME
Seg 4 Activated by TYPE_COVER Via INS_TYPE DEFINE
q
Copyright 2007, Information Builders. Slide 21
Retrieval InternalsField Activation
Fields Mentioned in the Body of TABLE are ACTIVATED FIRST_NAME LASTNAME SPOUSE CHILD_NAME
CHILD_DOB (Via AGE DEFINE) TYPE_COVER (Via INS_TYPE
DEFINE)
DEFINE FILE EMPLOYEE
INS_TYPE/A6 = DECODE TYPE_COVER(DDS 'DENTAL'
EYE 'VISION' MDS 'HEALTH' ELSE 'OTHER');
TODAY/YYMD = '&YYMD';
AGE/I3 = (TODAY - CHILD_DOB) / 365.25;
END TABLE FILE EMPLOYEE
PRINT INS_TYPE
CHILD_NAME AGE
BY LAST_NAME BY FIRST_NAME
BY SPOUSE
IF AGE LE 20
END
q
Copyright 2007, Information Builders. Slide 22
Retrieval
Unique segments are promoted into path of parent and are never missing
IF/WHERE tests on database fields are evaluated upon retrieval
DEFINE fields are evaluated if needed IF/WHERE tests are evaluated on DEFINE fields on
segment by segment basis, AFTER all other selection tests are passed
Each Path is processed independently, and fields are merged on common sort fields
Retrieval is “Top Down, Left Right” within the referencedsub-tree
q
Copyright 2007, Information Builders. Slide 23
Retrieval Order of Retrieval – FOCUS & XFOCUS Files
Root segment instances are obtained in physical order
Lower level instances obtained in SEGTYPE order within parent segment
TABLEF Root and child segment instances are obtained in
SEGTYPE order No sorting
TABLE/GRAPH/MATCH
q
Copyright 2007, Information Builders. Slide 24
Retrieval Order of Retrieval – FOCUS Files
When Fieldname is not indexedSegment containing “fieldname” becomes
ROOT of the view, and is retrieved physically When Fieldname is indexed
Segment containing “fieldname” is accessed via the equality test on INDEX
Other segments become children of the new root segment
TABLE FILE filename.fieldname
q
Copyright 2007, Information Builders. Slide 25
Retrieval InternalsAUTOPATH - Two Masters And How It Treats Seg1
JOIN EMP_ID IN EMPLOYEE TO EMP_ID IN SPICE AS J1SEG1 01 S1 ************** *EMP_ID ** *FIRST_NAME ** *LAST_NAME ** * ** * ** *************** ************** I + I I SEGS 02 I KU .............. :EMP_ID :K :SPOUSE : : : : : : : :............: JOINED SPICE
FILE=EMPLOYEE,SUFFIX=SQL
SEGNAME=SEG1,SEGTYPE=S0
FIELD=EMP_ID, EID,A9,$
FIELD=FIRST_NAME, FN,A15,$
FIELD=LAST_NAME, LN,A15,$
FILE=SPICE,SUFFIX=SQL
SEGNAME=SEGS,SEGTYPE=S0
FIELD=EMP_ID, EID, A9, $
FIELD=SPOUSE,SPOUSE_NME,A20,$
TABLE FILE EMPLOYEEPRINT SPOUSEEND
HOW MANY SEGMENTS DO WE READ?
q
2 Root SEG always gets read
Copyright 2007, Information Builders. Slide 26
Retrieval InternalsAUTOPATH - Single Master And How It Treats Seg1
SEG1 01 S1 ************** *EMP_ID ** *FIRST_NAME ** *LAST_NAME ** * ** * ** *************** ************** I + I I SEGS 02 I KU .............. :EMP_ID :K :SPOUSE : : : : : : : :............: JOINED SPICE
FILE=EMPLOYEE,SUFFIX=SQL
SEGNAME=SEG1,SEGTYPE=S0
FIELD=EMP_ID, EID,A9,$
FIELD=FIRST_NAME, FN,A15,$
FIELD=LAST_NAME, LN,A15,$
SEGNAME=SEGS,SEGTYPE=S0, PARENT =SEG1,
FIELD=EMP_ID, EID, A9, $
FIELD=SPOUSE,SPOUSE_NME,A20,$
TABLE FILE EMPLOYEEPRINT SPOUSEEND
HOW MANY SEGMENTS DO WE READ?
q
1 SEGS - AUTOPATH
Copyright 2007, Information Builders. Slide 27
Retrieval Order of Retrieval
Alternate Physical View is created through the referenced segment highest in the hierarchy
AUTOINDEX =ON Alternate Indexed View is created if there is an Equality test
specified for an indexed field on the referenced segment highest in the hierarchy
AUTOSTRATEGY = ON Determines when FOCUS stops the search for a key field
specified in a WHERE or IF test. When set to ON, the search ends when the key field is found
FIXRETRIEVE = ON Equality IF/WHERE test on primary specified sort field in
single segment FIX file will terminate retrieval as soon as possible
AUTOPATH = ON
q
Copyright 2007, Information Builders. Slide 28
Retrieval Autostrategy – FOCUS Files
IL MI
20012002 1999 1998 1997 1998 1997 1996
WHERE DATE EQ ‘1999’
1 STATE=IL, DATE=2002 Continue Search2 STATE=IL, DATE=2001 Continue Search3 STATE=IL, DATE=1999 Continue Search4 STATE=IL, DATE=1998 Next Parent5 STATE=MI, DATE=1999 Next Parent
q
Copyright 2007, Information Builders. Slide 29
FIXED Files
ENGLAND JAGUAR
ENGLAND JENSEN
ENGLAND TRIUMPH
FRANCE PEUGEOT
ITALY AUDI
JAPAN……
WHERE COUNTRY EQ ‘FRANCE’
Retrieval Stops When:
SET FIXRETRIEVE = ON
q
Copyright 2007, Information Builders. Slide 30
Retrieval Multiple Paths
Unique segments are always in the path of their parent
Unique segments are SEGTYPE = U, KU, DKU, KLU JOIN TO creates DKU segments JOIN TO ALL creates DKM segments
TABLE/MATCH/GRAPH Instances from each path will be merged in the sort
process by the common parent(s)TABLEF does not merge data from multiple pathsAlternate file views can be used to create single pathsSET MULTIPATH controls multiple path retrieval
Retrieval is performed for each path separately
q
Copyright 2007, Information Builders. Slide 31
Multiple Paths
ARRIVE_TIME
ARR_FLIGHT
ARR_FROM
DEPART_TIME
DEP_FLIGHT
DEPART_TO
Airport
q
Copyright 2007, Information Builders. Slide 32
Multiple Paths
DEFINE FILE AIRPORTS.ARRIVE_TIMEDELAY=DEPART_TIME – ARRIVE_TIME;ENDTABLE FILE AIRPORTS.ARRIVE_TIMEPRINT DEP_FLIGHT DEPART_TIMEWHERE AIRPORT EQ ‘O’’HARE’WHERE DELAY GT 60WHERE DEPART_TO EQ ‘LAX’WHERE ARR_FROM EQ ‘TOR’END
ARRIVE_TIME
ARR_FLIGHT
ARR_FROM
DEPART_TIME
DEP_FLIGHT
DEPART_TO
Airport
q
Copyright 2007, Information Builders. Slide 33
Multiple Paths
q
SEGTOP01 S1***************FAMILY *** *** *** *** ******************************* I +-----------------+ I I I SEG1 I SEG202 I S1 03 I S1************** ***************COLLEGE ** *INVESTMENT *** ** * *** ** * *** ** * *** ** * ***************** ***************
Copyright 2007, Information Builders. Slide 34
Retrieval Multiple Paths Instances
q
LASTRA WANG WHITE
YALE YALE
SCHWAB SCHWAB
Family
College
Investment
Actual Data Layout
SEGTOP01 S1***************FAMILY *** *** *** *** ******************************* I +-----------------+ I I I SEG1 I SEG202 I S1 03 I S1************** ***************COLLEGE ** *INVESTMENT *** ** * *** ** * *** ** * *** ** * ***************** ***************
Copyright 2007, Information Builders. Slide 35
Multiple Paths
q
TABLE FILE SAMPLE" SET MULTIPATH= &MULTIPATH "PRINT FAMILY COLLEGE INVESTMENT END
SEGTOP01 S1***************FAMILY *** *** *** *** ******************************* I +-----------------+ I I I SEG1 I SEG202 I S1 03 I S1************** ***************COLLEGE ** *INVESTMENT *** ** * *** ** * *** ** * *** ** * ***************** ***************
FAMILY COLLEGE INVESTMENT
WANG YALE SCHWAB
WHITE YALE .
LASTRA . SCHWAB
SET MULTIPATH= SIMPLE
FAMILY COLLEGE INVESTMENT
WANG YALE SCHWAB
SET MULTIPATH= COMPOUND
Copyright 2007, Information Builders. Slide 36
Retrieval Short Paths
High level segments with missing referenced descendents rejected (short path)
SET ALL=ON High level segments with missing referenced descendents
accepted (missing fails IF/WHERE tests) SET ALL=PASS
High level segments with qualified or missing referenced descendents accepted (missing passes IF/WHERE tests)
Valid only for FOCUS files SET ALL=SQL (coming in 7.7)
SET ALL=OFF
q
Copyright 2007, Information Builders. Slide 37
A B
2
C
21
&ALL &IF RESULT ON A 1, A 2, B .,C 2&ALL &IF RESULT OFF A 1, A 2, C 2
A B
2
C
21
&ALL &IF RESULT ON SSN EQ 1 A 1
A B
2
C
21
Retrieval Short Paths
SET ALL = &ALLTABLE FILE DEPTSPRINT *&IFEND
DEPT
SSN
SEX
LNAME
I
I
&ALL &IF RESULT PASS SSN EQ 1 A 1, B .
A B
2
C
21
q
Copyright 2007, Information Builders. Slide 38
A B
2
C
21
DEPT
SSN
SEX
LNAME
I
I
A B
2
C
21
Retrieval Short Paths
SET ALL=PASS
TABLE FILE DEPTS
PRINT DEPT SSN
WHERE SSN EQ 1 AND SSN EQ 2
END
q
Copyright 2007, Information Builders. Slide 39
RetrievalJOIN TO MULTIPLE
INNER
LEFT OUTER
JOIN INNER key IN filea TO MULTIPLE key in fileb AS J1
OR
SET ALL = OFF JOIN key IN filea TO MULTIPLE key in fileb AS J1
JOIN LEFT_OUTER key IN filea TO MULTIPLE key in fileb AS J1
OR
SET ALL =ONJOIN key IN filea TO MULTIPLE key in fileb AS J1
Copyright 2007, Information Builders. Slide 40
RetrievalJOIN TO UNIQUE
FOCUS MANAGED JOIN
SET ALL= IRRELEVANT
ALWAYS A LEFT OUTER JOIN
ONLY ONE MATCHING RECORD RETRIEVED
MISSING RECORD ARE DISPLAYED WITH DEFAULT VALUES
ADAPTER (RELATIONAL) MANAGED JOIN
SET ALL= RELEVANT
MAY BE LEFT OUTER JOIN OR INNER JOIN BASED ON ALL
ALL=ON LEFT_OUTER
ALL=OFF INNER
ALL MATCHING RECORD RETRIEVED
MISSING RECORD ARE DISPLAYED WITH DEFAULT VALUES
Copyright 2007, Information Builders. Slide 41
RetrievalShort Paths
DEPT
SSN
DEPT
LNAME
I
I
A B C
C1
A2
A1
JOIN DEPT IN DEPT1 TO DEPT IN EMP AS AJ
TABLE FILE DEPT1
PRINT DEPT
WHERE DEPT1.DEPT NE EMP.DEPT
END
A B C
C1
A2
A1
q
Copyright 2007, Information Builders. Slide 42
Retrieval Short Paths
Referenced, not present, Unique Segments are defaulted to blanks for alpha fields, zeros for numeric's
Unique segments do not create short paths. Therefore, ALL settings are irrelevant for Unique segments.
Unique segments (U, KU, DKU, and KLU) are never considered missing
q
Copyright 2007, Information Builders. Slide 43
FOCWIZARDISM
Missing Referenced Descendents Of
Missing Unique Segments Revert To:
ALL=OFF logic
EMPDATA 01 S1 ************** *PIN **I *LASTNAME ** *FIRSTNAME ** *MIDINITIAL ** * ** *************** ************** I I I I PERSONAL 02 I KU .............. :PIN :K :INCAREOF : :STREETNO : :APT : :STATE :I :............: JOINEDI PERSINFO I I I I ONE 03 I KU .............. :STATE :K :FULLNAME : : : : : : : :............: JOINED STATENAME
Can’t get here
If This Segment Is Missing
q
Copyright 2007, Information Builders. Slide 44
Internal Matrix Generation
One row for each distinct combination of sort keys
One column for each verb object Computed columns, row and column totals,
subtotals, and summaries are not yet done All data is in internal form
The output of the SORT/MERGE phase is conceptually a matrix
q
Copyright 2007, Information Builders. Slide 45
Internal Matrix Generation
Fields following a verbFields used in COMPUTEs not previously
mentionedFields used in HEADINGs or FOOTINGsFields used in SUBHEADs or SUBFOOTs, not
previously mentionedMISSING fields are not counted
Sort FieldsBY fieldsACROSS fields (used as BY at sort phase)FOCLIST (verb is PRINT or LIST)
Verb Objects (both SUM and COUNT are calculated)
q
Copyright 2007, Information Builders. Slide 46
Internal Matrix GenerationMultiple Verb Sets
SUM SALES BY DIVISION
SUM SALES BY DIVISION BY YEAR
LIST SALES BY DIVISION BY YEAR
q
Copyright 2007, Information Builders. Slide 47
Internal Matrix GenerationMultiple Verb Sets
EAST 210
NORTH 150
SOUTH 30
WEST 10
SUM SALES BY DIVISION
1 40
2 60
3 110
1 60
2 90
1 10
2 20
1 10
99 100
00 110
99 60
00 90
99 30
99 10
DIV SALES
SUM SALES BY DIVISION BY YEAR
YEAR SALESLIST SALES BY DIVISION BY YEAR
FOCLIST SALES
q
Copyright 2007, Information Builders. Slide 48
Multi verb option - WITHIN
Use WITHIN Phrase To Manipulate Field's Values Aggregated Within BY
Can Be Used With A Prefix Operator
Up To 64 Fields In A Display Command When Using The WITHIN Phrase
WITHIN Phrase Requires A BY Phrase And/Or An ACROSS Phrase
A Maximum Of Two WITHIN Phrases Can Be Used Per Display Field If One WITHIN Phrase Is Used, It Must Act On A BY Phrase
If Two WITHIN Phrases Are Used The First Must Act On A By Phrase The Second On An ACROSS Phrase.
You Can Also Use WITHIN table Returns The Value WITHIN A Request WITHIN Table Can Be Used When An ACROSS Phrase Is Needed Without A BY
Phrase A Single WITHIN Phrase Requires A BY Phrase
q
Copyright 2007, Information Builders. Slide 49
Multi verb option - WITHIN
q
TABLE FILE CARSUMCNT.SALES AS 'COUNT,OF,MODELS,WITHIN,CAR'CNT.SALES WITHIN COUNTRY AS 'TOTAL,MODELS,WITHIN,COUNTRY'PCT.CNT.SALES WITHIN COUNTRY AS 'PERCENT,OF,MODELS,WITHIN,COUNTRY'CNT.SALES WITHIN TABLE AS 'TOTAL,COUNT,OF,MODELS,ALL COUNTRIES'PCT.CNT.SALES WITHIN TABLE AS 'PERCENT,OF,MODELS,ALL COUNTRIES'BY COUNTRYBY CAREND COUNT PERCENT TOTAL
OF TOTAL OF COUNT PERCENT MODELS MODELS MODELS OF OF WITHIN WITHIN WITHIN MODELS MODELS COUNTRY CAR CAR COUNTRY COUNTRY ALL COUNTRIES ALL COUNTRIES ------- --- ------ ------- ------- ------------- ------------- ENGLAND JAGUAR 2 4 50.00 18 11.11 JENSEN 1 4 25.00 18 5.56 TRIUMPH 1 4 25.00 18 5.56 FRANCE PEUGEOT 1 1 100.00 18 5.56 ITALY ALFA ROMEO 3 4 75.00 18 16.67 MASERATI 1 4 25.00 18 5.56 JAPAN DATSUN 1 2 50.00 18 5.56 TOYOTA 1 2 50.00 18 5.56 W GERMANY AUDI 1 7 14.29 18 5.56 BMW 6 7 85.71 18 33.33