900 Series HP 3000 Computer Systems Getting Started as an MPE/iX Programmer Programmer's Guide ABCDE HP Part No. 32650-90008 Printed in U.S.A.
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 tness 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.
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.
iv
Preface Note 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.
Organization of this Manual The guide contains the following chapters: Chapter 1 Overview covers the basics of programming on MPE/iX. It introduces the 900 Series HP 3000, HP-PA architecture, and MPE operating systems. It describes the following topics on a high level, suitable for management and programming purposes: MPE/iX operating system features and fundamentals, user interface, accounting structure, migration from the MPE V/E operating system, and data conversion from MPE V/E.
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 italics lename In a syntax statement, a word in bold italics represents a parameter that you must replace with the actual value.
Conventions (continued) [ ... ] 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][...
Contents 1. OVERVIEW Introduction to the HP 3000 . . . . . . . . . . . . . 900 Series HP 3000 . . . . . . . . . . . . . . . . HP Precision Architecture (HP-PA) . . . . . . . . . MPE Operating Systems . . . . . . . . . . . . . . . MPE/iX and MPE V/E Operating Systems . . . . . Naming Conventions for HP 3000 Systems and Software Native Mode and Compatibility Mode . . . . . . . . MPE/iX Mixed Modes . . . . . . . . . . . . . . 900 Series Migration . . . . . . . . . . . . . . . . . Object Code Translator . . .
Break Mode . . . . . . . . . . . . . . . . . Echo On/O . . . . . . . . . . . . . . . . . Accounting Structure Overview . . . . . . . . . Logon and Logo . . . . . . . . . . . . . . Account . . . . . . . . . . . . . . . . . . User . . . . . . . . . . . . . . . . . . . . Group . . . . . . . . . . . . . . . . . . . File Speci cations . . . . . . . . . . . . . . Referring to a File in a Di erent Group . . . Referring to a File in a Di erent Account . . Session and Batch Modes . . . . . . . . . . .
3. Program Development Writing a Program . . . . . . . . . . . How to Use Intrinsics . . . . . . . . . Compiling a Program . . . . . . . . . . Compiler Input . . . . . . . . . . . . Compiler Output . . . . . . . . . . . Compiler Operation . . . . . . . . . . Compiled Code . . . . . . . . . . . Data Variables Information . . . . . . Unresolved References . . . . . . . . Compiler Libraries . . . . . . . . . Command to Compile Only . . . . . Compiler Control . . . . . . . . . . Linking a Program . . . . . .
4. HP Link Editor/XL 5. Optimizing a Program 6. File System Common Uses of HP Link Editor/XL . . . . . . . . . . . Linking a Relocatable Object File . . . . . . . . . . . . . Comparison of HP Link Editor/XL and MPE V/E Segmenter How HP Link Editor/XL Works . . . . . . . . . . . . . Files Used by HP Link Editor/XL . . . . . . . . . . . . . HP Link Editor/XL Commands . . . . . . . . . . . . . . Case Sensitivity . . . . . . . . . . . . . . . . . . . . Keyword and Positional Parameters . . . . . . . . . .
Input/Output Sets . . . . . . . . . . . . . . . . . Passed Files . . . . . . . . . . . . . . . . . . . . Searching File Directories . . . . . . . . . . . . . . Finding Files . . . . . . . . . . . . . . . . . . . . Types of Operations Allowed on Files . . . . . . . . . Opening a File . . . . . . . . . . . . . . . . . . Closing a File . . . . . . . . . . . . . . . . . . Using Files at Run Time . . . . . . . . . . . . . . . . Hierarchy of File Overrides . . . . . . . . . . . . . . . Record Structure . . . . .
7. Data Management Data Management Subsystems . . . . . . . KSAM/V . . . . . . . . . . . . . . . . FCOPY (KSAM Options) . . . . . . . . KSAM procedures . . . . . . . . . . . ALLBASE/SQL . . . . . . . . . . . . . HP SQL . . . . . . . . . . . . . . . . . Security . . . . . . . . . . . . . . . . Logical Transaction . . . . . . . . . . . Concurrency . . . . . . . . . . . . . . Recovery . . . . . . . . . . . . . . . . Database Creation . . . . . . . . . . . Database Restructuring . . . . . . . . .
Figures 1-1. 1-2. 1-3. 1-4. 1-5. 1-6. 1-7. 1-8. 1-9. 1-10. 1-11. 1-12. 1-13. 3-1. 3-2. 3-3. 3-4. 3-5. 3-6. 4-1. 4-2. 4-3. 4-4. 4-5. 5-1. 5-2. 5-3. 5-4. 5-5. 5-6. 5-7. 5-8. 6-1. 6-2. 6-3. 6-4. 6-5. 6-6. 6-7. 6-8. 6-9. 6-10. MPE/iX On-line Access Capabilities . . . . . . . . . . . . . 900 Series HP 3000 High-level Tools . . . . . . . . . . . . . . HP 3000 Software Naming Conventions Example . . . . . . . . Commanding MPE/iX . . . . . . . . . . . . . . . . . . . . UDC File Example . . . . . . . . . . . . . .
6-11. 6-12. 6-13. 6-14. 6-15. 6-16. 7-1. 7-2. 7-3. 7-4. 7-5. 7-6. File System Hierarchy of Overrides . . . . . . . Record Types . . . . . . . . . . . . . . . . Odd-byte Record Sizes . . . . . . . . . . . . . Creating a File . . . . . . . . . . . . . . . . Actions Resulting from Multiaccess of Files . . . Security Level for File Access . . . . . . . . . . Building a KSAM File . . . . . . . . . . . . . Loading a KSAM File . . . . . . . . . . . . . Reorganizing a KSAM File . . . . . . . . . . .
Tables 1-1. 6-1. 6-2. 6-3. 6-4. 6-5. 6-6. 6-7. 6-8. 6-9. 7-1. 7-2. 7-3. Word and Integer Conversions . . . . . . . New, Temporary, and Permanent File Features Valid File Domains . . . . . . . . . . . . Input Set . . . . . . . . . . . . . . . . Output Set . . . . . . . . . . . . . . . . Comparison of Logical Record Formats . . . Standard Default Record Sizes . . . . . . . File Sharing Restriction Options . . . . . . File Access Mode Types . . . . . . . . . . User Type De nitions . . . . . . . . . . .
1 OVERVIEW This chapter introduces the 900 Series HP 3000 and the MPE/iX operating system, describing how they t into the HP 3000 family of computers and MPE operating systems, in general. It describes hardware and software naming conventions and provides a brief overview of migration to the 900 Series from MPE V/E-based systems. It describes MPE/iX dual operating modes, features, and major subsystems.
MPE Operating Systems All HP 3000 models run under the Multiprogramming Executive (MPE) operating system. It is a disc-based operating system that manages all system resources and coordinates execution of all programs running on the system. The version of MPE used varies from one model to another. Figure 1-1 shows the on-line access capabilities common to all MPE operating systems. Figure 1-1.
Figure 1-2. 900 Series HP 3000 High-level Tools MPE/iX and MPE V/E Operating Systems Since the 900 Series HP 3000 was introduced, Hewlett-Packard supports two types of MPE operating system; MPE V/E and MPE/iX, which stands for MPE with eXtended Large addressing. The "V" in the name MPE V/E is the Roman numeral for "5." MPE V/E is the operating system formerly called MPE. MPE V/E is supported on Series 37 through the Series 70 systems. MPE/iX is the operating system for 900 Series systems.
Compatibility Mode (CM), which provides object-code compatibility with MPE V/E-based applications. Native Mode (NM), which provides full performance bene ts and advanced capabilities of HP-PA. Naming Conventions for HP 3000 Systems and Software When the 900 Series was added to the HP 3000 family of computers, Hewlett-Packard instituted a new naming convention for HP 3000 software products; the addition of the su x "/V" or "/XL" to a product name.
Native Mode and Compatibility Mode MPE/iX provides two run-time execution environments: Native Mode (NM) and Compatibility Mode (CM). MPE/iX dynamically and transparently coordinates and changes modes as required by applications. NM is the native MPE/iX run-time environment. Source code has been compiled into the 900 Series native instruction set.
Migration exibility: upgrading to the 900 Series is extremely exible because applications and databases can access and communicate with each other when they are in di erent modes (in other words, when one is in CM and the other is in NM). Operational exibility: MPE/iX is a functional superset of MPE V/E. They are nearly identical in terms of user interface, system management, accounting, and security.
Native Mode (NM) because SPL/V has a high dependence on the MPE V/E-based HP 3000 architecture. However, you can improve the performance of an SPL/V application running in CM by using the MPE V/E Object Code Translator. If you require NM performance, these applications should be rewritten in HP C/iX or HP Pascal/iX, which are systems programming languages for MPE/iX. If an application written in a high-level language calls SPL/V procedures, you can recompile it in NM.
Interactive Debug facility, which provides windows that allow you to simultaneously see the environment of the program being tested. It supports breakpoints, single stepping, calculation of expressions, macros, and command les. Multiprogramming MPE/iX supports multiprogramming, the concurrent execution of multiple programs. All system resources are available to you as if you were the only user on the system.
A common data dictionary that provides the integration necessary to tie the system together. The products that meet these needs on the 900 Series are: System Dictionary/XL, which provides programmers and system administrators with a single source for documenting all aspects of the system, from data de nitions to con guration information. This central source of information aids in developing and maintaining applications and e ectively managing system resources.
MPE/iX Transaction Management Facility The MPE/iX Transaction Management Facility provides the following functions for transaction-oriented applications: Automatic transaction locking Automatic transaction logging Automatic rollback recovery from "soft" failures Semi-automatic rollforward recovery from "hard" failures These functions are described in detail in the subsections below.
Transaction Management Facility returns data to a consistent state by reapplying all committed transactions in the log le to the checkpoint presented by the backup tape. This is called "rollforward recovery." Transaction logging requires little CPU overhead because it is designed as an integral part of the MPE/iX File System, utilizing the addressing and protection features of HP Precision Architecture (HP-PA).
Display a symbolic procedure stack trace, optionally displaying interleaved Native Mode (NM) and Compatibility Mode (CM) calls. You can also temporarily set the current debug environment back to the environment that existed at any marker in the stack. Calculate the value of expressions to determine the correct values of variables at a given point in a program. Values can be custom formatted in several bases.
You can use the command language to create batch les (also called stream jobs) that contain control statements and variables. Execution of the commands in the le can be altered at execution time by using these control statements. MPE/iX System Performance MPE/iX provides e cient performance through use of the mapped le technique and concurrent directories described in the following subsections. Mapped Files MPE/iX employs the mapped le technique for performing le access.
Directory Entries On operating systems that have the system directory centralized on one disc, access to directory services for les on any disc on the system requires serial access to the system directory. In other words, they must occur one at a time. At peak usage times, this creates a bottleneck due to physical contention for one disc and logical contention for one directory user. The space for the directory structure is spread across the volume set, not necessarily located on one volume.
O ce systems: - TDP (text editor and formatting application) - HPSLATE - HPDESKMANAGER (electronic mail application) - HPWORD - Editor (text editor application) Development aids: - System Dictionary/XL - Transact/V - Inform/V - Report/V Data Management: - ALLBASE/SQL - TurboIMAGE/XL - Query/V (subsystem for verifying and modifying data) - Keyed Sequential Access Management (KSAM) - MPE/iX File System - SORT-MERGE/XL (utility for ordering records in a le and merging records in sorted les.
Terminals come with various memory amounts. This a ects the amount of information you can access at one time. When each line of the screen is lled, the top line scrolls up to make room for a new line at the bottom. This continues until terminal memory is lled. At this point, information will be lost from view when you enter another line because the line scrolled up at the top of the memory bu er is no longer available.
The list below shows some common MPE/iX commands grouped according to similar function. :BYE :HELLO :BUILD :FILE :LINK :RUN :COPY :RENAME :LISTF :PURGE :SHOWJOB :SHOWME :HELP :REDO :TELL :TELLOP :SETMSG :CCXL :COB85XL :PASXL :FTNXL :RESUME :ABORT BREAK key For detailed information, refer to the MPE/iX Commands Reference Manual Volumes 1 and 2 (32650-90003 and 32650-90364). MPE/iX Command Parameters Some commands require or can accept parameters.
MPE commands can have positional or keyword parameter lists. The characteristics of a positional parameter list are: Location of a parameter in the list is signi cant. Each parameter is separated by a comma (,). If a parameter is omitted from the list, a place-holding comma must replace it, unless the parameter is at the end of the list. For example: :COBOLII SOURCE,,LISTOUT The characteristics of a keyword parameter list are: Location of a parameter in the list is not signi cant.
is common to all members of the set. You can use generic characters with some MPE/iX commands. The generic characters (or portions of names) are described as follows: @ All strings up to eight characters long, including a null string. ? A single alphanumeric character. # A single numeric character. Examples of wildcard use are: @A@ All lenames (in the logon account and group) that include an A. For example, it could include the lenames: AARDVARK DELTA BACCUS @.@.
A User-De ned Command (UDC) le is a text le that contains one or more command de nitions and with a name for each de nition. Each de nition is a UDC. You can use a UDC to perform several MPE/iX commands in succession by issuing only the name of the UDC. You can also use a UDC to disable an MPE/iX command. You can create the UDC le by using Editor or TDP. Each UDC le command de nition in a UDC has the following components: Head: name of the UDC (required) and parameters and defaults (optional).
If a UDC calls another UDC, the called UDC must be de ned in the UDC catalog (see below) after the calling UDC unless recursion is speci cally enabled. To activate the UDCs in a UDC le, the le must be identi ed to MPE/iX as a catalog. Use the :SETCATALOG command to catalog a UDC le. Each time you execute :SETCATALOG, the speci ed le becomes the only enabled UDC le, unless you specify that more les should be appended. An enabled UDC le is frequently called a UDC catalog.
:BYE :HELLO :HELP :LISTF :LISTVS :REDO :REMOTE HELLO :REPORT :SHOWDEV :SHOWIN :SHOWJCW :SHOWJOB :SHOWME :SHOWOUT :STREAM The following MPE/iX commands can by interrupted by pressing the BREAK key. This action temporarily suspends execution of the command; execution can be resumed by entering :RESUME.
Echo On/Off Normally, everything you type on the keyboard is shown on the screen. In other words, the screen echoes your typing. However, in some situations, you may not want to see your typing appear. For example, when you are typing a password, someone looking over your shoulder may see it or observe it on the screen if you leave the terminal. It provides better security if the password does not appear on the screen.
Amount of CPU time Elapsed connect time Disc space used An account name can be from one to eight alphanumeric characters long, starting with an alphabetic character. Following is an example of a logon for user John in the account PROG. :HELLO JOHN.PROG As a security provision, you can assign an account password to an account. When an account has a password, MPE/iX prompts you to enter it after you enter the :HELLO command.
As a security provision, you can assign a user password to a user. When a user has a password, MPE/iX prompts you to enter it after you enter the :HELLO command and the account password, if one exists. When you enter a password in response to this prompt, it is not echoed on the screen as you type it. As a short cut, you can enter the user password in the :HELLO command instead of waiting for MPE/iX to prompt you for it. To do this, type the user password after the user name, separated by a slash (/).
account and user passwords, if they exist. When you enter a password in response to this prompt, it is not echoed on the screen as you type it. As a short cut, you can enter the group password in the :HELLO command instead of waiting for MPE/iX to prompt you for it. To do this, type the group password after the group name, separated by a slash (/).
Referring to a File in a Different Group To refer to a le in a di erent group in the account you are logged onto, use the following standard le reference format: lename/lockword.groupname where groupname is the name of the group where the le resides. For example, you can refer to the le described in the example above, residing in a group named SEPT, by specifying: STATUS/MY.
Figure 1-9. Session and Job Commands Figure 1-10 shows a comparison of characteristics of a session and a job. You may not yet be familiar with all of the terms used, but you can get a general idea of the similarities and di erences and refer to this gure again when you are more familiar with the 900 Series HP 3000. Figure 1-10. Session and Job Characteristics You can identify sessions and jobs currently running on the system by using the MPE/iX command :SHOWJOB.
Converting Data Files from MPE V/E to MPE/iX When converting les from MPE V/E to MPE/iX, you must consider several di erences in data storage, including: Floating point di erences Floating point, single precision di erences Floating point, double precision di erences Floating point conversion intrinsic HP FORTRAN 77/iX native alignment HP Pascal/iX allocation alignment of independent variables COBOL II/XL native alignment MPE/iX has many data type di erences from MPE V/E, in terms of concepts of data stora
Figure 1-11. HP FORTRAN 77/iX COMMON Block Data Alignment Example Native alignment for some HP Pascal/iX, COBOL II/XL, and HP FORTRAN 77/iX data types is di erent than that used by languages running on MPE V/E. For tables comparing alignment by data type, refer to Introduction to MPE/iX for MPE V Programmers (30367-90005).
Table 1-1. Word and Integer Conversions Bits Native Mode (NM) Compatibility Mode (CM) 16 1 halfword or shortint 1 CM word or integer 32 1 word or integer 2 CM words, double integers, or double words 64 2 words 4 CM words Integers in MPE/iX can be 16 or 32 bits long, signed, or unsigned. Signed integers are in twos complement form. Halfword integers (16-bit) are stored in memory at even byte addresses, and word integers (32-bit) at addresses divisible by four.
Figure 1-13. IEEE Double-precision Real Number Format Conversion from HP 3000 format to IEEE format for a single-precision real number can present a range problem, because the IEEE range is smaller. Thus, over ow can occur in performing either of the following conversions: From an HP 3000 single-precision real number to an IEEE single-precision real number. From an IEEE double-precision real number to an IEEE single-precision real number. You may have to develop new error handling code to prevent over ow.
3. Call the intrinsic HPFPCONVERT to convert REALs from MPE V/E to MPE/iX oating point format. 4. Write the data out to a new le. Note A subroutine that has $HP3000_16 ON cannot call the HPFPCONVERT intrinsic. Pascal on MPE V/E and MPE/iX has the following incompatibilities due to data alignment: MPE V/E and IEEE oating point format Data alignment of simple variables and record elements String format Pointers COBOL II on MPE V/E and MPE/iX has incompatible indexed and synchronized data items.
Local Area Network (LAN) NS 3000/XL is Hewlett-Packard's local area network (LAN) software services for linking multivendor computer equipment, including MPE/iX based HP 3000 processors. These network services (NS) run in conjunction with either of the HP AdvanceNet link products ThinLAN3000/XL Link and StarLAN/3000 Link. The LAN link supports the NS product and consists of both hardware and software components.
Identify the database as a remote le in a previously executed :FILE command. Use the COMMAND intrinsic to include :FILE information in a program. Create a database-access le to supply :FILE, :DSLINE, and :REMOTE HELLO commands.
2 Utilities and Tools This section describes the MPE/iX user interface to show how user programs can programmatically access MPE/iX features and provides an introduction to utilities and tools. The information is presented as an overview on a conceptual level. For detailed information on programmatic access, refer to Command Interpreter Access and Variables Programmer's Guide (32650-90011).
Concatenating Strings and String Substitution You can concatenate a string with a pre x or su x. String substitution in a Command File or a UDC parameter takes precedence over substitution of Command Interpreter-level variables. For example, :SETVAR x 1 :WHILE x < 10 DO :PURGE ACCT!x :SETVAR x x+1 :ENDWHILE :DELETEVAR x purges les ACCT1, ACCT2, . . . , ACCT9. Expression Evaluation You can specify an expression in a Command File or a UDC parameter and an appropriate value will be assigned to it.
intrinsics to display, change, or delete it. You can force reclassi cation of a JCW by assigning it a large numeric value. For example, SETJCW X 99 de nes a variable named X as a JCW with value 99. The statement: SETVAR X 400 gives X the new value of 400, but X remains a JCW. However, when you assign a string value ABC to X with the statement: SETVAR X "ABC" then X becomes a variable and not a JCW.
Toolset/XL The Toolset/XL Program Development System is a product that provides a uniform programming environment for use with COBOL II/XL, HP FORTRAN 77/iX, and HP Pascal/iX on the 900 Series HP 3000. It combines an integrated set of programming tools to facilitate all phases of program development, from source code creation and modi cation to program compilation, execution, and testing for COBOL II/XL and HP Pascal/iX.
Useful Tools Several useful programming tools are available to facilitate tasks common to system administrators, programmers, and general users. You can reduce the tedious aspects of many repetitious tasks by using Hewlett-Packard tools to expedite forms design, screen handling, report generation, and system dictionaries, as described below. Forms Design and Screen Handling Tools VPLUS/V is a comprehensive software system that implements and controls source data entry.
Batch program called REFORMAT that reformats the data according to the REFSPEC formatting speci cations and writes it to a le for use by an application. Set of intrinsics that provides a powerful programming language interface to terminals, using FORMSPEC de nitions, from applications written in any of the supported programming languages. Report Generation Tools Several useful report generation tools are available. These are described in the subsections below.
EZAccess, which enables new or infrequent users of the database to generate queries. SQLAccess, which enables users familiar with HP SQL to use a screen-based editor to formulate SQL queries and perform many other database operations. EZReport, which formats and displays query results from EZAccess or SQLAccess and allows users to customize report formats and calculate additional statistcs using the data retrieved by the query.
A data dictionary is not an alternative to a database management system (DBMS). A dictionary manages information about data on the system, while a DBMS manages the data itself. A DBMS schema may contain some information on the format and usage of the data. However, dictionary information is more extensive and easily usable. In addition to documenting IMAGE databases, System Dictionary can describe MPE les, KSAM les, VPLUS/V forms les, programs, network device con gurations, and other system components.
SORT-MERGE/XL SORT-MERGE/XL is an MPE/iX subsystem that allows you to sort one or more les or merge several sorted les to form one le in a speci ed sequence. SORT-MERGE/XL changes the order of the records from the input le according to your speci cations and writes them to the output le. You can use SORT-MERGE/XL interactively or programmatically. Use the SORT-MERGE/XL intrinsics for programmatic use. You must specify the input and output les and the sorting (or merging) keys.
DISCFREE DISCFREE is a utility that reduces the amount of fragmentation on a disc. Fragmentation is a term used to describe the extent to which les are physically divided up on a disc. As disc space becomes fragmented, smaller and smaller amounts of contiguous space are available, and les must be broken into smaller and smaller pieces to t. Fragmentation has a negative e ect on system performance and is highly undesirable. You can use DISCFREE to: Determine free space on the disc.
FCOPY/XL display functions, which show numeric codes and corresponding character symbols, thus allowing you to examine the contents of les at a terminal or on a printer list. You can also operate on multiple les and multiple tapes. You can interactively invoke FCOPY/XL. For detailed information on using FCOPY/XL and syntax, refer to FCOPY Reference Manual (03000-90064).
3 Program Development The required elements for running a program are: Data space (for input, output, and computations) Instructions (machine readable code and constants) System routines (for example, input and output) Program development is a term for taking a program design, on paper, to the point where it is machine readable and functions reliably. Program components are data and code.
Writing a Program You can write a program with any text editor or word processor. MPE/iX provides two facilities for entering text that you can use to create a source le for a program: Editor and Toolset/XL. For an overview of Editor and Toolset/XL, refer to Chapter 2, "Utilities and Tools." Since these facilities can be used for writing documents, memos, and programs, the output is called text les.
Although intrinsics usually refer to system routines, you can de ne routines that you want to access as if they were intrinsics and then place them in new or existing intrinsic les and libraries. You invoke an intrinsic by calling it from within a program. In HP C/iX, HP Pascal/iX, COBOL II/XL, and HP FORTRAN 77/iX programs, you explicitly call an intrinsic. The Intrinsics Mechanism facilitates the declaration of system intrinsics. All MPE/iX intrinsics are processed as external procedures by user programs.
Compiler Output The compiler can write compiled code in a relocatable object le, generate a source code listing, and generate an error list. Unless you specify di erently, the compiler writes the object le to the standard le $NEWPASS, which is renamed $OLDPASS when the compile is completed and $NEWPASS is closed. The compiler writes the source code and error list to $STDLIST.
Figure 3-2. Compiler Producing Relocatable Object Modules A relocatable object module is an independent le. It may not require resources such as relocatable libraries (RLs) and links to other relocatable object modules, although these are made, when necessary, at link time. External resources (usually system routines) are acquired at run time.
The compiler assigns a x-up address to each de ned subroutine or variable symbol, indicating its position relative to the beginning of the module. Compiled Code A compiler segregates code and data into separate areas in a relocatable object module. The individual compiler determines how compiled code is organized within it and the content is compiler dependent. Data constants are stored in the relocatable object module along with code and, thus, are non-modi able.
You can obtain two types of output from a compiler, aside from the compiler listing of errors: Source code translation of the output to a relocatable object module. Source listing, with various map and table options. Compiler Control If you wish only to compile a program, without linking and running it, you can use the "compile only" command for the appropriate language.
Figure 3-3. Linking and Using User Libraries :LINK operates on one or more relocatable object modules created by a native compiler to perform the following tasks: Search one or more relocatable libraries (RLs) and resolve references to them in any of the relocatable object modules being linked. Resolve references among the relocatable object modules. Merge all the relocatable object modules associated with one program to create an executable program le.
Creating Executable Program Files The MPE/iX command :LINK creates a load module (an executable program le). The :LINK command invokes Link Editor, which is an MPE/iX subsystem that prepares compiled programs for execution and maintains libraries. When invoked by using :LINK, Link Editor resolves external references in relocatable object modules by merging relocatable object modules to produce an executable program le containing all of the code and data that was in the relocatable object modules.
IDENTIFICATION DIVISION. PROGRAM-ID. EX1 ENVIRONMENT DIVISION. INPUT-OUTPUT DIVISION. FILE-CONTROL. SELECT IFILE SELECT PFILE DATA DIVISION. FILE SECTION. FD IFILE. 01 IREC. 05 NAME 05 SOC-SEC 05 HIRE-DATE. 10 MO 10 DA 10 YR 05 SALARY 05 FD PFILE. 01 PREC. 05 SOC-SEC 05 05 NAME 05 05 HIRE-DATE. 10 MO 10 10 DA 10 10 YR 05 01 HREC. 05 HSOC-SEC 05 HNAME 05 HHIRE-DATE ASSIGN "IFILE". ASSIGN "PFILE". PIC X(30). PIC X(9). PIC PIC PIC PIC PIC XX. XX. XX. S9(6). X(29). PIC PIC PIC PIC X(9). XX. X(30). XX.
WORKING STORAGE SECTION. 01 LNCNT PIC S9(4) BINARY VALUE 60. 01 W-DATE. 05 WYR PIC XX. 05 PIC X(4). PROCEDURE DIVISION. P1. ACCEPT W-DATE FROM DATE. OPEN INPUT IFILE OUTPUT PFILE. PERFORM WITH TEST AFTER UNTIL SOC-SEC OF IREC = ALL "9" READ IFILE AT END MOVE ALL "9" TO SOC-SEC OF IREC NOT AT END IF WYR = YR OF IREC THEN ADD 1 TO LNCNT IF LNCNT > 50 PERFORM HEADINGS END-IF MOVE SPACES TO PREC MOVE CORR IREC TO PREC WRITE PREC AFTER ADVANCING 1 LINE END-IF END-READ END PERFORM CLOSE IFILE PFILE STOP RUN.
The commands :LINKEDIT LinkEd> LISTPROG EX1PROG invoke HP Link Editor/XL and create a program map displaying the symbols in EX1PROG, as shown in the following example: PROGRAM XL LIST CAPABILITIES HEAP SIZE STACK SIZE VERSION Sym Name ---$START _start ex1 M$1 : EX1PROG : BA, IA : : : 85082112 C H X P Sym Type - - - - ---0 3 3 sec_p 0 3 3 sec_p 0 3 3 pri_p 0 data Sym Scope ----univ univ univ local Sym Value ----000059B7 00005A07 000059EB dp+00000000 Lset Name ---- In this program map, the portion prece
Loading and Running a Program The loader performs the following tasks: Loads the executable module into virtual memory locations. Updates addresses contained in an executable object module with the actual memory addresses. Resolves unsatis ed external references to executable libraries. If any unsatis ed external references remain, the loader aborts.
MPE/iX allows you to change the speci cations listed above at load time, except the primary entry point name and program capabilities. Any information you specify at run time overrides the speci cations given by HP Link Editor/XL. If the program auxiliary header is not speci ed, the loader uses the default values for the :RUN command. Libraries speci ed at run time take precedence over those speci ed at link time.
Figure 3-4. UNSAT Procedure Example System Libraries System library characteristics include the following: They are loaded in system space. Processes using the same object module share code, global data, and binding. Object modules can reference only themselves or other system library object modules. Cannot use UNSAT procedures. System libraries are the only libraries that can contain both system and nonsystem object modules. (A nonsystem object module shares only the code with other processes.
detailed information on the switch subsystem and programmatic access through switch stubs, refer to Switch Programming Guide (32650-90014). Virtual Memory and Demand Paging When a program is running, only part of it is needed at any one time. To save space in main memory, MPE/iX brings pieces of a program in, as needed for current execution. It divides a program into xed-length pieces called pages (for a description of pages, refer to Chapter 1).
for passing information to a program at run time and determining which libraries are searched to resolve external references. Multi-programming Environment MPE/iX is a multiprogramming environment in which one process has control of the CPU at any given instant. All other processes are suspended to allow time for this to occur, and the processes take turns. The frequency and duration of a turn is determined by the MPE/iX Dispatcher and is dependent on the priority assigned to the process.
Circular Subqueues The CS, DS, and ES subqueues are circular queues. The characteristics of a circular queue are: Priority levels are cycled. An executing process controls the CPU until it voluntarily suspends, receives a higher priority interrupt, or reaches the end of its quantum (time slice). A circular queue lowers the priority of a process at the end of its quantum. After the drop, the process eventually gets another opportunity to execute.
Run-time Errors Run-time errors present a challenging problem, frequently causing the program to end abnormally (abort).
If the abort occurred during execution of an intrinsic, a subsystem library routine, or a user library routine, then the location is given within the appropriate routine and the program le location indicates the location from which the routine was called in the user's program. For detailed information on reading an abort message, refer to MPE/iX Intrinsics Reference Manual (32650-90028)j or the MPE/iX Commands Reference Manual Volumes 1 and 2 (32650-90003 and 32650-90364).
Control Codes (JCWs) A Job Control Word (JCW) is one word (16 bits) of memory used to pass information between job steps and to determine the status of the previous job step. Figure 3-5 shows the structure of a JCW. It is composed of a 2-bit type and a 14-bit modi er. The space allowed for JCWs is determined by the space allowed for your session or job after le equations, temporary les, and data space is taken.
instead of in the system JCW. When set by the user, the modi er may be modi ed by MPE/iX. The types are the bit settings given below, accompanied by their keywords, and descriptions. No error occurred in the previous step. 00:OK 01:WARN An unusual event occurred, but not necessarily fatal. 10:FATAL Program aborts, under its own control. 11:SYSTEM System aborts user process due to a problem outside the process's direct control. The modi er can be set to any number from 0 to 65535, inclusive.
Figure 3-6. JCW Notation Examples Using a System JCW The following job shows an example of using a system JCW: :JOB STUDENT.INTRO/PASSWORD :CONTINUE :FTNXL ABC :IF JCW
next step produces an error. The :IF/THEN, :ELSE, :ENDIF structure allows you to make a decision based on the JCW value following the :FTNXL job step. The system-de ned JCW that CI creates is called CIERROR. CI sets the JCW modi er to the last CI error number. Sometimes, CI aborts a job based on the value of the CIERROR modi er. User-defined JCWs User-de ned JCWs allow you to supply input to programs by using Command Interpreter (CI) and get status from programs that can be examined in CI.
4 HP Link Editor/XL HP Link Editor/XL is a software tool that prepares compiled programs for execution on Series 900 HP 3000 computers and allows you to create and maintain libraries containing subprograms that you frequently use. Most MPE/iX compilers let you compile, link, and execute a program, all in one step, or just compile and link in one step. In these cases, you do not directly execute HP Link Editor/XL to perform the linking function; it is executed automatically.
Figure 4-1. :LINK and HP Link Editor/XL on MPE/iX You automatically enter HP Link Editor/XL for the purpose of manipulating relocatable object modules into an executable program le by using the MPE/iX command :LINK. This command is especially useful in program development, when you must link a large program that calls many separately compiled routines or when you want to use values di erent from standard HP Link Editor/XL defaults for this process.
Common Uses of HP Link Editor/XL The most common ways to use HP Link Editor/XL are to: Link one or more relocatable object les. Link relocatable object modules from a relocatable library. Name executable modules from an executable library to be searched at load time. Obtain program le information by using the LISTPROG command.
Comparison of HP Link Editor/XL and MPE V/E Segmenter HP Link Editor/XL on MPE/iX corresponds to Segmenter on an MPE V/E operating system, with a few di erences. The primary di erences are: A source le must be recompiled to change any part of a relocatable object module. You can create a relocatable library (RL) that contains one large relocatable object module; or you can create RLs that contain several relocatable object modules, which can be independently added, copied, or purged.
command you speci ed, and exits HP Link Editor/XL. Figure 4-2 shows the les used by HP Link Editor/XL. Figure 4-2. Files Used by HP Link Editor/XL Note A relocatable object le produced by one of the MPE/iX compilers contains one relocatable object module. Types of HP Link Editor/XL output les are: $STDLIST, which is the terminal during a session and the output spool le from a batch job, unless you redirect it, as discussed below. LINKLIST, which is a list le. An executable program le.
You can redirect $STDLIST to another device by using the STDLIST option of the MPE/iX command :RUN. For example, the following commands send HP Link Editor/XL output to the printer and runs HP Link Editor/XL: :FILE LINKOUT;DEV=LP :RUN LINKEDIT.PUB.SYS;STDLIST=*LINKOUT LINKLIST information is sent to the $STDLIST device by default. LINKLIST contains: Symbol map produced by the MAP option of the LINK command. Listing produced by the LISTPROG command. Listing produced by the LISTOBJ command.
Case Sensitivity HP Link Editor/XL reads commands from the standard input le $STDINX. It is not case sensitive in commands or le names. However, entry point (procedure) names are case sensitive. For example, the COPY, EXTRACT, and PURGE commands allow you to specify an ENTRY name, which is case sensitive. This name must correspond, character for character, to the entry name in the symbol table, which indicates the name used in the relocatable object module.
For example, if an ASCII le named OBJLIST contained the lines LIB1OBJ LIB2OBJ LIB3OBJ LIB4OBJ LIB5OBJ you can use the indirect le OBJLIST in the following commands to add the ve relocatable object les named in OBJLIST to the relocatable library named LIBRL: :LINKEDIT LinkEd> BUILDRL LIBRL LinkEd> ADDRL FROM=JLIST LinkEd> EXIT Starting and Ending HP Link Editor/XL You automatically use HP Link Editor/XL when you execute one of the MPE/iX commands that compiles and links a program in one step or compiles,
There are three situations that terminate HP Link Editor/XL: When you explicitly end HP Link Editor/XL by entering the EXIT command: LinkEd> EXIT You can abbreviate the EXIT command as E, EX, or EXI. The commands QUIT, Q, and BYE also terminate HP Link Editor/XL. When end-of- le in $STDINX is encountered. When an error occurs in a batch job. An error message is printed, the system Job Control Word (JCW) is set to indicate a fatal error, and HP Link Editor/XL ends.
An executable program le contains only one program entry point, which marks the instruction where execution begins. Each language de nes its own program entry point. For example, HP FORTRAN 77/iX uses the main program as the entry point, while HP Pascal/iX uses a program's outer block as the entry point. When creating an executable program le, HP Link Editor/XL separates code and data areas, as shown in Figure 4-4.
Figure 4-5 shows HP Link Editor/XL executable program le commands along with the les that they use. Figure 4-5. Executable Program File Commands Comparison of Executable and Relocatable Libraries Relocatable libraries (RLs) and executable libraries (XLs) share important characteristics. Both are: Created by programmers using HP Link Editor/XL commands. Contain routines necessary for program execution. Permit programs to share routines.
Using a Relocatable Library MPE/iX relocatable libraries (RLs) give you the ability to use one or more libraries to resolve references at link time. HP Link Editor/XL can build RLs from independent relocatable object modules and by copying relocatable object modules from one RL to another. It can also extract a copies of relocatable object modules from an RL and place them in a relocatable object le.
Using an Executable Library You can use HP Link Editor/XL to create and maintain executable library les (XLs). XLs contain executable modules with the following characteristics: Are in a form that can be directly executed. Are shared, so that only one copy of the code need exist on the system. Programs that use an executable module share the same physical copy of the code. Have their own global data, separate from the program's global data.
5 Optimizing a Program The Optimizer is a program that is an integrated part of an MPE/iX compiler. It is available to use with HP C/iX, HP COBOL II/XL, HP FORTRAN 77/iX, and HP Pascal/iX. When you compile a program, you can select an optimizer option that will use the MPE/iX Optimizer to improve the code. This chapter provides an overview of: Techniques a programmer can use to program for best optimization. How Optimizer aids in producing improved code.
On the 900 Series, a branch does not take e ect until the second machine cycle after the branch instruction. The instruction immediately after a branch instruction is called the delay slot. Even when you do not select optimization, the compiler tries to schedule a useful instruction in the delay slot. However, the MPE/iX Optimizer does a better job of branch delay scheduling and may be able to completely eliminate some branches.
Use of MPE/iX Optimizer with Languages In MPE/iX Native Mode, HP C/iX, HP COBOL II/XL, HP FORTRAN 77/iX, and HP Pascal/iX provide the optimizer option. Currently, HP COBOL II/XL provides only Levels 0 and 1. HP C/iX, HP Pascal/iX, and HP FORTRAN 77/iX provide Levels 0, 1, and 2. Optimizer Assumptions During compilation, a compiler gathers information about the use of variables and passes it to the Optimizer.
Coding for Performance and Optimization The MPE/iX Optimizer modi es code to use machine resources e ciently, using less space and running faster. It improves code, but does not alter the algorithm used in code. Coding for good performance requires recognition of the following facts: Coding practices alter performance. Mismatches exist between programming languages and most architectures. Coding techniques can enhance or inhibit optimization opportunities.
Eliminate Common Subexpressions You can improve the performance of optimized and unoptimized code by using programmer identi cation of common subexpressions. Figure 5-2 shows an example of common subexpression elimination. Figure 5-2.
Instructions Required for Operations on Simple Data Types Comparison of oating point instructions and integer instructions is not valid because the oating point instructions may execute in a di erent cycle from the integer instructions and may require synchronization. The instructions that compute oating-point arithmetic are done in a coprocessor and do not execute in a single machine cycle. However, the instructions that compute integer arithmetic are done in a CPU and complete in a single machine cycle.
Reduce Procedure Calls Procedure calls in code limit optimization because some registers cannot be kept live (retain values) across calls. You can remove calls to user procedures from the main body of code and, instead, branch to a common area. Figure 5-5 shows an example of reducing procedure calls. Figure 5-5.
Extract Procedure Calls from Loops It is ine cient to code a loop containing only a procedure call because of the required overhead by each procedure call. It is a recommended programming practice to code the loop inside the procedure. Figure 5-7 shows an example of extracting a procedure call from a loop. Figure 5-7. Extracting Calls from Loops Avoid Non-native Alignment Figure 5-8 shows an example of avoiding non-native alignment. Figure 5-8.
Optimize HP COBOL II/XL Data Types Optimizing HP COBOL II/XL data types requires recognition of the following considerations: 32-bit binary integers are desirable. PIC S9(9) COMP SYNC speci cation is optimal. Relying on default speci cations is undesirable. You must specify COMP to get a binary integer. Otherwise, it defaults to a decimal integer. You must specify SYNC to guarantee word alignment. Decimal validation adds overhead. Signed numeric elds are preferable to unsigned numeric elds.
6 File System The File System is the part of the MPE/iX operating system that manages data access on the 900 Series of the HP 3000 family of computers. The MPE/iX I/O System transfers data between the File System and physical devices (for example, printers and tape drives). Figure 6-1 shows the relationships of a program, the MPE/iX File System, the MPE/iX I/O System and the system hardware. The File System is the interface between a program and the rest of the system. Figure 6-1.
Records and Files in the File System The File System manages data being transferred or stored with peripheral devices. It handles I/O operations, such as passing information to and from user processes, compilers, and information management subsystems. Conceptually, information for data transfers is arranged as elements of data in a record. The record is input, processed, and output as a single unit.
system. If you do not use the DEV= parameter, the :FILE command defaults to de ning a disc le. Magnetic tape has no mandatory settings. You can use the REC= parameter of the :FILE command to specify physical characteristics. The File System HPFOPEN and FOPEN intrinsics automatically set actual device characteristics that override any speci cations passed from the program or the :FILE command.
The File System must store data on disc in an e cient manner, since les are constantly manipulated: added, deleted, and updated. It uses demand paged virtual memory to manage virtual memory and the user interface to les. This occurs transparently from the user's perspective. Page-sized portions of les are swapped into memory only when needed. The user-de ned elements of a disc le are those within your control. Elements you can specify include: Which disc (or discs) the le will reside on.
You can specify disc volume restrictions in the following ways: Use the volume name option or the volume class option of HPFOPEN or the device parameter of FOPEN to specify either a volume name or a volume class name. This restricts the placement of your le s extents to either the speci ed volume or the speci ed volume class within the volume set, thus facilitating le portability.
Table 6-1.
Note When you specify a le domain using HPFOPEN, you should open only disc les with the domain option set to NEW. Device les can be opened with the domain option set to NEW (to maintain compatibility with MPE V/E), but a warning is returned in the status parameter. NEW Files When you create a le, you can indicate to the File System that it is a NEW le; it did not previously exist. Space for this le has not yet been allocated.
to the le, and attempt to save the le as OLD. A directory error (for example, a duplicate le name) can be detected only at close time; and data is lost, unless you have used one of the following methods to check for or avoid the situation: Create a NEW le by using BUILD before executing the program in which the le is opened as an OLD le. Delete the previous copy of the le before the run. Rename the existing le by using FRENAME.
File Designators A le designator is a name used by the File System to reference a le with great exibility. It allows you to equate a name other than the le name used in the standard le reference format, described below. The two types of MPE/iX le designators are: Formal le designator Actual le designator A formal le designator is the name by which a program recognizes a le. It is speci ed programmatically or in a le equation and is not the le name found in the le list of a directory.
Figure 6-4. Identifying a Disc File using File Designators Backreferencing a File You can invoke a :FILE command that refers to a previously invoked :FILE command using a technique called \backreferencing." Once you establish a set of speci cations in a :FILE command, you can apply them to other le references in your job or session by using the formal le designator, preceded by an asterisk (*).
Figure 6-5. Backreferencing a Previously Identified File For detailed information, refer to Accessing Files Programmer's Guide (32650-90017). File Classes The File System recognizes two general classes of les: User-de ned les, which users de ne, create, and make available for their own purposes. System-de ned les, which the File System de nes and makes available to all users. For example, they are used to indicate standard input/output devices.
:FILE X=AL126797 :FILE PAYROLL=SELFL A le name must be unique in its group. A reference to a le is always quali ed by adding to the le name the name of the group and account in which the le resides. For example, if you create a le named FILX under GROUPA and ACCOUNT1, the system will recognize your le as FILX.GROUPA.ACCOUNT1. A le with the same le name created under a GROUPB is recognized as FILX.GROUPB.ACCOUNT1 . Thus, you need only to ensure that a le name is unique in its group.
Figure 6-6. System Files in Use System-de ned le designators indicate les that the File System uniquely identi es as standard input/output devices for jobs and sessions. These designators are: $STDIN; the standard job or session input device from which your job or session is initiated. $STDINX; the same as $STDIN, except handling of MPE/iX command images is di erent. $STDLIST; standard job or session listing device. $NULL; name of a le that is always treated as an empty le.
Figure 6-7. Using a System File Input/Output Sets All le designators can be classi ed as an input set, use for input les of an output set, used for output les. For your convenience, these sets are summarized in Table 6-3 and Table 6-4. For information on interactive and duplicative input les and output les, refer to Accessing Files Programmer's Guide (32650-90017). Table 6-3. Input Set File Designator Function or Meaning $STDIN Job/session input device.
Table 6-4. Output Set File Designator Function or Meaning $STDLIST Job/session list device. $OLDPASS Last le passed. $NEWPASS New temporary le to be passed. $NULL Constantly empty le that returns end-of- le indication when read. *formal- designator Back reference to a previously de ned le. lereference File name (including any account and group names and lockword, if necessary).
$NEWPASS and $OLDPASS are specialized disc les with many similarities to other disc les, but with some di erences. For example, the default close disposition of $NEWPASS includes renaming it. For detailed comparisons of $NEWPASS to new les and $OLDPASS to old les refer to Accessing Files Programmer's Guide (32650-90017).
If the process issues more than one HPFOPEN or FOPEN call for a le before it is closed, it results in multiple, logically separate accesses of that le. In this case, MPE/iX returns a unique le number for each access and maintains a separate logical record pointer. (indicating the next sequential record to be accessed) for each access where you did not request or permit the multi-access option at HPFOPEN or FOPEN time.
When a program opens a NEW disc le with an HPFOPEN or FOPEN call, the File System does not search to determine if a le of the same name exists. This occurs when you attempt to save a le with the FCLOSE intrinsic. When a program opens a disc le speci ed as a NEW le in the option of an HPFOPEN or FOPEN call that determines the domain, and saves it with the FCLOSE intrinsic, the MPE/iX File System conducts a search. If the le is to be saved as a TEMP le, it searches the Job Temporary File Directory.
Figure 6-9. Directories Searched Based on File Domain The operation of the FCLOSE intrinsic used with unlabeled magnetic tape is dependent on conditions within the process using the device. It is possible for a single process to HPFOPEN (or FOPEN) a magnetic tape device using a device class and later HPFOPEN (or FOPEN) on the same device again by using its device name/logical device number. You can do this in a way that makes more than one tape le open concurrently.
Figure 6-10. Nested HPFOPEN/FOPEN and FCLOSE Pairs Nesting of HPFOPEN or FOPEN and FCLOSE pairs keeps a tape that has been FCLOSEd from rewinding. A tape closed with the TEMP, no-rewind disposition is rewound and unloaded unless the process closing it has another le currently open on the device. For detailed information on le disposition, end-of- le marks, and use of FCLOSE with magnetic tape, refer to Accessing Files Programmer's Guide (32650-90017).
Hierarchy of File Overrides The :FILE command cannot override at run time any speci cations in the disc le label for an existing disc le. (The le label speci es physical characteristics of the le; record structure, le structure, le code, and actual le name.) Anything in the disc le label has precedence. Similarly, device characteristics always prevail over a :FILE command invoked for a device le. :FILE can override the following: Speci cations that are not in a le label for a disc le.
Record Structure Record structures provide a de nition of storage format, record type, and size. Storage Format 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.
Figure 6-12. Record Types You can specify the format for records by using one of the following: HPFOPEN or FOPEN intrinsic MPE/iX command :BUILD MPE/iX command :FILE Files residing on disc or magnetic tape can contain records in any of the three formats. For les on other devices, the File System overrides any speci cations you supply for records and handles them as having unde ned length. A comparison of logical record formats is given in Table 6-5.
Table 6-5.
for data. If the le is binary, the byte is accessible. Figure 6-13 below, shows how the File System handles odd-byte record sizes in Compatibility Mode for device Figure 6-13. Odd-byte Record Sizes The adjustment the File System makes for odd-byte record sizes is important when reading tapes created on other systems.
sequence of records in the le. Other key elds can be de ned so that you can sequence the le in other orders. The order in which records are physically written to the le is the chronological order. The chronological order may be the same as the primary key sequence or unrelated. For detailed information on the creation and use of KSAM les, refer to Chapter 7, \Data Management" and KSAM/3000 Reference Manual (30000-90079). RIO le.
Creating a File When creating a le, you choose physical characteristics for it based on how the le will be used. These physical characteristics are determined by parameters you choose when you: Create the le with the HPFOPEN intrinsic, FOPEN intrinsic, or the :BUILD command. Specify the le with the :FILE command. Once a le has been created, you cannot change its physical characteristics. You can change other characteristics by rede ning them each time you open the le.
The FOPEN intrinsic is another programmatic tool for supplying the File System with information about a le. You can use optional parameters at le creation to specify record structure, le identi cation, le domain, and le usage characteristics. For detailed information on the HPFOPEN and FOPEN intrinsics, refer to MPE/iX Intrinsics Reference Manual (32650-90028) and Accessing Files Programmer's Guide (32650-90017).
Listing File Characteristics You can use the :LISTFILE command to see what the characteristics of a le are. :LISTFILE provides the following information: File names and structure of permanent disc les Various levels of detail about each le, depending on the user's capability on the system Number of records in the le Number of extents Maximum number of extents Records per block The :FILE Command The :FILE command determines how a le will be accessed.
Record Selection and Data Transfer Data is transferred in the File System by a mechanism including records, record pointers, and the intrinsics for transferring them. Record Pointers The File System uses record pointers to nd speci c records for use. Record pointers block and deblock records and indicate speci c records in a le. A le opened with the inhibit bu ering option parameter set to BUF (the default) is accessed by using a record pointer.
Mapped Access to Disc Files MPE/iX employs a \mapped les" technique for performing disc le access. File access e ciency is improved when code and data portions of les required for processing reside in memory. Accessing memory is faster than performing physical disc I/O operations. The mapped les technique eliminates le system bu ering and optimizes global system memory management.
You can bypass the normal record-by-record input and output, instead receiving large data transfers by specifying multirecord mode (MR) by using the multirecord option parameter in the HPFOPEN or FOPEN call, or by using the :FILE command. For detailed information and examples on multiple record transfers, refer to Accessing Files Programmer's Guide (32650-90017).
rst FREAD for the le. Execution of the rst FREAD causes MPE/iX to skip past any unread user-de ned header labels. Other specialized read intrinsics are READX and FREADLABEL. For detailed information on reading a le, refer to Accessing Files Programmer's Guide (32650-90017). Writing to a File You can move data from a program to a disc le or to a device le in several ways.
Using Mapped Access to a File The MPE/iX File System employs access to mapped les, accessible through the use of pointers in the HPFOPEN intrinsic. A mapped le is a le that can be accessed directly through machine loads and stores, bypassing File System intrinsics normally used for disc les. Mapped access is not available through the standard Input/Output statements of most programming languages. Thus, the programmatic use of HPFOPEN adds capability to programs.
Sharing a File Accessing and controlling a le that is open only to you is a relatively simple matter.
Table 6-7. File Sharing Restriction Options Access Restrictions :FILE Parameters Description Exclusive Access EXC After you open a le, prohibits concurrent access in any mode through another HPFOPEN/FOPEN request by any program (including this one), until this program issues FCLOSE or terminates. Exclusive Write Access SEMI After you open a le, prohibits concurrent write access through another HPFOPEN/FOPEN request by any program (including this one), until this program issues FCLOSE or terminates.
For detailed information on the multi-access and global multi-access options, refer to Accessing Files Programmer's Guide (32650-90017). Figure 6-15. Actions Resulting from Multiaccess of Files When a le is shared among two or more processes and one or more of the processes is writing to it, the processes must be properly interlocked to prevent undesirable results.
Lockwords Lockwords are le \passwords" which provide a primary level of le security by restricting access to a le to users not knowing the le's lockword. These lockwords may be assigned to a le when the le is created with the BUILD command or when the le is renamed. To delimit the lockword, enter a forward slash (/) following the le name: BUILD MYFILE/KEY RENAME MYFILE/LOCK For additional information, refer to the MPE/iX Commands Reference Manual Volumes 1 and 2 (32650-90003 and 32650-90364).
Table 6-8. File Access Mode Types Access Mode :FILE Parameter Description Read only IN Allows you to read a le, but not to write on it. Write only OUT Allows you to write on a le, but not to read it. Any data already in the le is deleted when the le is opened. Write (save) only OUTKEEP Allows you to write on a le, but not to read it. You can add new records both before and after current end-of- le indicator.
Table 6-9. User Type Definitions User Type Mnemonic Code Description Any user ANY Any user de ned in the system, including all categories de ned below. Account librarian user AL User with account librarian capability, who can manage certain les within the account that may or may not all belong to one group.
The default security at account, group, and le levels are as follows: Account level SYS (R,X:ANY;W,A,L:AC) other accounts (R,X,W,A,L:AC) Group level PUB (R,X:ANY;A,W,L,S:AL,GU) other groups (R,W,A,L,X,S:GU) File level (R,X,W,A,L:ANY) At the group level, the MPE/iX Security System recognizes six access modes: Reading (R) Appending (A) Writing (W) Locking (L) Executing (X) Saving (S) It recognizes seven user types: Any User (ANY) Account Librarian User (AL) Group Librarian User (GL) Group User (GU) Account
protection at the group level. For detailed information on this topic, refer to Accessing Files Programmer's Guide (32650-90017). Access Control Definitions (ACDs) Access Control De nitions (ACDs) allow the owner of a le to specify permissions for access to a le or to a device. An ACD takes precedence over the previous access controls, namely the MPE le access matrix and lockwords.
2. Preserving ACDs Device ACDs are not permanent objects and must be rede ned every time the system is rebooted. The easiest ways to do this are to put ALTSEC commands into the SYSTART le, either directly or in a command le. File ACDs are permanent objects and survive a reboot. When storing les to tape, FCOPY and STORE store the les' ACDs unless you specify otherwise. 3. Listing ACDs To get information about ACDs interactively, use the SHOWDEV command for devices, and the LISTFILE command for les.
Suspending and Restoring Security Provisions You can temporarily suspend the security restrictions on any disc le you create by using the :RELEASE command. This allows any user to access the le in any mode, thus providing unlimited access to the le. It does not remove lockword protection, and it does not modify the le security settings recorded in the system. It merely bypasses them temporarily.
7 Data Management Data management involves collecting data and reporting information. The following categories describe the concept of data management on a 900 Series HP 3000 system: Collecting data: the data entry process, including validating. Organizing data: analysis of data and its relationships; development of an appropriate data structure after analyzing the requirements of the application; for example, producing a logical record layout or schema.
KSAM/V KSAM is an acronym for Keyed Sequential Access Method. KSAM/V provides a disc le structure for organizing and accessing records in a le according to the contents of key elds. It is Hewlett-Packard's implementation of indexed sequential processing. KSAM/V allows you to access records in two ways: Sequentially, according to a sequence de ned by key values. Randomly, by nding the record that has a eld matching a speci c key value.
The KSAMUTIL command BUILD requires the following parameters: Data le name. Key le name. One or more key types, with corresponding key location, and key size. The rst key speci ed becomes the primary key. Each subsequent key speci ed becomes an alternate key. Notice in the example that the rst alternate key allows records to have duplicate values in that eld. The fourth subparameter of the KEY eld is the key blocking factor.
;NOKSAM - copies all records in chronological sequence, including deleted records. - if omitted, only active records are copied. FCOPY default, which copies active records in the primary key sequence When using the KSAM options of FCOPY, consider the following information: KEY and NOKSAM are mutually exclusive options; use them only when the FROM le is a KSAM le. NOKSAM processes the FROM le as an MPE/iX le. Use it to copy all data in a KSAM data le, including the logically deleted records.
The steps required to reorganize a KSAM le are: 1. Use KSAMUTIL to build a new KSAM le with new key elds. 2. Use FCOPY to copy the old KSAM le to the new one, specifying whichever key in the old le is the primary key in the new le. 3. Use KSAMUTIL to purge the old le and rename the new copy to the old le name. Figure 7-3 shows an example of reorganizing a KSAM le. Figure 7-3. Reorganizing a KSAM File KSAM procedures KSAM procedures allow you to programmatically add, delete, read, and update KSAM les.
ALLBASE/SQL ALLBASE/SQL is designed for HP 3000 900 Series systems. ALLBASE/SQL contains both a network model database management system, called TurboIMAGE, and a relational model database management system, called HP SQL. It has been optimized for MPE/iX systems. HP SQL, the relational model database management system used when MPE/iX is running in Native Mode, is discussed in the subsection below. TurboIMAGE/XL is discussed later in this chapter.
Rollforward recovery preserves logical and physical data integrity due to a hard crash. Dynamic restructuring allows you to change data structure, table capacities, and security without unloading and loading the database. Null data values allow use of elds that are relevant to some, but not all, records in a table. HP SQL does not require you to de ne explicit relationships between data sets.
Concurrency HP SQL preserves data integrity, when multiple users are accessing a database, through a comprehensive locking scheme based on the transaction concept. When a user begins a transaction, a lock is automatically granted for each page read or modi ed by the transaction. (A page is a unit of data storage that contains 4,096 characters.) This ensures that no one else may update the data on those pages while the user is reading or updating them.
Database Restructuring HP SQL provides a full set of database restructuring capabilities. HP SQL supports dynamic restructuring for commonly required structural changes. Dynamic restructuring allows users to continue to access data, except for the a ected areas, during restructuring. HP SQL provides dynamic restructuring for the following cases: Expanding table capacities Altering security designations Adding columns Adding or deleting indexes, views, and tables.
Table 7-1.
TurboIMAGE/XL Data Base A database is a collection of logically related data in one or more les. The les contain both the data itself and structural information on how one piece of data relates to another. Pointers in the database allow access to the actual data and indexing across the multiple les in the database. A network database ties together elds containing information that may be relevant to a single transaction even though they physically reside in di erent records.
Master Set Each master set entry contains a key item pointing to a subset of detail set entries, all with related values in a particular data item. Thus, you can quickly reference any subset of entries by nding its master key item (index pointer). Each master set can contain values for one detail data item to search. (In other words, it can have only one eld as a key item.
Figure 7-4. TurboIMAGE/XL Data Set Organization Example Automatic Master Set The characteristics of an automatic master set are: Each data entry contains a chain head. A data entry (record, in MPE/iX terms) can contain only the key item used as an index pointer. TurboIMAGE/XL automatically updates the master set when modi cations are made to the related detail sets. Changing a search item requires deleting the old one and adding the new one. The master set is automatically done.
TurboIMAGE/XL and QUERY/V Together, TurboIMAGE/XL and QUERY/V provide a database management system. TurboIMAGE/XL is a set of programs and procedures you can use to de ne, create, access, and maintain a database. QUERY/V is a database inquiry facility that provides a simple method of accessing a TurboIMAGE/XL database without requiring programming. You can use QUERY/V interactively. TurboIMAGE/XL components are: DBSCHEMA, a subprogram that creates a root le.
if PARM= is omitted, the formal designator for the input le, DBSTEXT, is equated to $STDLIST. You would use this option, for example, if you wanted to enter the schema directly from your terminal during a session and list the output to your terminal (in addition to creating a root le).
TurboIMAGE/XL has a transaction logging and recovery system with the capability of recovering a database from a transaction-oriented log le in the event of a system failure. DBUTIL allows you to enable or disable these options. Creating a Data Base Once you have created a root le, you can use DBUTIL to create the database described in the root le. To create the database, you must be logged onto the system with the same log-on used to create the root le.
DBCLOSE DBLOCK DBUNLOCK DBCONTROL Access data DBINFO DBGET DBPUT DBUPDATE DBDELETE Information and status DBINFO DBEXPLAIN DBERROR Logging DBBEGIN DBMEMO DBEND TurboIMAGE/XL subprograms are used for storing and loading. You must be the creator or know the maintenance password to use them and you must be logged onto the account and group where the database resides.
Recovering a Data Base TurboIMAGE/XL is designed to maintain the integrity of its data bases. However, it is possible that data or structural information can be lost during a hardware failure or an operating system crash. It is highly recommended that you regularly backup a database. You can maintain the database by copying it to magnetic tape using DBSTORE at regular intervals. If necessary, you can restore the database using DBRESTOR.
FORM, which displays a database structure LIST, which displays data in a data set FIND, which searches a data set for data items REPORT, which displays data in a data set located by the FIND command in the format you specify XEQ, which executes QUERY/V commands stored in a text le EXIT, which terminates QUERY/V execution Table 7-3 shows a comparison of data management considerations to help you determine whether to set up a data base with TurboIMAGE/XL or KSAM.
TurboIMAGE DBchange/V DBchange/V is the interactive utility that allows dynamic restructuring and capacity expansion of a TurboIMAGE database. Database changes are input using a menu format and executed either on-line or in batch mode. DBchange/V allows easy screen access and input of database restructuring requests for TurboIMAGE databases. Because multiple restructuring changes can be requested during one DBchange/V session, there is no need to run separate programs for each restructure feature.
DICTDBA DICTDBA checks the integrity of synonym chains and identi es broken chains. It generates reports on synonyms and chains for master sets and chain statistics for detail sets. DICTDBU DICTDBU unloads the contents of an existing TurboIMAGE database. It can unload the database chained to either a disc or tape le, thus organizing the records for e cient chained access. DICTDBU also provides the capability to unload only selected data sets.
Index 3 /3000 su x, 1-4 9 900 Series, 1-1, 1-2, 1-3, 1-4, 1-5, 1-6, 1-7, 1-8, 1-9, 1-14, 1-23, 1-27, 3-2, 3-19, 4-1, 4-12, 5-1, 6-1, 6-22, 6-31, 6-37, 7-1, 7-5, 7-6 A abort message, 3-19 access mapped le, 1-13, 6-30, 6-33 modes, 6-38 random, 6-30 RIO, 6-30 sequential, 6-30 update, 6-30 Access Control De nitions.
CI, 1-12, 1-21 CIERROR, 2-3, 3-21, 3-24 circular le, 6-26, 6-34 closing a le, 6-15, 6-20 closing a le with a domain, 6-5, 6-7, 6-16, 6-17 CM, 1-32 CM intrinsics, 3-15 CM pre x, 1-4, 1-30 COBOL, 1-8, 1-9, 6-26 3000, 1-4 COBOL II, 1-33 COBOL II/V, 1-4 COBOL II/XL, 1-4, 1-6, 1-14, 1-29, 1-30, 2-3, 2-7, 3-3, 3-20, 4-3, 4-4, 5-1, 5-2, 5-9, 7-5, 7-6, 7-16 COBOL II/XL De nition Extractor, 2-7 code bu ering, 1-1 compiled, 3-6 dead code elimination, 5-2 mapping, 3-15 object, 1-4, 1-6, 3-6, 3-13, 3-15, 4-4, 6-22 opti
concatenating strings, 2-1 constant folding, 5-2 control code (JCW), 3-21 converting les, 1-1, 1-32 converting les from MPE V/E to MPE/iX, 1-29 copying a relocatable library, 3-9 copying les across a local area network, 1-33 creating a database, 7-13 a le, 6-7, 6-12, 6-25, 6-26, 6-28, 6-29 a le at run time, 6-27 a load module, 3-13 an executable library, 4-1, 4-2, 4-3, 4-4, 4-13 a relocatable library, 3-9, 4-1 creating a relocatable library, 4-3 cross-family development, 1-5, 1-7 D data accessing, 7-1, 7-6
Dictionary/V, 2-6 directories duplicate le names, 6-7 errors, 6-7 Job Temporary File Directory, 6-5, 6-16, 6-17 searching, 6-16, 6-17, 6-18 System File Directory, 6-5, 6-16, 6-17 directories, location of entries, 1-14 directory structure, 1-26, 6-5, 6-9 accounts, 1-23, 1-26, 6-9, 6-11 groups, 1-23, 1-25, 1-26, 6-4, 6-9, 6-11 lockwords, 1-26, 6-9, 6-11 users, 1-23, 1-24, 1-26 disc, 2-10, 6-24 disc failure tolerance, 1-9 disc les, 6-2, 6-3, 6-4, 6-17, 6-20, 6-21, 6-23, 6-28, 6-29, 6-33, 7-1 disc le storage, 6
binary data, 1-32, 6-22 circular, 6-26, 6-34 closing, 6-20 command, 1-8, 1-12, 1-16, 1-19, 2-1 command input, 4-4 content, 6-22 converting, 1-1, 1-32 converting from MPE V/E to MPE/iX, 1-29 creating, 6-7, 6-12, 6-25, 6-26, 6-29 data, 1-29, 6-22, 7-2 de ning characteristics, 6-29 de ning le accessibility, 6-20 deleting, 6-28 dereferencing, 6-21 determining operations allowed, 6-20 device, 6-2, 6-21, 6-33, 6-34 disc, 6-2, 6-4, 6-21, 6-28, 6-29, 6-33, 6-34, 7-1 disc le storage, 6-4 duplicate names, 6-7 executa
FUNLOCK, 6-37 FUPDATE, 6-26, 6-33 FWRITE, 6-26, 6-30, 6-32, 6-33, 6-34 FWRITEDIR, 6-26, 6-32, 6-33 FWRITELABEL, 6-33 G GETJCW, 2-2 groups, 1-23, 1-25, 1-26, 6-4, 6-9, 6-11 H hardware interlock, 5-1 header, program auxiliary, 3-13 heap size, 3-13, 3-16 HELLO, 1-24 Help Facility, 1-8, 1-12, 1-18, 2-1, 2-3 hierarchy of le overrides, 6-21, 6-23 HP 3000, 1-1, 1-2, 1-3, 1-4, 1-7, 1-14, 1-23, 1-27, 1-31, 1-33, 1-34, 3-2, 3-19, 4-1, 4-12, 5-1, 6-1, 6-22, 6-31, 6-37, 7-1, 7-5, 7-6 900 Series, 1-1, 1-2, 1-3, 1-4, 1
FWRITEDIR, 6-26, 6-32, 6-33 FWRITELABEL, 6-33 GETJCW, 2-2 HPCICOMMAND, 2-1 HPCIGETVAR, 2-2 HPCIPUTVAR, 2-2 HPFCLOSE, 6-8 HPFOPEN, 1-34, 3-20, 6-3, 6-4, 6-7, 6-9, 6-12, 6-16, 6-21, 6-22, 6-23, 6-24, 6-26, 6-27, 6-29, 6-30, 6-31, 6-32, 6-33, 6-35, 7-5 HPFPCONVERT, 1-29, 1-31, 1-33, 6-21 MYCOMMAND, 2-1 PRINT, 6-33 PRINTFILEINFO, 3-20 PUTJCW, 2-2, 3-24 QUIT, 3-19 READ, 6-32 READX, 6-32 SETJCW, 3-24 SHOWJCW, 3-24 I/O devices, 1-34, 6-13 I/O peripherals, 6-2, 6-3, 6-6 I/O procedures, 1-34 I/O system, 1-8, 6-1 IPC
listing groups, 1-25 LMAP, 3-16 Loader, 3-13, 3-14, 3-16 loading a program, 3-13 Load MAP, 3-16 load module creating, 3-13 LOADPROC procedure, 3-15 load time, 3-13 load-time binding sequence, 3-16 Local Area Network (LAN), 1-33 lockwords, 1-26, 6-9, 6-11, 6-38 logging o , 1-23 logging on, 1-23 loop invariant code motion, 5-2 M maintaining a database, 7-13 maintaining an executable library, 4-1, 4-4 maintaining a relocatable library, 3-8, 3-9, 4-4 managing distributed applications, 1-33 managing les, 1-16 m
MPE V/E programs Segmenter, 1-7, 3-7, 4-3 multilingual capability, 1-8 multiprogramming, 1-7, 1-8 MYCOMMAND intrinsic, 2-1 N names volume, 6-4 Native Mode, 1-4, 1-5, 1-6, 1-7, 1-14, 1-30, 1-32, 3-13, 3-14, 3-15, 5-2, 6-31 Native Mode system components, 1-14 NetIPC, 1-33 network database, 1-8, 7-11 network le transfer (NFT), 1-33 Network Interprocess Communication (NetIPC), 1-33 network services (NS), 1-33 Network File Transfer (NFT), 1-33 NS 3000/XL, 1-33 NEW les, 3-19, 6-2, 6-5, 6-16, 6-17, 6-27 $NEWPASS,
extracting calls from loops, 5-8 LOADPROC, 3-15 UNSAT, 3-14, 3-15 procedures, expanding in-line, 5-7 process, 3-16, 3-17, 6-37 processes creating, 1-33 killing, 1-33 processing transaction, 1-1 process, priority level, 3-17 program auxiliary header, 3-13 program capabilities, 3-13 program development, 1-2, 1-7, 1-8, 1-27, 2-1, 2-3, 3-1 compiling, 2-3, 3-1, 3-3, 3-4, 3-6, 4-1 linking, 3-4, 3-7, 4-1 link time, 3-4, 3-6, 3-9, 3-14 MPE/iX NM compilers, 1-6, 3-3, 4-1 running, 3-1, 3-13, 3-16, 4-1 run time, 1-5,
resolving references at compile time, 3-6 resolving references at link time, 3-8 Resource Identi cation Number (RIN), 6-37 restoring le security, 6-43 restricting le access, 6-42 restructuring a database, 7-17 RESUME, 1-21 RFA, 1-34 RIO access, 6-30 RIO le, 6-26, 6-34 RISC, 1-1 root le, 7-11, 7-14 rounding, 1-32 RPG, 1-8 RPG/V, 1-4, 1-14 RPM, 1-33 RUN, 3-14, 3-16, 4-4, 4-8 running a program, 3-1, 3-13, 3-16, 4-1 run time, 1-5, 3-6, 3-13, 3-14, 3-16, 6-27 using les, 6-20 run-time library support, 3-13, 3-14
T Table Labeling Facility, 1-14 tape, 1-8, 1-14, 1-34, 2-10, 6-6, 6-19, 6-23, 6-24, 6-32, 6-33 tape labeling facility, 1-8 TDP, 1-14, 1-19 TEMP les, 6-5, 6-16, 6-17, 6-27 terminal, 1-8, 1-15, 1-34, 2-10, 4-4, 6-6, 6-24 ThinLAN3000/XL, 1-33 tombstone, 3-20 tools high-level, 1-2 migration, 1-5 programming, 1-8, 2-1, 2-3, 2-4, 2-6, 3-2, 4-1, 6-24 Toolset/XL, 1-9, 2-3, 3-2 transaction, 7-11 locking, 1-10 logging, 1-10 transaction management, 1-10 locking, 1-10 logging, 1-10 transaction processing, 1-1, 1-7, 1-