For a physical file, use this position to specify the data type of the field within the database.
Specify data type in a logical file only to override or change the data type of the corresponding field in the physical file on which this logical file is based. If you leave this position blank, the field you are defining has the same data type as the corresponding field in the physical file(s) on which the logical file(s) is based.
Valid data type entries are as follows:
Figure 3 and Figure 1 show how to code the data type.
For physical files, if you do not specify a data type or duplicate one from a referenced field, the OS/400 program assigns the following defaults:
Notes:
The following table shows what types of data conversion are valid
between the data types of physical and logical file fields, where valid
conversions are marked with an X or with a reference to the table
notes:
Data type of physical file field | Data type of logical file field | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | H | S | P | B | F | L | T | Z | UTF8 | UTF16 | UCS2 | O | J | E | G | 5 | |
Character (A) | X | X | 1 |
|
|
|
|
|
| X | X | X | X |
| X |
| X |
Hexadecimal (H) | X | X | 1 |
|
|
|
|
|
|
|
|
| X | X | X |
| X |
Zoned (S) | 1 | 1 | X | X | 2 | X |
|
|
|
|
|
|
|
|
|
| 1 |
Packed (P) |
|
| X | X | 2 | X |
|
|
|
|
|
|
|
|
|
|
|
Binary (B) |
|
| 2 | 2 | 3 | 2 |
|
|
|
|
|
|
|
|
|
|
|
Floating Point (F) |
|
| X | X | 2 | X |
|
|
|
|
|
|
|
|
|
|
|
Date (L) | 6,7 |
| 6 | 6 |
|
| X |
|
|
|
|
|
|
|
|
|
|
Time (T) |
|
| 4 |
|
|
|
| X |
|
|
|
|
|
|
|
|
|
Timestamp (Z) |
|
|
|
|
|
| 5 | 5 | X |
|
|
|
|
|
|
|
|
UTF-8 | X |
|
|
|
|
|
|
|
| X | X | X | X |
|
| X |
|
UTF-16 | X |
|
|
|
|
|
|
|
| X | X | X | X |
|
| X |
|
UCS-2 | X |
|
|
|
|
|
|
|
| X | X | X | X |
|
| X |
|
Open (O) |
| X |
|
|
|
|
|
|
| X | X | X | X |
|
|
| X |
Only (J) |
| X |
|
|
|
|
|
|
|
|
|
| X | X | X | X | X |
Either (E) |
| X |
|
|
|
|
|
|
|
|
|
| X |
| X |
| X |
Graphic (G) |
|
|
|
|
|
|
|
|
| X | X | X | X | X | X | X |
|
Binary character | X | X | 1 |
|
|
|
|
|
|
|
|
| X | X | X |
| X |
Notes:
|
Any conversion of data types from the physical file record format is permitted within the numeric types. For example, a binary field in the physical file can be converted to zoned decimal in the logical file.
You can convert zoned decimal fields to character or hexadecimal fields and the converse, provided that the field lengths are the same. The data type of the field in your program is the data type specified in the logical file. No error occurs in an I/O operation if the data passed contains only numeric characters (0 through 9). However, your program cannot send an I/O operation that attempts to pass characters other than 0 through 9 from a character or hexadecimal field to a zoned decimal field. The OS/400 program sends a message and the I/O operation cannot be completed.
For example, suppose a field is zoned decimal in the physical file. If you specify character type (A) for presentation to your programs, you must ensure that the field contains only numeric characters (0 through 9) when it is returned through the logical file to the physical file.
In another example, suppose a field is a character field in the physical file. If you specify the field as a zoned decimal field and as a key field in the logical file, you cannot create the logical file unless all records in the physical file contain only numeric characters (0 through 9).
If you are converting a floating-point field (in a physical file) to a packed decimal, zoned decimal, or binary field (in a logical file), you must explicitly specify the length and decimal positions. When converting floating-point data to fixed-point format make sure the values you specify for length and decimal positions are large enough to accommodate the data. Physical file length and decimal positions are presentation values only and do not indicate the magnitude of the number.
If the field you are defining is a concatenation of fields from the associated physical file (specified by the CONCAT keyword), you cannot specify the data type. The OS/400 program assigns the data type based on the data types of the fields that are being concatenated. The general rules are:
If the field you are defining is a substring of a field (specified
by the SST keyword) from the logical file or the associated physical file, the
original field must be character, hexadecimal, zoned, DBCS-graphic or Binary
character (A, H, S, or G). If you do not specify the logical file
field's data type, then the conversion is shown in the following table
(the Source field type is the type of the physical file field or
the logical file field defined earlier in the logical file source):
Source field type | Logical file field becomes: |
---|---|
A | A |
H | H |
S | A |
G | G |
Binary character | Binary character |
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.