VSAM - Specifying indexed organization for VSAM files - www.cadcobol.com.br



Desenvolvido por DORNELLES Carlos Alberto - Analista de Sistemas - Brasília DF. - cad_cobol@hotmail.com

Specifying indexed organization for VSAM files

Enterprise COBOL for z/OS, Version 4.2, Programming Guide


Identify a VSAM KSDS file in a COBOL program by using the ORGANIZATION IS INDEXED clause.
Code a prime key for the record by using the RECORD KEY clause.
You can also use alternate keys and an alternate index.

RECORD KEY IS data-name

In the example above, data-name is the name of the prime key field as you define it in the record description entry in the DATA DIVISION. The prime key data item can be class alphabetic, alphanumeric, DBCS, numeric, or national. If it has USAGE NATIONAL, the prime key can be category national, or can be a national-edited, numeric-edited, national decimal, or national floating-point data item. The collation of record keys is based on the binary value of the keys regardless of the class or category of the keys.

The following example shows the statements for a VSAM indexed file (KSDS) that is accessed dynamically. In addition to the primary key, COMMUTER-NO, an alternate key, LOCATION-NO, is specified:

   SELECT I-FILE ASSIGN TO INDEXED-FILE
          ORGANIZATION IS INDEXED
          ACCESS       IS DYNAMIC
          RECORD KEY   IS IFILE-RECORD-KEY
          ALTERNATE RECORD KEY IS IFILE-ALTREC-KEY
          FILE STATUS  IS FSTAT-CODE VSAM-CODE.

Related concepts



© Copyright IBM Corp.