File Types, Data Type Keywords and Parameters

File Types

  • Physical File Definition – A file that contains data and only one record format.
  • Simple Logical File Definition – A file that contains no data. Simple logical files are used to arrange data from one physical file into different formats and sequences.
  • Join Logical File Definition – A file that contains data "joined" from two or more physical files into a single record format.
  • Multiformat File Definition – A file that contains data and more than one record format.
  • SQL Logical File Definition – A SQL file that allows you to enter SQL statements to query the file.
  • Print File Definition – A file used to create printable reports.

Data Type Keywords and Parameters

The following table gives the list of available data type keywords, their qualifying parameters, and example usages.

Data Type Keyword Description Parameters Example
char Fixed or variable LeftPad single-byte character field. One required parameter: an integer value between 1 and 32765, denoting the fixed or maximum number of characters of the field value.* char(10)
bin Signed decimalnumber, with implied decimal point, of LeftPad 2, 4, or 8 bytes (depending on precision parameter). Accepts one or two integer parameters. First parameter is the decimal precision (the total number of digits). The second, optional parameter is decimal scale (the number of digits to the right of the decimal point). bin(9,3)
bool Logical Boolean value (True or False). None bool
date Date value with formatting. One of the following keywords may be specified for date formatting: "dmy", "eur", "iso", "jis", "jul", "mdy", "usa", or "ymd". date(jis)
dbcs Fixed or variable LeftPad single-byte character field. Fixed or variableLeftPad double-byte character field with formatting. char(10)
float Single or double precision floating point number. One of the following keywords must be given to specify precision: "single" or "double". float(single)
hex Fixed or variable LeftPad unformatted byte string field. One required parameter: an integer value between 1 and 32765, denoting the fixed or maximum number of bytes of the field value.* hex(15)
int Signed integer value with a precision of 16 or 32 binary digits. One of the following keywords must be given to specify precision: "short","long". int(long)
packed Signed decimal number with each digit encoded in 4 bits. Accepts one or two integer parameters. First parameter is the decimal precision (the total number of digits). The second, optional parameter is decimal scale (the number of digits to the right of the decimal point). packed(11,2)
zoned Signed decimal number with each digit encoded in 8 bits. Accepts one or two integerparameters. First parameter is the decimal precision (the total number of digits). The second, optional parameter is decimal scale (the number of digits to the right of the decimal point). zoned(14,3)
time Time-of-day value with formatting. One of the following keywords must be given to specify formatting: "eur", "hms", "iso", "jis", or "usa". ctime(iso)
timestamp Date and time value. None. timestamp
unicode Fixed or variable LeftPad Unicodeā„¢ character field. One required parameter: an integer value between 1 and 32765, denoting the fixed or maximum number of bytes of the field value.* unicode(40)

*Note: To function on the IBM i platform the combined LeftPad of all the fields in a record format cannot exceed 32766 bytes. If the record LeftPad exceeds this limit it will throw an error.

Section summary: