Getting Started as an MPE/iX Programmer Programmer's Guide: HP 3000 Computer MPE/iX Computer Systems > Chapter 6 File SystemRecord Structure |
|
Record structures provide a definition of storage format, record type, and size. Devices on the 900 Series HP 3000 can transmit information in ASCII (American Standard Code for Information Interchange) and/or binary code, depending on the device. For example, a line printer handles ASCII formatted data, while a disc can transmit and store data in either format. You can use optional parameters in the HPFOPEN or FOPEN intrinsic to specify the code (ASCII or binary) in which a new file is to be recorded when it is written to a device that supports both codes. Examples of ASCII files on the HP 3000 include program source files, general text and document files, and MPE/iX stream files containing MPE/iX commands. Examples of binary files include program files containing linked object code and application data files. For detailed information, refer to Accessing Files Programmer's Guide (32650-90017). A file can contain records written in one of three formats, called record types:
Figure 6-12 “Record Types” shows how the content of each record type appears. You can specify the format for records by using one of the following:
Files residing on disc or magnetic tape can contain records in any of the three formats. For files on other devices, the File System overrides any specifications you supply for records and handles them as having undefined length. A comparison of logical record formats is given in Table 6-5 “Comparison of Logical Record Formats”. For a detailed discussion of fixed-length, variable-length, and undefined-length records, refer to Accessing Files Programmer's Guide (32650-90017). Table 6-5 Comparison of Logical Record Formats
You can specify the size of records in your file by using one of the following:
You can specify your own record size or accept the default size for the device you are using.MPE/iX default record sizes for devices are shown in Table 6-6 “Standard Default Record Sizes”. Subsystem defaults may be different from MPE/iX defaults. For example, the Editor default can be 72 or 80 bytes, depending on the text format, while the MPE/iX standard default is the record size configured for the device. For detailed information on specifying a record size, refer to Accessing Files Programmer's Guide (32650-90017). Table 6-6 Standard Default Record Sizes
The File System sets up all records (ASCII and binary) to begin on 2-byte boundaries for device files. Even if you specify an odd-byte record, the next record cannot begin in the next byte. In this case, the File System adjusts the record size by adding one byte to make the next record begin on a word boundary. If the file is ASCII, the extra byte is made inaccessible for data. If the file is binary, the byte is accessible. Figure 6-13 “Odd-byte Record Sizes” below, shows how the File System handles odd-byte record sizes in Compatibility Mode for device The adjustment the File System makes for odd-byte record sizes is important when reading tapes created on other systems. If the tape has actual odd-byte length records that are blocked, you cannot specify the exact byte length and blocking factor and obtain accurate results, because you will get a cumulative effect of each successive record being "off" by more bytes. It is a recommended practice to handle the block as one large logical record in one block and then programmatically pull apart the odd byte lengths. You can use the DEBLOCK option of FCOPY for this purpose. |