ABL programs have the ability to insert data whose length exceeds the Data Dictionary value of SQLWidth. SQL applications will not be able to read a row if a column contains data greater than the SQLWidth value defined in the Data Dictionary.
There are three tools which facilitate column width discrepancies:
- The DBTOOL utility: What is DBTOOL?
- Using Authorized Data Truncation (ADT): Where to enable the -SQLTruncateTooLarge and -SQLWidthUpdate features
- The -checkwidth startup parameter, to specify the maximum width of the data allowed in a field for ABL Clients on single-byte databases.
The
-checkwidth startup parameter was introduced in Progress 9.1D06. It allows the ABL client to compare the width of the data in a CHARACTER, DECIMAL, or RAW field with the value of the metaschema
_width field value for that particular field before updating a database record.
- MAX-WIDTH - The SQL Width is required for SQL applications to know how much data is expected in the field. SQL clients cannot read a record if a column contains data greater than the SQLWidth value defined in the Data Dictionary. In the metaschema, this maps to _field._width.
- FORMAT - Fields defined in the Data Dictionary are also given a specific ABL format. This format is a display-only format for the 4GL engine. It does not restrict the amount of data that can be stored in the field. ABL clients can insert data into fields whose length exceeds the Data Dictionary value of SQLWidth as long as the total record size does not exceed the maximum record size (32KB).
- For further clarification refer to Article What is MAX-WIDTH or SQL_WIDTH in a df file?
- SQL applications will fail to read a row (record) if a column (field) contains data greater than the SQLWidth value defined in the Data Dictionary.
- When an ABL client session is started with the -checkwidth parameter, it be prevented from entering data larger than a field's _width value which is consistent with how SQL clients handles the SQLWidth value. The comparison will only happen when the field is being updated and not when the data is being extracted. When all ABL clients connect to a Progress database have the -checkwidth parameter enabled, the SQL engine connecting to the same database will not attempt to retrieve columns that have values exceeding their max length or precision because they will not exist.
- -checkwidth parameter modes:
0 - keep the current behavior, ignore the _width value when creating or updating CHARACTER, RAW, and DECIMAL extent fields
1 - keep the current behavior, generating a warning message before storing data larger than SQL Width
2 - raise an error, do not store anything when the field data exceeds _field._width which will affect ABL application behavior
- -checkwidth uses the RAW length of the data in its calculation which fails for databases that store multi-byte characters: