THINKing in WEBFOCUS

40
Walter F. Blood Information Builders Nashville User Forum February 23, 2012 THINKing in WEBFOCUS

description

THINKing in WEBFOCUS. Walter F. Blood Information Builders Nashville User Forum February 23, 2012. Output Generator. Report Generator. Matrix. Thinking in WebFocus. Retrieve DEFINE Screening. Analysis. FOCUS or External Sort Aggregation COUNT/MIN/MAX. TOTAL Screens - PowerPoint PPT Presentation

Transcript of THINKing in WEBFOCUS

Page 1: THINKing  in WEBFOCUS

Walter F. BloodInformation Builders

Nashville User ForumFebruary 23, 2012

THINKing in WEBFOCUS

Page 2: THINKing  in WEBFOCUS

Thinking in WebFocus

Retrieve DEFINEScreening

FOCUS or External SortAggregationCOUNT/MIN/MAX

TOTAL ScreensCOMPUTEFormatExtracts

Analysis Report Generator

Matrix

Output Generator

Page 3: THINKing  in WEBFOCUS

Thinking in WebFOCUSAnalysis

Verify DBA access to file(s)

Determine I/O access modules required

Process DEFINE field expressions for pertinent files

Read and parse the request

Check DBA and set up access restrictions at SEGMENT and FIELD levels

Open and parse Master File Descriptions

Page 4: THINKing  in WEBFOCUS

Thinking in WebFOCUS Analysis

Activate fields (real and DEFINEd) Read USE list and/or check Access Files and

FILEDEF/ALLOCATES Open and Verify files

Activate segments: referenced subtree(s) Smallest subtree which contains “root” and every

segment referenced directly or indirectly (HEADING PARENT AND GRAND CHILD)

Page 5: THINKing  in WEBFOCUS

Thinking in WebFOCUSRetrieval

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

Page 6: THINKing  in WEBFOCUS

Thinking in WebFOCUSRetrieval - SQL

WebFOCUS converted to SQL Levels of optimization

JoinSelectionAggregationDEFINEd fields

Unoptimized – done in WebFOCUS Returns data at the Internal Matrix level or before

SQL interface retrieval optimized

Page 7: THINKing  in WEBFOCUS

Thinking in WebFOCUS Structures

SH2KU

KEMP_IDSPOUSE

JOIN EMP_ID IN EMPLOYEE TO EMP_ID IN SPICE AS AJ

EMP_IDFIRST_NAMELAST_NAME

COVER_DTTYPE_COVER

FAMILY

JOIN EMP_ID IN EMPLOYEE TO ALL EMP_ID IN KIDS AS BJ

EMP_IDCHILD_DOB

CHILD_NAME

K

KM

Page 8: THINKing  in WEBFOCUS

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

Thinking in WebFOCUSStructures

JOIN EMP_ID IN EMPLOYEE TO EMP_ID IN SPICE AS J1SEG1 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

Limit 1024 segments in structureLimit 1023 Joins

Page 9: THINKing  in WEBFOCUS

Thinking in WebFOCUSDEFINE

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

Page 10: THINKing  in WEBFOCUS

Thinking in WebFOCUS Order of Retrieval – FOCUS 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

Page 11: THINKing  in WEBFOCUS

Thinking in WebFOCUS Order of Retrieval – FOCUS Files

Fieldname is not indexedSegment containing “fieldname” becomes ROOT of

the view, and is retrieved physicallyFieldname 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

Page 12: THINKing  in WEBFOCUS

Thinking in WebFOCUS Order of Retrieval – FOCUS Files

Alternate Physical View is created through the referenced segment highest in the hierarchy

SET AUTOINDEX=ONAlternate Indexed View is created if there is an Equality

test specified for an indexed field on the referenced segment highest in the hierarchy

SET AUTOSTRATEGY=ONEquality IF/WHERE test on primary key field in logically

retrieved segment will terminate “chain chasing” as soon as possible

SET AUTOPATH = ON

Page 13: THINKing  in WEBFOCUS

Thinking in WebFOCUS Autostrategy – FOCUS Files

IL MI

00010002 9912 9911 9910 9911 9910 9909

WHERE DATE EQ ‘9912’1 STATE=IL, DATE=0002 Continue Search2 STATE=IL, DATE=0001 Continue Search3 STATE=IL, DATE=9912 Continue Search4 STATE=IL, DATE=9911 Next Parent5 STATE=MI, DATE=9911 Next Parent

STATE

DATE

Page 14: THINKing  in WEBFOCUS

Thinking in WebFOCUS FIXRETRIEVE – SUFFIX=FIX

SET FIXRETRIEVE=ON Equality IF/WHERE test on primary specified sort field in single

segment FIX file will terminate retrieval as soon as possible

FILE=TESTFI,SUFFIX=FIXSEGNAME=TESTSEG,SEGTYPE=S1 FIELD=COUNTRY,E01,A10,A10,$ FIELD=CAR ,E02,A16,A16,$

ENGLAND JAGUARENGLAND JENSENENGLAND TRIUMPHFRANCE PEUGEOTITALY AUDI

WHERE COUNTRY EQ ‘FRANCE’

Retrieval stops if:Set FIXRETRIEVAL = ON

Page 15: THINKing  in WEBFOCUS

Thinking in WebFOCUS 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

Page 16: THINKing  in WEBFOCUS

Thinking in WebFOCUSMultiple Paths

ARRIVE_TIMEARR_FLIGHTARR_FROM

DEPART_TIMEDEP_FLIGHTDEPART_TO

Airport

Page 17: THINKing  in WEBFOCUS

Thinking in WebFOCUSMultiple 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_TIMEARR_FLIGHTARR_FROM

DEPART_TIMEDEP_FLIGHTDEPART_TO

Airport

Page 18: THINKing  in WEBFOCUS

Thinking in WebFOCUSMultiple Paths

FAMILYINVESTMENT

FAMILYCOLLEGE

FAMILY

Page 19: THINKing  in WEBFOCUS

Thinking in WebFOCUS Multiple Paths Instances

1

A I

B M

2

B M

C

3

C I

D

FAMILY

FAMILYCOLLEGE

FAMILYINVESTMENT

Page 20: THINKing  in WEBFOCUS

Thinking in WebFOCUSMultiple Paths

TABLE FILE SAMPLEPRINT COLLEGE INVESTBY FAMILYWHERE COLLEGE EQ ‘B’WHERE INVEST EQ ‘I’END

FAMILY COLLEGE INVEST------ ------- ------1 B I2 B .3 . I

FAMILY COLLEGE INVEST------ ------- ------1 B I

SET MULTIPATH=SIMPLE SET MULTIPATH=COMPOUND

Page 21: THINKing  in WEBFOCUS

Thinking in WebFOCUS Retrieval - Short Paths

High level segments with missing referenced descendents rejected (short path)

SET ALL=ON -- JOIN LEFT_OUTER 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)

SET ALL=OFF -- JOIN INNER

Page 22: THINKing  in WEBFOCUS

Thinking in WebFOCUS Retrieval - Short Paths

Referenced, not present, Unique Segments are defaulted to blanks for alpha fields, zeros for numerics

Unique segments do not create short paths. Therefore, ALL settings are irrelevant for Unique segments.

Note: Missing referenced descendents of missing unique segments revert to ALL=OFF logic

Unique segments (U, KU, DKU, and KLU) are never considered missing

Page 23: THINKing  in WEBFOCUS

Thinking in WebFOCUSInternal 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

Page 24: THINKing  in WEBFOCUS

Thinking in WebFOCUSInternal Matrix - Contents

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 low order BY at sort

phase)FOCLIST (verb is PRINT or LIST)

Verb Objects (both SUM and COUNT are calculated)

Page 25: THINKing  in WEBFOCUS

Thinking in WebFOCUSMultiple Verb Sets - limits

Up to 16 verbs with associated BY fields can be specified

Up to 128 sort fields may be specified Up to 1024 verb objects may be specified

Page 26: THINKing  in WEBFOCUS

Thinking in WebFOCUSMultiple 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

Page 27: THINKing  in WEBFOCUS

Thinking in WebFOCUSInternal Matrix - Sorting

Aggregation is performed as record is sorted, with FOCUS sort

Aggregation is performed by external sort if SET EXTAGGR = ON

Numeric Fields are added. Alpha fields being SUMmed, return the LAST value within the BY field, the FST value with external sorts (SET SUMPREFIX=LST if required)

All verb objects are also COUNTed

Page 28: THINKing  in WEBFOCUS

Thinking in WebFOCUSMerge – FOCUS Sort

SORT MERGE

FOCSORT

BINs

FOCSORTBINs

SORT MERGE

BINsFOCSORT

Page 29: THINKing  in WEBFOCUS

Thinking in WebFOCUSEXTSORT = ON, AUTOTABLEF = OFF

FOCSORT

BINs ~ First 5000

Records

EXTSORT

BINsSubsequent

Records

S001WK09

S001WK08

S001WK07

S001WK06

S001WK05

S001WK04

S001WK03

S001WK02

S001WK01

FOCSORTSORT

MERGE FOCSORT

Page 30: THINKing  in WEBFOCUS

Thinking in WebFOCUSEXTSORT = ON, AUTOTABLEF = ON

S001WK09

S001WK08

S001WK07

S001WK06

S001WK05

S001WK04

S001WK03

S001WK02

S001WK01

EXTSORTSubsequent

Records

OFFLINE

Extract

Hotscreen

Or…

Or…

BINs ~ First 5000

Records

Page 31: THINKing  in WEBFOCUS

Thinking in WebFOCUSOutput Stage

SORT Internal Matrix

FOCSML

Report Extract

Formatting/Stylsheets HOLD/PCHOLD/SAVEFML/EMRProcessor

Secondary Sort

Post Matrix Processing

COMPUTE’sIF/WHERE TOTAL

BY TOTAL

Totals…

Page 32: THINKing  in WEBFOCUS

Thinking in WebFOCUSBY TOTAL

PAGE 1 PIN AVE DEPT SALARY COUNT SALARY ---- ------ ----- ------ ACCOUNTING $283,300.00 5 $56,660.00 SALES $395,200.00 7 $56,457.14 MARKETING $570,700.00 11 $51,881.82 CUSTOMER SUPPORT $198,400.00 4 $49,600.00 PROGRAMMING & DVLPMT $182,300.00 4 $45,575.00 PERSONNEL $216,800.00 5 $43,360.00 CONSULTING $126,300.00 3 $42,100.00 ADMIN SERVICES $56,200.00 2 $28,100.00

TABLE FILE EMPDATA SUM SALARY CNT.PIN COMPUTE AVGSAL=SALARY/CNT.PIN; AS 'AVE,SALARY' BY HIGHEST TOTAL AVGSAL NOPRINT BY DEPT END

Page 33: THINKing  in WEBFOCUS

Thinking in WebFOCUSOutput Stage

SORT Internal Matrix

FOCSML

Report Extract

Formatting/Stylesheets HOLD/PCHOLD/SAVEFML/EMRProcessor

Secondary Sort

Post Matrix Processing

COMPUTE’sIF/WHERE TOTAL

BY TOTAL

Totals…

Page 34: THINKing  in WEBFOCUS

Thinking in WebFOCUSON Sortfield Options

Subtotaling – BY and ACROSS SUBTOTAL and SUB-TOTAL RECOMPUTE and SUMMARIZE

MULTILINE suppresses operation if only single detail line

RECAP (COMPUTE) SUBFOOT/SUBHEAD

Page 35: THINKing  in WEBFOCUS

Thinking in WebFOCUSTotaling

BY specified onlyand TABLE *

BY specified plusHigher BysTABLE *

ADD’s all numeric columns

SUBTOTALCOLUMN-TOTAL

SUB-TOTAL

RecalculatesCOMPUTE’sADD’s up other numeric columns

RECOMPUTE SUMMARIZE

* NOTOTAL Suppresses Grand Totals

Page 36: THINKing  in WEBFOCUS

Thinking in WebFOCUSON Sortfield Options - Format

PAGE-BREAK [REPAGE] NOSPLIT

**FOLD-LINE **SKIP-LINE UNDERLINE

** May be specified on verb-objects

Page 37: THINKing  in WEBFOCUS

Thinking in WebFOCUSON TABLE Options

Totaling – ON TABLE… COLUMN-TOTAL ROW-TOTAL SUMMARIZE NOTOTAL RECAP [PAGE-BREAK AND ] SUBFOOT/SUBHEAD

Page 38: THINKing  in WEBFOCUS

Thinking in WebFOCUSHEADings and FOOTings

References to fields in SUBHEAD and SUBFOOT become verb objects only if not previously mentioned

Fields used in HEADINGs and SUBHEADs are taken from the first line within the group (BY phrase or page)

References to fields in HEADING and FOOTING become verb objects with the first verb

Page 39: THINKing  in WEBFOCUS

Thinking in WebFOCUSON TABLE Extract Options

Extracts ON TABLE HOLD [FORMAT …] ON TABLE PCHOLD [FORMAT…] ON TABLE SAVE [FORMAT…]

SET commands specific to format Interface SET WebFOCUS SET

Page 40: THINKing  in WEBFOCUS

Thinking in WebFOCUS

QUESTIONS?