IBM 4690 Programming Guide
IBM 4690 Programming Guide
Programming Guide
SC30-3602-02
Note
Before using this information and the product it supports, be sure to read the general information under Notices
on page vii.
Contents
Notices . . . . . . . . . . . . . . . . . . . . . . . .
Trademarks . . . . . . . . . . . . . . . . . . . . . .
Preface
. . . . . . . . . . . . . . . . . . . . . . . .
Who Should Read This Book . . . . . . . . . . . .
How to Use This Book . . . . . . . . . . . . . . . .
Terminal Models . . . . . . . . . . . . . . . . . . .
Where to Find More Information . . . . . . . . . .
Store System Related Publications Software
Store System Related Publications Hardware
General Publications . . . . . . . . . . . . . . .
Summary of Changes . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vii
vii
viii
viii
viii
ix
ix
ix
x
xii
xiii
. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1-1
1-1
1-1
1-2
1-2
1-2
1-3
1-3
1-3
1-4
1-4
2-1
2-2
2-7
2-8
2-11
2-13
2-14
2-17
2-17
2-18
2-18
2-28
3-1
3-6
3-10
3-12
3-27
3-29
3-31
3-48
3-60
3-67
iii
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
3-79
3-82
3-87
3-89
3-96
3-98
4-1
4-1
4-2
4-4
4-6
4-9
4-9
4-10
4-10
4-10
4-13
5-1
5-1
5-1
5-2
5-3
5-4
5-4
5-6
Part 2: Utilities
Chapter 6. Using the Keyed File Utility
Accessing the Keyed File Utility . . . . .
Using the Keyed File Utility from the Host
Using the Keyed File Utility in a Batch File
Keyed File Utility Working Files . . . . . .
Hashing Algorithms . . . . . . . . . . . . .
Internal Processes of Keyed Files . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iv
. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6-1
6-2
6-2
6-4
6-10
6-10
6-12
7-1
7-1
7-1
7-2
7-2
8-1
8-2
8-3
8-3
8-4
8-4
8-5
8-5
8-6
|
|
|
|
|
|
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
9-1
9-2
9-3
9-4
9-4
9-11
9-12
9-12
9-12
9-15
10-1
10-1
10-2
10-3
10-5
11-1
11-1
11-1
11-3
11-4
11-4
11-7
11-8
11-8
. . . . . . . . . . . . . . . . . . . . . . . .
12-1
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13-1
13-1
13-2
13-3
13-7
13-8
13-10
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
14-1
14-2
14-3
14-4
14-4
14-5
14-5
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
15-1
15-2
15-3
15-5
15-6
15-8
Contents
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-11
15-17
15-30
15-31
16-1
16-2
16-48
17-1
17-1
17-2
17-3
17-3
17-3
17-4
17-6
17-6
Appendixes
Appendix A. IBM 4690 Operating System Disk Directory
Protecting the IBM 4690-Provided Subdirectories . . . . . .
Naming Conventions for 4690 Operating System Files . . .
Dictionary of 4690 Operating System Files . . . . . . . . . .
Appendix B. Error Messages
LIB86 Error Messages . . . . .
POSTLINK Error Messages . .
LINK86 Error Messages . . . .
. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vi
A-1
A-1
A-2
A-3
B-1
B-1
B-4
B-8
. . . . . . . . . . . . . . . . . . . . .
C-1
C-1
C-2
C-3
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
X-1
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
X-23
Notices
References in this publication to IBM products, programs, or services do not imply that IBM intends to
make these available in all countries in which IBM operates. Any reference to an IBM product, program,
or service in this publication is not intended to state or imply that only IBMs product, program, or service
may be used. Any functionally equivalent product, program, or service that does not infringe any of IBMs
intellectual property rights may be used instead of the IBM product, program, or service. Evaluation and
verification of operation in conjunction with other products, programs, or services, except those expressly
designated by IBM, are the users responsibility.
IBM may have patents or pending patent applications covering subject matter in this document. The
furnishing of this document does not give you any license to these patents. You can send license
inquiries, in writing, to the IBM Director of Licensing, IBM Corporation, 500 Columbus Avenue
THORNWOOD, NY 10594 USA.
Trademarks
The following terms are trademarks of the IBM Corporation in the United States or other countries or both:
AS/400
Display Manager
NetView
Personal System/2
System/370
XT
C/2
IBM
Operating System/2
PS/2
Systems Application Architecture
COBOL/2
Micro Channel
OS/2
SAA
AIX
Other company, product, and service names, which may be denoted by a double asterisk (**), may be
trademarks or service marks of others.
vii
Preface
This book describes how to program the IBM 4690 Operating System and the interfaces for application
programs.
viii
Appendixes
Appendix A describes the 4690 Operating System hierarchical directory structure. This appendix
includes information on naming conventions for 4690 Operating System files.
Appendix B provides error messages for the Library, Postlink, and Linker utilities.
Appendix C describes character sets and the check printing application.
The glossary defines new, unique, and unfamiliar terms and abbreviations used in this book.
The index provides a quick reference to the contents of the book.
Terminal Models
|
|
|
|
|
|
The 4683/4693-xx1/4694 terminals are called Mod1 terminals. Although all are called Mod1 terminals,
each terminal model supports some features that other models do not support.
The 4683/4693-xx2 terminals are called Mod2 terminals. These terminals attach to a Mod1 terminal and
depend upon that Mod1 terminal for control and communication with the store controller. Table 0-1
shows the different Mod1 and Mod2 terminals.
Table 0-1. Mod1 and Mod2 Terminals by Machine Type
4683 Terminals
4693 Terminals
4694 Terminals
Mod1
Mod2
Mod1
Mod2
Mod1
Mod2
|
|
|
|
|
|
4683-P11
4683-P21
4683-P41
4683-001
4683-A01
4683-421
4683-xx2
4683-xx2
4683-xx2
4683-xx2
4683-xx2
4683-xx2
4693-7x1
4693-5x1
4693-4x1
4693-3x1
4693-xx2
4693-xx2
4693-xx2
Not supported
4694-144
Not supported
Note: A 4683-xx2 terminal cannot attach to a 4693 Mod1 terminal. A 4693-xx2 terminal cannot attach to
a 4683 Mod1 terminal.
The controller/terminal (for example, a 4684 or 4693-5x1 controller/terminal) combines the function of the
store controller and point-of-sale terminal in a single product. The terminal portion of a controller/terminal
is considered to be a Mod1 terminal.
ix
IBM
IBM
IBM
IBM
IBM
IBM
IBM
IBM
IBM
Notices
xi
Cabling
A Building Planning Guide for Communication Wiring, G320-8059
IBM Cabling System Planning and Installation Guide, GA27-3361
IBM Cabling System Catalog, G570-2040
Using the IBM Cabling System with Communication Products, GA27-3620
Networks
IBM Local Area Network Support Program, IBM P/N 83X7873
IBM Token-Ring Network Introduction and Planning Guide, GA27-3677
IBM Personal System/2 Store Loop Adapter/A: Installation and Setup Instructions, SK2T-0318
General Publications
Advanced Data Communications for Stores General Information, GH20-2188
Distributed Systems Executive General Information, GH19-6394
Communications Manager X.25 Programming Guide, SC31-6167
IBM Disk Operating System 4.0 Command Reference, S628-0253
IBM Proprinters, SC31-3793
IBM 4680 Support for COBOL Version 2 (Softcopy provided with the product)
IBM 4680 Store System Regression Tester (Softcopy provided with the product)
IBM 4680 X.25 Application Programming Interface, GG24-3952
NetView Distribution Manager: General Information, GH19-6587
Systems Network Architecture: General Overview, GC30-3073
IBM Local Area Network Administrators Guide, GA27-6367
DSX Preparing and Tracking Transmission Plans, SH19-6399
IBM Dictionary of Computing (New York; McGraw-Hill, Inc., 1993)
IBM Local Area Network Support Program, IBM P/N 83X7873
The Ethernet Management Guide Keeping the Link, Second Edition (McGraw-Hill, Inc.,
ISBN 0-07-046320-4)
xii
Summary of Changes
The following information has been added or modified in this edition of the manual:
4694
Fiscal Printers
Notices
xiii
xiv
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1-1
1-1
1-2
1-2
1-2
1-3
1-3
1-3
1-4
1-4
This chapter is an overview of the IBM 4690 Operating System environment. It provides the capabilities of
the system and refers you to other chapters for more detailed information.
System Capabilities
The IBM 4690 Operating System is a multitasking and multiuser environment that runs in the store
controller, the point-of-sale terminals, and the controller/terminals. The operating system can handle store
controller communications with point-of-sale terminals, other controllers, the controller/terminal, and the
host processor. The following sections briefly describe the systems capabilities.
Concurrent Operations
The following functions of the 4690 Operating System allow concurrent operations:
The operating system allows you to run your batch and interactive programs at the same time. One
program does not have to finish before another program can start.
The operating system allows several operators to use the system at the same time. Your operators
can be authorized to run one program at a time or several at a time. Operators are authorized
through the system authorization file. See Chapter 15 for information on how to authorize users on
the system.
Multiple users on the system can run multiple interactive applications through the use of windows. An
operator can switch from window to window, start or stop an application running on a window, or
check the status of an application running on a window. Windows are possible through a window
control facility. Refer to the IBM 4690 Store System: Users Guide for an explanation on how windows
are used on the system.
You can communicate with a host site at the same time your in-store communications are taking
place.
You can attach multiple serial devices to your store controller. The Multiple Console facility handles
the management of these devices as additional system consoles.
1-1
Operator Interface
For some system functions (for example, configuration) you communicate with the system through a
menu-driven interface at the store controller console. For other functions (for example, copying files) you
enter commands directly into the system. You can attach auxiliary consoles to the store controller. For
information on how to use system functions and auxiliary consoles, refer to the IBM 4690 Store System:
Users Guide.
Communications
The following list contains communications-related information:
The communication interfaces that support Systems Network Architecture (SNA) protocols are logical
unit (LU) 0 and LU 6.2 as node types 2.0 and 2.1. The line connections supported on the non-SNA
interface are asynchronous (ASYNC) and Binary Synchronous Communication (BSC). The line
connections supported on the SNA interface are BSC, Synchronous Data Link Control (SDLC), token
ring, Ethernet, local link, and X.25. The IBM 4690 Store System: Communications Programming
Reference explains how to use host and peer communications.
LU 6.2 allows user-written transaction programs (TPs) on the 4690 store controller to communicate
with Advanced program-to-program communications (APPC) applications on a host node (type 4 or 5)
or on a peer node (type 2.1). The TP accesses the LU 6.2 communications functions by calling APPC
functions. These functions are known as calls (verbs) from a set of library routines that are linked to
the TP. CPI Communication is the LU 6.2 communications interface used by the 4690 Operating
System. The IBM 4690 Store System: Communications Programming Reference explains LU 6.2
communications.
Application-to-application communications are processed through in-memory files called pipes. For
information on how pipes work with your applications, see Chapter 15 and Chapter 16.
You can optionally link your store controllers together by the token ring or Ethernet and they can
communicate with each other using the Multiple Controller Feature (MCF). A store controller
configured as the master store controller serves as the central point of control on this type of system.
On a system using the MCF, files are updated and distributed as you specify to other store controllers
on the network. For more information, refer to the IBM 4690 Store System: Users Guide.
1-2
Files
This list briefly describes file security, file types, and file structures:
The operating system provides protection for your files by limiting access to only authorized users. To
control file access, you assign each user to one of three categories. See Protecting Files on
page 2-23 for a description of these categories and their uses.
You can specify and manage the way disk files are shared with other users. See Sharing Files on
page 2-21 for information on allowing file access.
You can create and manage keyed files and other files. A utility allows you to change keyed files into
direct files or direct files into keyed files. See Keyed on page 2-4 for information about keyed files
and how to change these files into direct files, or direct files into keyed files. Creating Files on
page 2-19 explains how files are created on the system.
The system uses a hierarchical file structure similar to the IBM Personal Computer Disk Operating
System (IBM DOS).
Utilities
The 4690 Operating System provides the following utilities:
A utility is available to help you develop the input sequence table. The input sequence table lets you
edit operator input from various input devices. Chapter 7 describes the input sequence table utility.
The Apply Software Maintenance (ASM) Utility allows you to update system or user programs through
a menu-driven interface. Refer to the IBM 4690 Store System: Users Guide for information about this
utility. The Staged IPL Utility lets you apply maintenance using ASM when one controller is up and
able to run TCC Networks. See Chapter 13 for information on the Staged IPL Utility.
Special write operations protect your data in the event of a power line disturbance. For information on
recovering from power line disturbances, see Chapter 4.
You can use the Distributed File utility to distribute files to other nodes on a multiple-controller system.
Refer to the IBM 4690 Store System: Users Guide for a complete description of this utility.
A text editing facility lets you create and edit files. Refer to the IBM 4690 Store System: Users Guide
for information on the text editing facility.
1-3
Additional Products
The following list contains information about other products related to the IBM 4690 Operating System:
The IBM 4690 Operating System supports an optional high-level debugging aid called the IBM 4680
Application Debugger. It is available by RPQ P85154.
The IBM 4690 Operating System includes a Display Manager program that allows you to create,
modify, or manage information displayed on the store controller screen. Refer to the IBM 4680 Store
System: Display Manager Users Guide for information about this program.
1-4
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
2-2
2-2
2-3
2-4
2-5
2-7
2-8
2-11
2-12
2-12
2-12
2-12
2-13
2-13
2-14
2-14
2-14
2-14
2-15
2-16
2-16
2-17
2-17
2-18
2-18
2-18
2-19
2-19
2-19
2-20
2-20
2-21
2-21
2-23
2-23
2-23
2-24
2-25
2-25
2-26
2-27
2-27
2-27
2-28
2-28
This chapter shows you how to handle files. It gives you information about file types and describes how to
manage your files and subdirectories.
2-1
Random
Random files have fixed record lengths. The system uses the last two bytes in each record for the
carriage return and line feed characters (CR/LF). The system pads the data space between the last field
of the record and the CR/LF.
Random files offer random access, which allows direct access to any record in a file. This ability makes
random and direct files an ideal type for files that can be referenced by a relative record number. If you
need a name or a specific number (such as a telephone number) to reference a record, use Keyed File
Services. You ensure that the number of bytes occupied by the field delimiters and CR/LF do not exceed
the specified record length. Figure 2-1 shows a random file composed of three records. The data is in
ASCII characters.
FILE.1
RECORD 1
RECORD 2
CR/LF
RECORD 3
111,222,3.3,444,5.5
CR/LF
IBM 4680 BASIC locates each record of a randomly accessed file by taking the record number,
subtracting 1, and then multiplying that result by the record length. The result is a byte displacement
value for the record measured from the beginning of the file. Records can span sectors. You must
specify the record to be accessed in each READ#, PRINT#, or WRITE# statement executed. The
following BASIC program creates the random file diagrammed in Figure 2-1.
CREATE
WRITE
WRITE
WRITE
CLOSE
END
2-2
"FILE.1" RECL 40 AS 2
A$ = "FIELD ONE"
B$ = "FIELD TWO"
C$ = "FIELD THREE"
D$ = "Field 1"
E$ = "Field 2"
F$ = ""
G% = 111
H% = 222
I = 3.3
J% = 444
K = 5.5
#2,1; A$, B$, C$
#2,2; D$, E$, F$
#2,3; G%, H%, I, J%, K
2
The following program reads the first three fields from record 3 in FILE.1.
IF END #20 THEN 200
OPEN "FILE.1" RECL 40 AS 20
READ #20,3; FIELD1%, FIELD2%, FIELD3
PRINT FIELD1%, FIELD2%, FIELD3
200 END
The preceding program results in the following output.
111
222
3.3
For applications written for the terminal, you must use the WRITE statement to send data to a random file.
Direct
Direct files are like random files except that direct files contain no delimiting characters (quotes, commas,
and CR/LF). Direct files contain no data formatting information. Because of this, you must specify a
special format string when you want to access the data in a direct file. See Performing File Functions on
page 2-18 to learn more about accessing a direct file.
The following program creates a direct file named DIRECT.DAT that consists of one 15-byte record. The
variable D represents the format string used in the WRITE FORM# statement.
STRING A,
INTEGER*2
REAL C
D
B
CREATE
"DIRECT.DAT" DIRECT
A = "ABC"
B = 32767
C = 27.35
D = "C3, I2, R"
WRITE FORM D; #3,1; A,B,C
RECL 15
AS 3
LOCKED
CLOSE 3
END
Figure 2-2 shows the direct file created by the preceding program. The data in the figure is in
hexadecimal.
RECORD 1
414243FF7F42000000000000003527
ABC
32767
27.35
2-3
Keyed
Keyed files are composed of fixed-length records that are accessed by using a key, which can be any
combination of characters that can be used in an IBM 4680 BASIC string.
A keyed file consists of blocks that contain keyed records. A block is a 512-byte sector. Each block uses
the first four bytes for chain pointers and the next 508 bytes for records. A block can contain multiple
records, but records are not split across blocks. Each record contains its key and data, with the key
always being first. A record can be a maximum of 508 bytes. The key can be as many bytes of the
record as you need.
You should use keyed files for files accessed by a name or a number. Examples of such numbers are a
Universal Product Code (UPC), a label, a telephone number, or a check authorization number. These
types of names and numbers do not have any contiguous nature and are random in their occurrence. You
can use numbers that have a contiguous nature to access a random or direct file.
You access keyed files by hashing the key to obtain a relative position within the file to locate the record.
Keyed files do not have indexes. The more unique each key is with respect to all of the other keys used
in a keyed file, the better the hashing technique works.
To access a keyed file sequentially, use the keyed file as a direct file. You can obtain information about
the keyed file from the first block, which is used only for control information. The format of this first block
is:
Relative Byte
Offset (in Decimal)
Number of Bytes
(in Decimal)
Keyed File
Information
42
46
48
Randomizing divisor
54
Key length
56
Chaining threshold
You can create keyed files directly with an IBM 4680 BASIC program, or you can use the Keyed File
Utility program provided with the IBM 4690 Operating System. The utility provides an efficient two-pass
method of converting a direct file into a keyed file. See Keyed Files on page 2-28 for an explanation of
this utility.
Like direct files, keyed files use no delimiting characters. You use a format string to map the data to and
from the record. Figure 2-3 shows a keyed file record with a 19-byte length. The data in the figure is in
hexadecimal.
RECORD 1
4B455931414243FF7F42000000000000003527
key1
ABC 32767
2-4
27.35
The following program creates the 19-byte keyed file shown in the Figure 2-3 on page 2-4. The keyed
file consists of one 19-byte record.
STRING A,
INTEGER B
REAL C
D,
KEY