How to flush the write buffer in Sage X3

By | February 19, 2017

Sage X3 version 7 has a new function Flush the Write buffer, which is filled by the Writeb instruction.

Flush: The Flush instruction sends to the database the lines that have not already flushed when the Writeb syntax is used to create lines in the database.



Parameter Details:

CLASS is the abbreviation of the table in which the flush is done. By default, the current table as defined by Fileor by Default File is considered.

When several lines have to be written in a database table, it is important to use the Writeb instruction instead of the Write syntax. The difference is that the lines are sent to the database by groups of adxwrb lines. This avoids too many exchanges with the database server and is therefore less time consuming. The only consequence is that the fstat value is returned only at flush time or for every adxwrb record. This means that the development partner can no longer identify the exact line where the error occurred; however, it is still possible to retry the create transaction with adxwrb equals to 0 (that disables the buffering).

It is mandatory to flush the write buffer before a Commit; otherwise, an error occurs if lines remain in the flush buffer at Commit.

Flush updates the fstat variable to give the result of the write operations, as indicated by the following table:

fstat value Description
0 The write operation has been successful.
1 The write operation failed due to locking issues.
3  The write operation failed on a duplicate key creation attempt.

Hope this helps.

About Us
Greytrix – a globally recognized Premier Sage Gold Development Partner is a one-stop solution provider for Sage ERP and Sage CRM needs. Being recognized and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development and implementation expertise.

Greytrix caters to a wide range of Sage Enterprise Management (Sage X3) offerings – a Sage Business Cloud Solution. Our unique GUMU™ integrations include Sage Enterprise Management (Sage X3) for Sage and Magento eCommerce along with Implementation and Technical Support worldwide for Sage Enterprise Management (Sage X3). Currently we are Sage Enterprise Management Implementation Partner in East Africa, Middles East, Australia, Asia. We also offer best-in-class Sage X3 customization and development services, integrated applications such as POS | WMS | Payment Gateway | Shipping System | Business Intelligence | eCommerce and have developed add-ons such as Catch – Weight  and Letter of Credit for Sage Enterprise Management to Sage business partners, end users and Sage PSG worldwide.

Greytrix is a recognized Sage Rockstar ISV Partner for GUMU™ Sage Enterprise Management – Sage CRM integration also listed on Sage Marketplace; GUMU™ integration for Sage Enterprise Management – Salesforce is a 5-star app listed on Salesforce AppExchange.

For more information on Sage X3 Integration and Services, please contact us at We will be glad to assist you.