HPlogo Accessing Files Programmer's Guide: HP 3000 MPE/iX Computer Systems > Chapter 2 Creating A File

Specifying Record Size

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

You can specify the size of the records in your file by using the BUILD (for disk files) or FILE commands, or the HPFOPEN/FOPEN intrinsic; however, the interpretation of the requested record size can be affected by the record structure and data format chosen as well as the device for the file.

NOTE: Within MPE/iX and in various subsystems, the record size for an ASCII file is usually identified in terms of bytes (8 bits) and the record size for a binary file is identified in terms of half-words (16 bits). This convention is a matter of convenience only, since most users think of ASCII files as being character oriented.

When you specify the record size for a fixed-length ASCII file, the record size determined for the file is the same as that which you specified for it. The maximum record size allowed for fixed-length ASCII files is 32767 bytes.

To maintain compatibility with pre-900 Series HP 3000 computer systems, the following file types always begin records on half-word boundaries:

  • ASCII files with variable-length or undefined-length record format

  • binary files with fixed-length, variable-length, or undefined-length record format

For these file types, when you specify an odd-byte record size, the file system rounds up the value to an even number to reflect the fact that these records always begin on half-word boundaries. The maximum record size you can specify for these file types is 32766 bytes.

When the file is a binary file or a variable-length ASCII file, the extra byte is available to be used for data. Figure 2-5 “Record Placement for ASCII Files” illustrates the placement of odd-bytes records and the disposition of the added byte.

Figure 2-5 Record Placement for ASCII Files

[Record Placement for ASCII Files]

Rather than specify your own record size, you can accept the default record size for the device that you are using. Default record sizes are listed in Table 2-6 “Standard Default Record Sizes”. Note that subsystem defaults may be different from MPE defaults; for example, the Editor default may be 72 or 80 bytes (depending on text format) while the MPE standard default is the record size configured for the device.

Table 2-6 Standard Default Record Sizes

DEVICERECORD SIZE (BYTES)
Disk256
Magnetic Tape Unit256
Terminals (most cases)80
Line Printer132
Plotter510
Programmable Controller256
Synchronous Single-Line Controller256