7.2 The SREV Field Attribute
The SREV field attribute is provided to assist the collating sequence of bi-directional data stored in database files.
It indicates that the field's contents should be reversed as it crosses the interface between an RDML application program and a database I/O module or *DBOPTIMIZE generated inline I/O logic.
This means that everywhere the field is referenced at the RDML (or programmer) level it is in a reversed format to what it is at the I/O level or the database level.
The following should be noted about using this attribute:
- Use attribute SREV as either an input attribute or an output attribute at the data dictionary level only. Use of this attribute in any other context, such as RDML DEFINE or OVERRIDE commands is meaningless. The SREV attribute only applies to a field in one place: at the database I/O interface level.
- Take care when changing an existing field from, or to, an SREV field. Data already stored in database files may conflict with this definition and require (re)alignment before it can be effectively used.
- Since SREV applies at the I/O level, it can have a bearing on other operations performed at the I/O level. Such operations must be aware that a field is in reversed format as soon as it enters the I/O level, and remains in reversed format until it leaves the I/O level.
Operations that may be affected by this consideration include:
- File and dictionary level validation checks may need to reference the field in reversed format.
- User defined virtual code.
- Avoid giving fields that have the SREV attribute default values that are directional in nature. A field's default value has a dual role at the RDML level and at the I/O level. Where a field's default value has a directional content, there will almost certainly be a conflict that may produce strange or unexpected results.
- The SREV attribute can only be applied to alphanumeric fields.