#### On - Turning on Statistical Gathering (STATS/ON)

Selecting the On option allows statistical information to go from your part program to the database. With stats on, you can send data to the stats file, transfer the information to a different directory, or store the information in a database application.

Any dimensions that follow a STATS/ON command and precede the next STATS/OFF command will be sent to the stats file or database upon execution of the next STATS/TRANSER, STATS/UPDATE, or final command of the part program. With the STATS/ON command you can send the output information to multiple databases, even within the same part program.

Upon each execution of a part program that includes at least one STATS/ON command, PC-DMIS asks if it should send the output information to any statistical database directories. This prompt can be bypassed by selecting the ALWAYS Update Database check box accessible from the Dimension tab of the Setup Options dialog box. See the "Setup Options: Dimension tab" topic in the "Setting Your Preferences" chapter.

Note: If you select DataPage from Database Options, PC-DMIS automatically calls the DPUPDATE.exe executable to insert the data in the XSTATS11.tmp file into any selected DataPage directories.
Similarly, selecting the DataPage+ option calls DPPLUSUPDATE.exe which in turn calls DataImporter to import the XML file into the DataPage+ database.

Turning stats on inside a loop can result in a slightly different output for the dimension and feature IDs in generated stats files such as the XSTATS11.tmp text file or the XML file.

The Edit window command line for a STATS/ON command block changes depending on the database type specified. All STATS/ON commands start with this on the initial line:
STATS/ON,database option;

database option = This toggle field indicates the database type to which the stats will be sent. This field can be DATAPAGE, DES, SPC_DATABASE, or DATAPAGE+. Depending on what you select here, the rest of the command can change.

With the DATAPAGE option, the command block looks like this:

STATS/ON,DATAPAGE,$

DIRECTORY=directory_name,$

READ=n1,WRITE=n2,MEMPAGES=n3,variable_name1,variable_name2,$

STATS/END

With the SPC option, the command block looks like this:

STATS/ON,SPC_DATABASE,database_name

With the DES option, the command block looks like this:

STATS/ON,DES,DIRECTORY=directory

With the DATAPAGE+ option, the command block looks like this:

STATS/ON,DATAPAGE+,database_name,OFFLINE=y/n

RECORD=data_list

DIRECTORY=directory_name If the database option is DATAPAGE or DES, the value of directory_name should be a string that indicates the database directory to which the statistics will be sent. If you have more than one database directory, this DIRECTORY field repeats itself for each additional directory. Each one must be a valid database directory.

database_name = If the database option is SPC_DATABASE or DATAPAGE+, this string indicates the Data Source Name (DSN) of the database. For an SPC database, this name can be created in the ODBC options of the computer’s control panel. For a DATAPAGE+ database, the DSN is usually created inside of the DATAPAGE+ tool. The DSN must be created to link to a valid database.

READ=n1 This is a read lock. n1 indicates the maximum number of seconds PC-DMIS will wait for database access when reading. The default setting is 10 seconds. This field is only used for the DataPage database option.

WRITE=n2 This is a write lock. n2 indicates the maximum number of seconds PC-DMIS will wait for database access when writing. The default setting is 20 seconds. This field is only used for the DataPage database option.

MEMPAGES=n3 This stands for memory pages. n3 indicates the number of 4K memory pages to reserve for database tables when opening the database. This option will affect performance. The minimum number that can be entered is 4 (also default). This field is only used for the DataPage database option.

variable_name1 = This field indicates the variable name setting. If set to DIMENSION_NAME then dimension names will be displayed. If set to FEATURE-NAME then feature IDs will be displayed. This field is only used with the DataPage database option.

variable_name2 = This field determines whether or not control calculations should be used. If set to CONTRLCALC ON then control calculations are used. If set to CONTROLCALC OFF then they are not used.

OFFLINE = This YES/NO field determines if the offline options should be used. If set to YES, then the RECORD= field appears, specifying the info to write to the XML file. This field is only used with the DataPage+ database option.

RECORD=data_list This determines what data to record to the XML file. The value of data_list is either ALL, meaning all data is sent to the XML file, or a comma-separated listing of items. For example, if you wanted just dimension and hit information recorded, you would choose DIMENSION, HIT. This field is only used with the DataPage+ database option, and it is only available if OFFLINE=YES.

DataPage+ XML Handling

If you're using STATS/ON with a DataPage+ database name and OFFLINE=YES, a generated XML is created in the C:\Users\Public\Documents\WAI\PC-DMIS\ directory immediately after execution finishes. Note that this directory is version independent. It contains the transaction date and time, the DSN, as well as other information. You can limit this other information by using the Record option with the Offline check box.

Once generated, dpplusupdate.exe moves the file into the %AppData%/DataPage+/ForStatsFile directory for file handling. The DataImporter tool, if running, then looks in that directory and automatically imports the data into DataPage+. For information on using DataImporter, see the documentation that came with your installation of DataPage+.

The name of the XML is based on the current local time when it was generated. It uses this naming format:

<YYYY><MM><dd><hh><mm><ss>.xml

<YYYY> - The four digit year

<MM> - The two digit month

<dd> - The two digit day of the month

<hh> - The hour in 24-hour format

<mm> - The minutes

<ss> - The seconds