Microsoft KB Archive/32950

File Types Supported by COBOL Version 3.0

PSS ID Number: Q32950 Article last modified on 04-21-1993

3.00 | 3.00 MS-DOS | OS/2

Summary: The following file types are supported in Microsoft COBOL Version 3.0: - Line Sequential: Each record in the file is separated by carriage return (0D hexadecimal) and linefeed (0A hexadecimal) characters. Every record in the file is assumed to be variable in length. For example, you have a data file with maximum record length of 80 characters and you output a record that only uses the first 20 characters. In DEBUG you will see 20 characters of data, a carriage return and linefeed, then the start of the next logical record. - Sequential: This is the default format for data files. Records in such a file can be fixed or variable in length. For example, you have a fixed-length format file with a maximum record length of 80 characters and you output a record that only uses the first 30 characters. In DEBUG, you will see 30 characters of data and 50 space characters. Or, you have a variable-length format file with a maximum record length of 80 characters and you output a record that only uses the first 30 characters. In DEBUG, you will see a 128-byte header record. Each record is preceded by one “status” byte and a length specifier. You will see 30 characters of data with each record aligned on a 4-byte boundary (including status byte field and length fields). - Relative: This is a fixed-length format file. If records are declared as variable length, system assumes maximum record length for all WRITEs (system space fills unused character positions). Each record is followed by a 2-byte status code field. Possible values are as follows: 0D0A - valid user record 0000 - unused record 0D00 - deleted record For example, if you have a relative file with a maximum record length of 35 characters, WRITE a record that contains all “A”. If examined in DEBUG, you will see the following: 41 41 ….. repeated for 35 characters, then 0D0A. - Indexed: This includes B-Tree file format and Microsoft proprietary format. One COBOL ISAM file is really two DOS files, a DATA file and an INDEX file. The data file can have any extension. The index file must have an extension .IDX. Records can be fixed or variable length. DATA and INDEX files have a 128-byte (80 hexadecimal) header record that contains information about the minimum and maximum record sizes, information about the key(s), an integrity flag, etc. Each record in the file is preceded by a 2- or 4-byte control field. The control field is 2 bytes of the maximum record size if less than or equal to 4096 bytes and 4 bytes if the maximum record size greater than 4096. The first 4 bits of the first byte of the control field indicate the record status; a value of 0100 indicates the record is deleted, a system record or an unused record.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.