Skip to content

DF_RUNTIME_PROGRESS_FREQUENCY

See Also: Call Driver, Copy DB, Copy Records, Get Attribute, Set Attribute, Sort, Structure End, Structure Start, Execute Structure Start

Determines how often the runtime sends a callback message of type DF_MESSAGE_PROGRESS_VALUE.

Level

Global

Type

Numeric, temporary

Access

Read / Write

Values

1 - 4,000,000,000

Remarks

The callback message is used by several database-related functions to inform the calling process of the progress made for time-consuming operations. It is up to the programmer to deal with this information. It can be ignored completely or used to inform the user about progress.

The higher the value of this attribute, the less often DF_MESSAGE_PROGRESS_VALUE will be sent. You should try to set this value to provide adequate feedback without interrupting the processing of the program.

For example, if you are restructuring a file with 500,000 records, setting DF_RUNTIME_PROGRESS_FREQUENCY at 100 (the default) would probably be intrusive — the program would send the DF_MESSAGE_PROGRESS_VALUE message 5,000 times before completing. A value of 10,000 would most likely provide a better balance between feedback and program performance in this case.

Example Code

Simple Progress Class

Class cSimpleProgress Is A cObject
    Function CallBack String sMessage Integer iType Returns Integer
        String sType
        Case Begin
            Case (iType = DF_MESSAGE_TEXT)
                Move "(Text)" To sType
            Case Break
            Case (iType = DF_MESSAGE_HEADING_1)
                Move "(Message Heading 1)" To sType
            Case Break
            Case (iType = DF_MESSAGE_HEADING_2)
                Move "(Message Heading 2)" To sType
            Case Break
            Case (iType = DF_MESSAGE_HEADING_3)
                Move "(Message Heading 3)" To sType
            Case Break
            Case (iType = DF_MESSAGE_HEADING_4)
                Move "(Message Heading 4)" To sType
            Case Break
            Case (iType = DF_MESSAGE_HEADING_5)
                Move "(Message Heading 5)" To sType
            Case Break
            Case (iType = DF_MESSAGE_WARNING)
                Move "(Warning)" To sType
            Case Break
            Case (iType = DF_MESSAGE_PROGRESS_TITLE)
                Move "(Progress Title)" To sType
            Case Break
            Case (iType = DF_MESSAGE_PROGRESS_VALUE)
                Move "(Progress value)" To sType
            Case Break
        Case End
        Showln sMessage " -- " sType
    End_Function // CallBack
End_Class // cSimpleProgress

The sample class above can be used to give extremely simple feedback on one of the processes that support callback logic. It uses Showln to report progress.

Sort Customer Procedure

Procedure SortCustomer Integer iFrequency
    Handle hoProgress
    Showln "Sorting table Customer, progress frequency is " iFrequency
    Open Customer Mode DF_EXCLUSIVE
    Set_Attribute DF_RUNTIME_PROGRESS_FREQUENCY To iFrequency
    Get Create U_cSimpleProgress To hoProgress
    Sort Customer.File_number "" ;
        (DF_SORT_OPTION_NO_DATA_CHECK ior DF_SORT_OPTION_DUP_DATA_FILE) hoProgress
    Send Destroy Of hoProgress
    Close Customer
End_Procedure // SortCustomer

The sample procedure above uses the simple progress reporting class defined earlier to report progress on sorting the customer table. The runtime progress frequency is passed as an argument to the procedure.