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

Chapter 2 23
Creating a KSAM File
Creating the File With the BUILD Command
Figure 2-4. Creating a KSAM 64 file with data block size set at 4K bytes (default)
Use the FILE command along with the FCOPY command to copy a new KSAM file to one
where the data block size is chosen using OPTMBLK.
Users with existing KSAM XL files of 4K bytes can convert their files by using FCOPY.
Specify the OPTMBLK option in the file equation. This allows KSAM XL to select the data
block size in the file equation. If a file equation does not specify either option, FCOPY uses
the FROM= file's setting of OPTMBLK or DEFBLK.
Sample BUILD Command
Figure 2-5. builds a sample KSAM XL master file to process 80-byte accounts receivable
records in English. The maximum size of the file is 100 records. Record numbering in the
sample file begins with number 1. Reuse of deleted record space is allowed.
In this sample, four key fields are defined to sequence data for various programming
functions:
A unique 6-digit account number as the primary key.
A 25-character field containing the client's last name.
A 5-digit zip code field.
A 3-character branch ID.
Figure 2-5. creates the ARMSTR file with the preceding specifications using the BUILD
command. (Note that ampersands have been included at the end of each line to continue
the command on subsequent lines to improve readability.)
Figure 2-5. Building the AR Master KSAM XL File
:BUILD XDEF64;KSAM64;KEY=(B,1,4)
:LISTFILE XDEF64,7
KEY KEYTYPE KEY LOCATION KEY SIZE DUP/RDUP
--- ------- ------------ -------- --------
1 BYTE 1 4 NONE
NUM KSAM KEYS: 1 FIRST KSAM RECORD : 0
LANGUAGE : ENGLISH REUSE RECORD : NO
VERSION : 4 COMPUTE BLK SIZE : DEFBLK
DATA :
:BUILD ARMSTRXL.MGR.AR;REC=-80,,F,ASCII;&
DEV=DISC;DISC=100;KSAMXL;&
KEY=(N,4,6;& Specifies account number (primary) key
B,10,25,RDUP;& Defines the last name key
N,65,5,RDUP;& Defines the zip code key
B,70,3,RDUP);& Defines the branch ID key
FIRSTREC=1;REUSE ;LANG=5 Specifies that the first record is identified by
number 1, that deleted record space can be reused,
and that the native language is English.