What is field width? [Open Edge 10.2b)

JoseKreif

Member
I feel dumb for not knowing this. What is field width?

1954

1956

I would assume it's the number of characters the field is allowed to retain; however; I can set a field width to 5, but I can store more than 5 characters in a given field.
 

Bounty

New Member
Format is the default width for displaying character fields. You can store as many characters (limited to something in the range of 31000) as you like.
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
I would assume it's the number of characters the field is allowed to retain; however; I can set a field width to 5, but I can store more than 5 characters in a given field.
Every field in every table is defined by a record in a meta-schema table called _Field. One of the attributes in this table is "Width" (field name _Field._Width), though it should really be labelled as "SQL Width".

_Width:
  • Is only relevant for character fields;
  • Is only relevant for SQL clients;
  • Has no effect on how much data can be stored in a field;
  • Defaults to two times the length of the ABL display format in the schema. E.g. if a field's default display format is "x(15)", its _Width value will default to 30;
  • Can be updated manually, or via the "Adjust Field Width" option in the Data Dictionary, or via the dbtool utility, or via ASU (see below).
Character data in the database is variable-length, up to a maximum of roughly 32000 bytes (actually a little less). But SQL clients expect the OE RDBMS to act like SQL databases, with fixed-length fields. The _Width value is the maximum length they are told to expect when querying a field value. If a character field contains a value longer than its _Width setting and it is queried by a SQL client, it will throw a runtime error like this:
Code:
=== SQL Exception 1 ===
SQLState=HY000
ErrorCode=-210012
[JDBC Progress Driver]:Column <field> in table PUB.<file> has value exceeding its max length or precision.

There are also features called Autonomous Data Truncation (aka ADT, OE 11.5+) and Autonomous Schema Update (aka ASU, OE 11.6+) that can also be enabled on a SQL broker to help with this issue on an ongoing basis. They are described in the docs.
 
Last edited:

JoseKreif

Member
Thanks for the feedback guy. I guess I don't have to worry too much since the database in question is never accessed through SQL, and the data is only displayed in a Linux environment. So format "x(##)" is all I need. This info will surely come to use sometime in the future though.
 
when you whant to play with the width of a field there is 3 way:
width : calculate on the same scale tha, your grame width
width pixels : can be usefull when you want to manage your field width dinamicly
FORMAT : as a double use, first it adjust your field width and second it force the display of more characte by default it's 8 ;)
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
when you whant to play with the width of a field there is 3 way:
width : calculate on the same scale tha, your grame width
width pixels : can be usefull when you want to manage your field width dinamicly
FORMAT : as a double use, first it adjust your field width and second it force the display of more characte by default it's 8 ;)
You're talking about display width, which is a different concept from what JoseKreif asked about.
 
Top