Microsoft KB Archive/37880

From BetaArchive Wiki

Use START Instead of READ FIRST and READ LAST in COBOL 3.0

PSS ID Number: Q37880 Article last modified on 04-20-1993

3.00 | 3.00 MS-DOS | OS/2

The information in this article applies to:
- Microsoft COBOL for MS-DOS and OS/2, version 3.0

Summary: The ANSI X3.23-1985 COBOL standard provides for the NEXT option for READ statements with Indexed Sequential (ISAM) file access. Although Microsoft COBOL Version 3.0 goes beyond the standard by providing a PREVIOUS option to READ, it does NOT include either a READ…FIRST, or a READ…LAST form. To read the first record of an open ISAM file, you may do one of the following: 1. CLOSE the file, OPEN it, then do a READ…NEXT. 2. Use the START command to move the file pointer to the first or the last record in an ISAM file. The START statement provides a basis for logical positioning within a relative or indexed file.

More Information: For more information on the START statement refer to Pages 5-92 through 5-98 in the “Microsoft COBOL Compiler Version 3.0: Language Reference Manual”. For More information on the READ statement refer to Pages 5-75 through 5-86 of the “Microsoft COBOL Compiler Version 3.0 Language Reference Manual”. Microsoft COBOL Versions 1.x and 2.x do not support the PREVIOUS, FIRST, and LAST options for the ISAM READ statement discussed in this article. The following is a syntax example: READ-FIRST. START filename KEY IS > = LOW-VALUES. READ filename NEXT. READ-LAST. START filename KEY is < = HIGH-VALUES. READ filename PREVIOUS.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.