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

44 Chapter4
Opening and Closing the File
Opening a New File
file_num := 0;
status := 0;
file_name := '%ARMSTRXL.MGR.AR%';
ksam_type := 3;{creating a KSAM XL file} {to create a KSAM64 file set to 7}
write_access := 1;
rec_len := 80;
file_len := 100;
save_perm := 1;
ascii := 1;
.
.
.
ksamparam[10].lang_id := 5;
ksamparam[16].resrvd3 := 0;
ksamparam[16].num_keys := 1;
ksamparam[17].key_type := 2;
ksamparam[17].key_length := 5;
keylocation := 5;
ksamparam[18].bitword := keylocation;
.
.
.
HPFOPEN(file_num, status,
2, file_name,
10, ksam_type
11, write_access
19, rec_len,
35, file_len
50, save_perm,
53, ascii
54, ksamparam
);
if status <> 0 then handle_file_error (file_num, status);
end;
To create a new KSAM64 file set ksam_type=7 in the program segment shown inFigure
4-2. To create a new KSAM file using the FOPEN intrinsic, file characteristics and KSAM
key information are specified in the positional parameters. In most cases, the
foption
,
aoption
,
recsize
,
ksamparam
, and
filesize
parameters must be specified. Commas
identify those positional parameters for which the default specifications are used. Figure
4-3. provides an FOPEN intrinsic call that creates a KSAM XL file with write access to build
the file.