You can create a KSAM file in several different ways:
Using the BUILD command. The file name and file
characteristics are specified in the command parameters. The file can
then be loaded with data by using the FCOPY subsystem to load
existing file data or by directing program output to the
file.
Copying an existing file using the FCOPY subsystem. File
characteristics can be defaulted to those of the existing file or
modified by using a file equation.
Using HPFOPEN or FOPEN intrinsic parameters from
within an application program. The intrinsic call creates and opens
the file. The program's output can then be written to the opened
file.