CriticalPoint

Syntax

CRITICALPOINT [ SLEEP expression ] [ NORELEASE ]

Parameters

CriticalPoint can be abbreviated as CP.

Description

The CriticalPoint logic command is used in reports to force end-of-transaction, defining a synchronization point for recovery. This enables easy and rapid recovery following a system failure.

The CriticalPoint logic command should be used at important points in the processing cycle of the report, such as after a record is read, but before it is written. This ensures data stored for recovery is the data about to be processed.

For an MCP-based system, regular CriticalPoints should be included to avoid delays at sync points and control points, when other programs using the database might be suspended waiting for this Report.

For a Windows-based system, regular CriticalPoint logic statements should be included to avoid delays in committing locked records, when other programs using this user database might be suspended waiting for this report.

During normal operation, the following processes occur when a CriticalPoint logic statement is executed:

Note: The CriticalPoint logic command is for use in Reports only. The use of this command in Ispecs and Messengers is invalid or is ignored.

CriticalPoint Sleep

The CriticalPoint Sleep logic command variant is not the same as the Sleep logic command, which is invalid in reports that contain CriticalPoint logic statements.

Suspension occurs immediately when the CriticalPoint logic command is executed, freeing access to the database. The report is activated after the specified number of seconds, and proceeds to complete any activities that it might have accumulated. The report can also be is explicitly activated by a Wake logic statement.

Recovery

Refer to CriticalPoint Recovery.

ROC reports

When a CriticalPoint logic statement is executed, all output for a report is written to the database so that it might be recovered. On resumption of the report, output continues to the same database files. The current files are not released.

For Windows-based systems

ROC standard reports write output to a flat file. Interaction with ROC tables is minimal, and achieved indirectly through an independent process. This separates the transaction activities performed by the report on the ROC database from the user database. For applications deployed to Windows, a single LINC16RR.exe process is used.

The user database remains in transaction state until a CriticalPoint logic statement, whereupon it commits the result before resuming transaction state.

For MCP-based systems

Standard ROC Reports write output to the ROC tables in the database.

If the database is not in transaction state when data has to be written to a ROC data structure, a transaction state will be started for the database update, and then immediately end.

ROC database activity does not affect user database activity, and so CriticalPoint commands (or Sleep 0 commands) are not required to avoid long database transactions due to ROC database activity.

OLTP

If your report has started an OLTP global transaction, the CriticalPoint logic command commits and completes the transaction, and commences a new global transaction. This ensures the required recovery information is stored in the appropriate databases.

Restrictions

The following restrictions while using the CriticalPoint logic command:

Examples

Example 1

This example executes a CriticalPoint logic statement after every 500 records.

Suppose a failure occurs after record 4438 has completed. The system is restored to its condition at record 4000, and processing restarts from record 4001.

SD_Recover is a group variable, with members SD_Total, SD_Key, and SD_Comp.

Message Attention "Enter Company name"
Accept Comp_Name                                  : Get a value for company.
LookUp Comp_Name Corec                            : Read company name from
                                                  : database for header.
SD_Recover.SD_Comp := Comp_Name                   : Move key to group variable.
Loop
    Determine From Cust.Cust_Prof (SD_Recover.SD_Key1) : Read database.
        SD_Counter := SD_Counter + 1              : Increment counter.
        If SD_Counter > 500                       : Test for record 500.
            SD_Recover.SD_Key1 := Cust.Number     : Assign key to group variable.
            JumpTo Finis                            : Exit to CriticalPoint.
        End
                                                  : Assign value to SD_Recover.
        SD_Recover.SD_Total :=                    \
            SD_Recover.SD_Total + Cust.Balance
        Frame10.Print()                           : Process report: Step 1.
        Advance 2                                 : Process report: Step 2.
    End
    Break All                                     : End report processing.
    Label Finis
    CriticalPoint Sleep 2                         : Perform CriticalPoint.
    If Glb.Recover = 1                            : Test the need for a
                                                  : reinitialization.
        Comp_Name := SD_Recover.SD_Comp           : Retrieve company name.
        LookUp Comp_Name Corec                    : Read company name.
        Glb.Recover := 0                          : Set indicator.
    End
    SD_Counter := Glb.Zeros                       : Set counter to zero.
End

Example 2

This example executes a CriticalPoint logic statement after every SD_Limit customer.

If a failure occurs, the system is restored to its condition just prior to the most recent critical point and processing continues with the next customer.

Loop
   Determine From Event.Recevable (SD_Cust, SD_ActMth, Glb.Spaces, Glb.Zeros)
        If Event.Customer <> SD_Cust
             If SD_Cust <> Glb.Spaces
                  SD_Count := SD_Count + 1
                  If SD_Count > SD_Limit
                       SD_Count := Glb.Zeros
                       Break
                  End
             End
             SD_Cust := Event.Customer
        End
        If Event.ActMth = SD_ActMth
             Extract Event As FileA RetainAs "CustEvents"
             If Event.Ispec = "Cash"
                  Purge Event
             End
        End
    End
    If Glb.Status = "*****"
         Break All
    End
    CriticalPoint Sleep MyNum
End