|  |  | The first parameter in every KSAM procedure call must be
filetable, a table describing the file and its access. This
table is defined in the WORKING-STORAGE SECTION of the COBOL program. It
requires eight halfwords as illustrated in Figure
A-1 "Filetable Structure"
    
Figure A-1 Filetable Structure
 ![[Filetable Structure]](img/gfx21.gif)
  A sample file table definition might be:filenumberA number identifying the file returned by the CKOPEN
      procedure after the file named in halfwords 2-5 has been successfully
      opened. After the file is closed by CKCLOSE, filenumber is reset
      to 0. (This number should be set to zero when the file table is initially
      defined.) It must be defined as a COMPUTATIONAL item.filenameThe name of the KSAM file. This name is the actual designator assigned
      to the file when it is created with the KSAMUTIL or MPE/iX BUILD
      command; filename may be a formal designator if it is equated to the
      actual designator in a FILE command.input/output typeA code that limits the file access to input only, output only, or
      allows both input and output:
     
      It must be defined as a COMPUTATIONAL item.0input only1output only2input/outputaccess modeA code that indicates how the file will be processed: sequentially
      only, randomly only, or either (dynamically):
     
      It must be defined as a COMPUTATIONAL item.0sequential only1random only2dynamic (sequential or random)previous operationA code in the right byte of halfword 8 of the file table indicating
      the previous successful operation:
     
      This field should be set to zero when the file table is initially defined
      and thereafter should not be altered by the programmer. It must be
      defined as a COMPUTATIONAL item.0previous operation unsuccessful or there has been no previous
          operation on this file1CKOPEN successful2CKSTART successful3CKREAD successful4CKREADBYKEY successful5CKDELETE successful6CKWRITE successful7CKREWRITE successful8CKCLOSE successful9CKOPENSHR successfullock/unlockA code in the left byte of halfword 8 of the file table that indicates
      whether a CKLOCK or CKUNLOCK has been performed
      successfully since the operation specified in previous operation:
     
      10CKLOCK successful11CKUNLOCK successful 
  WORKING-STORAGE SECTION.
  FILE_TABLE.
    01 KSAM_FILE.
      02 FILENUMBER    PIC S9(4) COMP VALUE 0.
      02 FILENAME      PIC X(8) VALUE "KSAMFILE".
      02 I-O-TYPE      PIC S9(4) COMP VALUE 0. 
      02 A-MODE        PIC S9(4) COMP VALUE 0.
      02 PREV-0P       PIC S9(4) COMP VALUE 0.
The file table identifies a file created with the name KSAMFILE as a
file to be opened for sequential input only. The values of I-O-TYPE and A-MODE
can be changed following a call to CKCLOSE for the file.
 
 |