Browse Prior Art Database

Alternate record key support for the ILE COBOL compiler.

IP.com Disclosure Number: IPCOM000016168D
Original Publication Date: 2002-Aug-12
Included in the Prior Art Database: 2003-Jun-21
Document File: 2 page(s) / 43K

Publishing Venue

IBM

Abstract

The invention is implemented in the ILE COBOL Compiler for iSeries system. The purpose is to provide support for Alternate Record Keys as defined by ANSI 85 COBOL.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 52% of the total text.

Page 1 of 2

Alternate record key support for the ILE COBOL compiler.

The invention is implemented in the ILE COBOL Compiler for iSeries system. The purpose is to provide support for Alternate Record Keys as defined by ANSI 85 COBOL.

Alternate Record keys are defined in a COBOL program using the "ALTERNATE RECORD KEY IS data-item" clause. More than one alternate key is allowed. Usually, records in an indexed file are accessed using the primary key to order the records. Defining alternate keys allow the COBOL program to access the index file using an alternate key to order the records instead of the primary key.

Database files in iSeries have support only for primary keys. That is, the records in the files can be accessed using a keyed sequence base on the primary key. Indexed COBOL files are mapped to these system database files. The RECORD KEY clause is used to map the record key data item defined in the COBOL program to the primary key of the database file. If system database files have support for alternate keys, the implementation of alternate record keys would be simple. The COBOL program can simply map an alternate key data item defined in the program to the alternate keys of the database file. The compiler must be adapted since system database files do not support alternate keys.

The problem is solved as follows. Although the system does not provide support for alternate keys in database files, there is an API (QQQQRY) that can perform queries against database files. The QQQQRY API has the ability to perform an order-by-field query against any field of a database file and return a file pointer that allows access of the file records in the order specified by the query. This file pointer is similar to the one use by the COBOL run-time to read records ordered by the primary key. As an example, if the database file has three fields (FLD1, FLD2, and FLD3) and field FLD1 is the key field, the QQQQRY API can be used to perform an order-by-field FLD2 query. The file pointer returned by the API can then be used to read re...