For programs optimized with the Natural Optimizer Compiler, certain statements can be directly converted into machine code when cataloged. As a result, when executing the optimized objects with Natural at runtime, the performance can be improved considerably.
The NOCSTAT
command analyses cataloged objects and provides statistical information to help decide
whether program statements benefit from optimization with the Natural Optimizer Compiler
and, if so, to what extent they can be optimized.
If a program is cataloged (STOW,
CATALL), the Natural compiler generates an internal (pseudo)
object code based on the statements in the source program. In most cases, one source
statement is transformed into one pseudo-code instruction. However, for complex
statements, such as FOR and REPEAT, several pseudo-code
instructions are generated. The NOCSTAT analyses are based on
the generated pseudo-code instructions. Therefore, the number of statements indicated in
the statistical reports may exceed the number of statements in the source program.
This document covers the following topics:
To use the Natural NOCSTAT command
Enter the direct command NOCSTAT.
The main NOCSTAT screen is displayed:
16:05:43 ***** NATURAL NOCSTAT COMMAND ***** 2017-05-29
Name .................. ________
Library ............... SAGTEST_
NOCable Objects only .. _
Output Report ......... X Statement Category
_ Statement Type
_ Code Profile
Output Destination .... X Screen
_ CSV to Work File
_ XML to Work File
with XSL ________________________________
Progress Control ...... X
Download to PC ........ _
Command ===>
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
Help Exit Canc |
To obtain field-specific help information, either enter a question mark in the relevant
field and press ENTER, or place the cursor in the field and press
PF1. Press PF3 to exit NOCSTAT.
You can generate statistical reports for a single program or a set of programs. If you analyze more than one program at a time, the reports are produced in series. When you have finished looking at one report, press ENTER to view the next report.
The main NOCSTAT menu provides the following options:
| Field | Explanation | |
|---|---|---|
Name |
Enter a name or a range of names to specify the program(s) you want to examine: | |
value
is any combination of one or more characters.
|
||
value |
Single program. | |
* |
All programs. | |
value* |
All programs whose names begin with
value.
|
|
value> |
All programs whose names are greater/equal
value.
|
|
value< |
All programs whose names are less/equal
value. |
|
Library |
Enter the name of a library or specify a
range; the same applies as described for the Name field above.
The current library is the default. |
|
|
|
Mark this option to exclude programs already
compiled with the Natural Optimizer Compiler.
Otherwise, the
|
|
Output Report |
Mark any of the options to select statements
by category, type or code profile.
See Statement Category, Statement Type and Code Profile below. |
|
Output Destination |
Mark any of the following options to determine the output format and destination: | |
Screen |
Displays the report on the screen or writes the report data
to Print File 7 if Download to
PC is selected for processing.
|
|
CSV to Work File |
Generates spreadsheets with comma-separated values.
The report data is written to either of the following files:
Use the file extension You can only route reports to a PC if Entire Connection is installed. |
|
XML to
Work File |
Generates XML documents.
The report data is written to either of the following files:
Use the file extension You can only route reports to a PC if Entire Connection is installed. If a value is entered in the field <?xml-stylesheet type="text/xsl" href=" value "?> The value entered should be the absolute or relative URL of the style sheet, for example: nocstat.xsl or http://natural.software-ag.de/nocstat.xsl The processing instruction causes the document to be transformed according to the given style sheet when it is viewed by an XSLT-capable browser or transformed by a batch XSLT run. A typical use of this feature is to convert the output XML to an HTML page. There are two XSLT style sheets delivered with Natural as text objects
Download the style sheets with file extension |
|
Progress Control
|
Only applies in an online environment and if
one of the following options is selected for processing:
If one of these options is selected, a brief message appears for each program listed in the generated report. |
|
Download to PC |
Only applies if Entire Connection is
installed, and if you run online with Print/Work File 7 defined as the PC file
(see the WORK and PRINT profile parameters).
Download report output data with Entire Connection to a PC by using either of the following:
|
|
You can choose between three output formats described below to display the statistics
NOCSTAT provides for the statements analyzed. Different report layouts
are produced for programs already optimized with the Natural Optimizer Compiler and for
programs to be considered for optimization. The example reports below show the
difference. Press PF3to interrupt report processing and return to the
NOCSTAT menu.
Below is information on:
The statistical report generated with the option Statement Category
lists various categories of statements with the corresponding number of occurrences
and the total number of statements already optimized or suitable for optimization,
depending on whether or not the program was optimized with the Natural Optimizer
Compiler.
11:49:46 ***** NATURAL NOCSTAT COMMAND ***** 2017-05-29
Library SAGTEST Name NOCTEST1 Type Program
No NOC NOCable
-------- --------
Database Loop: 0 0
Database Simple: 0 0
SORT / WORK I/O: 0 0
FOR / REPEAT: 0 1
Screen / Printer: 1 0
String Manipulation: 6 34
Arith / Logical: 0 996
Program Calls: 20 0
Control Transfer: 2 182
Block Start: 1 0
Set Environment: 7 0
System Functions: 2 0
Miscellaneous: 0 1
Total Statements: 1254
NOC optimizable: 1214 ( Ratio: 96 % )
Longest NOC Run: 216 Statements |
11:51:25 ***** NATURAL NOCSTAT COMMAND ***** 2017-05-29
Library SAGTEST Name NOCTEST1 Type Program
MCG Options: (ON,OVFLW,INDX,MIX,IO)
Database Loop: 0
Database Simple: 0
SORT / WORK I/O: 0
FOR / REPEAT: 0
Screen / Printer: 1
String Manipulation: 36
Arith / Logical: 0
Program Calls: 20
Control Transfer: 2
Block Start: 1
Set Environment: 7
System Functions: 2
Miscellaneous: 1
Total Statements: 1255
NOC optimized: 1185 ( Ratio: 94 % )
Longest NOC Run: 136 Statements |
| Column | Explanation |
|---|---|
No NOC |
Statements not suitable for optimization. |
NOCable |
Statements suitable for optimization.
Note |
| Field | |
Database Loop |
The number of database statements that generate a processing loop, such
as FIND and READ.
|
Database Simple |
Database statements that do not generate a processing loop, such as
STORE, UPDATE, DELETE and
GET.
|
SORT / WORK I/O |
SORT and work file statements.
|
FOR / REPEAT |
Statements generating loops. |
Screen / Printer |
Screen and printer I/O, such as WRITE, DISPLAY
and INPUT.
|
String Manipulation |
String statements, such as EXAMINE and
COMPRESS.
|
Arith / Logical |
Arithmetic and logical statements, such as MOVE,
COMPUTE and IF.
|
Program Calls |
Transfer of control to a subroutine or subprogram, such as
PERFORM, CALLNAT and FETCH.
|
Control Transfer |
Jumps within the program, such as ESCAPE BOTTOM,
FOR and REPEAT loops.
|
Block Start |
Non-executed statements that demarcate code blocks, such as DEFINE
SUBROUTINE and AT END. These statements are never
optimized because they are never executed.
|
Set Environment |
Statements that set the environment, such as SET CONTROL,
SET GLOBALS and SET KEY.
|
System Functions |
Statements, such as TOTAL, SUM,
COUNT, MAX, MIN and
*COUNT.
|
Miscellaneous |
Pseudo-code statements not relevant for optimization and, therefore, ignored by the NOC. |
| Totals | |
Total Statements |
The total number of statements found in the program. This number may not
correspond to the actual source statements as described in the introduction to
NOCSTAT command above.
|
NOC optimized |
For an optimized program, these are the actual pseudo-code statements (as
described in the introduction to NOCSTAT command above) that have
been NOC-optimized to machine code.
|
NOC optimizable |
For non-optimized programs, this is the possible number of statements
that could be optimized. The figure may be slightly higher than the actual
number, since certain factors are not considered in the NOCSTAT
program. For example, a SUBSTRING statement that has more than
four arrays will be indicated as "optimizable" though it will not
be optimized.
|
Ratio |
Relation between Total Statements and NOC-optimized statements or Total Statements and NOC-optimizable statements in percent. |
Longest NOC Run |
NOC-optimized program:
The number of contiguous optimized statements - the fewer fragment sequences, the better the performance. |
| Non-optimized program:
The number of contiguous statements to be expected if the program were optimized. |
The statistical report generated with the option Statement Type lists
single statements with the corresponding number of occurrences and the NOC coding
generated for optimized objects.
12:29:23 ***** NATURAL NOCSTAT COMMAND ***** 2017-05-29
Library SAGTEST Name NOCTEST1 Type Program
Statement No NOC NOCable
------------------------ -------- --------
MOVE/COMPUTE/ASSIGN 0 615
EXAMINE 6 0
SEPARATE 0 30
COMPRESS 0 4
MOVE TO SYSTEM FUNCTION 2 0
CALLNAT/PERFORM EXTERNAL 17 0
MOVE EDITED 1 0
ELSE/CLOSE LOOP 0 182
ON ERROR 1 0
END 1 0
STOP 1 0
IF 0 51
IF IN REPEAT UNTIL 0 1
REPEAT 0 1
RESET 0 74
IF 0 255
FETCH 3 0
IGNORE 0 1
STACK TOP CMD/DATA 2 0
MCG OPTIONS 1 0
OPTIONS 1 0
SET CONTROL 4 0 |
12:31:30 ***** NATURAL NOCSTAT COMMAND ***** 2017-05-29
Library SAGTEST Name NOCTEST1 Type Program
MCG Options: (ON,OVFLW,INDX,MIX,IO)
Statement Number
------------------------ --------
EXAMINE 6
SEPARATE 30
MOVE TO SYSTEM FUNCTION 2
CALLNAT/PERFORM EXTERNAL 17
MOVE EDITED 1
NOC CODE 1183
ON ERROR 1
END 1
STOP 1
FETCH 3
IGNORE 1
STACK TOP CMD/DATA 2
MCG OPTIONS 2
OPTIONS 1
SET CONTROL 4 |
The statistical report generated with the option Code Profile displays
contiguous sequences of statements grouped by categories in a source program suitable
for optimization, or lists the NOC coding generated for an optimized program.
Occurrences are highlighted.
12:38:52 ***** NATURAL NOCSTAT COMMAND ***** 2017-05-29
Library SAGTEST Name NOCTEST1 Type Program
Line Statement
----- -------------------------
0000 ON ERROR
0000 MCG OPTIONS
0000 OPTIONS
0295 CALLNAT/PERFORM EXTERNAL
0295 MOVE/COMPUTE/ASSIGN <-- NOCable
0295 MOVE/COMPUTE/ASSIGN <-- NOCable
0295 MOVE/COMPUTE/ASSIGN <-- NOCable
0295 MOVE/COMPUTE/ASSIGN <-- NOCable
0740 MOVE/COMPUTE/ASSIGN <-- NOCable
0745 IF <-- NOCable
0750 MOVE/COMPUTE/ASSIGN <-- NOCable
0755 MOVE/COMPUTE/ASSIGN <-- NOCable
0760 CALLNAT/PERFORM EXTERNAL
0765 IF <-- NOCable
0770 MOVE/COMPUTE/ASSIGN <-- NOCable
0775 ELSE <-- NOCable
0780 MOVE/COMPUTE/ASSIGN <-- NOCable
0810 RESET <-- NOCable
MORE |
12:39:47 ***** NATURAL NOCSTAT COMMAND ***** 2017-05-29
Library SAGTEST Name NOCTEST1 Type Program
Line Statement
----- -------------------------
0000 MCG OPTIONS
0005 MCG OPTIONS
0000 OPTIONS
0295 CALLNAT/PERFORM EXTERNAL
0295 NOC CODE
0295 NOC CODE
0295 NOC CODE
0295 NOC CODE
0740 NOC CODE
0745 NOC CODE
0750 NOC CODE
0755 NOC CODE
0760 CALLNAT/PERFORM EXTERNAL
0765 NOC CODE
0770 NOC CODE
0775 NOC CODE
0780 NOC CODE
0810 NOC CODE
MORE |
Below are job examples for processing NOCSTAT reports in batch mode to
create a CSV work file. After job execution, the work files generated can be transferred
from host to PC for further processing with standard transfer tools.
//NOCBATCH JOB (NOC,,,30),CLASS=K,MSGCLASS=X 00000100
//NATEX EXEC PGM=NATvrsBA,REGION=6200K,PARM=('IM=D') 00000200
//STEPLIB DD DISP=SHR,DSN=TESTNAT.LOAD 00000300
//CMPRINT DD SYSOUT=X 00000400
//CMWKF01 DD DSN='NOC.NOCSTAT.OUT',DISP=(NEW,CATLG), 00000500
SPACE=(CYL,(1,1)),UNIT=SYSDA,VOL=SER=SAG001 00000600
//SYSOUT DD SYSOUT=X 00000700
//CMSYNIN DD * 00000800
NOCSTAT 00000900
*,library,,X,,,,X 00001000
. 00001100
FIN 00001200
/* 00001300