The segment cycle is the processing cycle that occurs when the application executes an ispec or event transaction. It is controlled by the segment and defines the order in which built-in methods are called.
Note: In the following text of this topic, the term ispec should be read to denote both ispecs and events.
The following diagram is of the basic segment cycle:
Requesting an Ispec
An ispec can be requested as a result of one the following:
A request from the Select Ispec dialog box.
A Recall logic command invoked by another ispec.
A Recall logic command invoked by the same ispec.
An Abort logic command.
A Roc logic command.
A request/incoming message from an external caller via the segment's public (COM) interface.
An automatic refresh of the ispec.
When an ispec is requested, the following process steps occur before the ispec is ready to accept input (for ispecs with a user interface, this corresponds with its display to the application client). The orange arrow in the diagram above indicates the starting point:
Segment and ispec attributes without defined initial values are initialized to their corresponding values from the input message.
The Construct method is called unless either the ispec is being requested due to an automatic refresh and a Message logic command has not been invoked, or the ispec has not been requested as a result of a Recall logic command invoked by the same ispec.
The Construct method can be used for reasons such as the pre-filling of user interface fields, or security checking.
Transmitting an Ispec Update
An ispec update initiates the following process steps (the green arrow in the diagram above indicates the starting point):
Segment and ispec attributes without defined initial values are initialized to their corresponding values from the input message if they are in the presentation, or to the appropriate "empty" value (0, "", or false), depending on the attribute type.
Automatic edit occurs – attributes with decimals are validated.
Any errors are returned to the application client.
The Prepare method is called.
The Prepare method can be used for reasons such as generating a customer number, performing any necessary validation of user input data, performing logic actions based on the user input, or recalling another ispec without processing the current ispec.
Any Message or Recall logic commands invoked halts processing at the end of the prepare method.
Automatic validation occurs – keys, dates, and required fields are validated; the database records corresponding to the specified keys are retrieved if they have an automatic lookup dependency.
Any errors are returned to the application client.
The Main method is called.
The Main method can be used for reasons such as checking stock-on-hand, or checking a customer credit limit for a sale.
Any errors are returned to the application client.
Automatic update occurs – for a persistent ispec, the database record is updated (or written).
At this point, one of the following process steps occurs:
If a Recall logic command was invoked on the same ispec, the Construct method call is skipped, and the segment cycle repeats from step 1 above.
If a Recall logic command was invoked on a different ispec, the specified ispec is requested. Refer to Requesting an ispec for more information.
If the ispec's Refresh Screen property is set to true, and no Recall logic command was invoked, the current ispec is requested. Refer to Requesting an ispec for more information.
If the ispec's Refresh Screen property is set to false, and no Recall logic command was invoked, the Select Ispec dialog box is displayed. Refer to Requesting an ispec for more information.
Transmitting an Ispec Inquiry
An ispec inquiry occurs when an ispec is transmitted with Maint built-in presentation attribute is set to "FIR", "LAS", "NEX", "BAC", or "REC". It initiates the following process steps:
Segment and ispec attributes without defined initial values are initialized to their corresponding values from the input message.
Automatic edit of keys occurs – numeric fields are validated, separators and decimal points are removed.
Any errors are returned to the application client.
The database record corresponding to the specified keys is retrieved.
The retrieved record is made available (for ispecs with a user interface, this corresponds with its display to the application client).
Glb.Error
The behavior of the segment cycle is affected by the Glb.Error built-in segment attribute in the following manner:
Automatic processing (edit, validation, or update) does not occur if Glb.Error is set to "*****". If Glb.Error is set to "*****" upon completion of the Main method call, the automatic update of the database update does not take place.
Glb.Error is initialized to spaces prior to both the Prepare and Construct method calls. Consequently, automatic processing in the Construct method occurs even if Glb.Error has previously been set to "*****" in the Prepare or Main methods.
A Message or Recall logic command invoked in the Prepare or Main methods sets Glb.Error to "*****" and cause the Construct method call to be skipped. However, explicitly setting Glb.Error to "*****" does not cause the Construct method call to be skipped if the ispec's Refresh Screen property is set to true.
If Glb.Error is set to Glb.Spaces following the invocation of a Message or Recall logic command, database updates, including the automatic update following the Main method call, occurs, and construct automatic processing is performed if the ispec's Refresh Screen property is set to true.
If database updates in the Prepare or Main methods are completed successfully, the message "SUCCESSFUL ENTRY” is displayed on the status line. However, if database updates are disabled because Glb.Error is set to "*****", the message "THIS ENTRY DID NOT UPDATE" is displayed instead, regardless of any successful database update that might subsequently occur in the ensuing Construct method. This situation results because the status line message is output after the Main method call, at which point the application does not know whether the Construct method attempts to (successfully or otherwise) update the database.
Ispec Cycle
The ispec cycle is a subset of the segment cycle and consists of the processing of an input message by a single ispec. It is controlled by each individual ispec.
The ispec cycle can also be called independently of the segment cycle, such as with external automatic entry processing.