When defining a character field in a table, is there a way for certain fields to default to spaces if nothing is put into the field through application programs?
By using the DBEDITS field attribute functionality of the Datadictionary, you can enable special CA-Datacom/DB processing for both data editing and default processing. For example, a field can be defined to allow nulls or not. It can also be set to use various defaults, based on the type of data stored in the field.
To add this functionality to a field, use the Batch Datadictionary FIELD maintenance transaction 4012, or follow this process through Datadictionary Online (DDOL):
- Select the menu option for DBMAINT mode.
- Select the menu option to maintain TABLEs.
- Select the menu option to DISPLAY FIELDS, then enter the desired table name information to be maintained.
- Enter the line command ATT beside the character field you wish to change.
- Enter 'Y' in the DBEDITS field, 'O' in the DEFAULT-INSERT field (to indicate a User-Defined default value exists), and the keyword SPACE or SPACES in the VALUE field.
- Apply as usual, and follow your standard table change promotion procedure.
Be aware that if you change the attributes of a field for an existing table, you need to review programs that maintain this table to ensure that your changes are compatible with your current processing.
For further information about the values of the various FIELD attributes, please refer to the CA Datacom Datadictionary Attribute Reference Guide.
For further information about Default values and FIELD edit criteria, please refer to the CA Datacom/DB Database and System Administrator Guide.
For further information about using batch Datadictionary Maintenance transactions, please refer to the CA Datacom/DB Datadictionary Batch Guide.