Using KSAM/XL and KSAM 64 (32650-90886)

20 Chapter2
Creating a KSAM File
Creating the File With the BUILD Command
The length of the key.
Random insertion or sequential insertion of the key, if duplication is allowed.
Record numbering starting with 0 or 1.
Reuse of deleted record space or no reuse.
Specify default data block size or allow KSAM to select data block size.
KSAM File Characteristics
The key characteristics, the method of file numbering, and the reuse option are unique to
KSAM files. Each key must be defined in the BUILD command's ;KEY= parameter. Record
numbering and the reuse option must be specified if the default values are not acceptable.
Key Characteristics
The ;KEY= parameter of the BUILD command encloses all key characteristics in
parentheses. Individual characteristics for a single key are separated by commas. Each
key description is separated from the next by a semicolon. The following example shows a
;KEY= parameter that defines two keys. Four characteristics are defined for each key: key
type, location, size, and duplication method.
;KEY=(B,9,5,RDUP;I,17,3,DUP)
The following descriptions list the available options for the definition and use of keys. Four
characteristics are defined for each key: key type, location,size, and duplication method.
The key type defines the data type of the key field. The type is identified by a keyword or
its abbreviation. In the previous example, the first key field contains byte data and the
second is an integer. The following list provides the valid key types.
byte or B Byte data field.
integer or I Integer data field.
real or R Real number.
IEEE real or E IEEE floating-point decimal number.
numeric or N Numeric field.
packed or P Packed decimal field, odd number of digits.
*packed or * Packed decimal field, even number of digits.
The key's location is determined by the position of the first byte of the field in relation to
the beginning of the record. The first byte of the record is considered to be 1. Only one key
can start at a particular location. In the previous example, the first key begins in byte 9,
the second in byte 17.
The size of the key must be specified in bytes. Specific use of any key is determined by its
definition. The ranges listed below indicate the maximum possible values. The maximum
length of the key varies by data type, as specified in the following list:
byte 1 to 255 bytes.
integer 1 to 255 bytes of integer data.