HP 3000 Manuals

Accessing Files Programmer's Guide : COPYRIGHT NOTICE [ Accessing Files Programmer's Guide ] MPE/iX 5.0 Documentation


Accessing Files Programmer's Guide


900 Series HP 3000 Computer Systems Accessing Files Programmer's Guide HP Part No. 32650-90017 Printed in U.S.A. Edition Fifth Edition E0692
________________________________________________________________________ |The information contained in this document is subject to change | |without notice. | | | |Hewlett-Packard makes no warranty of any kind with regard to this | |material, including, but not limited to, the implied warranties of | |merchantability or fitness for a particular purpose. Hewlett-Packard | |shall not be liable for errors contained herein or for direct, | |indirect, special, incidental or consequential damages in connection | |with the furnishing or use of this material. | | | |Hewlett-Packard assumes no responsibility for the use or reliability | |of its software on equipment that is not furnished by Hewlett-Packard.| | | |This document contains proprietary information which is protected by | |copyright. All rights are reserved. Reproduction, adaptation, or | |translation without prior written permission is prohibited, except as | |allowed under the copyright laws. | ________________________________________________________________________ Copyright (c) 1992 by Hewlett-Packard Company ________________________________________________________________________ |Use, duplication, or disclosure by the U.S. Government is subject to | |restrictions as set forth in subparagraph (c) (1) (ii) of the Rights | |in Technical Data and Computer Software clause at DFARS 252.227-7013. | |Rights for non-DoD U.S. Government Departments and agencies are as set| |forth in FAR 52.227-19 (c) (1,2). | | | |Hewlett-Packard Company | |3000 Hanover Street | |Palo Alto, CA 94304 U.S.A. | ________________________________________________________________________ Restricted Rights Legend Printed 1992 Printing History The following table lists the printings of this document, together with the respective release dates for each edition. The software version indicates the version of the software product at the time this document was issued. Many product releases do not require changes to the document. Therefore, do not expect a one-to-one correspondence between product releases and document editions. Edition Date Software Version --------------------------------------------------------------------------------------- First Edition November 1987 A.01.00 Update July 1988 A.10.00 Second Edition June 1992 B.40.00 Preface MPE/iX, Multiprogramming Executive with Integrated POSIX, is the latest in a series of forward-compatible operating systems for the HP 3000 line of computers. In HP documentation and in talking with HP 3000 users, you will encounter references to MPE XL, the direct predecessor of MPE/iX. MPE/iX is a superset of MPE XL. All programs written for MPE XL will run without change under MPE/iX. You can continue to use MPE XL system documentation, although it may not refer to features added to the operating system to support POSIX (for example, hierarchical directories). Finally, you may encounter references to MPE V, which is the operating system for HP 3000s, not based on PA-RISC architecture. MPE V software can be run on the PA-RISC (Series 900) HP 3000s in what is known as compatibility mode. Accessing Files Programmer's Guide (32650-90017) is written for an experienced programmer who has a working knowledge of MPE/iX and is familiar with: * a text editor * at least one programming language * compiling, linking, and executing a program on MPE/iX This manual describes how you can use the MPE/iX File System to create files and manage the data stored in those files. In addition to discussing file system methods and operations involved with file and data manipulation, this manual describes system intrinsics and commands useful for file management and data transfer. Examples are provided throughout this manual that demonstrate how to use file system intrinsics and commands in various applications. This manual is part of the MPE/iX Programmer's Series. This series consists of the MPE/iX Intrinsics Reference Manual (32650-90028) and a set of task-oriented programmer's guides. This manual contains the following chapters and appendix: Chapter 1 Introduction provides an overview of the MPE/iX File System. Chapter 2 Creating a File discusses file creation considerations and describes how to create a file. Chapter 3 Specifying a File Designator describes how you designate an MPE/iX file. Chapter 4 Specifying a Domain describes how you can specify your file as being either a new file, a temporary file, or an old file. MPE/iX then places the file in the appropriate file directory. Chapter 5 Opening a File illustrates through program examples how you can open a file. Chapter 6 Closing a File illustrates, through program examples, how you close a file. Chapter 7 Record Selection and Data Transfer introduces system intrinsics you can use to select records and transfer data between your program and a file. Chapter 8 Writing to a File illustrates, through program examples, how you can transfer data from your program to a file. Chapter 9 Reading from a File illustrates, through program examples, how you can transfer data to your program from a file. Chapter 10 Updating a File illustrates, through program examples, how you can update records in a file. Chapter 11 Accessing a File Using Mapped Access describes how you use the mapped access method to access a file. Chapter 12 Sharing a File discusses methods you can use to share a file with other users. Chapter 13 Maintaining File Security describes how you can maintain secure files and restrict file access. Chapter 14 Getting File Information describes the intrinsics you can use to obtain information about file. Appendix A HP Pascal Program Example offers you HP Pascal program examples to help you better understand how to use file system intrinsics to perform file access tasks. Conventions UPPERCASE In a syntax statement, commands and keywords are shown in uppercase characters. The characters must be entered in the order shown; however, you can enter the characters in either uppercase or lowercase. For example: COMMAND can be entered as any of the following: command Command COMMAND It cannot, however, be entered as: comm com_mand comamnd italics In a syntax statement or an example, a word in italics represents a parameter or argument that you must replace with the actual value. In the following example, you must replace filename with the name of the file: COMMAND filename bold italics In a syntax statement, a word in bold italics represents a parameter that you must replace with the actual value. In the following example, you must replace filename with the name of the file: COMMAND(filename) punctuation In a syntax statement, punctuation characters (other than brackets, braces, vertical bars, and ellipses) must be entered exactly as shown. In the following example, the parentheses and colon must be entered: (filename):(filename) underlining Within an example that contains interactive dialog, user input and user responses to prompts are indicated by underlining. In the following example, yes is the user's response to the prompt: Do you want to continue? >> yes { } In a syntax statement, braces enclose required elements. When several elements are stacked within braces, you must select one. In the following example, you must select either ON or OFF: COMMAND { ON } { OFF} Conventions (continued) [ ] In a syntax statement, brackets enclose optional elements. In the following example, OPTION can be omitted: COMMAND filename [OPTION] When several elements are stacked within brackets, you can select one or none of the elements. In the following example, you can select OPTION or parameter or neither. The elements cannot be repeated. COMMAND filename [ OPTION ] [ parameter] [...] In a syntax statement, horizontal ellipses enclosed in brackets indicate that you can repeatedly select the element(s) that appear within the immediately preceding pair of brackets or braces. In the example below, you can select parameter zero or more times. Each instance of parameter must be preceded by a comma: [,parameter][...] In the example below, you only use the comma as a delimiter if parameter is repeated; no comma is used before the first occurrence of parameter: [parameter][,...] |...| In a syntax statement, horizontal ellipses enclosed in vertical bars indicate that you can select more than one element within the immediately preceding pair of brackets or braces. However, each particular element can only be selected once. In the following example, you must select A, AB, BA, or B. The elements cannot be repeated. { A} |...| { B} ... In an example, horizontal or vertical ellipses indicate where portions of an example have been omitted. In a syntax statement, the space symbol shows a required blank. In the following example, parameter and parameter must be separated with a blank: (parameter) (parameter) The symbol indicates a key on the keyboard. For example, RETURN represents the carriage return key or Shift represents the shift key. CTRLcharacterCTRLcharacter indicates a control character. For example, CTRLY means that you press the control key and the Y key simultaneously. NOTATION DESCRIPTION base prefixes The prefixes %, -, and $ specify the numerical base of the value that follows: %num specifies an octal number. -num specifies a decimal number. $num specifies a hexadecimal number. When no base is specified, decimal is assumed. Bit (bit:length) When a parameter contains more than one piece of data within its bit field, the different data fields are described in the format Bit (bit:length), where bit is the first bit in the field and length is the number of consecutive bits in the field. For example, Bits (13:3) indicates bits 13, 14, and 15: most significant least significant -------------------------------------------------------------------- | 0 | | | | | | | | | | | | | 13 | 14 | 15 | -------------------------------------------------------------------- Bit(0:1) Bits(13:3)


MPE/iX 5.0 Documentation