This article mainly tells you about the external file formats supported by the DB2 database-ASCII files with fixed record length. DB2 also supports fixed-length ASCII external file formats, which are sometimes called positional ASCII files.
The ASCII file format at the fixed record length position uses a fixed byte offset to replace the record separator to determine the boundary of each field. In short, in this file format, each record in the file (each field in the record) has a fixed length.
For example, the starting position of the N record is determined by the fixed length of the record multiplied by the product of N. The calculated value is the byte offset from the start point of the file. Not only is the length of the record row fixed, but the start position and end position of each column value in each record are also the same. That is, the length of each field is the same. However, if the actual content of a field does not reach this fixed width, it is often replaced by a space character.
However, this file format is much different from the previously mentioned ASCII file. Such as making this file is very troublesome and prone to errors. Inputting one or more spaces leads to Database Import errors. For example, Chinese characters and English characters occupy different positions. If the data file contains both Chinese and English characters, it is difficult to control the fixed length.
Therefore, like many database administrators, I do not set up the fixed-length ASCII file format. If you must use it, you must use professional tools to convert the file. For example, in Linux, you can use the redirection symbol to create a fixed-width ASCII file.
In short, if you create this file manually, there is a high possibility of errors. In the current DB2 database system, some import tools also support this format of external files. However, this format has been abandoned during data export. It can be seen that files in this format are exiting the historical stage.
The above content is an ASCII file with a fixed record length that explains the external file formats supported by the DB2 database. In this regard.