Home | Previous Page | Next Page   Defining Formats > Fixed-Length Records >

Creating a Fixed Format That Includes BYTE or TEXT Data

You can organize the byte or text data in a fixed-format data file in the following ways:

Inline Data

Byte or text data that is included as part of a fixed-format data file is called inline data. When byte or text data is inline, the data-file record has two parts: a fixed-length part and a variable-length part. For example, a record with two fields and byte or text data might be organized as Figure 57 shows.

Figure 57. Organization of a Record that Includes Inline TEXT Data
field1   textlength   field2   textdata

The length of the TEXT data is included in the fixed-length part of the record. The actual TEXT data is inserted at the end of the fixed-length part of the record. The HPL reads the TEXT length from the fixed-length part of the record and uses that length to read the actual TEXT data. The HPL also uses the TEXT length to calculate the offset to the beginning of the next record.

Figure 58 shows the format definition of a record with inline BYTE and TEXT data. The arrows show how the HPL puts the record into the database. The arrows from field 1 and field 2 indicate entries in fixed-length format. The split arrow shows that the HPL uses the TEXT length information to find the TEXT data and insert it into the table. The HPL does not insert the TEXT length into the database.

Figure 58. Inline TEXT Data
begin figure description - This figure is described in the surrounding text. - end figure description

When you define the format in the format-definition window, select Blob Length as the data type for the textlength field. Figure 59 shows the format for the example in Figure 57. The format does not include an entry for TEXT data.

Figure 59. Fixed Format That Includes TEXT Data
begin figure description - This graphic depicts the ipload graphical user interface. The onpladm command line utility provides the same functionality. - end figure description

When you create a map to link the input fields that are defined by the format to the columns of a database table (see Defining Maps), connect the textlength input field to the table column that contains the TEXT data.

Data in a Separate File

You can also store BYTE and TEXT data in separate files. During a load, BYTE and TEXT data files are read and inserted into the database. During an unload, the file is created, and BYTE and TEXT data is written to the file. When the fixed-format input contains the pathname of a data file, the HPL uses that pathname to insert data into a column of the database table, as Figure 60 shows. When you prepare the format, select Blob File for the data type.

Figure 60. BYTE or TEXT Data in a File
begin figure description - This figure is described in the surrounding text. - end figure description

When you create a map to link the fields of the input record to the columns of a database table (see Defining Maps), link the name of the BYTE or TEXT file with the BYTE or TEXT column. The arrows in Figure 60 illustrate how the HPL inserts the BYTE or TEXT data into the column.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]