Copyright 2007, Information Builders. Slide 1
ONE-LINERS for WebFOCUS Efficiency
Joel StarkmanDirector of Operations, FOCUS Division
Information Builders, Inc.
June 2012
Skip video
JUMP
Copyright 2007, Information Builders. Slide 2
One-Liners For WebFOCUS Efficiency
*Your mileage may vary
Perform one extra pre-step in your process, or
Replace one type of statement with another, or
Add one line into or before your request, or
Issue just one additional SET statement.
Perform one extra pre-step in your process, or
Replace one type of statement with another, or
Add one line into or before your request, or
Issue just one additional SET statement.
JUMP
Prove it - How do I see these savings?
-SET &STARTCPU = &FOCCPU ;TABLE ….-RUN-SET &ENDCPU = &FOCCPU ;-SET &USED=(&ENDCPU - &STARTCPU) /1000;-TYPE Table used &USED CPU seconds
-SET &STARTCPU = &FOCCPU ;TABLE ….-RUN-SET &ENDCPU = &FOCCPU ;-SET &USED=(&ENDCPU - &STARTCPU) /1000;-TYPE Table used &USED CPU seconds
Capture CPU in-stream
Examine post-execution
operating system statistics
Examine post-execution
operating system statistics
JUMP
Copyright 2007, Information Builders. Slide 4
Data already sorted in the order of the report request?
Use TABLEF !!
“I installed a skylight in my apartment yesterday. The people who live above me are really furious.”
Steven Wright
Use TABLEF when appropriate
TABLE FILE CARSUM DCOSTBY COUNTRY BY CAR ON CAR SUBFOOTEND
TABLE FILE CARSUM DCOSTBY COUNTRY BY CAR ON CAR SUBFOOTEND
Extractdata
Sort andMergedata
Generatereport
F
AVINGS: Eliminates large cost of sorting, even if none to do. S
One Liners For FOCUS Efficiency
JUMP
Copyright 2007, Information Builders. Slide 5
Performs the sort phase, butdoes not build internal matrix.
Sort andmergedata
Ellen Degeneres
“My grandmother started walking five miles a day when she was sixty. She’s ninety-seven now,
and we have no idea where she is.”
Use AUTOTABLEF to bypass the Merge phase
AVINGS: This customer cut a 6-hour report to 6-minutes. S
One Liners For FOCUS Efficiency
TABLE FILE …SUM [~200 fields]BY [3 sorts] ON TABLE HOLDEND
TABLE FILE …SUM [~200 fields]BY [3 sorts] ON TABLE HOLDEND
Extractdata
Generatereport
SET AUTOTABLEF=ON
JUMP
Copyright 2007, Information Builders. Slide 6
"If you live to the age of a hundred you have it made because very few people die past the age of a hundred.”
George Burns
Most of the time, you don’t need the Internal Matrix
SET SAVEMATRIX = OFFTABLE FILE CARSUM DCOST
BY COUNTRY ON TABLE HOLDEND
No need to create or preserve
the Internal Matrix?
When is SAVEMATRIX=ON needed ? See next slide.
Savematrix defaults to OFF in Rel 7.2+, but might be set ON in a site-wide profile.
AVINGS: Significant cost of creating a matrix that is not used.S
born Nathan Birnbaum
One Liners For FOCUS Efficiency
JUMP
Copyright 2007, Information Builders. Slide 7
“I’m not going to buy my kids an encyclopedia. Let them walk to school like I did.”
Yogi Berra
Do the HOLDs after the END
TABLE FILE CARPRINT COUNTRY CARON TABLE HOLD AS HTMLENDTABLE FILE CARPRINT COUNTRY CARON TABLE HOLD AS EXL2KENDTABLE FILE CARPRINT COUNTRY CARON TABLE HOLD AS PDFEND
SET SAVEMATRIX = ONTABLE FILE CARPRINT COUNTRY CARON TABLE HOLD AS HTMLENDHOLD AS EXL2KHOLD AS PDF
HOLD’ing the same results in 3 different formats?
AVINGS: 50% for 2 HOLD, 66% for 3 HOLDS, etc.SRe-uses saved matrix
Re-extracts entire data set 3 times
Re-extracts entire data set 3 times
Re-extracts entire set of data
3 times !
born Lawrence Peter Berra
One Liners For FOCUS Efficiency
Instead:
JUMP
Copyright 2007, Information Builders. Slide 8
Extract once to HOLD, then do multiple TABLEs
TABLE FILE HUGESUM …IF REGION EQ ‘NORTH’ENDTABLE FILE HUGESUM …IF REGION EQ ‘SOUTH’ENDTABLE FILE HUGESUM …IF REGION EQ ‘EAST’ENDTABLE FILE HUGESUM …IF REGION EQ ‘WEST’END
TABLE FILE HUGESUM …IF REGION EQ ‘NORTH’ENDTABLE FILE HUGESUM …IF REGION EQ ‘SOUTH’ENDTABLE FILE HUGESUM …IF REGION EQ ‘EAST’ENDTABLE FILE HUGESUM …IF REGION EQ ‘WEST’END
TABLE FILE HUGESUM …IF REGION EQ ‘NORTH’ OR ‘SOUTH’
OR ‘EAST’ OR ‘WEST’
ON TABLE HOLDEND
TABLE FILE HUGESUM …IF REGION EQ ‘NORTH’ OR ‘SOUTH’
OR ‘EAST’ OR ‘WEST’
ON TABLE HOLDEND
HOLD
HOLD
HOLD
HOLD
SAVINGS: Spend a little, get a lot, when high degree of aggregation.
“Apparently, a new survey says that three out of four people make up 75% of the population.”
David Letterman
One Liners For FOCUS Efficiency
Why extract the entire database
four times?
JUMP
Copyright 2007, Information Builders. Slide 9
“I was going to have cosmetic surgery until I noticed that the doctor's office was full of portraits by Picasso.”
Rita Rudner
For constants, use an &Variable instead of DEFINE
DEFINE FILE CARINCR/I3 = 50 ;ENDTABLE FILE CARSUM DCOSTCOMPUTE NEWCOST=DCOST + INCR ;BY COUNTRY BY CAREND
-SET &INCR = 50 ;TABLE FILE CARSUM DCOSTCOMPUTE NEWCOST=DCOST + &INCR ;BY COUNTRY BY CAREND
Recalculated for every record Calculated once
for entire report
SAVINGS: Could save millions of calculations, one per record.
One Liners For FOCUS Efficiency
Instead:
JUMP
“The IQ and the life expectancy of the average American recently passed each other,
going in opposite directions.”
George Carlin
Substitute DEFINE with COMPUTE
DEFINE FILE CARINCR/I7 = DCOST * 5 ;ENDTABLE FILE CARSUM DCOST
INCRBY COUNTRY BY CAREND
TABLE FILE CARSUM DCOSTCOMPUTE INCR/I7 = DCOST * 5 ;BY COUNTRY BY CAR END
Calculated for every record
extracted
AVINGS: Increases with record volume extracted and aggregated.S
One Liners For FOCUS Efficiency
Careful! You cannot always substitute DEFINE with COMPUTE.
Instead:
Calculated for each report row
after summation
JUMP
Copyright 2007, Information Builders. Slide 11
Don’t read the entire flat file
AllenBeattyBullockDenverKidman..Zappa
SET FIXRETRIEVE=ONTABLE FILE NAMES
PRINT NAME
IF NAME LT ‘E’
END
On
e Million
Record
s
Ten R
ecords
*Only for flat files
AVINGS: Average 50% search time; could save 1% or 99%.S
"I always wanted to be somebody, but I should have been more specific."
Lily Tomlin
One Liners For FOCUS Efficiency
The flat file is sorted on the screened field; stop searching when you see a larger value.
“ “
JUMP
Copyright 2007, Information Builders. Slide 12
Reformat fields inside the TABLE instead of DEFINE
DEFINE FILE CAR-* DCOST is originally D12.2INTCOST/I6 = DCOST ;ENDTABLE FILE CARSUM COST
INTCOSTBY CAREND
DEFINE FILE CAR-* DCOST is originally D12.2INTCOST/I6 = DCOST ;ENDTABLE FILE CARSUM COST
INTCOSTBY CAREND
TABLE FILE CARSUM DCOST
DCOST/I6 AS ‘INTCOST’BY CAREND
TABLE FILE CARSUM DCOST
DCOST/I6 AS ‘INTCOST’BY CAREND
No DEFINE needed
Hint: Extra field appears in a HOLD file. To remove, SET HOLDLIST=PRINTONLY
AVINGS: Only final displayed field is reformatted.S
Instead:
“I base most of my fashion taste on what doesn't itch.”
Gilda Radner
One Liners For FOCUS Efficiency
JUMP
Copyright 2007, Information Builders. Slide 13
COUNTRY
CAR
MODEL
BODYDCOST
Flip to Alternate File View to elevate screening criteria
COUNTRY
CAR
MODEL
BODYDCOST
COUNTRY
CAR
MODEL
BODYDCOST
Why follow pointers all the
way to the bottom, just to find that a DCOST does not fit the criteria?
TABLE FILE CARPRINT MODEL DCOSTIF DCOST GE 20000END
TABLE FILE CARPRINT MODEL DCOSTIF DCOST GE 20000END
.DCOST
P
O
I
N
T
E
R
S
BODY
MODEL
CAR
COUNTRY
DCOST
AVINGS: Tremendous reductions in I/O and response time.S
“I asked a fellow at hang-glider school 'How many successful jumps do you need before you graduate?'
He said, 'All of them.’ ”
Red Skelton
One Liners For FOCUS Efficiency
JUMP
Copyright 2007, Information Builders. Slide 14
COUNTRY
CAR
MODEL
BODYDCOST
“I don’t like watching golf on TV. I can’t stand whispering.”
Use Indexed File View to elevate screening criteria
COUNTRY
CAR
MODEL
BODYDCOST
COUNTRY
CAR
MODEL
BODYDCOST
Same dot-syntax as alternate view;
uses index automatically when present.
TABLE FILE CARPRINT MODEL DCOSTIF DCOST GE 20000END
TABLE FILE CARPRINT MODEL DCOSTIF DCOST GE 20000END
.DCOST
P
O
I
N
T
E
R
S
BODY
MODEL
CAR
COUNTRY
DCOST
AVINGS: Tremendous reductions in I/O and response time.S
David Brenner
One Liners For FOCUS Efficiency
Note: Index view requires test on indexed field
JUMP
Copyright 2007, Information Builders. Slide 15
“I’m the kind of guy who will have nothing all my life and then they’ll discover oil while digging my grave.”
George Gobel
Presort the data before loading
A B C D E F G H I J
EHFGD
Unsorted
MODIFY FILE …FIXFORM keyfieldMATCH keyfieldON NOMATCH UPDATEDATA ON …
Sort the data file first
P a g e 1 P a g e 2 P a g e 3 P a g e 4
“If it’s not ahead of me, I have to
start from the top.” - WebFOCUS
SAVINGS: Could be 100’s of times faster on large volumes.
Call system sortDEFGH
Sorted
One Liners For FOCUS Efficiency
Same appliesto MAINTAIN
JUMP
Copyright 2007, Information Builders. Slide 16
“I find television very educating. Every time somebody turns on the set,
I go into the other room and read a book.”
Groucho Marx
JOIN in the faster direction
FILE=JOBSEGMENT=JOB1, …FIELD=POS, …, INDEX=I,$FIELD=BLDG, … …
FILE=JOBSEGMENT=JOB1, …FIELD=POS, …, INDEX=I,$FIELD=BLDG, … …
Carly Corinthos OperatorAlexis Davis TechnicalDr. Patrick Drake OperatorDamian Spinelli TechnicalDante Falconeri Vice PresEthan Lovett OperatorJohnny Zacchara ManagerOlivia Falconeri SecretaryShawn Butler TechnicalSteven Webber ManagerJasper "Jax" Jacks PresidentLuke Spencer PresidentMaxie Jones OperatorSonny Corinthos PresidentElizabeth Spenser SecretarySamantha McCall OperatorJason Morgan TechnicalEdward Quartermaine Vice PresMichael Corinthos, III OperatorTracy Quartermaine OperatorMalcolm ‘Mac’ Scorpio ManagerLulu Spencer OperatorsMax Giambetti TechnicalElizabeth Webber Technical
JOIN POS IN GH TO POS IN JOBJOIN POS IN GH TO POS IN JOB
FILE=GHSEGMENT=GH1, …FIELD=NAME, …FIELD=POS, …INDEX=I,$…
FILE=GHSEGMENT=GH1, …FIELD=NAME, …FIELD=POS, …INDEX=I,$…
TABLE FILE ????PRINT NAMEWHERE BLDG IS ‘C2’ END
TABLE FILE ????PRINT NAMEWHERE BLDG IS ‘C2’ END
Manager A1Operator C2President C2Secretary B3Technical C2Vice Pres A1
JOIN POS IN JOB TO POS IN GHJOIN POS IN JOB TO POS IN GH
JOB
SAVINGS: Could reduce processing time by 90% or more.
born Julius Henry Marx
One Liners For FOCUS Efficiency
JUMP
Copyright 2007, Information Builders. Slide 17
>> rebuildENTER OPTIONexternal indexNEW OR ADD TO EXISTING?. . .
-AHP F - - - - - - - - - -FGJH JIDSA EJSDQR WLFS Z - - - - - - - - - - -ZWIO H
AAACDDEFHHHJ....
UWXYZZ
On
e Million
Record
s
SAVINGS: Could reduce data accessing time by 90% or more.
EXTERNAL
INDEX
Build your own External Index when you don’t have write access to the file
TABLE FILE filename.indexfieldBuild your own index
Note:External Index is static - not updated per transaction. Must Rebuild Index if file changes, say nightly.
“A boy can learn a lot from a dog: obedience, loyalty, and the importance of turning around three times
before lying down.”
Robert Benchley
One Liners For FOCUS Efficiency
Non-writeable file, no index on field 2
JUMP
Copyright 2007, Information Builders. Slide 18
BY TOTAL – Sort by computed columns in one pass
AVINGS: Eliminates second pass of the data – could be 50%.S
Sort by Average Sales*
COUNTRY CAR AVE SALES SALESENGLAND JENSEN 17650 73000 TRIUMPH 24200 122000JAPAN HONDA 17480 235000 TOYOTA 18250 197300TABLE FILE CAR SUM SALES AVE.SALES BY COUNTRY BY CARON TABLE HOLDENDTABLE FILE HOLD SUM E03 BY COUNTRY BY CAR BY E04 AS ‘Ave Sales’’ END
TABLE FILE CAR SUM SALES AVE.SALES BY COUNTRY BY CARON TABLE HOLDENDTABLE FILE HOLD SUM E03 BY COUNTRY BY CAR BY E04 AS ‘Ave Sales’’ END
TABLE FILE CAR SUM SALES BY COUNTRY BY CAR BY TOTAL AVE.SALESEND
TABLE FILE CAR SUM SALES BY COUNTRY BY CAR BY TOTAL AVE.SALESEND
*Invented numbers
No HOLD !
BY AVE.SALES
“Curious people are interesting people. I wonder why that is.“
Bill Maher
One Liners For FOCUS Efficiency
JUMP
Copyright 2007, Information Builders. Slide 19
Display the number of the last page (Finally!)
TABLE FILE CARHEADING "PAGE <TABPAGENO OF <TABLASTPAGE </1"SUM DCOST BY COUNTRY PAGE-BREAK ON TABLE HOLD FORMAT HTML ON TABLE SET STYLE * TYPE=REPORT,FONT=ARIAL,$ ENDSTYLE END
TABLE FILE CARHEADING "PAGE <TABPAGENO OF <TABLASTPAGE </1"SUM DCOST BY COUNTRY PAGE-BREAK ON TABLE HOLD FORMAT HTML ON TABLE SET STYLE * TYPE=REPORT,FONT=ARIAL,$ ENDSTYLE END
Page 4 of 4Page 4 of 4
Page 3 of 4Page 3 of 4
Page 2 of 4Page 2 of 4
Page 1 of 4
REPORT
Page 1 of 4
REPORT
“A girl phoned me the other day and said ‘Come on over, there’s nobody home’. I went over.
Nobody was home.”
Rodney Dangerfield
SAVINGS: Internally still two passes – mostly for coding simplicity
born Jacob Cohen
One Liners For FOCUS Efficiency
Note: &FOCNEXTPAGE is set to TABLASTPAGE+1 Supported for FORMAT HTML/PDF/PS only
JUMP
Copyright 2007, Information Builders. Slide 20
DEFINE FILE ... EXCHANGE/A3 = EDIT(PHONE,'$$$999$$$$'); FLAG/A1 = IF (SALARY + BENEFITS GT 50000) AND (EXCHANGE EQ '736‘) THEN 'Y' ELSE 'N';END
Test higher-hit fields first
AVINGS: Potentially significant reduction in calculation time.S
TABLE FILE ...PRINT ... IF LASTNAME EQ ‘$M$*' IF EXCHANGE EQ '736' WHERE FLAG EQ 'Y‘END
TABLE FILE ...PRINT ... WHERE FLAG EQ 'Y‘ IF EXCHANGE EQ '736‘ IF LASTNAME EQ ‘$M$*'END
Calculated first for every record -- and often false
Complicated calc done only when all other criteria pass
Do real fields first, or those most likely to eliminate records
Technique applies to fields on the same level. Higher level screens are always done first,
regardless of the order coded.
“The most exciting phrase to hear in science, the one that heralds new discoveries, is not 'Eureka!' but
'That's funny...‘ ”
Isaac Asimov
One Liners For FOCUS Efficiency
JUMP
Copyright 2007, Information Builders. Slide 21
DEFINE FILE ... LASTNAME2/A1 = EDIT(LASTNAME,’$9’);END
TABLE FILE ...PRINT ... IF LASTNAME2 EQ ‘M' IF EXCHANGE EQ '736' IF FLAG EQ 'Y‘END
DEFINE FILE ... LASTNAME2/A1 = EDIT(LASTNAME,’$9’);END
TABLE FILE ...PRINT ... IF LASTNAME2 EQ ‘M' IF EXCHANGE EQ '736' IF FLAG EQ 'Y‘END
Do string manipulation inside the TABLE when possible
“????.”
AVINGS: In-TABLE string manipulation is faster than DEFINE.S
TABLE FILE ...PRINT ... IF LASTNAME EQ ‘$M$*' IF EXCHANGE EQ '736' IF FLAG EQ 'Y‘END
$ means any one character$* means all remaining chars
Marcel Marceauborn Marcel Mangel
One Liners For FOCUS Efficiency
JUMP
Copyright 2007, Information Builders. Slide 22
Index your HOLD file
“I’m this century’s Dennis The Menace.”
AVINGS: Slower to build extract, but much faster post-retrieval. S
Bart Simpsonborn Bartholomew Jo-Jo Simpson
TABLE FILE … PRINT CITY TITLE BY EMPL_NO ON TABLE HOLDENDTABLE FILE HOLD COUNT EMPL_NO BY TITLE IF CITY EQ ‘ORLANDO’END
FORMAT FOCUS INDEX CITY
Extracts might be more efficient if you could index important search
fields for subsequent reports.
Sequential file sorted by
EMPL_NOFOCUS database
indexed on CITY
One Liners For FOCUS Efficiency
JUMP
Copyright 2007, Information Builders. Slide 23
Build an alternate master with large alphas when you need only a few fields out of hundreds“When you go into court you are putting your fate into the hands of twelve people who weren’t smart enough
to get out of jury duty.”
Norm Crosby
AVINGS: Reduce parsing time, especially for iterative usage.S
FILE=LOTSOFSEGMENT=ONE FIELD=ABC,,A10 FIELD=DEF,,I9 FIELD=GHI,,F4.1 FIELD=JKL,,D12.2 FIELD=MNO,,A5
FILE=LOTSOFSEGMENT=ONE FIELD=ABC,,A10 FIELD=DEF,,I9 FIELD=GHI,,F4.1 FIELD=JKL,,D12.2 FIELD=MNO,,A5
FILE=LOTSOFSEGMENT=ONE FIELD=ABC,,A10 FIELD=DEF,,I9 FIELD=LAST3,,A17
FILE=LOTSOFSEGMENT=ONE FIELD=ABC,,A10 FIELD=DEF,,I9 FIELD=LAST3,,A17
TABLE FILESUM ABC BY DEFEND
TABLE FILESUM ABC BY DEFEND
SEGMENT=TWO FIELD=PQR,,I9 FIELD=STU,,F4.1 FIELD=VWX,,D12.2 FIELD=YZA,,A5 FIELD=PQR,,I9 FIELD=STU,,F4.1 FIELD=VWX,,D12.2 FIELD=YZA,,A5 FIELD=PQR,,I9 FIELD=STU,,F4.1 FIELD=VWX,,D12.2 FIELD=YZA,,A5
SEGMENT=TWO FIELD=PQR,,I9 FIELD=STU,,F4.1 FIELD=VWX,,D12.2 FIELD=YZA,,A5 FIELD=PQR,,I9 FIELD=STU,,F4.1 FIELD=VWX,,D12.2 FIELD=YZA,,A5 FIELD=PQR,,I9 FIELD=STU,,F4.1 FIELD=VWX,,D12.2 FIELD=YZA,,A5
SEGMENT=TWO FIELD=ALLONE,,A65
.
.
.
Make sure you count the bytes
properly !...
One Liners For FOCUS Efficiency
JUMP
Copyright 2007, Information Builders. Slide 24
JOIN fileson any fields
without indexes based on anycalculation
JOIN WHERE - when two files have nothing in common!
SAVINGS: Actually slow, but tough to code many scenarios without it
“With kids, the days are long, but the years are short.”
John Leguizamo
CAR FIRSTNAME LASTNAME ----- --------- -------- BMW JOHN BANNING JOAN IRVING BARBARA CROSS
CAR FIRSTNAME LASTNAME ----- --------- -------- BMW JOHN BANNING JOAN IRVING BARBARA CROSS
Which employees can afford to buy a BMW?Which employees can afford to buy a BMW?
JOIN FILE CAR AT RETAIL_COST TO ALL FILE EMPLOYEE AT CURR_SAL AS CAREMP
WHERE CURRSAL GT (RETAIL_COST*3);ENDTABLE FILE CARPRINT FIRSTNAME LASTNAME BY CARIF CAR EQ ‘BMW'END
Interpretation: You have to earn at least $90,000 to afford a car of $30,000.Example only; not the opinion of the presenter or Information Builders
One Liners For FOCUS Efficiency
JUMP
Copyright 2007, Information Builders. Slide 25Copyright 2007, Information Builders. Slide 25
Use JOIN instead of WHERE IN FILE
TABLE FILE CARPRINT COUNTRYWHERE COUNTRY NE 'ENGLAND'ON TABLE HOLD AS VALUES FORMAT ALPHAEND
AVINGS: JOIN is generally faster than a file search for each recordS
TABLE FILE CARSUM SEATS BY COUNTRYWHERE COUNTRY IN FILE VALUESEND
TABLE FILE CARSUM SEATS BY COUNTRYWHERE COUNTRY IN FILE VALUESEND
JOIN COUNTRY IN VALUES TO COUNTRY IN CAR AS J1TABLE FILE VALUESSUM SEATS BY COUNTRY
END
JOIN COUNTRY IN VALUES TO COUNTRY IN CAR AS J1TABLE FILE VALUESSUM SEATS BY COUNTRY
END
“If dogs could talk, it would take a lot of the fun out of owning one.”
Andy Rooney
One Liners For FOCUS Efficiency
JUMP
Copyright 2007, Information Builders. Slide 26Copyright 2007, Information Builders. Slide 26
FILE=CAR,…SEGMENT=…,SEGTYPE=S1,$FIELD=VALUE1,,A5,$FIELD=VALUE2,,A9,FIELDTYPE=I,$FIELD=VALUE3,,A2,FIELDTYPE=I,$FIELD=VALUE4,,A1,FIELDTYPE=I,$FIELD=VALUE5,,A6,$. . .
Force use of the higher-hit index
“It’s money. I remember it from when I was single.”
Billy Crystal
AVINGS: Significant reduction in data access time.S
One Liners For FOCUS Efficiency
TABLE FILE CARPRINT ... WHERE VALUE3 LT '736‘ WHERE VALUE4 EQ ‘ABC‘ WHERE VALUE2 EQ 'Y‘ END
TABLE FILE CARPRINT ... WHERE VALUE3 LT '736‘ WHERE VALUE4 EQ ‘ABC‘ WHERE VALUE2 EQ 'Y‘ END
Automatically uses the first index, regardless of how the WHEREs are
arranged in the TABLE
Force WebFOCUS to use the most valuable Index.
Only you know which one that is!
.VALUE3
CAR Master
JUMP
Copyright 2007, Information Builders. Slide 27
“Getting on a plane, I told the ticket agent to send one of my bags to New York and the other to LA. She said
she can’t do that. I told her she did it last week”.
Henny Youngman
REBUILD FOCUS databases without the Index first
FILE = …SEGMENT = …FIELD=ABC,,I5, FIELDTYPE=I ,$FIELD=DEF,,A12,$FIELD=GHI,,D12.2, FIELDTYPE=I ,$FIELD=JKL,,F5,$
FILE = …SEGMENT = …FIELD=ABC,,I5, FIELDTYPE=I ,$FIELD=DEF,,A12,$FIELD=GHI,,D12.2, FIELDTYPE=I ,$FIELD=JKL,,F5,$
1. Remove indexes and save as alternate master2. REBUILD REBUILD with no-index master3. Put back original master with indexes4. REBUILD INDEX
AVINGS: Usually measured in hours of elapsed time savings.S
One Liners For FOCUS Efficiency
* (up to 7 indexes)
JUMP
Copyright 2007, Information Builders. Slide 28
Minimize test-run time during development
-DEFAULT &1 = ‘ ‘-SET &&IFRECORDLIMIT = IF &1 NE ‘TEST’ THEN ‘ ‘- ELSE ‘IF RECORDLIMIT EQ 1’
;TABLE FILE …PRINT …BY …&&IFRECORDLIMITEND
EX focexecname TEST
Stop retrieval after the nth satisfying recordGenerally for Developers to quick-test codeEasy to turn on and off; ignored in Production
Hint: Use global &&Set once for entire application.
Parameter &1 of call
SAVINGS: Cut 99.9% of runtime (during testing).&&IFRECORDLIMIT is NOT a reserved variable; could be any name.
“Apparently, a new survey says that three out of four people make up 75% of the population.”
David Letterman
“We spend the first twelve months of our children’s lives teaching them to walk and talk, and the next twelve
telling them to sit down and shut up.”
Phyllis Dillerborn Phyllis Ada Driver
One Liners For FOCUS Efficiency
JUMP
Copyright 2007, Information Builders. Slide 29
Replace compound-IF in DEFINE with “WHERE”
Jackie Vernon
“When I was born my father spent three weeks trying to find a loophole in my birth certificate.”
DEFINE FILE ... TESTFIELD/A1 =
IF (F1 EQ ‘ABC’) OR (F2 GE 27) THEN ‘Y’ ELSE ‘N’ ;
END TABLE FILE ...IF TESTFIELD EQ ‘Y'END
DEFINE FILE ... TESTFIELD/A1 =
IF (F1 EQ ‘ABC’) OR (F2 GE 27) THEN ‘Y’ ELSE ‘N’ ;
END TABLE FILE ...IF TESTFIELD EQ ‘Y'END
TABLE FILE ...WHERE (F1 EQ ‘ABC’) OR (F2 GE 27) END
TABLE FILE ...WHERE (F1 EQ ‘ABC’) OR (F2 GE 27) END
AVINGS: WHERE is much faster than compound-IF in DEFINES
Instead:
Must use WHERE, not IF, in this
compound situation
One Liners For FOCUS Efficiency
JUMP
Copyright 2007, Information Builders. Slide 30
-SET &CNT = 0 ;-LOOPTOP-SET &CNT = &CNT + 1 ;TABLE, MODIFY, etc.PRINT FIELD&CNT …-IF &CNT LE 10 GOTO LOOPTOP;-AFTERLOOP
-SET &CNT = 0 ;-LOOPTOP-SET &CNT = &CNT + 1 ;TABLE, MODIFY, etc.PRINT FIELD&CNT …-IF &CNT LE 10 GOTO LOOPTOP;-AFTERLOOP
-REPEAT LOOP FOR &CNT FROM 1 TO 10TABLE, MODIFY, etc.PRINT FIELD&CNT …-LOOP
-REPEAT LOOP FOR &CNT FROM 1 TO 10TABLE, MODIFY, etc.PRINT FIELD&CNT …-LOOP
Use –REPEAT instead of –IF loop
Other options:-REPEAT label n TIMES-REPEAT label WHILE condition
Randolph Duke: “Mother always said you were greedy.”
Mortimer Duke: “She meant it as a complement.”Trading
Places
Ralph Don Bellamy Ameche
AVINGS: Minor, yet far more readable code.S
One Liners For FOCUS Efficiency
Hint: Use &’s to vary the range dynamically
Hint: Use &’s to vary the range dynamically.Can decrement.Can be negative.
Instead:
JUMP
Copyright 2007, Information Builders. Slide 31
DEFINE/COMPUTE PHONE/A12 = ‘123-567-9012’;
EXCH/A3 = EDIT (PHONE, ‘$$$$999’) ; EXCH/A3 = SUBSTR (12, PHONE, 5, 7, 3, EXCH) ; EXCH/A3 = GETTOK (PHONE, 12, 2, ’-’, 3, EXCH) ;
DEFINE/COMPUTE PHONE/A12 = ‘123-567-9012’;
EXCH/A3 = EDIT (PHONE, ‘$$$$999’) ; EXCH/A3 = SUBSTR (12, PHONE, 5, 7, 3, EXCH) ; EXCH/A3 = GETTOK (PHONE, 12, 2, ’-’, 3, EXCH) ;
EDIT is faster than comparable subroutines
“The guy who invented the first wheel was an idiot. The guy who invented the other three – a genius.”
Sid Caesar
AVINGS: 25-50% directly attributable to those calculations.S
Extract the exchange
EDIT does not apply to all situations of partial extractions
born Isaac Sidney Caesar
One Liners For FOCUS Efficiency
JUMP
Copyright 2007, Information Builders. Slide 32
I leave you with this gem
"I'd rather be a could-be if I cannot be an are; because a could-be is a maybe who is reaching for a star. I'd rather be a has-been than a might-have-been, by far;for a might-have-been has never been, but a has was
once an are."
Milton Berle
One-Liners for WebFOCUS Efficiency
born Milton Berlinger
One Liners For FOCUS Efficiency
JUMP
End of presentation. Press Esc now.
Copyright 2007, Information Builders. Slide 33
JUMP
Copyright 2007, Information Builders. Slide 34
Director, Focus Div, Information Builders
“I found the secret to the work week. I’ve convinced myself that everything after Monday is almost Friday.”
Joel Starkman
Reduce MODIFY update notices
Hey! Who’s this guy?
MODIFY FILE CARFIXFORMMATCH field ON MATCH REJECT ON NOMATCH INCLUDEDATA ON fileCHECK 99999END
MODIFY FILE CARFIXFORMMATCH field ON MATCH REJECT ON NOMATCH INCLUDEDATA ON fileCHECK 99999END
Default: write to database every
1000 records (1 for CRTFORM)
Or justCHECK OFF
Hint:Midstream recovery? Use “START &TRANS”
SAVINGS: Large I/O savings on bulk loads.
One Liners For FOCUS Efficiency
JUMP
Copyright 2007, Information Builders. Slide 35
“I set records that will never be equaled. In fact, I hope 90% of them don’t ever get printed.”
Bob Uecker
Eliminate 1000’s of REBUILD messages
SET REBUILDMSG = 100000REBUILDREORGDUMP or LOAD…
SET REBUILDMSG = 100000REBUILDREORGDUMP or LOAD…
CAR FOCUS A1 ON 09/23/2005 AT 16.19.05 REFERENCE...AT TRANS 100000 REFERENCE...AT TRANS 200000 REFERENCE...AT TRANS 300000 TRANSACTIONS: TOTAL =302000 ACCEPTED=302000 REJECTED= 0 SEGMENTS: INPUT =302000 UPDATED = 0 DELETED = 0
AVINGS: On large files, millions of JES bytes; save forests if printedS
One Liners For FOCUS Efficiency
(Default is 1000)
JUMP
Copyright 2007, Information Builders. Slide 36
Capture FOCUS commands and statistics with FOCLOG
“As a child my family’s menu consisted of two choices: take it or leave it.”
Buddy Hackett
AVINGS: Could be immense based on analysis of usage data. S
hart interactive activity versus batch activity across all LPARs.
ocate excessive or misguided use by measuring CPU, paper output, extract files, session length, frequency, repetition, ....
bserve how data is used by identifying the most popular extract destinations via HOLD (like HTML, Excel 2000, PDF).
raph patterns and trends of usage across any time period.
ind applications and focexecs that could significantly benefit from adjustment, consolidation, redesign.
versee how much FOCUS is being used at your site.
*FOCLOG is a chargeable product. See your local IBI Representative.
born Leonard Hacker
One Liners For FOCUS Efficiency
JUMP
Copyright 2007, Information Builders. Slide 37
I could index SSN, but an index won’t
help on partial searches
Split a field into pieces for instantaneous searches
USE FORSocial Security NumbersPhone NumbersCredit Card NumbersHottrack Numbers (we do!)
AVINGS: Rock-bottom I/O when searching for that ‘field’.S
SSNSSN4TO5
SSN1TO3
SSN6TO9
SSN123-45-6789
DATA
DATA
QUESTIONHow many pages would I have to
search to find the last of 999,999,999 SSN combinations?
5Mil pages
3 pages
40 pages
1 page
Store full SSN here too
“Always get married in the morning. That way if it doesn’t work out, you haven’t wasted the whole day.”
Mickey Rooneyborn Joseph Yule, Jr.
One Liners For FOCUS Efficiency
JUMP
Copyright 2007, Information Builders. Slide 38
LOAD FOCEXEC fex_name1 fex_name2 …LOAD FOCCOMP compiled_modify_name
EX …RUN …
LOAD FOCEXEC fex_name1 fex_name2 …LOAD FOCCOMP compiled_modify_name
EX …RUN …
Pre-LOAD your application into memory
“When I adlib something, I laugh for the same reason the audience does; I’ve never heard that joke before
and I’m just as surprised as they are.”
Steve Allen
AVINGS: Instant startup of large components. (No execution value.)S? LOAD [filetype]UNLOAD [* | filetype] [* | filename1 [filename2 …] ]
? LOAD [filetype]UNLOAD [* | filetype] [* | filename1 [filename2 …] ]
LOAD Masters and Access Files too
One Liners For FOCUS Efficiency
Uses the image now in memory