Natural Optimizer Compiler - PowerPoint PPT Presentation

1 / 31
About This Presentation
Title:

Natural Optimizer Compiler

Description:

In standard compile process Natural Source ... Re-link the Natural nucleus and INCLUDE NOCNUC. ... ERRDUMP Terminate compile if Natural encounters an abend. ... – PowerPoint PPT presentation

Number of Views:105
Avg rating:3.0/5.0
Slides: 32
Provided by: wilhe6
Category:

less

Transcript and Presenter's Notes

Title: Natural Optimizer Compiler


1
Natural Optimizer Compiler
  • Faster Natural applications and lower CPU costs

Presented By Darrell Davenport
2
Todays Agenda
  • A Little About WSU
  • Why we needed an optimizer
  • What is NOC?
  • How it works
  • How Does NOC Work?
  • Where it lives
  • What it does to your programs
  • How Do You Know If It Will Help Your Systems?
  • The NOCSTAT command
  • How to Install and Customize NOC
  • Linking and setting parameters
  • What OPTIONS are available
  • DEMO
  • Getting the Most From Natural
  • Performance Programming tips

3
About WSU
  • Washington State University has been a Software
    AG customer for about 22 years. Nearly
    everything we do in the administrative side of
    the university uses Natural and Adabas. We have
    hundreds of applications and thousands of Natural
    programs.
  • Payroll
  • Registration
  • Grades
  • Financial Aid
  • Accounting
  • Property Inventory
  • Student Records
  • Retirement and Benefits
  • And Many more...

4
About WSU
  • We are a Mainframe centric installation. We were
    pushing our previous machine close to the limit.
  • When it came time to move forward to the new
    Z-series machines, we could not afford to
    increase our service class. We bought a z-800
    0A1.
  • This meant we went from a dual processor to a
    single processor, and dropped a couple of points
    on the MIP scale. Our normal daily demand was
    within that capacity, but a few times per year,
    we exceed it. We knew we had to do something to
    get our most important business done on those
    peak days.
  • NOC looked like a quick, easy, proven solution.
    Software AGs NOC customers on SAG-L list serve
    reported approximately 30 better performance,
    although it varied by site and by program. We
    tested a sample batch Natural program and found
    the 30 factor about right.

5
What is NOC?


NOC
NOC is a Natural add-on product specifically
designed for maximizing performance in your
Natural Applications. It compiles Natural
statements into machine code. Reduces CPU usage
in Natural Programs (frees up CPU
resources) Reduces clock time and increases
throughput for Natural batch jobs Improves
online response time (better transaction rate)
6
How Natural Optimizer Compiler Works
Development
Production
Natural Runtime
Natural Compiler
Natural Optimizer Compiler
Natural Bufferpool
7
How Natural Optimizer Compiler Works
  • In standard compile process Natural Source Code
    is translated into a Natural object code.
  • This object code will be interpreted at runtime
    (e.g. in a production system)
  • With Natural Optimizer Compiler switched on in a
    development environment, machine code is added to
    the Natural object code in an additional compile
    phase.
  • Running NOC optimized programs in a production
    environment, this machine code is executed
    instead of interpreting normal Natural Object
    Code. (The optimizer is not needed in the
    production environment.)

8
How Natural Optimizer Compiler Works
  • NOC compiles the following statements
  • ESCAPE, COMPRESS, PERFORM, SEPARATE, EXAMIN
    (incl. Most Options) RESET, IF SELECTION
  • Move statements
  • , MOVE ALL, MOVE UNTIL, MOVE INDEXED, MOVE (PMI)
  • Arithmetic statements
  • COMPUTE, ADD, SUBTRACT, MULTIPLY, DIVIDE,
  • Conditional statements
  • IF, DECIDE
  • Control statements
  • FOR, REPEAT
  • Operand types are optimized
  • Parameter arrays and SUBSTRING operands

9
How much will it do for me?
  • It is easy to determine how much NOC will
    benefit your Natural application(s). To find
    out, use the Natural NOCSTAT command.

10
The NOCSTAT menu
154709 NATURAL NOCSTAT
COMMAND 10/30/200 Name
.................. ________ Library
............... MYLIB____ NOCable Objects only
.. _ Output Report ......... X Statement
Category _ Statement
Type _ Code
Profile Output Destination .... X Screen
_ CSV to Work File 1
_ XML to Work File 1
with XSL ________________________________
Progress Control ...... X
11
The NOCSTAT Utility
3 different Output Destinations
Workfile (e.g. Excel)
Your 3270 screen
XML (e.g. web)
12
The NOCSTAT Utility
3 different Output Formats
BY Category
Code Profile
By Type
13
NOCSTAT. Example output of by category.
155527 NATURAL NOCSTAT
COMMAND 10/30/2003
Library XDMD Name CONVOBJ Type Program
No NOC NOCable
-------- -------- Database
Loop 1 0 Database Simple
3 0 SORT / WORK I/O
0 0 FOR / REPEAT 0
0 Screen / Printer 3
0 String Manipulation 0 0
Arith / Logical 0 52
Program Calls 0 0 Control
Transfer 1 13 Block
Start 3 0 Set Environment
4 0 System Functions
0 0 Miscellaneous 0
0 Total Statements
80 NOC optimizable 65 (
Ratio 81 ) Longest NOC Run
31 Statements
14
NOC is Easily installed.
  • Add NTOPTON and the desired settings for OPTIONS
    to your NATPARM module. (Or set session parameter
    OPT dynamically, for example with SYSPARM).
  • Re-link the Natural nucleus and INCLUDE NOCNUC.
  • You may need to increase the size of your
    bufferpool. The optimized code is added to the
    original modules, making them bigger.
  • NOC disables the RECATON function for GDA
    alignment.

15
Easily customized (per session)
  • Naturals NOCOPT command makes it easy to
    customize the optimizers parameters.

User DMDSAC - Optimizer Compiler
Options - Optimizer Compiler linked
OPT Parameter at NATURAL Startup
DIGTCHCK,INDX,OVFLW Current OPT
Parameter Setting DIGTCHCK,INDX,OVFLW
OPT ____________________________________________
_________ Command gt____________________________
16
Easily customized
  • The OPTIONS statement can be used to bracket
    statements within a program, allowing specialized
    targeting of specific code segments.

OPTIONS MCG(PGENON) . . . SET KEY PF12 SET
CONTROL 'WC9L35F' REPEAT INPUT (ADMIL'_'
IPOFF) . . . . OPTIONS MCG(PGENOFF) . . . END
17
Easily customized
  • NOCs OPTIONS are
  • ABEND Generate code to abend program if Natural
    dies.
  • CACHE Cache selected variables and parms for
    quick access.
  • DIGTCHCK Check zoned and packed fields for sign
    bytes
  • ERRDUMP Terminate compile if Natural encounters
    an abend.
  • INDEX Check array indexes for out-of-bounds
    conditions.
  • INDX Same as setting INDEX and RANGE parameters
  • LOOPS Generate loop-table entries (for
    undetermined targets)
  • NODBG Build code to allow Natural debugger to
    work or not.
  • NOSGNTR No sign translate done (from C to F) see
    also COMPOPT
  • ON/OFF
  • OPTLEV Number of passes optimizer compiler does.
  • PGEN Can generate assembler code listing (and
    tracing)
  • RANGE Array range checks (E.G. move 13 to 56)
  • SIGNCHCK Check for negative zero after
    multiplication.
  • ZD Check for zero divisors to prevent NAT0954
    abends.

18
Also has caching of variables.
  • In addition to optimizing code into machine
    instructions, NOC will cache variables that are
    referenced several times, but not modified. This
    is only done for numerics, or arrays with the
    same index, or parameters.

19

DEMO
20
Demo program
  • FORMAT PS60
  • FIND LIB-DIRECTORY
  • WITH DSNAME DSN
  • IF BREAK MEMBER /3/ SKIP 1 END-IF
  • FIND READ-FILE
  • WITH DSNAMEDSN
  • AND MEMBER MEMBER(0160)
  • IF RECORD-NUMBER 2
  • EXAMINE RECORD FOR '.WSUMVS1' DELETE
  • WRITE MEMBER(0210) RECORD (AL44)
  • ESCAPE BOTTOM (0210)
  • END-IF
  • END-FIND
  • END-FIND

21
Demo programs NOCSTAT
  • Line Statement
  • ----- -------------------------
  • 0000 ON ERROR
  • 0000 MCG OPTIONS
  • 0010 MOVE/COMPUTE/ASSIGN lt-- NOCable
  • 0160 FIND
  • 0160 DB AT CONDITION
  • 0190 IF lt-- NOCable
  • 0190 NEWPAGE
  • 0210 FIND
  • 0210 DB AT CONDITION
  • 0240 IF lt-- NOCable
  • 0250 EXAMINE
  • 0260 WRITE
  • 0270 ESCAPE BOTTOM lt-- NOCable
  • 0210 DB AT CONDITION
  • 0290 ELSE/CLOSE LOOP lt-- NOCable
  • 0160 DB AT CONDITION
  • 0300 ELSE/CLOSE LOOP lt-- NOCable

22
Demo programs NOCSTAT
  • No NOC NOCable
  • -------- --------
  • Database Loop 0 0
  • Database Simple 0 0
  • SORT / WORK I/O 0 0
  • FOR / REPEAT 0 0
  • Screen / Printer 2 0
  • String Manipulation 1 0
  • Arith / Logical 0 3
  • Program Calls 2 0
  • Control Transfer 1 3
  • Block Start 5 0
  • Set Environment 0 0
  • System Functions 0 0
  • Miscellaneous 0 0
  • Total Statements 18
  • NOC optimizable 6 (
    Ratio 33 )
  • Longest NOC Run 0
    Statements

23
Getting the most from Natural.
  • There are things you can do to help make the
    program perform even better. These apply to all
    Natural programs, optimized or not.
  • Doing the math-- dealing with numeric variables.
  • Arrays -- Defining and processing arrays and
    tables.
  • Work Files -- Reads and Writes, and validity
    checking.
  • Strings and thing -- MOVE, INIT, RESET, etc.
  • Local and System variables
  • IF and DECIDE statements

24
Doing the Math
  • Counters and Arithmetics should use packed (P) or
    Integer (I4) format. Indexes are best with (I4).
  • Do not mix formats of (N), (P), (I), or (F) in
    conditionals (IF statements) or arithmetics.
  • For ADD, SUBTRACT and IF, force numeric constants
    to have the same number of decimal places as the
    variable with the highest precision by adding a
    decimal place and trailing zeros, for example
    ADD 1.00 TO P(P7.2)

25
Arrays
  • Whenever possible, use EXAMINE instead of a FOR
    loop to process arrays.
  • MOVE A() to B() is much better than a FOR
    loop.
  • To ease the optimization process, try to keep all
    scalar references at the front of the data
    section and all array references at the end of
    the data section.

26
Work Files
  • By default the READ WORK statement selects,
    validates, and moves data from the buffer into
    the data area on a field by field basis. If you
    do not require field validation, use the RECORD
    option of the READ WORK statement. The CPU usage
    will be decreased dramatically.

27
Strings and things.
  • Whenever possible use the RESET statement instead
    of the MOVE statement to blank or zero a field.
  • When moving literal values to variables, or
    comparing variables to literal values, make the
    length of the alpha literal the same as the
    variable if the difference in length is not
    large. This will greatly speed up the operation.

28
Local and System variables
  • When using DECIDE ON with (repeated reference to)
    a system variable, array or parameter operand1,
    it is more efficient to move the value to a
    scalar variable of the same type and length
    defined in the LOCAL storage section.

29
Decide and IF statements
  • When coding DECIDE statements, put the most
    likely value/condition first, and use DECIDE ON
    FIRST whenever possible.

30
Summary
We mass recompiled our top 25 major Natural
applications, (several thousand programs). We
did not recompile data areas or maps. We have
had no problems with our optimized applications.
Several programmers reported amazing results on
their batch jobs.
31

THANK YOU! Now, Time for Questions!

Contact Information dmdsac_at_wsu.edu (509)
335-7316 See you at the Natural
Conference www.naturalconference.com May 23
26, 2004 Cambridge, Massachusetts
Write a Comment
User Comments (0)
About PowerShow.com