Slide 1 - ufm.ibi.com - PowerPoint

Document Sample
Slide 1 - ufm.ibi.com - PowerPoint Powered By Docstoc
					    ONE-LINERS
    for [Web]FOCUS Efficiency




                                      Joel Starkman
             Director of Operations, FOCUS Division
                           Information Builders, Inc.
                                       August, 2009


1
    One-Liners For [Web]FOCUS Efficiency




                 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, or
                 Increase the appropriate default limit value

                       *Opinions of comedians throughout this presentation are not
    Conclusion          necessarily those of the presenter nor Information Builders.
2
    Prove it - How do I see these savings?

    -SET &STARTCPU = &FOCCPU ;
    TABLE, etc….                Capture CPU
    -RUN                          in-stream                                                Examine your
    -SET &ENDCPU = &FOCCPU ;                                                               post-execution
    -SET &USED=(&ENDCPU - &STARTCPU) /1000;                                               operating system
    -TYPE Table used &USED CPU seconds                                                        statistics
                                                                      TABLE, etc….
            STATISTICS OF LAST COMMAND
                                                                      ? STAT
           RECORDS         =                  0             SEGS DELTD              =            0
           LINES           =                  0             NOMATCH                 =            0
           BASEIO          =                  0             DUPLICATES              =            0
           SORTIO          =                  0             FORMAT ERRORS           =            0
           SORT PAGES      =                  0             INVALID CONDTS          =            0
           READS           =                  0             OTHER REJECTS           =            0
           TRANSACTIONS    =                  0             CACHE READS             =            0
           ACCEPTED        =                  0             MERGES                  =            0
           SEGS INPUT      =                  0             SORT STRINGS            =            0
           SEGS CHNGD      =                  0             INDEXIO                 =            0
           INTERNAL MATRIX CREATED: YES                     AUTOINDEX USED:                     NO
           SORT USED:             FOCUS                     AUTOPATH USED:                      NO
           AGGREGATION BY EXT.SORT: NO                      HOLD FROM EXTERNAL SORT:            NO

                          *Opinions of comedians throughout this presentation are not
    Conclusion             necessarily those of the presenter nor Information Builders.
3
    Use TABLEF when appropriate

        “I bought some batteries but they weren‟t included,
                   so I had to buy them again.”
                          One Liners For FOCUS Efficiency


     TABLE        F
             FILE CAR
     SUM DCOST                                                                                    Steven Wright
     BY COUNTRY
     BY CAR
                                                  Data already sorted
     ON CAR SUBFOOT
                                          in the order of the report request?
     END                                                Use TABLEF !!
                                                 Sort and                                   Generate
              Extract                             Merge
               data                                                                          report
                                                   data                                 You can still use COMPUTE,
                                                                                         SUM and WHERE TOTAL

S   AVINGS: Eliminates large cost of sorting, even if none to do.
     Conclusion
                        *Opinions of comedians throughout this presentation are not
                         necessarily those of the presenter nor Information Builders.
4
    Most of the time, you don‟t need the Internal Matrix

      "If you live to the age of a hundred you have it made
                           One Liners For of a hundred.”
    because very few people die past the ageFOCUS Efficiency



                                                               Savematrix is OFF
                                                              by default in Rel 7.2
                                                              and up, but it might                 Burns
                                                                                      GeorgeBirnbaum
                                                                                       born Nathan
                                                              be SET to ON in the
                                                                site-wide profile.
        SET SAVEMATRIX = OFF
        TABLE FILE CAR
        SUM DCOST                                      No need to create
             BY COUNTRY                                 or preserve the
                                                       Internal Matrix
        END
                                                           Matrix is needed only
        HOLD FORMAT EXL2K                                  when result is re-used.
                                                         Use SAVEMATRIX=ON
S   AVINGS: Significant cost of creating a matrix that is not used.
     Conclusion
                     *Opinions of comedians throughout this presentation are not
                      necessarily those of the presenter nor Information Builders.
5
     Use an &Variable constant instead of DEFINE

       “I was going to have cosmetic surgery until I noticed
                            One full of portraits by Picasso.”
     that the doctor's office wasLiners For FOCUS Efficiency

             Recalculated for
              every record                              Calculated once
                                                        for entire report
     DEFINE FILE CAR                                                                   Rita Rudner
     INCR/I3 WITH DCOST = 5 ;                                             Instead:
     END                                               -SET &INCR = 5 ;
     TABLE FILE CAR                                    TABLE FILE CAR
     SUM DCOST                                         SUM DCOST
     COMPUTE                                           COMPUTE
      NEWCOST=DCOST + INCR ;                             NEWCOST=DCOST + &INCR ;
     BY COUNTRY BY CAR                                 BY COUNTRY BY CAR
     END                                               END
SAVINGS: Could save millions of calculations, one per record.
     Conclusion
                       *Opinions of comedians throughout this presentation are not
                        necessarily those of the presenter nor Information Builders.
 6
    Don‟t read the entire Flat File

       "My one regret in life is that I am not someone else”.
                              One Liners For FOCUS Efficiency

       SET FIXRETRIEVE=ON                                                      Allen




                                                                                         Ten Records
       TABLE FILE NAMES                                                        Beatty




                                                         One Million Records
                                                                                                       Woody Allen
       PRINT NAME                                                              Bullock                 born Allen Stewart Konigsberg




       IF NAME LT „E‟                                                          Denver
       END                                                                     Kidman
                                                                               .
“The flat file is sorted on the                                                               *Only for
screened field; stop searching                                                 .               flat files
when you see a larger value.”                                                  Zappa

S   AVINGS: Average 50% search time; could save 1% or 99%.
     Conclusion
                       *Opinions of comedians throughout this presentation are not
                        necessarily those of the presenter nor Information Builders.
7
    Substitute DEFINE with COMPUTE

      "Have you ever noticed that anybody driving slower
                           One Liners For FOCUS Efficiency
    than you is an idiot, and anyone going faster than you is
                            a maniac?”
                  Calculation done           Calculation done only
                      for every              for each SUM‟ed line
                  record extracted                on the report
                                                                                          George Carlin
     DEFINE FILE CAR
     INCR/I7 = DCOST * 5 ;                                                  Instead:
     END
     TABLE FILE CAR                                    TABLE FILE CAR
     SUM DCOST                                         SUM DCOST
           INCR                                        COMPUTE INCR/I7 = DCOST * 5 ;
     BY COUNTRY BY CAR                                 BY COUNTRY BY CAR
     END                                               END

S          Careful! You cannot always substitute DEFINE with COMPUTE.
    AVINGS: Increases with record volume extracted and aggregated.
     Conclusion
                          *Opinions of comedians throughout this presentation are not
                           necessarily those of the presenter nor Information Builders.
8
    Do the HOLD After the END

           “I‟m not going to buy my kids an encyclopedia.
                            One school For FOCUS Efficiency
                 Let them walk toLinerslike I did.”

     HOLD‟ing the same results                      Re-extracts
      in 3 different formats?                      entire data set
                                                       3 times
    TABLE FILE CAR                                                                   Yogi Berra
    PRINT COUNTRY CAR                                                Instead:        born Lawrence Peter Berra


    ON TABLE HOLD AS HTML                                SET SAVEMATRIX = ON
    END
    TABLE FILE CAR                                       TABLE FILE CAR
    PRINT COUNTRY CAR                                    PRINT COUNTRY CAR
    ON TABLE HOLD AS EXL2K                               ON TABLE HOLD AS HTML
    END                                                  END
    TABLE FILE CAR                                       HOLD AS EXL2K
    PRINT COUNTRY CAR                                    HOLD AS PDF
    ON TABLE HOLD AS PDF                                               Re-uses internal
    END                                                                matrix from first

S   AVINGS: 50% for 2 HOLD, 66% for 3 HOLDS, etc.
     Conclusion
                                                                      to generate others

                     *Opinions of comedians throughout this presentation are not
                      necessarily those of the presenter nor Information Builders.
9
     Reformat Fields in TABLE instead of DEFINE

     “The pen is mightier than the sword, and considerably
                     easier to write with.” FOCUS Efficiency
                         One Liners For


        DEFINE FILE CAR
        -* DCOST is originally D12.2                                Marty Feldman
        INTCOST/I6 = DCOST ;                 Instead:
        END                  TABLE FILE CAR
        TABLE FILE CAR SUM DCOST
        SUM COST                     DCOST/I6 AS „INTCOST‟
              INTCOST        BY CAR           Hint: Invisible field would appear
        BY CAR               END              in a HOLD file. To remove,
                                              SET HOLDLIST=PRINTONLY
        END                No DEFINE needed.
                                  (does create invisible

SAVINGS: Only final displayed field is reformatted.
     Conclusion
                                     field in matrix)

                       *Opinions of comedians throughout this presentation are not
                        necessarily those of the presenter nor Information Builders.
10
     Flip to Alternate File View to elevate screening criteria

           “Beauty may be skin deep, but ugly goes clear to the
                                bone.”
                             One Liners For FOCUS Efficiency

                                                                       DCOST
             COUNTRY                Why follow                               BODY
                                                                             BODY
     P                            pointers all the
                                 way to the bottom,                                  DCOST   Redd Foxx
     O                                                                                       born John Elroy Sanford
                                 just to find that a
     I                           DCOST does not
                      CAR         fit the criteria?                        MODEL
                                                                           MODEL
     N
     T
                MODEL               .DCOST
                               TABLE FILE CAR    CAR                           CAR
     E                         PRINT MODEL DCOST
     R                         IF DCOST GE 20000
     S            BODY         END             COUNTRY                 COUNTRY
                       DCOST
SAVINGS: Tremendous reductions in I/O and response time.
         Conclusion
                            *Opinions of comedians throughout this presentation are not
                             necessarily those of the presenter nor Information Builders.
11
     Use Indexed File View to elevate screening criteria

                “I don‟t like watching golf on TV. I can‟t stand
                                  whispering.”
                                 One Liners For FOCUS                                       Efficiency

                                                                       DCOST
             COUNTRY             Same dot-syntax                             BODY
                                                                             BODY
     P                           as alternate view;
                                     uses index                                      DCOST David Brenner
     O
                                   automatically
     I                             when present.
                      CAR                                                  MODEL
                                                                           MODEL
     N
     T
                MODEL               .DCOST
                               TABLE FILE CAR    CAR                           CAR
     E                         PRINT MODEL DCOST
     R                         IF DCOST GE 20000
     S            BODY         END             COUNTRY                 COUNTRY
                       DCOST
SAVINGS: Tremendous reductions in I/O and response time.
         Conclusion
                            *Opinions of comedians throughout this presentation are not
                             necessarily those of the presenter nor Information Builders.
12
     Let your Sort Utility do the work – and not just the sorting!

        “We spend the first twelve months of our children‟s
                           One and talk, and FOCUS Efficiency
     lives teaching them to walkLiners For the next twelve
               telling them to sit down and shut up.”

              FOCUS
               Sort                                                                                 Diller
                                                                                      PhyllisAda Driver
                                                                                       born Phyllis




                             SET EXTSORT=ON                                 System Sort
                                                                            SYNCSORT
                             SET EXTAGGR=ON
                                                                             DFSORT
                             SET EXTHOLD=ON                                  VMSORT

                                                          HOLD File
S    AVINGS: Tremendous reductions in sort time and data movement.
      Conclusion
                      *Opinions of comedians throughout this presentation are not
                       necessarily those of the presenter nor Information Builders.
13
     Presort data before MODIFY FIXFORM

     “I‟m the kind of guy who will have nothing all my life and
                           One while digging my grave.”
         then they‟ll discover oil Liners For FOCUS Efficiency


        E
        H
        F                                                                                    George Gobel
        G
        D
     Unsorted
                    A      B
                         Pa g e 1
                                        C D P a g e 2E F                            G
                                                                                 Pa g e 3
                                                                                            H I          J
                                                                                                  Pa g e 4
      Sorted
        D
        E          Call system sort
                   MODIFY FILE …
        F          FIXFORM keyfield
        G          MATCH keyfield
        H          ON NOMATCH UPDATE                       Sort the data file first
SAVINGS: Could be 100’s of times faster on large volumes.
      Conclusion
                   DATA ON …

                            *Opinions of comedians throughout this presentation are not
                             necessarily those of the presenter nor Information Builders.
14
     Extract once to HOLD, then multiple TABLEs

        “I have six locks on my door. When I go out, I lock
                            One Liners For FOCUS Efficiency
     every other one. I figure no matter how long somebody
      tries to pick the locks, they are always locking three.”
                                             TABLE FILE HUGE
                                             SUM …
                                             IF REGION EQ „NORTH‟
     TABLE FILE HUGE                         END                                      Elayne Boosler
     SUM …                                   TABLE FILE HUGE
     IF REGION EQ „NORTH‟                    SUM …
         OR „SOUTH‟                          IF REGION EQ „SOUTH‟                           Why
         OR „EAST‟ OR „WEST‟                 END                                         extract the
                                                                                            entire
     ON TABLE HOLD                           TABLE FILE HUGE                              database
     END                                     SUM …                                       four times?
                                             IF REGION EQ „EAST‟
                                             END
      Another
      One-Liner Solution:                    TABLE FILE HUGE
                                             SUM …
                                             IF REGION EQ „WEST‟
                                             END
SAVINGS: Spend a little, get a lot, when high degree of aggregation.
     Conclusion
                    (see next slide)

                      *Opinions of comedians throughout this presentation are not
                       necessarily those of the presenter nor Information Builders.
15
     Use POOLED TABLES for multiple TABLEs

        “Always get married in the morning. That way if it
       doesn‟t work out, you haven‟t wasted the whole day.”
                           One Liners For FOCUS Efficiency
                                                      TABLE FILE HUGE
                                                      SUM …
                SET POOL= ON                          IF REGION EQ „NORTH‟
                                                      END                                   Mickey Rooney
     • No HOLD file needed                            TABLE FILE HUGE                         born Joseph Yule, Jr.

                                                      SUM …
     • Extracts from database once                    IF REGION EQ „SOUTH‟                           Why
     • Feeds all TABLEs at one time                   END                                         extract the
                                                      TABLE FILE HUGE                                entire
     • Output identical to no pooling SUM …                                                        database
                                                                                                  four times?
     • Set ESTLINES/ESTRECORDS IF REGION EQ „EAST‟    END
     for even more efficiency
                                                      TABLE FILE HUGE
               SET POOL= OFF                          SUM …
                                                      IF REGION EQ „WEST‟
         Note: Pooled Tables is a chargeable feature. END
SAVINGS: 1/n
        SET POOLFEATURE=ON in FOCPARM


      Conclusion
                      th   of I/O’s where n is number of TABLES.
                            *Opinions of comedians throughout this presentation are not
                             necessarily those of the presenter nor Information Builders.
16
     REBUILD without the Index first

      "I know a man who is a diamond cutter. He mows the
                   lawn at Yankee Stadium”. FOCUS Efficiency
                        One Liners For
     FILE = …
     SEGMENT = …
     FIELD=ABC,,I5, FIELDTYPE=I ,$                                                         Henny Youngman
     FIELD=DEF,,A12,$
     FIELD=GHI,,D12.2, FIELDTYPE=I ,$
     FIELD=JKL,,F5,$

                  1.   Remove indexes and save as alternate master
                  2.   REBUILD REBUILD with no-index master
                  3.   Put back original master with indexes
                  4.   REBUILD INDEX
     S AVINGS: Usually measured in hours of elapsed time.
     Conclusion
                           *Opinions of comedians throughout this presentation are not
                            necessarily those of the presenter nor Information Builders.
17
     Eliminate 1000‟s of REBUILD messages

     “I set records that will never be equaled. In fact, I hope
               90% of them don‟t ever get printed.”
                           One Liners For FOCUS Efficiency

     SET REBUILDMSG = 100000
     REBUILD
     REORG                                                                                Bob Uecker
     DUMP or LOAD
     …     (Default is 1000)

     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



SAVINGS: On large files, millions of JES bytes; save forests if printed
     Conclusion
                      *Opinions of comedians throughout this presentation are not
                       necessarily those of the presenter nor Information Builders.
18
     Reduce MODIFY update notices

      “I found the secret to the work week. I‟ve convinced
      myself that everything after Monday is almost Friday.”
                          One Liners For FOCUS Efficiency



     MODIFY FILE CAR                                                               Joel Starkman
                            Default: write to
     FIXFORM                 database every
     MATCH field               1000 records                                           Hey! Who‟s
       ON MATCH REJECT     (1 for CRTFORM)                                            this guy?
       ON NOMATCH INCLUDE
     DATA ON file                 Or just
                              CHECK OFF
     CHECK 99999
                          Hint:Midstream recovery?
     END                     Use “START &TRANS”

SAVINGS: Large I/O savings on bulk loads.
     Conclusion
                   *Opinions of comedians throughout this presentation are not
                    necessarily those of the presenter nor Information Builders.
19
     JOIN in the faster direction

     “I find television very educating. Every time somebody
                           One Liners For FOCUS
           turns on the set, I go into the other room and Efficiency
                           read a book.”
     Diego Alcazar             Operator
     Lorenzo Alcazar           President
     Nicolas Cassadine         Vice President
     Carly Corinthos           Operator       Manager A1
     Michael Corinthos, III
     Sonny Corinthos
                               Operator
                               President
                                              Operator C2 TABLE FILE
                                              President C2 PRINT NAME
                                                                                        ????
                                                                                         JOB
     Alexis Davis              Technical
     Noah Drake                Manager        Secretary B3 WHERE BLDG IS „C2‟                    Groucho Marx
     Patrick Drake             Operator       Technical C2                        born Julius Henry Marx
     Jasper "Jax" Jacks        President      Vice Pres A1 END
     Georgie/Maxie Jones       Operators
     Ric Lansing               Technical
     Reese Marshall            Operator
     Samantha McCall
     Jason Morgan
                               Operator
                               Technical   JOIN POS IN                 GH          TO POS IN     JOB
     Dillon Quartermaine       Technical
     Edward Quartermaine       Manager
     Tracy Quartermaine
     Skye Quartermaine
                               Operator
                               Secretary
                                           JOIN POS IN                JOB          TO POS IN     GH
     Emily Quartermaine        Manager
     Dr. Alan Quartermaine     Vice President
     Dr. Monica Quartermaine         FILE=GH
                               Technical                           FILE=JOB
     Malcolm ‘Mac’ Scorpio           SEGMENT=GH1, …
                               Manager                             SEGMENT=JOB1, …
     Robert Scorpio
     Dr. Robin Scorpio               FIELD=NAME, …
                               Technical
                               Technical                           FIELD=POS, …, INDEX=I,$
     Bobbie Spencer                  FIELD=POS, …INDEX=I,$
                               Secretary                           FIELD=BLDG, …
     Elizabeth Spenser
     Lucky/Lulu Spencer              …
                               Secretary
                               Operators                           …

SAVINGS: Could reduce processing time by 90% or more.
     Luke Spencer
     Lainey Winters


     Conclusion
                               President
                               Technical

                                 *Opinions of comedians throughout this presentation are not
                                  necessarily those of the presenter nor Information Builders.
20
            Build your own External Index
             when you don‟t have write access to the file
                      “Zsa Zsa Gabor got married as a one-off, and it was so
                             successful she turned it into a series.”
                                         One Liners For FOCUS Efficiency
                           -
                           AHP     F         A
                             -
                             -
                                        E    A
                                             A
                                                                   >> rebuild
                             -
                                        X                          ENTER OPTION
                                             C
                                        T
                             -
                             -
                                             D
                                             D                     External index                      Bob Hope
     One Million Records




                             -          E                                                              born Leslie Towne Hope

                             -
                                        R
                                             E
                                             F
                                                                   NEW OR ADD TO EXISTING?
                             -
                             -          N    H              ...
                             -               H                  #
                           FGJH
                           IDSA
                                   J
                                   E
                                        A    H
                                             J
                                                    Build your External Index is static; must rebuild if file changes.
                           JSDQR   W    L    .      own index# USE
                           LFS     Z         .
                             -               .
                             -          I    .
                                                                mastername
                             -
                             -
                             -
                                        N   U
                                                                extindexname INDEX mastername
                             -          D   W                   END
                             -              X
                                        E
                             -
                             -
                                        X
                                            Y
                                            Z
                                                                TABLE FILE filename .indexfield
                             -
                             -              Z


SAVINGS: Could reduce data accessing time by 90% or more.
                           ZWIO



                  Conclusion
                                   H


                                       *Opinions of comedians throughout this presentation are not
                                        necessarily those of the presenter nor Information Builders.
21
     Index Your HOLD File

                  “I‟m this century‟s Dennis The Menace.”
                                  One Liners For FOCUS Efficiency

              HOLD extracts might be used more
            efficiently if you could index important
             search fields for subsequent reports.                                         Bart Simpson
                                                                                           born Bartholomew Jo-Jo Simpson


     TABLE FILE …        Sequential file
                           sorted by     FOCUS database
      PRINT CITY TITLE    EMPL_NO          indexed on
      BY EMPL_NO                             CITY

      ON TABLE HOLD FORMAT FOCUS INDEX CITY
     END
     TABLE FILE HOLD
      COUNT EMPL_NO BY TITLE IF CITY EQ „ORLANDO‟
     END
SAVINGS: Slower to build extract, but much faster post-retrieval.
     Conclusion
                           *Opinions of comedians throughout this presentation are not
                            necessarily those of the presenter nor Information Builders.
22
       JOIN WHERE - when two files have nothing in common!

         “With kids, the days are long, but the years are short.”
                                             One Liners For FOCUS Efficiency

            Which employees can afford to buy a BMW?
     JOIN FILE CAR      AT RETAIL_COST TO ALL
          FILE EMPLOYEE AT CURR_SAL    AS CAREMP                                                           John Leguizamo

           WHERE CURRSAL GT (RETAIL_COST * 3);
     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


     TABLE FILE CAR
     PRINT FIRSTNAME LASTNAME BY CAR                                                                                JOIN files
     IF CAR EQ ‘BMW'
     END    CAR          FIRSTNAME LASTNAME                                                                        on any fields
                     -----           ---------                    --------                            without indexes
                     BMW             JOHN                         BANNING
                                     JOAN                         IRVING
                                     BARBARA                      CROSS
S    AVINGS: Actually slow, but tough to code many scenarios without it
        Conclusion
                                      *Opinions of comedians throughout this presentation are not
                                       necessarily those of the presenter nor Information Builders.
23
     BY TOTAL – Sort by computed columns in one pass

       “When I see the Ten Most Wanted Lists, I always have
                           One Liners wanted earlier, Efficiency
     this thought: If we‟d made them feelFor FOCUS they
                     wouldn‟t be wanted now.”
                Sort by Average Sales*
       COUNTRY CAR        AVE SALES     SALES
       ENGLAND JENSEN         17650     73000
                  TRIUMPH     24200    122000                                                             Cantor
                                                                                              Eddie Israel Iskowitz
                                                                                              born Edward


       JAPAN      HONDA       17480    235000
       TABLE FILE TOYOTA
                   CAR        18250    197300
                                                                                              No HOLD !
        SUM SALES AVE.SALES
        BY COUNTRY BY CAR BY AVE.SALES TABLE FILE CAR
       ON TABLE HOLD                    SUM SALES
       END                              BY COUNTRY BY CAR
       TABLE FILE HOLD                  BY TOTAL AVE.SALES
        SUM E03 BY COUNTRY BY CAR      END
        BY E04 AS ‘Ave Sales’’

SAVINGS: Eliminates second pass of the data – could be 50%.
       END

     Conclusion
                    *Opinions of comedians throughout this presentation are not
                     necessarily those of the presenter nor Information Builders.
                                                                     *Invented      numbers
24
     Test Higher-Hit Fields First

             “If your ship doesn‟t come in, swim out to it.”
                                 One Liners For FOCUS Efficiency

     DEFINE FILE ...
        EXCHANGE/A3 = EDIT(PHONE,'$$$999$$$$');
        FLAG/A1 = IF (SALARY + BENEFITS GT 50000)           Jonathan Winters
        AND (EXCHANGE EQ '736‘) THEN 'Y' ELSE 'N';
     END               Calculated first                Do real fields first,
                     for every record -               or those most likely
       TABLE FILE ...- and often false  TABLE FILE ...to eliminate records
       PRINT ...                        PRINT ...
          WHERE FLAG EQ 'Y‘               IF LASTNAME EQ ‘$M$*'
          IF EXCHANGE EQ '736‘            IF EXCHANGE EQ '736'
          IF LASTNAME EQ ‘$M$*'           WHERE FLAG EQ 'Y‘
       END                              END               Complicated calc
                   Technique applies to fields on the same level.                         done only when all
                    Higher level screens are always done first,                           other criteria pass

SAVINGS: Potentially significant reduction in calculation time.
     Conclusion
                          regardless of the order coded.

                          *Opinions of comedians throughout this presentation are not
                           necessarily those of the presenter nor Information Builders.
25
     Do String Manipulation Inside the TABLE When Possible

                                 “????.”
                            One Liners For FOCUS Efficiency

                                   $ means any one character
                                   $* means all remaining chars
       DEFINE FILE ...                             Marcel Marceau
                                                     born Marcel Mangel

       LASTNAME2/A1 = EDIT(LASTNAME,’$9’);
       END
       TABLE FILE ...             TABLE FILE ...
       PRINT ...                  PRINT ...
         IF LASTNAME2 EQ ‘M'        IF LASTNAME EQ ‘$M$*'
         IF EXCHANGE EQ '736'       IF EXCHANGE EQ '736'
         IF FLAG EQ 'Y‘             IF FLAG EQ 'Y‘
       END                        END


SAVINGS: In-TABLE string manipulation is faster than DEFINE.
     Conclusion
                     *Opinions of comedians throughout this presentation are not
                      necessarily those of the presenter nor Information Builders.
26
     Replace Compound-IF in DEFINE with “WHERE”

     “When I was born my father spent three weeks trying to
             find a loophole in my birth certificate.”
                         One Liners For FOCUS Efficiency

       DEFINE FILE ...
         TESTFIELD/A1 =
                                                                                          Jackie Vernon
            IF (F1 EQ ‘ABC’) OR (F2 GE 27)
            THEN ‘Y’ ELSE ‘N’ ;
       END
       TABLE FILE ...
       IF TESTFIELD EQ ‘Y'
       END          TABLE FILE ...
                                    Instead:
     Must use WHERE,           WHERE (F1 EQ ‘ABC’) OR (F2 GE 27)
        not IF, in this        END
     compound situation

SAVINGS: WHERE is much faster than compound-IF in DEFINE
     Conclusion
                          *Opinions of comedians throughout this presentation are not
                           necessarily those of the presenter nor Information Builders.
27
     Avoid reparsing Masters over and over again

         “It‟s no longer a question of staying healthy. It‟s a
                             One a sickness you like.”
               question of finding Liners For FOCUS Efficiency



           Store up to 99 parsed masters in memory,
     SET SAVEDMASTERS = 99          so no reparsing                                  Jackie Mason
                                                                                        born Jacob Maza
     TABLE FILE CAR
     PRINT …                                                       Never reparses on
     END                                                            consecutive use
     TABLE FILE CAR …
     TABLE FILE EMPLOYEE …                                      Without the SET, would:
     TABLE FILE CAR …
                                                                -- dump CAR master,
                                                                -- parse EMPLOYEE,
     TABLE FILE SALES …                                         -- reparse CAR again
     TABLE FILE EMPLOYEE …                                      -- parse SALES ….
SAVINGS: Large savings when a user constantly flips Masters.
     Conclusion
                     *Opinions of comedians throughout this presentation are not
                      necessarily those of the presenter nor Information Builders.
28
     Split a field into pieces for instantaneous searches

        “Fame comes with its own standards. A guy who
                            One Liners For a lip twitch –
      twitches his lips is just another guy withFOCUS Efficiency
                 unless he‟s Humphrey Bogart.”
          SSN
      123-45-6789                                                SSN1TO3
                           QUESTION
                                                                                           Sammy Davis Jr.
                           How many pages
             SSN            would I have to                                               I could index SSN,
                           search to find the                    SSN4TO5                  but an index won‟t
                          last of 999,999,999                                               help on partial
                          SSN combinations?                                                    searches
           DATA
                                                                 SSN6TO9
                                                                Store full SSN here too
            Social Security Numbers
            Phone Numbers
            Credit Card Numbers
            Hottrack Numbers (we do!)                                DATA

SAVINGS: Rock-bottom paging I/O when screening on that field.
     Conclusion
                         *Opinions of comedians throughout this presentation are not
                          necessarily those of the presenter nor Information Builders.
29
     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
                          One Liners For FOCUS Efficiency
                     to get out of jury duty.”
          FILE=LOTSOF                                FILE=LOTSOF
          SEGMENT=ONE                                SEGMENT=ONE
            FIELD=ABC,,A10                            FIELD=ABC,,A10
            FIELD=DEF,,I9                             FIELD=DEF,,I9                                Norm Crosby
            FIELD=GHI,,F4.1                          FIELD=LAST3,,A17

                                                                                                             !
            FIELD=JKL,,D12.2                                                                   Make sure you
            FIELD=MNO,,A5                                                                      count the bytes
          SEGMENT=TWO                                                                             properly
            FIELD=PQR,,I9
                                                     SEGMENT=TWO
            FIELD=STU,,F4.1
            FIELD=VWX,,D12.2                         FIELD=ALLONE,,A65
            FIELD=YZA,,A5
            FIELD=PQR,,I9                                                .
            FIELD=STU,,F4.1
            FIELD=VWX,,D12.2
                                             TABLE FILE                  .
            FIELD=YZA,,A5
            FIELD=PQR,,I9                                                .
            FIELD=STU,,F4.1
               .
            FIELD=VWX,,D12.2                 SUM ABC BY DEF
            FIELD=YZA,,A5
               .                             END
S              .
     AVINGS: Reduce reparsing time when non-seq but iterative usage.
      Conclusion
                               *Opinions of comedians throughout this presentation are not
                                necessarily those of the presenter nor Information Builders.
30
     Display the number of the last page (Finally!)

        “A girl phoned me the other day and said „Come on
                            One Liners I went over.
              over, there‟s nobody home‟. For FOCUS Efficiency
                         Nobody was home.”

     TABLE FILE CAR
     HEADING
     "PAGE <TABPAGENO OF <TABLASTPAGE </1"                                                 Rodney Dangerfield
                                                                                                 born Jacob Cohen

     SUM DCOST BY COUNTRY PAGE-BREAK                                                 Page 4 of 4
     ON TABLE HOLD FORMAT HTML
                                                                                       Page 3 of 4
     ON TABLE SET STYLE *
     TYPE=REPORT,FONT=ARIAL,$                                                             Page 2 of 4
     ENDSTYLE                                                                                 Page 1 of 4
     END
                                                                                         REPORT
     Notes: &FOCNEXTPAGE is set to TABLASTPAGE
            Supported for FORMAT HTML/PDF/PS only

SAVINGS: Internally still two passes – mostly for coding simplicity
     Conclusion
                     *Opinions of comedians throughout this presentation are not
                      necessarily those of the presenter nor Information Builders.
31
     EDIT is faster than comparable subroutines

     “The guy who invented the first wheel was an idiot. The
                         One Liners he was a genius.”
      guy who invented the other three –For FOCUS Efficiency

                                                        Extract the
                                                         exchange
            DEFINE/COMPUTE
              PHONE/A12 = „123-567-9012‟;                                                  Sid Caesar
                                                                                           born Isaac Sidney Caesar




                  EXCH/A3 = EDIT (PHONE, „$$$$999‟) ;

                  EXCH/A3 = SUBSTR (12, PHONE, 5, 7, 3, EXCH) ;
                  EXCH/A3 = GETTOK (PHONE, 12, 2, ‟-‟, 3, EXCH) ;
                                                                   EDIT does not apply to all

SAVINGS: 25-50% directly attributable to those calculations.
     Conclusion
                                                                   situations of partial extractions

                         *Opinions of comedians throughout this presentation are not
                          necessarily those of the presenter nor Information Builders.
32
     Minimize test-run time during development

      "I think I did pretty well, considering I started out with
                             a bunch of blank paper”.
                nothing butOne Liners For FOCUS Efficiency

      Stop retrieval after the nth satisfying record
      Generally for Developers to quick-test code
      Easy to turn on and off; ignored in Production
                                                                                              Steve Martin
     -DEFAULT &1 = „ „
     -SET &&IFRECORDLIMIT = IF &1 NE „TEST‟ THEN „ „
     -                              ELSE „IF RECORDLIMIT EQ 1‟ ;
     TABLE FILE …
     PRINT …               EX focexecname TEST
     BY …                                  Parameter
                                           &1 of call
     &&IFRECORDLIMIT
                       Hint: Use global &&
     END               Set once for entire application.

SAVINGS: Cut 99.9% of runtime (during testing).
     Conclusion
                  &&IFRECORDLIMIT is NOT a reserved variable; could be any name.

                              *Opinions of comedians throughout this presentation are not
                               necessarily those of the presenter nor Information Builders.
33
     Pre-LOAD Your Application into Memory

      “When I adlib something, I laugh for the same reason
                           I‟ve never heard that joke before
       the audience does;One Liners For FOCUS Efficiency
              and I‟m just as surprised as they are.”


            LOAD FOCEXEC fex_name1 fex_name2 …
                                                                                             Steve Allen
            LOAD FOCCOMP compiled_modify_name
                                                                                       LOAD Masters and
                                                                                        Access Files too
            EX …
                              Uses the image now in memory
            RUN …


            ? LOAD [filetype]
            UNLOAD [* | filetype] [* | filename1 [filename2 …] ]
SAVINGS: Instant startup of large components. (No execution value.)
     Conclusion
                       *Opinions of comedians throughout this presentation are not
                        necessarily those of the presenter nor Information Builders.
34
     Use –REPEAT instead of –IF loop
     Randolph Duke: “Mother always said you were greedy.”
     Mortimer Duke: “She meant it as a complement.”
                                                          Efficiency
                                 One Liners For FOCUSPlaces
                                                  Trading


     -SET &CNT = 0 ;
     -LOOPTOP                                Hint: Use
     -SET &CNT = &CNT + 1 ;                  &‟s to vary Ralph     Don
                                             the range
     TABLE, MODIFY, etc.                     dynamically Bellamy Ameche
     PRINT FIELD&CNT …
     -IF &CNT LE 10 GOTO LOOPTOP; Instead:
     -AFTERLOOP
                         -REPEAT LOOP FOR &CNT FROM 1 TO 10
                         TABLE, MODIFY, etc.
                         PRINT FIELD&CNT …
     “increment/check”. -LOOP
     Easier to code than
                                     Other options:
       Can decrement.                                       -REPEAT label n TIMES
       Can be negative.                                     -REPEAT label WHILE condition
S    AVINGS: Minor, yet far more readable code.
      Conclusion
                          *Opinions of comedians throughout this presentation are not
                           necessarily those of the presenter nor Information Builders.
35
     Capture FOCUS Commands and Statistics with FOCLOG

     “As a child my family‟s menu consisted of two choices:
                       take it or leave it.”
                          One Liners For FOCUS Efficiency

       ind applications and focexecs that could significantly
       benefit from adjustment, consolidation, redesign.
       versee how much FOCUS is being used at your site.                              Buddy Hackett
                                                                                        born Leonard Hacker



       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.

SAVINGS: Could be immense based on analysis of usage data.
     Conclusion
                                      *FOCLOG is a chargeable product. See your local IBI Representative.

                      *Opinions of comedians throughout this presentation are not
                       necessarily those of the presenter nor Information Builders.
36
     One-Liners for [Web]FOCUS Efficiency
     "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.
                            One Liners For FOCUS Efficiency
     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
                                                                                      born Milton Berlinger




                              I leave you
                             with this gem



                     *Opinions of comedians throughout this presentation are not
     Conclusion       necessarily those of the presenter nor Information Builders.
37
                  *Opinions of comedians throughout this presentation are not
     Conclusion    necessarily those of the presenter nor Information Builders.
38
     Presentation Information


      Author: Joel Starkman
      Company: Information Builders
      Presentation Title: One-Liners for [Web]FOCUS Efficiency
      Presentation Abstract: Does your FOCUS job take hours to
       run, or absorb inordinate amounts of system resources, or
       barely fit into your nightly production window? This session
       presents over three dozen techniques, each virtually a minor
       one-line change to your focexec, that target hidden
       inefficiencies in your code. With a little help from history's
       greatest one-liner comedians, if even one tip helps you gain
       tremendous savings, it's worth attending this session.


                     *Opinions of comedians throughout this presentation are not
     Conclusion       necessarily those of the presenter nor Information Builders.
39
     One-Liners For [Web]FOCUS Efficiency




                    *Opinions of comedians throughout this presentation are not
     Conclusion      necessarily those of the presenter nor Information Builders.
40
     One-Liners For [Web]FOCUS Efficiency




                    *Opinions of comedians throughout this presentation are not
     Conclusion      necessarily those of the presenter nor Information Builders.
41
     One-Liners For [Web]FOCUS Efficiency




                    *Opinions of comedians throughout this presentation are not
     Conclusion      necessarily those of the presenter nor Information Builders.
42

				
DOCUMENT INFO
Shared By:
Categories:
Stats:
views:11
posted:4/9/2011
language:English
pages:42