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

26 Chapter2
Creating a KSAM File
Modifying Existing File Specifications While Copying
:FCOPY FROM=DATA; TO=(*DATANEW)
Modifying Existing File Specifications While Copying
A file equation can be used to modify file specifications of an existing file. The FCOPY
subsystem can be used to copy data from an existing file into a new file using a back
reference to the file equation for the new specifications. The following example copies data
from the file DOC to a new KSAM XL file DOC1. The file type and key specifications for the
new file are specified in the file equation.
FILE DOC1=DOC1;KSAMXL;KEY=(b,1,4)
FCOPY FROM=DOC;TO=*DOC1;NEW
Building a KSAM File Programmatically
The HPFOPEN and FOPEN intrinsics can be used within a program to create and open a
KSAM file in a single step. As with the BUILD command, file and key characteristics are
provided as parameter data.
NOTE
The HPFOPEN intrinsic can be used only in an MPE/iX environment. If a
program is to be developed for both MPE/iX and MPE V/E systems, the FOPEN
intrinsic should be used. Refer to “Mixed Mode Operation” in Chapter 8 for
information regarding cross development.
The unique KSAM file and key characteristics are contained in an array that varies in
length from 40 to 162 words. The format of the array is shown in Figure 2-9..
Characteristics for a maximum of sixteen keys need to be specified in the array. Standard
file characteristics are contained in the file options parameter of the intrinsic.
Language ID
Enter the three digit code for the native language that you desire. To find out what
languages can be accessed on your system, enter RUN NLUTIL.PUB.SYS. A list of languages
and their IDs is displayed on the screen. Any of the listed language IDs can be entered in
this field.
Flag word
The flag word contains two bytes defining the KSAM file characteristics:
Bits Value/Meaning
15:1 Reserved.