File Number S360-30 Order Number GY28-6618-5

Program Logic

OS ISAM Logic

Release 21

Program Number 3605-10-526

This publication describes the program logic of the two indexed sequential access methods: the queued indexed sequential (QISAM) and the basic indexed sequential access method (BISAM). It also discusses the relationship of indexed sequential access method routines to other parts of the control program. Sixth Edition (February 1972) This is a major revision of, and makes obsolete, the edition of this manual identified as GY28-6618-4. This edition applies to OS Release 21 and to all subsequent releases until otherwise indicated in new editions or technical newsletters. Changes to the information in this book may be made at any time; before using this publication in connection with the operation of IBM systems, consult the latest SRL Newsletter, GN20-0360, for the editions that are applicable and current. Requests for copies of IBM publications should be made to your IBM representative or to the IBM Branch Office serving your locality.

Forms for readers' comments are provided at the back of this publication. If the forms have been removed, comments may be addressed to IBM Corporation, Programming Publications, Department D78, Monterey and Cottle Roads, San Jose, California 95114. Comments become property of IBM.

© Copyright International Business Machines Corporation 1966, 1968, 1969, 1971, 1972 PREFACE

This publication describes the program structure of the two indexed sequential access methods: queued indexed sequential access method (QISAM) and basic indexed sequential access method (BISAM). The manual is divided into seven sections: "Section 1: Introduction" is an overview of indexed sequential access method organization and an overall description of ISAM operations. "Section 2: Method of Operation" comprises four parts: 1. ISAM common open, common close, and validation modules - a discussion of the common processing operations for QISAM scan, QISAM load, and BISAM. 2. Queued Indexed Sequential Access Method, Load Mode - a discussion of the operations and routines unique to creating data sets with QISAM. 3. Queued Indexed Sequential Access Method, Scan Mode - a discussion of the operations and routines involved in retrieving and updating records sequentially using QISAM. 4. Basic Indexed Sequential Access Method - a discussion of the techniques and operations used in the direct storage and retrieval of records in an indexed sequential . "Section 3: Program Organization" contains flowcharts of individual ISAM routines. "Section 4: Director" contains a table of ISAM modules, by type, and module selection tables for QISAM load mode, open executors, and close executors. "Section 5: Data Areas" contains descriptions of data management control blocks and work areas used by ISAM. "Section 6: Diagnostic Aids" summarizes appendage, asynchronous, and exception codes set and used by ISAM routines. "Section 7: Appendixes" supplements this manual and program listings with a description of ISAM data set organization (Appendix A) and the ISAM channel programs (Appendix B).

Prerequisite Knowledge

Before reading this book, you should understand the material presented under "Processing an Indexed Sequential Data Set" in OS Data Management Services Guide, GC26-3746.

Recommended Reading

The following publications contain information that you may need in conjunction with reading this book: OS DADSM Logie, GY28-6607 OS Data Management Macro Instructions, GC26-3794

iii OS Data Management for System Programmers, GC28-6550 OS I/O Supervisor Logic, GY28-6616 OS MFT Guide, GC27-6939 OS MVT Guide, GC28-6720 OS Open/Close/EO V Logic, GY28-6609 OS Supervisor Services and Macro Instructions, GC28-6646 OS Sytem Control Blocks, GC28-6628

iv CONTENTS

iii Preface

xiii Summary of Changes for Release 21 1 Section 1: Introduction 1 Open Phase 2 Processing Phase 5 Close Phase 7 Section 2: Method of Operation 9 ISAM Common Open, Common Close, and Validation Modules 9 The ISAM Common Open Executors 12 The Validation Modules 13 Common Close Phase Executors 14 Queued Indexed Sequential Access Method, Load Mode 15 Load Mode Open Phase Operations 15 Initial Load or Reload Open Operations 15 Resume Load Open Operations 16 Full-Track-Index-Write Open Operations 16 The Final Load Mode Open Phase Operations 16 Load Mode Open Phase Organization 17 Initial Load Organization 20 Resume Load Open Organization 22 Full-Track-Index-Write Phase Organization 22 The Final Executors in Load Mode Open Phase Organization 23 Load Mode Processing Phase Operations 24 Put Routine 27 Beginning-of-Buffer Routine 27 End-of-Buffer Routine 28 Full Track-Index-Write 29 Appendages 30 Load Mode Processing Phase Organization 31 Channel Programs 33 Control Blocks and Work Areas 33 Load Mode Close Phase Operations 33 Load Mode Close Phase Organization 35 Queued Indexed Sequential Access Method, Scan Mode 36 Scan Mode Open Phase Operations 37 Scan Mode Open Phase Organization 38 Scan Mode Processing Phase Operations 39 Buffer Control Techniques 42 SETL Routine 43 Get Routine 45 EOB Routine 45 Scheduling Routine 47 PUTX Routine 48 ESETL Routine 49 RELSE Routine 49 Appendages

v 51 Scan Mode Processing Phase Organization 51 Processing Routines 51 Scan Mode Channel Programs 52 Scan Mode Control Blocks and Work Areas 52 Scan Mode Close Phase 55 Basic Indexed Sequential Access Method 55 BISAM Open Phase Operations 56 BISAM Open Phase Organization 60 BISAM Processing Phase Operations 61 An Example of BISAM Processing Flow 62 Privileged Macro-time Routines 64 Nonprivileged Macro-time Routines 65 Appendage and Asynchronous Routines 67 Dynamic Buffering Routines 68 Check Routine 71 BISAM Processing Phase Organization 71 BISAM Channel Programs 89 BISAM Control Blocks and Work Areas 91 BISAM Close Phase 93 Section 3: Program Organization 139 Section 4: Directory 141 ISAM Module Identified in Alphameric Sequence 147 Section 5: Data Areas 149 ISAM Control Blocks and Data Areas 149 (DCB) 159 Data Event Control Block (DECB) 160 Data Set Control Block (DSCB) 167 Data Extent Block (DEB) 170 Input/Output Block (lOB) 172 Buffer Control Block (BCB)-BISAM 174 Buffer Control Block (BCB)-QISAM 175 Buffer Control Table (IOBBCT) 179 QISAM Load Mode DCB Work Area 187 QISAM Scan Mode DCB Work Area 193 BISAM DCB Work Area 196 QISAM Track-Index Save Area 198 ISAM DCB Field Area 199 Section 6: Diagnostic Aids 201 Appendage Codes 201 QISAM Scan Mode Appendage Codes 201 BISAM READ and WRITE K Appendage Codes 201 BISAM WRITE KN Appendage Codes 202 Asynchronous Codes 202 BISAM READ and WRITE K Asynchronous Codes 203 BISAM WRITE KN Asynchronous Codes 204 Exception Codes 204 QISAM Exception Codes 205 BISAM Exception Codes

vi 207 Section 7: Appendixes 209 Appendix A: ISAM Data Set Organization 209 Introduction 209 Data Set Structure 211 Prime Data Area 211 Index Areas 213 Adding Records to a Data Set 215 Detailed Index Description 222 Appendix B: ISAM Channel Programs 285 Index

vii

ILLUSTRATIONS

Figures

3 Figure 1. SIO Appendage for ISAM RPS 10 Figure 2. ISAM Open Flow of Control 11 Figure 3. RPS Identification Field in the Data Event Block 14 Figure 4. Flow of control through the Close Executors 17 Figure 5. Flow of Control through Load Mode Open Executors 25 Figure 6. Load Mode Put Routine 26 Figure 7. Load Mode BOB Routine 27 Figure 8. Load Mode EOB Routine 28 Figure 9. Load Mode Channel-end Appendage Routine 29 Figure 10. Load Mode Abnormal-end Appendage Routine 30 Figure 11. Load Mode Processing Modules 31 Figure 12. QISAM-Load Mode Channel Program Flow (Fixed-Length Records) 32 Figure 13. QISAM-Load Mode Channel Program Flow (Variable-Length Records) 34 Figure 14. Load Mode Control Blocks and Work Areas 36 Figure 15. The Flow of Control through QISAM Load Mode Close Executors 38 Figure 16. Flow of Control through Scan Mode Open Executors 40 Figure 17. Scan Mode Channel Program/Buffer Queues 40 Figure 18. Buffer Queuing and Movement in Scan Mode 43 Figure 19. Scan Mode SETL Routine 44 Figure 20. Scan Mode GET Routine 46 Figure 21. Scan Mode EOB Routine 47 Figure 22. Scan Mode Scheduling Routine 48 Figure 23. Scan Mode ESETL Routine 51 Figure 24. QISAM Scan Mode Processing Modules 53 Figure 25. Scan Mode Channel Program 54 Figure 26. Scan Mode Control Blocks and Work Areas 56 Figure 27. BISAM Open Executors 59 Figure 28. Flow of Control through BISAM Open Executors 62 Figure 29. Privileged Macro-time Routines 64 Figure 30. Nonprivileged Macro-time Routines 66 Figure 31. BISAM Appendage and Asynchronous Routines 67 Figure 32. Dynamic Buffering Routines 68 Figure 33. BISAM Check Routine 69 Figure 34. BISAM Processing Flow (Not WRITE KN) 70 Figure 35. BISAM Privileged Macro-time Modules 71 Figure 36. BISAM Nonprivileged Macro-time Modules 71 Figure 37. BISAM Asynchronous Modules 72 Figure 38. BISAM Appendage Modules 73 Figure 39. BISAM Channel Program Modules 76 Figure 40. READ K, WRITE K, READ KU Channel Program Flow 77 Figure 41. WRITE KN Channel Program Flow-Index Searching 78 Figure 42. WRITE KN Channel Program Flow-Add to Prime (Fixed-Length Unblocked Records, System Work Area)

ix 79 Figure 43. WRITE KN Channel Program Flow-Add to Prime (Fixed-Length Unblocked Records, User Work Area) 80 Figure 44. WRITE KN Channel Program Flow-Add to Prime (Fixed-Length Blocked Records, System Work Area) 81 Figure 45. WRITE KN Channel Program Flow-Add to Prime (Fixed-Length Blocked Records, User Work Area) 82 Figure 46. WRITE KN Channel Program Flow-Add to Prime (Variable- Length Records, System Work Area) 83 Figure 47. WRITE KN Channel Program Flow-Add to End (Fixed-Length Records, System Work Area) 84 Figure 48. WRITE KN Channel Program Flow-Add to End (Fixed-Length Records, User Work Area) 85 Figure 49. WRITE KN Channel Program Flow-Add to End (Variable- Length Records) 86 Figure 50. WRITE KN ChanneL Program Flow-Add to Overflow (Fixed- Length Records, System Work Area) 87 Figure 51. WRITE KN Channel Program Flow-Add to Overflow (Fixed- Length Records, User Work Area) 88 Figure 52. WRITE KN Channel Program Flow-Add to Overflow (Variable- Length Records) 89 Figure 53. Elements of a BISAM Request 90 Figure 54. BISAM Control Blocks and Processing Modules 91 Figure 55. BISAM Work Areas and Queues 142 Figure 56. ISAM Modules Identified by Function and Mode 143 Figure 57. IS AM Modules Identified by Alphameric Sequence 150 Figure 58. BISAM/QISAM DCB 159 Figure 59. Data Event Control Block 161 Figure 60. Format-2 DSCB 166 Figure 61. ISAM Extention to DEB 170 Figure 62. ISAM Extension to lOB 172 Figure 63. Fields of the BISAM Dynamic Buffering BCB 174 Figure 64. Fields of the QISAM BCB 175 Figure 65. QISAM Load Mode Buffer Control Table 180 Figure 66. QISAM Load Mode DCB Work Area 186 Figure 67. Area Y: QISAM Load Index Fields 187 Figure 68. QISAM Scan Mode DCB Work Area 193 Figure 69. BISAM Work Area 196 Figure 70. Track-Index Save Area 197 Figure 71. TISA Control Fields 198 Figure 72. DCB Field Area 204 Figure 73. QISAM Exception Code Summary 205 Figure 74. BISAM Exception Code Summary 210 Figure 75. Indexed Sequential Data Set Structure 211 Figure 76. Initial Structure of Prime Cylinder 212 Figure 77. Structure of Cylinder Index and Track Index 213 Figure 78. Structure of Prime Cylinder after Cylinder Overflow 215 Figure 79. Structure of Prime Cylinder after Independent Overflow 216 Figure 80. Format of ISAM Index Entry 219 Figure 81. Description of Track Indexes 220 Figure 82. Description of Cylinder Indexes 221 Figure 83. Description of Master Indexes 223 Figure 84. ISAM Channel Program Summary

x Flowcharts

95 Chart AA First Common Open Executor (IGGOl92A) 98 Chart AB Second Common Open Executor (IGGOl92B) 100 Chart AC Third Common Open Executor (IGGOl92C) 101 Chart AD Fixed-length Validation Open Executor (IGGOl920) 102 Chart AE First Load Mode Open Executor (IGGOl92I) 105 Chart AF First Initial Load Mode Open Executor (IGGOl92D) 108 Chart AG First Resume Load Open Executor (IGG0196D) 109 Chart AH Last Scan Mode Open Executor (IGGO 1924) 110 Chart AI First Scan Mode Open Executor (IGG01928) 114 Chart AJ ISAM Common Close Executor Module (IGG0202D) 116 Chart AK QISAM Scan Processing Module (IGG019HB) 130 Chart AL Scan Mode Appendage (IGG019HG) 133 Chart AM Scan Mode Close Executor Module (IGG02029) 134 Chart AN BISAM Open Executor-Load Privileged Module (IGG0192I) 136 Chart AP BISAM Nonprivileged Macro-time Processing- READ K, READ KU, WRITE K (IGG019JV) 137 Chart AQ BISAM Privileged Macro-time Processing Module (WRITE KN. without Read, and Update) (IGG019JX)

xi

SUMMARY OF CHANGES FOR RELEASE 21

Control Block Changes Several fields containing addresses of ISAM routines have been moved to the DEB from the DCB and DCB work areas. These changes are for QISAM load and scan modes and for BISAM.

New QISAM Load Mode Open Executors There are two new open executors for load mode - IGG01925 and IGG01927. They are executed when high-level indexes are created on 2301 and 2321 devices.

Summary of ISAM Modules A table listing all ISAM modules in alphameric order has been added to the Directory. The table indicates the pages on which each module is described and replaces individual module names in the index.

Summary of ISAM Channel Programs A table listing all ISAM channel programs has been added to the introductory text of Appendix B.

M~ceUaneous Changes This manual is to be used with MFT and MVT systems. All information about PCP has been removed. New information has been added to channel programs 20 and VXCCW(1A) in Appendix B. Technical and editorial corrections have been made throughout the manual.

xiii

SECTION 1: INTRODUCTION

The indexed sequential access methods (ISAM) are data management techniques used for storing indexed sequential data sets on direct-access devices, or for retrieving those data sets. A detailed description of the structure of an indexed sequential data set is provided in Appendix A of this manual. Detailed information on how to create and process an indexed sequential data set is in the publication OS Data Management Services Guide, GC26-3746. ISAM routines are part of the operating system control program. They are grouped into modules that are placed in the supervisor call (SVC) library during system generation. Only the modules needed to perform those functions required by a processing program are loaded into main storage from the system-residence volume. Wherever possible, all processing programs use the same copy of a module. There are two indexed sequential access methods: queued indexed sequential access method (QISAM) and basic indexed sequential access method (BISAM). QISAM has routines for two modes: load mode routines, which are used to create an indexed sequential data set and to add records to the end of a data set; and scan mode routines, which are used to retrieve and update records from a previously created data set. BISAM routines provide direct storage and retrieval of any logical record by its record key. The BISAM routines also permit records to be updated in place. The BISAM Write-Key-New (WRITE KN) routine provides the user a means of inserting new records into an indexed sequential data set. Routines within QISAM load mode, QISAM scan mode, and BISAM are divided into three phases of execution: the open phase, the processing phase, and the close phase.

Open Phase

When a data control block (DCB) is opened to process an indexed sequential set, the Open routine gives control to ISAM open executors. (The Open routine is described in OS Open/Close/EOV Logic, GY28-6609.) The ISAM open executors are modules that perform the initial ISAM processing. Open processing is performed in two stages: the first or common open stage which is executed for both QISAM and BISAM; and the second or mode-oriented stage which is executed by separate open modules for QISAM load mode, QISAM scan mode, and BISAM. The common open executors receive control from the Open routine of II0 support when it is determined that an indexed sequential access method is to be used. The same executors are used for both QISAM and BISAM. These common open executors determine which mode of ISAM has been specified in the processing program and then select the required ISAM modules from the system-residence library. The common open executors determine storage requirements for the access method routines and also begin the building of control blocks and control lists for subsequent use by the processing and closing phases. When these operations are completed, the common open executors transfer control to the mode-oriented, second-stage open executors.

Section 1: Introduction 1 The common open executors are described in detail in the first part of the Method of Operation section of this manual; the mode-oriented executors are discussed in their respective QISAM and BISAM parts.

Processing Phase

During the processing phase of indexed sequential access method operations, several types of routines are invoked: these include input/output routines (in some cases, both privileged and nonprivileged) and their related channel programs, channel program appendage routines, asynchronous routines, and buffer management routines. Control blocks, work areas, and queues are used by the processing phase routines and by the corresponding channel programs. When an input or output macro instruction is encountered in the processing program, ISAM routines construct the needed channel programs for processing the data and request the I/O supervisor to schedule those channel programs for execution. If an error occurs during the execution of the channel program, the ISAM appendage and asynchronous routines inform the processing program of the error. In the processing phase of ISAM, buffers are allocated, queued, and scheduled (buffer management); indications of whether or not the channel programs have been executed successfully are given by both the buffer management and appendage routines.

Processing Routines The ISAM processing routines select and complete the channel programs that store, process, and retrieve an indexed sequential data set. These routine~ perform various operations and construct different channel programs depending on the characteristics of the data to be processed, the type of macro instruction issued by the processing (user) program, and the indexed sequential access method (or mode) being used. For QISAM load mode, the primary processing routine is the Put routine. The load mode Put routine is used in creating or resuming the creation (see "Resume Load") of an indexed sequential data set. In QISAM scan mode, five macro instruction routines are used for data retrieval and updating; the scan mode routines are described under Scan Mode Processing Phase in the Method of Operation section. The BISAM processing routines consist of several variations of the basic Read and Write routines. In BISAM, both nonprivileged and privileged routines are used to facilitate channel program execution. The QISAM load, QISAM scan, and BISAM processing routines are described fully in their respective sections of this manual.

Appendage Routines The appendages are routines entered from the input/output supervisor when a channel program is to be started or when a channel program ends. The appendage routine determines if additional processing is necessary before an input/output operation has started or after it has been completed. For example, more than one channel program may be needed to satisfy completely a specific input or output request from the processing program. In such a case, the channel appendage would keep track of the

2 OS ISAM Logic channel programs needed and assist in initializing and scheduling these channel programs sequentially. Appendages may also schedule asynchronous routines to handle the additional processing of an I/O request. (Appendages and asynchronous routines are described in OS Data Management for System Programmers, GC28-6650.)

Rotational Position Sensing Start I/O Appendages The rotational position sensing (RPS), start I/O (SIO) appendage routines decrease channel time by disconnecting the channel from RPS devices whenever possible. This is done by inserting channel command word (CCW) slots in the various ISAM channel programs. When an ISAM data set is being used with an RPS device, the RPS start I/O appendages modify the channel command word slots dynamically to either an NOP, Set Sector, Read Sector, or a TIC, depending on the device type and the channel program. Three RPS SIO appendages are used: one each for QISAM scan and load modes, and one for BISAM. These SIO appendages convert non-RPS channel programs to RPS channel programs and vice versa, as necessary.

Conversion of a non-RPS channel program to an RPS channel program involves: Conversion of the CCW slots from TICs or NOPs to Read or Set Sectors Possibly modifying a CCW's command-chaining flag so that the RPS CCWs are executed Interposing an RPS channel program prefix when the channel program starts with a search ID of five bytes Setting up sector values where necessary Note: The rotational position sensing (RPS) devices referred to in this manual are the IBM 3330 and 2305 Direct-Access Storage Devices.

Set up non-RPS No Yes Set up channel program RPS deVice channel program for RPS

Update sector value

Figure 1. SIO Appendage for ISAM RPS

Section 1: Introduction 3 Asynchronous Routines Asynchronous routines are used in QISAM scan mode and in BISAM to perform any additional processing of an I/O request required when a channel program ends. Complete processing of an I/O request may require several channel programs. For BISAM, the asynchronous routines set up and schedule the requests as required. Also, when I/O request processing is complete, whether satisfactorily or in error, the completion must be posted. These routines do the posting. For QISAM scan mode, the asynchronous routine schedules the channel programs when the next record is to be read or written on another device. The appendage routines of QISAM scan mode and BISAM select and schedule the appropriate asynchronous routines. Further description of the scan mode asynchronous routines can be found in the discussion of "Appendages" under "Scan Mode Open Phase Operations" in Section 2. For more detail about the BISAM asynchronous routines, see "Appendage and Asynchronous Routines" under "BISAM Processing Phase Operations" in Section 2.

Buffer Handling Routines Buffer handling or buffer management routines are provided in both modes of QISAM and, optionally, in BISAM. In QISAM load mode, the Put routine has two subsidiary buffer handling routines: the beginning-of-buffer (EOB) routine and the end-of-buffer (EOB) routine. The BOB and EOB routines perform both the Put move mode and Put locate mode processing. In move mode, the Put routine and its buffer handling routines move an output record from the user work area or input area to an output buffer. In locate mode, the Put routine and its subsidiary routines give the address of an output buffer area to the user; the user must move the record to the buffer. In QISAM scan mode, five buffer queues are used to control input/output operations. The queuing of buffers is handled primarily by the Get routine and its subsidiary routines-the scheduling routine and the end-of-buffer routine. In scan mode, a copy of channel program 22 (CP 22) is allocated to each buffer. The buffers are manipulated among the queues and scheduled for I/O operations according to the macro instructions issued in the processing program. Refer to the discussion of "Buffer Control Techniques" under "Scan Mode Processing Phase Operations" in Section 2 for a description of the buffer queues. Dynamic buffering may be used in BISAM to allow the queuing of mUltiple read requests. A buffer is automatically acquired from a buffer pool and assigned to the request just before data transfer begins. The buffer is returned automatically to the buffer pool when its contents are written, or it is returned under programmer control with the free dynamic buffer (FREEDBUF) macro instruction. Dynamic buffering requires relatively fewer buffers since the read requests waiting in the queue do not monopolize buffers.

4 OS ISAM Logic Close Phase

When a DCB for an ISAM data set is closed, the Close routine gives control to ISAM close executor modules which terminate processing for the particular mode of ISAM being used. As do the open executors, the close executors have two stages: (1) the mode-oriented stage (that is, the load mode, scan mode, or BISAM close executors), and (2) the common close stage executor. When invoked by the CLOSE macro, the CLOSE routines first determine that an ISAM data set is being processed. They then examine the DCBMACRF field in the DCB to determine which mode of ISAM is in use and which mode-oriented close executor should be given control. The close executors for load mode, scan mode, and BISAM are described in their respective sections.

Section 1: Introduction 5

SECTION 2: METHOD OF OPERATION

Section 2: Method of Operation 7

ISAM Common Open, Common Close, and Validation Modules

There are three distinct indexed sequential access methods: QISAM load mode, QISAM scan mode, and BISAM. Each comprises a group of modules. In addition to the three separate groups of modules, certain ISAM modules are used for both QISAM and BISAM processing. In particular, the three common open executor modules (IGG0192A, IGGOl92B, and IGG0192C), the common close executor module (IGG0202D), and the validation open executor modules (IGG01920, IGG01922, and IGG01950) are used in both modes of QISAM and in BISAM. This part of the manual describes the common open and common close executors in detail, and generally describes the validation modules which are further detailed in the discussion of QISAM (load, scan) and BISAM.

The ISAM Common Open Executors The first stage, or common, open executors receive control from the Open routine. A preexecutor module of Open (module IGG0190W): 1. Reads in the additional DSCBs for this data set (if multivolume) 2. Tests first volume for a format-2 DSCB 3. Checks DSCBs for ascending order on the same sequence in which space was allocated 4. Transfers control (XCTL) to the first ISAM open executor The common executors, upon completion, pass control to second stage open executors required to initialize the specific form of QISAM or BISAM called for by the processing program. The DCB Integrity Feature: ISAM routines maintain DCB integrity by preserving pertinent DCB fields and maintaining the current status of these fields during processing. The DCB integrity feature is invoked for the user whenever he opens with DISP=SHR. This feature prevents multiple tasks, when sharing the same indexed sequential data set, from altering the data set without updating its attributes in the DCB. This could happen if one of the tasks opens the data set for Write-Key-New and modifies an area in order to change various DCB fields. For example, adding records to the last prime-data track would result in updating DCBLPDA and possibly DCBLIOV. Another task with concurrent access to the data set in QISAM scan mode would not process the added records. With the DCB integrity feature, any change in the DCB caused by a modification of the data set causes a corresponding change in all DCBs currently open for that prticular data set. An ISAM common open module, IGG0192C, determines whether another ISAM data set has previously been opened, and if not, obtains space for a DCB field area (DCBFA) associated with each ISAM data set that is opened. The DCB field area is obtained (by a GETMAIN from subpool 255) by the ISAM open executor module, IGGOl92C, when a data set is opened for the first time.

Section 2: Method of Operation 9 The DCBF A contains the DCB information that can be changed while processing the data set and is pointed to by all DCBs opened for that data set. The DCB fields that require this updating are DCBLIOV, DCBLPDA, DCBNOV, DCBNOREC, DCBNREC, DCBRORGl, DCBRORG2, DCBRORG3, DCBST, and DCBTDC. These fields require a 36-byte DCB field area. During procesing of a data set opened for WKN or RU, ISAM routines gain access to the associated DCB fields and modify them from the DCBFA. This eliminates the possibility of a user's inadvertently and incorrectly modifying these fields. The ISAM open executors are each 1024 bytes in length and overlay each other in the transient area. The three common open executor modules are IGGOl92A, IGG0192B, and IGG0192C. The flow of operations among these executors and to the second stage open executors is depicted in Figure 2.

Open routme

,----, I IFG0196V I L - -- -l +

Common open executors

I -- --, IGG0192A I IGG0192B I IGG0192C L -- - --...J

Second stage open executors + + BISAM open QISAM scan mode QISAM load mode executors open executors open executors (see Figure 28) (see Figure 16) (see Figure 5) I , I

Open routine

t

Processmg program

Figure 2. ISAM Open Flow of Control

Note: The second stage open executors return control to the Open routine of 1/0 support, which returns control to the processing program.

10 OS ISAM Logic Common open executor IGGO 192A receives control from the Open routine of input/output support. The primary functions of IGG0192A are: 1. It calculates the space needed for the DEB. (16 bytes are allocated for the DEB prefix, and 32 bytes for the basic section of the DEB.) The number of extents indicated by the user's data definition statements is picked up from the DSCBs (the data sets allocated must be online). The number of extents, plus 1, is multiplied by 16. Thus, each extent has 16 bytes. 2. It executes a GETMAIN macro instruction for the DEB. 3. It places a pointer to the DEB in the DCB and a pointer to the DCB in the DEB. 4. It sets the pointer to the UCB in each extent (there may be from 1 to 16 extents per volume.) The UCB in each extent points to the direct-access device where the data set (or extent) resides. S. It checks the devices allocated to the data set to see if these devices have the rotational position sensing (RPS) feature and sets a bit in DSCCWI +4 accordingly. If bit 0, 1, or 2 is on and if the data set is being opened for either QISAM scan mode or BISAM, a count of 1 is added to the module count (DEBNMSUB) in anticipation of loading the necessary RPS start I/O appendage. (See the description of these bits in Figure 3, DEBRPSID.) After the GETMAIN macro instruction has been performed for the DEB, IGG0192A moves the byte at DXCCW1+4 to DEBISAD in the DEB; the result is that DEBISAD has its high-order byte cleared to Os if no RPS devices are being used. If RPS devices are being used, the bit is set as shown in Figure 3.

Field Bit Setting Meaning DEBRPSID o Prime is on an RPS device 1 Index is on an RPS device 2 Overflow is on an RPS device 3 An SIO appendage has been loaded (set by IGG0192K)

Figure 3. RPS Identification Field in the Data Event Block

Upon completion, IGG0192A transfers control to the common open executor module IGGOI92B. The primary functions of IGGOI92B are outlined below: 1. IGG0192B uses the DCBBUFNO and DCBBUFL fields (plus 8 bytes for a control field) to develop the buffer pool. 2. It develops the buffer control block (BCB), using DCBBUFNO and DCBBUFL, and uses a GETMAIN from subpool 250 for the BCB space. 3. It also calculates the buffer lengths (using DCBBLKSIZE) and places the calculation in the DCBBUFL field (unless the user sets up his own buffers). 4. The number of buffers (DCBUFNO) field is checked, and if none have been specified, two buffers are allocated for the data set. S. If the computed buffer length is inadequate, IGGOI92B schedules an ABEND with a completion code of hexadecimal 37.

Section 2: Method of Operation 11 6. IGG0192B then returns to the initialization of the DEB, initializing the extent entries with the address and count fields already established in the DEB. The DEB now contains the VCB pointer, the starting addresses of the extents (cylinder, track, and head), and the number of cylinders per extent. ISAM common open executor IGG0192B passes control to common open module, IGGOI92C. The functions of IGG0192C are outlined below: 1.. Free.s the main storage space occupied by all data set control blocks (DSCBs) except the format-l and the format-2 DSCBs. 2. Sets the device type fields (DCBDEVT and DCBOVDEV). 3. If the data set can be shared by two or more tasks (as indicated with a DISP=SHR parameter in the JCL), IGG0192C executes a GETMAIN macro instruction from subpool 255 for the DCBPA (DCB field area), unless the DCBPA was previously obtained for this same data set.

The Validation Modules Modules IGGOI920, IGGOI922, and IGG01950 are open executors used to validate and maintain DSCB and DCB fields for resume load, scan mode, and BISAM. An initial load (or reload) in load mode does not cause execution of the validation modules. The operlitions done in IGGOI920, IGGOI922, and IGG01950 are described in detail below. Thereafter the validation modules are referred to in the load, scan, and BISAM discussions. Modules IGG01920 lind IGOOI922 process fixed-length records and module IOG01950 processes varilible-Iength records. The validation modules may not be executed, although they are entered if the user has specified tqat the datli set may be shared by other tasks (DISP=SHR). They are not executed in that case because another DCB may have already been opened for the data set lind a DeBPA (DCB field area) already set up for the purpose of maintaining the DCB fields ..

Open Ex;ecutorIGG01920 1. Validate and reset, if necessary, the following fields in the format-2 DSCB: a. DS2LPRAD-the address of the last record in the prime-data area. This address is in the form MBBCCHHR and subsequently moved to the DCBLPDA field. b. DS2PRCTR-the number of records in the prime-data area. This count is later moved to the DCBNREC field.

12 OS ISAM Logic Open Executor IGG01922 1. Validate and reset, if necessary, the following fields in the format-2 DSCB: a. DS2LOVAD-the address of the last record in the current independent overflow area. This address is in the form of an MBBCCHHR address and subsequently moved to the DCBLlO field. b. DS2BYOVL-the number of bytes remaining on the current independent overflow track. This count is later moved to the DCBNOV field. c. DS2RORG2-the number of tracks remaining in the independent overflow area; subsequently merged into the DCBRORG2 field. d. DS20VRCT-the number of records in all overflow areas; later merged to DCBNOREC. These fields may be incorrect if the data set was previously closed improperly.

Open Executor IGG01950 1. Validate and reset, if necessary, the following fields in the format-2 DSCB: a. DS2LPRAD-the address of the last record in the prime-data area. This address will be in the form MBBCCHHR and subsequently moved to the DCBLPDA field. b. DS2LOV AD-the address of the last record in the current independent overflow area. This address will be in the form of an MBBCCHHR address and subsequently moved to the DCBLlOB field. c. DS2BYOVL-the number of bytes remaining on the current independent overflow track. This count is later moved to the DCBNOV field. d. DS2RORG2-the number of tracks remaining in the independent overflow area; subsequently merged into the DCBRORG2 field. e. DS20VRCT-the number of records in all overflow areas; merged to DCBNOREC. These fields may be incorrect if the data set was previously closed improperly. Common Close Phase Executors Like the open executors, the close executors are 1024 bytes in length and overlay each other in the transient area. The common close executor module is module IGG0202D; its functions are as follows: 1. Obtains main-storage space for the format-2 DSCB. 2. Reads the format-2 DSCB, updates it from the DCB, and writes it back into the volume table of contents (VTOC). 3. If operating with QISAM load mode, frees the main storage used for the load mode work area and channel programs. 4. If initial load, sets bit 2 of the DCB status byte field (DCBST). The flow of control through the I/O support routines and the stages of ISAM close executors is shown in Figure 4.

Section 2: Method of Operation 13 Input/output support Close routine

~

OISAM load mode close executors OISAM scan IGG02021,or BISAM mocle close IGG02028, close executor executor IGG0202J, IGG02029 IGG0202A IGG0202K, IGG0202L, IGG0202M I

ISAM common close executor IGG0202D

Input/output support Close routine

Figure 4. Flow of Control through the Close Executors

Queued Indexed Sequential Access Method, Load Mode

The load mode of QISAM is used to create (or recreate) indexed sequential data sets and may also be used to reopen existing data sets to add records to the end of the prime-data area. Creating a data set is called initial loading; recreating one is called reloading; and reopening a data set is called resume loading. (See as Data Management Services Guide, GC26-3746, for a user-oriented discussion of resume loading.) Since it is part of the queued access method, load mode handles all required buffering, blocking, and I/O activity synchronization. There are three groups of QISAM load mode routines: • The open phase The processing phase • The close phase The open phase routines include executor modules that perform tasks needed to open a data set, initialize data areas, and prepare to load other routines for the processing phase. The open phase executors receive control from the Open routine. The processing phase routines include the Put routine (which receives control and is executed when a PUT macro instruction is issued in the user's program), appendages, and channel programs. The processing phase routines perform the actual access

14 OS ISAM Logic method functions in QISAM load mode. The close phase routines perform functions essential to closing the indexed sequential data set when all processing phase operations are finished. The close phase routines are executor modules that receive control from the Close routine.

Load Mode Open Phase Operations There are two stages of IS AM open executors. The first stage executors are entered for all indexed sequential access methods and are the common open executors (see Figure 2). The second stage open executors for load mode receive control from the common open executors. These second stage executors perform initialization operations required for load mode processing, whether creating, reloading, or resume loading the data set, with either variable or fixed-length records. The second-stage executor for load mode (module IGG01921) is entered for both initial and resume loading to provide main storage space for the load mode work area. ISLCOMON is the load mode DCB work area and contains the input/output blocks (lOBs), location tables, counters, and various pointers. The load mode processing modules and channel programs refer to and modify· the ISLCOMON area. The lOBs, tables, and pointers in ISLCOMON are used in scheduling, controlling, checking the load mode processing operations, filling the buffers with records, loading these records into the ISAM data set, and referring to these records and their locations in the various ISAM indexes. Besides obtaining main storage space for an initializing ISLCOMON, the beginning open executor for load mode determines if the user intends to create a new ISAM data set (initial load), to reload an old data set, or to reopen an existing data set.

Initial Load or Reload Open Operations For the initial load or reload of an ISAM data set, the ISAM load mode open executors structure, allocate space for, and format the prime-data area, the track-index area, and, if specified, the high-level index areas. An initial load open module (lGGO 192G) also initializes fields in the ISLCOMON area to be used by the load mode buffering routines. The initial load or reload open routines of the load mode open executors also determine whether or not the last track of the track index for each cylinder will contain one or more data records, (that is, shared track). If there is to be a shared track, temporary records representing each track-index entry (preformat) must be written so the first data records can be written before the actual index entries are developed and written. Refer to the descriptions of modules IGGOl92D and IGG0192S in the discussion of "Load Mode Open Phase Organization" for further information on the preformatting of shared tracks.

Resume Load Open Operations When opening an existing ISAM data set to add records at the end of the prime-data area (resume load), the load mode open executors for resume load must ensure that the addressing control fields for prime, index, and overflow records are accurate and usable for locating the last records in each area and loading additional records into the data set. Control fields for buffering and record-moving logic must be initialized in accordance with the dimensions of the already created data set; this is also done as part of the resume load open operations. (Refer to "Resume Load Open Organization" for further details.)

Section 2: Method of Operation 15 Full-Track-Index-Write Open Operations The full-track-index-write feature of load mode allows for accumulating and writing a full track of track-index entries as a group rather than singly (refer to "Appendix A: ISAM Data Set Organization"). The track-index entries are accumulated in the track-index save area (TISA) shown in Section 5. A full track of track index is written into the track-index area of the data set when the TISA is full, when end-of-cylinder is reached, or when the data set is closed. When the user opens the DCB for load mode and specifies the full-track-index-write option (DCBOPTCD=U), the load mode open phase executors perform operations especially for the initialization of the full-track-index-write feature. These operations include acquiring the track-index save area, and initializing channel program 20 to write the track-index entries from the TISA to the direct-access storage device.

The Final Load Mode Open Phase Operations The final load mode open phase operations are performed for all load mode open options. The final load mode open executors: 1. Load the needed ISAM load mode modules containing the appropriate routines, appendages, and channel programs. 2. Initialize and execute channel program 19 for preformatting shared track in Area Z of ISLCOMON when required. 3. Initialize channel programs 20 and 21 for writing track-index and high-level index entries.

Load Mode Open Phase Organization

Load Mode Open Executor IGG01921

As indicated in the load mode open operations discussion, the first load mode open executor, module IGGOI921, is entered for both initial and resume load. The operations for this module are outlined below. 1. Obtains main-storage space for the load mode work area (ISLCOMON) and sets the work area pointers. 2. Fills in the load mode input/output blocks (lOBs) in ISLCOMON. 3. Determines from the DISP parameter the user's intent to reload the data set; resets the DCB status bits if necessary, and reinitializes the data set in accordance with DCB parameters supplied in the DD statement. 4. Calculates and sets the DCBHIRPD field (highest record that can be written in the prime area) and the DCBHIROV field (highest record of overflow). 5. Determines if track capacity of the independent overflow device is sufficient to contain the maximum length record for an overflow chain (the longest possible record in an overflow chain). 6. Checks the data control block for contradictory specifications; issues an ABEND macro instruction if RKP + key length is greater than LRECL.

16 OS ISAM Logic Upon completion of module IGGO 1921, the selection of modules to continue load mode open operations depends on whether initial or resume loading is to take place: this is indicated by Figure 5 which shows the flow of control through the load open executors.

ISAM common open executor IGG0192C ~~~-e------~------Load Open Executors

Resume Loadlllg IGG01921 Variable Fixed length length l___ Initial Load Records Records I' (or reload) I

Cylinder/Master Indexes IGG01920 IGG01920 On On On 2301 2321 Other '--_...,-_..... DeVice IGG01950

IGG01922 IGG01925 IGG01927 IGG0192E I

IGG0192F IGG0196D

IGG0192G IGG0195G

Cylinder Mdster ~exes IGG0196G

IGG0195D

A

Figure 5 (Part 1 of 2). Flow of Control through Load Mode Open Executors

Initial Load Organization If an indexed sequential data set is to be created, the first load mode open executor (IGGO 1921) passes control to module IGGO 192D.

Section 2: Method of Operation 17 No FuJI Track Index Write Fu II Track Index Write ~ Open Executors FTIW

IGG0195T

FTIW

IGG0195U

------Write-checking No Write-checking I I

IGG0192U IGG0192R I I Fin al Load Mode Op en Executors

IGG0192S

Write-checking + No Write-checking I I

IGG0192V IGG0192T I I -----t------

I/O support Open routine

Figure 5 (Part 2 of 2). Flow of Control through Load Mode Open Executors

18 OS ISAM Logic Load Executor IGG0192D

IGG0192D calculates several control fields needed in load mode processing. Listed below are some of the primary functions performed by module IGG0192D in structuring the prime-data area and calculating various DCB fields needed to allocate direct-access device storage for track, cylinder, and master indexes: 1. Determines if the higher levels of index are to be used and where they are to be located. 2. Determines whether the track index will share a track with prime-data records (shared track). 3. Uses the DEBFIEAD field (indicates if high-level indexes are to be used and set from the user-specified OPTCD parameter in the DCB) to determine whether high-level indexes are to be used. If the user has not specified an independent index area, the DEBNOEE field is used to determine whether an independent overflow area has been specified. 4. Module IGGO 192D also sets indicators to specify whether the independent index, the independent overflow, or the prime area is to be used for the high-level indexes when they are requested by the user. The indicators are passed to module IGGOI92E, module IGGOI925, or module IGGOI927 when high-level indexes are required. Module IGG0192D transfers control to module IGG0192F if high-level indexes are not needed. 5. Before transferring control, module IGG0192D establishes several fields in the DCB work area, ISLCOMON, to be used by other open modules. 6. Determines if the last index track can be shared by calculating the number of index entries required per cylinder and dividing by the number of entries that fit on a track, to yield the number of entries on the final track and the portion of the track available for data. 7. If a 3330 device is being used, IGGOI92D treats the cylinder value on the device as a halfword. It also refers to the two halfwords, defined in IGGO 1921 (described previously), rather than to the I/O device table for its track capacity calculations for prime-data records. A similiar field is used during open processing for the analogous calculations on the index device. However, this field is already defined in the DSECT for the QISAM load mode work area and is returned to its normal usage at the completion of open operations. The index backup routine in IGGOI92D set bits 1 or 2 of DEBRPSID, if necessary, as does IGGOI95D.

The Load Mode Open Executors IGG0192E, IGG01925, and IGG01927

If in the initial loading (creation) or reloading of an ISAM data set, cylinder or master indexes are specified, then executor IGG0192D passes control to module IGG01925 if the indexes are on a 2301 device, module IGGOI927 if the indexes are on a 2321 device, or module IGG0192E of the indexes are on any other device. The functions of these executors are outlined below: 1. Structures the high-level indexes, using information from the data fields established by module IGGOl92D.

Section 2: Method of Operation 19 2. Allocates space for the cylinder and/or master indexes in the independent overflow, or prime areas depending on the user's specifications (in his DCB and data definition statements).

Load Mode Open Executor IGG0192F

If cylinder or master indexes are not required in the initial load for creating an ISAM data set, then module IGG0192D passes control directly to module IGGOI92F, instead of IGGOI92E, IGGOI925, or IGGOI927. Executor IGG0192F might also receive control from IGGOI92E, IGGOI925, or IGGOI927 after the high-level index areas have been structured. The primary functions of IGG0192F are: 1. Initializes several index location table pointers (the ISLIXLT fields in ISLCOMON) to point to high-level indexes if these indexes have been created by module IGGOI92E. 2. Initializes pointers in the DCB to the high-level index entries. 3. Places the calculated amount of storage needed for cylinder and master indexes in the DCBNCRHI field. This field of the DCB is useful to the user if he later needs to bring the high-level indexes into main storage to search them. 4. Module IGGOI92F also computes the number of tracks available for independent and cylinder overflow and places this calculation in the DCB, the JFCB, and the DSCB. Note: When the JFCB or DSCB are modified, they are scheduled for rewriting.

Load Mode Open Executor IGG0192G During the initial loading of an ISAM data set, control is transferred from module IGG0192F to executor module IGGOI92G. 1. Module IGGOI92G sets up the buffer control table (IOBBCT) used by the Put macro processing modules. 2. Formats and initializes several fields in the DCB work area (ISLCOMON) which are used later in load mode processing. These fields include: • ISLCBF - a pointer to the buffer to be loaded next by the Put processing routine. • ISLBMPR - calculated by adding the logical record length to the key length and used to facilitate "stepping through" a series of records in blocked buffers. • ISLFBW - (equal to the number of buffers specified in the DCB minus 1) used to determine when buffers are filled and can be scheduled for writing. • ISLEOB - contains the end-of-block address calculated from adding the contents of the DEBBUFL field to the starting address of the buffer. Resume Load Open Organization If the user is adding new records to the prime area of a previously created data set (resume loading), then module IGG01921 doesn't pass control to module IGG0192D and the rest of the initial load modules; instead, control goes to the resume load modules beginning with IGGOI920 (and IGGOI922) or IGGOI950. The beginning open executors for resume load ensures the accuracy of the required DSCB and DCB fields. If the user is resume loading a data set containing fixed-length records, module IGG01920 is the first module entered. If variable-length records are being added to the prime area, module IGG01950 is entered first.

20 OS ISAM Logic Load Mode Open Executor IGG0196D

From module IGGOI922 or module IGGOI950, module IGG0196D is given control during the opening of a DCB for resume load. The functions of IGG0196D follow: 1. Sets up the buffer control table. 2. Sets up the R, F, and P bytes for the current-normal and current-overflow track-index entries. 3. Initializes and executes channel program 31 A which reads the key portion of the last overflow track-index entry of the last cylinder. CP 31A reads this last overflow track-index entry into the key save area of ISLCOMON. 4. If necessary, module IGG0196D initializes and executes channel program 31B. CP 31B is used when the last prime-data block allocated for the data set is not full. CP 31B reads this unfilled last prime-data block into the first buffer specified in the buffer control table.

Load Mode Open Executor IGG0195G

The next module, after IGGOI96D, to be executed during open processing for resume loading is module IGG0195G. IGG0195G is the resume load counter - a part of the initial load module IGGOI92G. Both modules calculate and initialize fields in the ISLCOMON area for buffer and record management in load mode. IGG0195G also: 1. Sets up ISLCBF, ISLEOB, ISLBMPR, and ISLFBW in the load mode DCB work area (ISLCOMON). (See module IGGOI92G, and the ISLCOMON area in "Section 5: Data Areas.") 2. Sets the DCBMSW A field to the direct-access device address (MBBCCHH) of the next-to-Iast track in the last prime-data extent. The DCBMSW A field normally contains the address of a user-supplied work area used when records are being added to an existing data set. 3. Initializes record moving logic. 4. Initializes Area Y, the load mode processing work area containing a high-level index entry, and normal and overflow track-index entries. Area Y is shown in Figure 68. ISLVPTRS (in ISLCOMON) points to area Y.

Load Mode Open Executor IGG0196G 1. Sets the count fields in ISLCOMON as follows: ISLNCNT - the count field for the current normal-track-index entry. ISLOCNT - the count field for the current overflow-track-index entry. ISLDCNT - the count field for the current dummy-track-index entry. 2. Sets the count field in the first buffer. 3. Checks the DCBST field to determine where the data set is loaded. 4. Reads in the last block to determine setting of appropriate lOBS field in buffer control block (BCB).

)

Section 2: Method of Operation 21 Load Mode Open Executor IGG0195D

If the user has no high-level indexes (cylinder or niaster indexes), then upon completion of module IGGOI96G, all the open executors used for resume load only will have been executed; the flow of control will pass to the rest of the load mode open executors which are used for both initial and resume load. However, if during the opening of a DCB for resume loading, high-level indexes are required, control is transferred from module IGG0196G to module IGGOI95D. The functions of IGGOI95D, the last resume load open executor, are described below: 1. Initializes the index location table (ISLIXLT) in the load mode DCB work area (ISLCOMON). ISLIXLT contains the beginning and ending address for each level of index above the track index. 2. Corrects the bin number in the index location table if the direct-access device being used is a 2321.

Full-Track-Index-Write Phase Organization

If the full-track-index-write option has been selected by the user, two load mode open executors (used exclusively with full-track-index-write initialization) are entered. These modules are IGG0195T and IGGOI95U. Both modules are executed during a resume load when the full-track-index-write option has been selected. For an initial load, module IGG0195U receives control from IGG0195T but is not executed. Modules IGG0195T and IGG0195U are both described below.

Load Mode Open Executor IGG0195T 1. Calculates the size of the track-index save area (TISA). When the full-track­ index-write feature is selected, the TISA is used by the full-track-index-write­ put routine module (either IGGOI9I1 or IGGOI92, see Figure 11) to accumulate track-index entries and write them as a group. This is done once for each track of track index. (The full-track-index-write is described in "Load Mode Processing Phase Operations.") 2. Calculates the size of the appropriate version of channel program 20. 3. Obtains main-storage space for both the TISA and CP 20 and initializes both. If main-storage space is not available, the full-track-index-write feature will not be employed.

Load Mode Open Executor IGG0195U

If the data set is being opened for resume loading, IGG 1095U initializes the track-index save area and CP 20 to resume writing track-index entries. Otherwise, IGGO 195U transfers control to the final load mode open executors.

The Final Executors in Load Mode Open Phase Organization From the resume or initial load open modules, and from the full-track-index-write modules (if used), control is passed to the final load mode open modules which are used for all forms of load mode open processing. (

22 OS ISAM Logic Load Mode Open Executor IGG0192U

The first of the final open executors entered may be either module IGG0192U or IGGO 192R. IGGO 192U receives control if the user has specified that write-checking is used; module IGGOI92R receives control if write-checking is not used. 1. Load the modules that contain the: Macro-time routines - modules IGG019GB or IGG019IB for the Put routine, or module IGG01912 for full-track-index-write routine Appendage routines - module IGG019GD Channel programs - module IGG019GF or IGG019IF 2. Module IGG0192U also obtains main-storage space for the channel programs needed by the processing routines. 3. Module IGGOI92U builds channel program 18 from its skeleton brought in by module IGG019GF or IGGOI9IF.

Load Mode Executor IGG0192R

IGG0192R performs exactly those functions outlined above for module IGGOI92U, except those necessary for write-checking.

Load Mode Executor IGG0192S

Module IGGOI92S receives control from either IGGOI92U or IGGOI92R. 1. This module builds channel program 19 from its skeleton. CP 19 is used to initialize the cylinder overflow record and to preformat shared tracks when II,,,

) required with fixed-length records. ~' 2. If a track is being shared, the temporary index entries on the shared track of the first cylinder are written. This is referred to as preformatting the first shared track. Channel program 19 is used to preformat shared index tracks and to write the cylinder overflow control record (COCR). The preformatting of shared tracks pertains to fixed-length records only. Area Z in ISLCOMON is used as a work area in pre formatting the first shared track. The description of module IGGO 192D also discusses the shared track feature. 3. This module loads the RPS SIO appendage module (IGG019GG).

Load Mode Processing Phase Operations When loading or resuming the loading of an ISAM data set, the user issues a PUT macro instruction to place the record in the data set. The Put routine moves the record to the buffer. When a specified number of buffers are full, channel programs are scheduled to write the buffers into the prime-data area of the data set and to create or update any required index entries. An appendage routine analyzes the results of each channel program execution. When necessary, the appendage routine will start a new channel program to continue or complete the request, or it will process and resolve errors resulting from the channel program execution. When necessary, the appendage routine will start a new channel program to continue or complete the request, or it will process and resolve errors resulting from the channel program execution. If the original request was successfully completed, the appendage routine returns control to the user. ) Section 2: Method of Operation 23 Information about the data set is communicated among the processing routines and the channel programs in control blocks and work areas. These data areas are described in ( detail in "Section 5: Data Areas." This part describes the processing routine logic, the flow of control through the channel programs, in addition to the relationships of the data areas to each other, the channel programs, and the processing routines.

Put Routine Successive PUT macro instructions cause entries to the Put routine which places records into the data set and creates the necessary indexes. The records must be in data key sequence. The Put routine (shown in Figure 6) may operate in either of two modes: move or locate. In move mode, the routine actually moves a logical record from an input buffer or work area into an output buffer. In locate mode, the routine supplies the address of an output buffer to the processing program, which must then move the record to that buffer. The mode of PUT is specified in the DCBMACRF field of the DCB. The Put routine utilizes the beginning-of-buffer and end-of-buffer subsidiary routines to accomplish buffer management. The Put routine initializes the various channel programs and requests their execution when writing data or indexes. The appendage modules gain control after channel program execution and indicate whether or not the writing was successful. The Put routine first checks to see if the appendage routine has signaled (in DCBEXCDl) an uncorrectable write error on a previous attempt to write either data or index entries. If so, the Put routine takes the exit to the processing program's synchronous error routine, where the user may either issue a CLOSE macro instruction or terminate the task. In any event, no more records will be accepted. The results are unpredicatable if the programmer issues another PUT macro instruction. The Put routine then performs a check on the data key. (In locate mode the key checked is that of the previous record.) If the keys are not in ascending sequence, control is given to the user's synchronous error routine. However, in this case, if the processing program is able to correct the sequence error, it may issue another PUT macro instruction for this record, and continue normal processing. For variable-length records, the Put routine compares the length of the record with the maximum record length specified in DCBLRECL. If it is greater than the maximum record length, the Put routine sets bit 4 of DCBEXCD2 and enters the user's synchronous error routine. The user may either change the record length and reissue a PUT macro instruction for this record or he may reissue one for the next record. The Put routine next determines if the processing mode is move or locate mode.

Move Mode Processing

Fixed-Length Records: If the current buffer is full, the routine links to the beginning-of-buffer routine to initialize a new buffer.

It then moves the user's record to the buffer. If this record completes the buffer, the routine links to the end-of-buffer routine to attempt to write the buffer. If the buffer is not full but a write-channel program is available, the routine uses the end-of-buffer routine to attempt to write any previously filled buffers which could not be written for lack of a channel program. ( 24 OS ISAM Logic The routine then returns control to the user. Variable-Length Records: If the record format is blocked and the record fits in the current buffer and/or on the current track, it is moved into the buffer and control is returned to the user. If the record format is unblocked or if the current buffer is full, control is passed to the end-of-buffer routine to schedule the current buffer for writing. The end-of-buffer routine will pass control to the beginning-of-buffer routine to initialize the next buffer. Then the record is moved into the new buffer and control is returned to the user.

PrevIous Yes permanent I/O error

No

Error Sequence check Set error signal

Okay

EOB routine

Locate Current Yes Mode Attempt to wnte buffer full current buffer

Move

BOB routine

Yes Current buffer full Initialize new buffer Provide buffer pOinter Initialize new buffer

No

Move record to buffer

No Channel program No Current buffer full available

Yes Yes

EOB routine EGS routine

Attempt to wr,:~ Attempt to write current buffer prevIOus buffers

Figure 6. Load Mode Put Routine

If the record does not fit on the current track either as part of the current buffer or as another block, the current buffer is marked as the last for the current track. Control is

Section 2: Method of Operation 25 then passed to the end-of-buffer routine to schedule the current buffer for writing. The end-of-buffer routine passes control to the beginning-of-buffer routine to initialize the next buffer. The record is moved into the new buffer and control is returned to the user.

Locate Mode Processing

Fixed-Length Records: If the current buffer is full, the Put routine links to the end-of-buffer routine to attempt to write the buffer just filled and then immediately links to the beginning-of-buffer routine to initialize a new buffer. If the current buffer is not full but channel program 18 is now available, the routine links to the end-of-buffer routine to attempt to write any buffers that could not be written previously because the channel program was in use. The locate Put routine then provides the processing program with the address of an available buffer and returns control to the processing program. Variable-Length Records: The Put routine computes the number of bytes remaining in the current buffer, using the buffer size and subtracting the sum of the logical record lengths of the records that have already been placed in the buffer by the user. Then the routine determines if another record of maximum LRECL can be placed into the address of the available position in the buffer. Otherwise, if the number of bytes remaining in the buffer is less than LRECL or if record format is unblocked, control is passed to the EOB and BOB routines, as described in the discussion of move mode. If it is determined the LRECL bytes added either to the current buffer or as another block exceeds the remaining capacity of the current track, the current buffer is marked as the last for the track. Control is then passed to the EOB and BOB routines.

Locate cou nt field In prevIous buffer

Will new count Yes Yes Preformat start new cylmder Preformat new cylinder

No No

Initialize new buffer

Figure 7. Load Mode BOB Routine

26 OS ISAM Logic Beginning-of-Buffer Routine The beginning-of-buffer routine (shown in Figure 7) initializes a new buffer and determines the device location into which the buffer will eventually be written. If the records are fixed-length and the location for this buffer proves to be the first location available for data records on a new cylinder, CP 19 may be called to preformat the track index of the cylinder if it is to contain a shared track and/ or a cylinder overflow control record. In the preformatted records, only the count field is significant. If writing this buffer causes the data set to exceed the prime-data space allocated to it, or if the appendage routine has indicated that a~ uncorrectable write error occurred during an attempt to add the previous contents of this buffer to the data set, the beginning-of-buffer routine takes the exit to the processing program's synchronous error routine. The user may either issue a CLOSE macro instruction or terminate the task. In any event, no additional records will be accepted when either of these errors occurs. The end-of-buffer routine is entered when the Put routine has determined that the current buffer is full. The EOB routine initiates writing of the current buffer and any previously filled buffers not yet written under these conditions: when the current buffer is marked as the last one for the current tracks, or when the number of buffers ready for writing is equal to the value of ISLFBW.

End-of-Buffer Routine The number of buffers that must be filled in order for a write to be scheduled (so that the number of writes per track is kept minimal) is maintained in the field ISLFBW. Its content depends on the number of buffers in the pool; however, it does not exceed the number of buffers necessary to fill an empty tracy: if one is to be started or to fill a partially written track if one has already been started. If a channel program is available and if the number of full buffers is equal to the content of ISLFBW, the end-of-buffer routine (shown in Figure 8) schedules a write channel program for that number of buffers and then recomputes the number. If a track or cylinder is to be completed, it also schedules channel programs to write index entries.

Schedule Compute number channel of buffers to be program(s) written next

Figure 8. Load Mode EOB Routine

Section 2: Method of Operation 27 Fun Track-Index-Write The full track-index-write is an option for load mode that may be selected by specifying DCBOPTCD=U.

Channel End Channel End CP 18/20 CP 19

Reset CP 18/20 busy bit

No

Set CP start address Set status bits 'Buffer Available' for to skip cylinder each buffer written overflow control

Update pOinter to I nltlall2e next buffer group to count fields be written (IOBPTRAI In area Z

Channel End CP 21

Construct entry In area Y portion of load mode work area

Initialize CP 21 to wnte master Index entry

Note CP 21 writes the cylinder and master Index entries on Initial entry to the cylinder Index entry already written

Figure 9. Load Mode Channel-end Appendage Routine

When the full-track-index-write option is specified, ISAM accumulates track-index entries in a track-index save area (TISA) obtained during open processing and writes these entries as a group, once for each track of track index. The TISA obtained during open processing is preceded by a 20-byte control field which controls placement of entries. If an area of sufficient size is not available for the TISA, ISAM defaults to the usual mode of processing. (Normal and overflow entries written at the end of each prime-data track.)

28 OS ISAM Logic The TISA is written when it is full, when end-of-cylinder is detected, or at processing time.

Appendages There are both channel-end and abnormal-end appendages (shown in Figures 9 and 10) for the channel programs of load mode.

Channel-End Appendage: The channel-end appendage for CP 18 and CP 20 indicates successful completion of the channel program to the Put routines. The channel-end appendage of CP 21 indicates successful writing of an index record and determines whether a higher level index entry is needed. If so, it creates that index entry and issues an EXCP so that entry will be written. The channel-end appendage of CP 19 receives control after ten index entries have been written on a shared track and checks to see if more are needed. If the track is not yet full, it continues to issue EXCP commands until the track is properly formatted.

Abnormal-end Appendage

Permanent No 110 error

Yes

CP 18 Yes Set status bits Move first 16 bytes prime data of buffer(sl of lOB to load In error mode work area

Load reg O-address Set DCBXCD1 of buffer I n error, uncorrectable reg l-address of first 110 error 16 bytes of lOB

Figure 10. Load Mode Abnormal-end Appendage Routine

When write-checking has been specified, the CP 18 and CP 19 channel-end appendages reinitialize those channel programs to reread the data or index entry written before indicating successful completion. Appendages do not modify the channel programs when CP 20 and CP 21 are used with write-checking, because those channel programs are designed to read back without modifications.

Abnormal-End Appendage: The abnormal-end appendage for CP 18, upon finding a permanent error, identifies the buffer in error, saves the contents of the appropriate input/output block (lOB), and indicates the error to the Put routine. The abnormal­ end appendages for CP 19, CP 20, and CP 21 also indicate permanent errors to the Put routine.

Section 2: Method of Operation 29 When write-checking has been specified, the CP 18 and CP 19 abnormal-end appendages have an additional function. If an error (for example, data check) is detected during read-back, the appendage reinitializes CP t 8 or CP 19 for writing and issues the EXCP command.

Load Mode Processing Phase Organization The processing routines of load mode include one module that contains the Put routine and its subsidiary routines: the beginning-of-buffer (BOB) routine and the end-of-buffer (EOB) routine. In addition, there is one module of appendages and one module of channel programs. Each of these modules exists in several versions; the version selected and executed depends on the options specified by the user. Load mode open executors, IGGOI92U and IGGOI92R, load the proper version according to the user's program options. Figure 11 shows the load mode processing modules.

Module Name Additional Considerations Function

IGG019GA No write-check Fixed-length Records Put processing contains Put IGG019GB Write-check routine, EOB routine, and BOB routine. IGG0191A No write-check Variable·length Records IGG0191B Write-check

IGG01911 Full track index write No write-check (Fixed·length records only) IGG01912 Write-check

IGG019GC No write-check Put appendage routines- channel-end and IGG019GD Write-check abnormal·end.

IGG019GE No write-check Fixed·length Records Channel program skeletons- IGG019GF Write-check contains CP 18, CP 19, CP 20 and CP 21. IGG0191E No write-check Variable-length Records IGG0191F Write-check

IGG019GG RPS SIO appendage

Figure 11. Load Mode Processing Modules

30 OS ISAM Logic r---BOB Routine ----, I I I Calculate device I I address for buffer I I I I I Yes I I I Will this buffer begin neVJ >--+---"II~ I cylinder entries to be

I ~NO~ ____4- ______~No L__ _ r------EOB Routine ---I I I Update extent Will this I I number and I extent address extent I I No I I I Yes I I buffer begm new >--+-'-::jo..j I cylinder I No No I I I Will this Yes Full track buffer begin new >-+'-< Index write I track option I No I Accumulate I track Index I entry In T I SA I CP 18/20 Appendage IL ______

Figure 12. QISAM-Load Mode Channel Program Flow (Fixed-Length Records)

Channel Programs The channel programs (except CP 31 and CP 91) exist in write-checking and no-write-checking versions. CP 19 and CP 20 also exist in different versions for fixed-length records and variable-length records. Figure 11 shows which channel program skeleton modules are loaded for each combination of user options. Flow of control through the channel programs is shown in Figure 12 for fixed-length records and in Figure 13 for variable-length records.

Section 2: Method of Operation 31 BOB Routine r--- I

I Calculate device I address for buffer I L __ _ r---EOB Routme ----, I Update extent Ilumber and I extent address I

No Will this buffer beglll new >-+-_"'1 cylillder

Cylinder overflow option

Will this buffer beglJl new >-+-_~ track

No

I I I I I L_

Figure 13. QISAM-Load Mode Channel Program Flow (Variable-Length Records)

CP 18 Used to write prime-data records. CP 19 Fixed-length Records: used to initialize cylinder overflow record and shared index tracks (preformat).

Variable-length Records: used to initialize cylinder overflow control record. CP 20 Used to write track-index entries.

32 OS ISAM Logic CP 20A Used to write a full track of track-index entries on a nonshared track of track-index entries. CP 20B Used to write a shared track of track-index entries. CP 20C Used to perform write-checking for CP 20A and CP 20B .. CP 21 Used to write cylinder and master-index entries. CP 31A Used to read the key portion of the last overflow track-index entry of the last prime-data cylinder into the key save area. (Resum~ loading only, located in IGGOI96D.) CP 31B Used when the last prime-data block is not full enough to read it into the first buffer specified in the buffer control table. (Resume loading only, located in IGGOI96D.) CP 91 Used to fill unused index tracks with inactive and dummy entries. (CP 91 is located in IGG0202K.)

Control Blocks and Work Areas Information about the data set and processing requests is carried in various control blocks and work areas. The relationship of these areas to each other and to the data set and processing programs is shown in Figure 14.

Load Mode Close Phase Operations The first load mode close executor is entered from the Close routine. When all previously scheduled writes are finished, the load mode close executors complete the data set activity for load mode. The load mode close phase: • Pads the last buffer • Completes the writing of buffers • Completes the writing of index entries • Writes end-of-data mark • Pads track indexes on unused cylinders • Pads high-level indexes Load Mode Close Phase Organization The close phase of QISAM load mode comprises six executor modules that perform operations required to complete data set activity when a previously scheduled write operation is completed.

Section 2: Method of Operation 33 DCB DCB WORK AREA IISLCOMONI Channel Programs o ECB I 10BA -_ 14 DCBBUFCB 2C ECB I 10BB ...... -- CP 18 ;----120 DCBDEBAD f-c-,---t------j -''-, -, - 5B EeB I IOBC - ...... , " ~,: -.....1-______-1 ' B4 Area Z (Preformat Work Areal " ," , .. CP 20/20A \'" \ " DC Index Location Table CP 21 E4 DCBWKPTl ~ '" , --.- FO DCBWKPT4 DC " ~J------l F4 DCBWKPT5 144 Various buffer/data set work ...... -..,. CP 19/91 Fa DCBWKPT6 fIelds and pOinters ~ L-~L------J-----~~r------i ------~---C-P-3-,A-I-3-,B--4

ISLVPTRS CP 20B (Pomters to CPs, Area Y )

CP 20C Buffer Control Table

TISA DEB Area Y B -20 t SID appendage r Key save Area - -18 t CE appendage table -14 t AE appendage table qs ISAM DATASET PrefIX section

Index 18 DEBOCBAD BasIc section ~ __ rBU~FrF~E~RS~ ______, '-- lC DEBAPPAD 20 # Index DE8FIEAD 0.Fjr- ,.- 24 # Prime DEBFPEAD M ~ 0 ~ 28 # Overflow DEBFOEAD extent \..:::;: 2C t ISAM ExtenSion (- Prime extents Prime (- Index extents = (- Overflow extents (- Overflow Module 10 table =

t Put module

Vector table RPS 810 Put module Put appendage appendage module

NOTE DIsplacements ate In hexadeCimal

Figure 14. Load Mode Control Blocks and Work Areas

Load Mode Close Executor IGG0202I After receiving control from the Close routine for a fixed-length record data set, IGG0202I does the following: 1. Pads (fills with dummy records) the last buffer, if necessary 2. Writes all filled but unwritten buffers 3. Completes the index entries

34 as ISAM Logic Load Mode Close Executor IGG02028 This module receives control from the Close routine for variable-length record data sets only. It then: 1. Pads the last buffer when necessary 2. Writes all buffers that are filled but not yet written into the data set 3. Completes the index entries so these reflect the complete data set

Load Mode Close Executor IGG0202J 1. Writes the end-of-data mark after the last data record 2. Writes the end-of-file mark in independent overflow

Load Mode Close Executor IGG0202K 1. Performs calculations for modules IGG0202L and IGG0202M in padding unused index space 2. Initializes channel program CP 91 which is used to fill unused index tracks with inactive dummy entries

Load Mode Close Executor IGG0202L 1. Writes the final dummy end-index entry. 2. Pads, with inactive entries, the unused track-index space of the cylinder containing the last prime-data record. Module IGG0202L uses ISLNIRT to signal the end-of-track index padding.

Load Mode Close Executor IGG0202M 1. Determines if higher level indexes exist and, if so, writes the final dummy entries for them. 2. Pads any unused index space with inactive entries. (See "Appendix A: ISAM Data Set Organization" for information on dummy entries and padding.) The flow of control through the close executors is shown in Figure 15. After the mode-oriented close executors have completed their functions, the ISAM common close executor (IGG0202D) receives control. After completing the closing functions common to all ISAM, it returns control to the input/output support close routines.

Queued Indexed Sequential Access Method, Scan Mode

The scan mode of QISAM retrieves and updates the records of an indexed sequential data set in a manner similar to that of the queued sequential access method. There are three phases of scan mode routines: • The open phase • The processing phase • The close phase

Section 2: Method of Operation 35 Input/Output Variable-length Records Support Close Routine

Fixed-length Records +

IGG02021

IGG02028

IGG0202J

t

IGG0202K t

IGG0202L

t

IGG0202M t

ISAM common close esecutor IGG0202D t Input/Output Support Close Routine

Figure 15. The Flow of Control through QISAM Load Mode Close Executors

Scan Mode Open Phase Operations The ISAM common open executors are executed when an indexed sequential data set is opened and is to be processed by scan mode. The last ISAM common open executor passes control to the scan mode open executors. The scan mode open executors: 1. Move format-2 DSCB items to the DCB 2. Construct the DCB work area 3. Load the scan mode modules 4. Initialize channel programs and free queues.

36 as ISAM Logic Scan Mode Open Phase Organization The scan mode open executor modules are IGGOl920, IGGOl922, IGG019S0, IGGOl928, IGGOl929, and IGGOl924. The common open executor IGG0192C transfers control to the beginning open executors which are the validation modules, IGG01920, IGG01922, and IGG019S0. The validation modules ensure that the DSCB and DCB fields needed are still accurate. If the data set contains fixed-length records, module IGG01920 will be the first module entered. For variable-length records, module IGG019S0 is entered first. IGG01920, IGG01922, and IGG019S0 are described in the common processing module description part of this manual. Upon completion, the validation modules pass control to the first executor used exclusively in opening for scan mode, module IGG01928.

Scan Mode Open Executor IGG01928 1. Obtains main storage space for and structures the QISAM scan mode DCB work area (see "Section 5: Data Areas"). 2. Loads scan mode processing modules processing routines. 3. Loads module IGG019HL which contains the channel program skeletons. 4. Moves the required channel program skeletons into the scan mode work area (see Figure 26). This includes moving one copy of the read/write channel program, CP 22, into the work area for each buffer. s. Deletes the channel program skeleton module, IGG019HL, from main storage. 6. Tests the bits at DEBRPSID for an RPS device. If any of the bits are on, the scan mode RPS SIO appendage, IGG019HA, is loaded by executor IGG01924. A GETMAIN macro instruction for a 16-byte larger work area is issued to allow for the channel program prefix required RPS devices.

Scan Mode Open Executor IGG01929 1. Initializes the channel programs loaded by module IGGOl928 in the DCB work area. If necessary, it initializes these channel programs to their non-RPS state. 2. Chains the copies of CP 22 together. Assigns a buffer to each copy of CP 22.

Scan Mode Open Executor IGG01924 1. Moves the format-2 DSCB fields needed into the DCB. (See modules IGG019S0 and IGGOl920 in Section 2.) 2. Loads the RPS SIO appendage if required. (See module IGG01928 above.) 3. Completes the initialization of the scan mode work area. 4. Obtains the interruption request block (IRB) that is used by the supervisor to maintain information concerning an asynchronous routine located in the Get appendage module (IGG019HG). Among the information in the IRB is the entry point address (RBEP-see the IRB as shown in Figure 26) of the asynchronous routine within module IGG019HG. (See the discussions of the scan mode Get routine and the appendages for further information on this asynchronous routine.)

Section 2: Method of Operation 37 S. Calculates WlICNOT, which is equal to the integer that contains the number of buffers (DCBBUFNO) divided by (WlICNOT=BUFNO/2). WlICNOT is located in the scan mode DCB work area, and is used in scheduling input/ output requests. The read/write channel program (CP 22) is only scheduled if the WlICNOT field is set.

I IGG0192C I

IGG01950 IGG01920

I , IGG01922

IGG01928 ~

IGG01929

~..

IGG01924

~ os Open routine

Figure 16. Flow of Control through Scan Mode Open Executors

Scan Mode Processing Phase Operations QISAM scan mode is designed to read records from and/or write records back to an ISAM data set, selectively. Scan mode may be used to retrieve and update indexed sequential data records sequentially or randomly. The basic features of scan mode that make it able to retrieve and update records from any point in the data set are: A buffer controlling technique that allocates a copy of the read/write channel program (CP 22) to each buffer. • Several logical buffer queues to which each copy of CP 22 and the buffer that the CP 22 points to may be moved. Figure 17 illustrates the chaining of channel program 22 and the buffers on these queues.

38 OS ISAM Logic • Use of the WlICNOT field in the scan mode DCB work area. WlICNOT is equal to the number of buffers being used (DCBBUFNO/2) or the number of records on a prime track, whichever is less. WlICNOT is especially important in the scheduling routine operations. (Refer to the scheduling routine description.) The five macro instructions that cause scan mode processing routines to retrieve and update indexed sequential data records are SETL, GET, PUTX, ESETL, and RELSE. These macro instructions are described fully in OS Data Management Macro Instructions, GC26-3794. The SETL routine sets the starting point of retrieval. The Get routine makes records available to the processing program. The PUTX routine restores the records to the data set. The ESETL routine terminates scanning of the data set. The RELSE routine causes the remaining records of the current buffer to be bypassed. SETL initializes channel programs to search the indexes for the start-of-retrieval point and to read in the first buffer or buffers. GET initializes channel programs to read successive buffers, and PUTX causes the same channel programs to be reset and rescheduled to write the updated buffers back into the data set. The channel programs for scan mode are described in detail in "Appendix B: ISAM Channel Programs." Appendage routines analyze the results of each channel program and initiate further processing operations depending on the status of the channel program's successful or unsuccessful execution. Information about the data set is communicated among the processing routines and the channel programs in control blocks, work areas, and queues. This section shows the relationship of these areas to each other. They are described in detail in "Section 5: Data Areas." This section describes the processing routine logic.

Buffer Control Techniques Buffers are attached, by a copy of CP 22, to anyone of the five buffer queues. (See Figure 17.) These queues are used in controlling input/output operations. The buffers are assigned to particular queues according to the current status of each buffer. • Free queue buffer is not in use. • Read queue buffer is scheduled to be filled (a version of CP 22 reads a record or records into the buffer). • User queue buffer is made available for processing program use by the GET macro instruction. • PUTX queue buffer is flagged as ready to be written. • Write queue buffer is scheduled to be written. The queuing on these buffer queues is handled by the Get routine and its subsidiary routines - the scheduling routine and the end-of-buffer (EOB) routine. However, all scan mode routines handle the buffer queuing to some degree. Figure 18 illustrates the buffer movement during scan mode processing. The buffer queue movements of SETL and ESETL are shown in the upper portions of Figure 18, and the effects of Get and PUTX in the lower portion. The routines that process the queues are indicated on the flowlines to and from queues.

Section 2: Method of Operation 39 Free Queue Read Queue User Queue PUT X Queue Write Queue

First CP First CP First CP First CP First CP

Last CP Last CP Last CP C C I C I C

Channel Program 22 Channel Program 22 Channel Program 22 Channel Program 22

Note: c= The number of buffers in the queue. R= A residue of unused buffers In the Read queue. The R field is used to provide more efficient scheduling of overflow records.

Figure 17. Scan Mode Channel Program/Buffer Queues

ESETL

~ To initiate a Scan To Terminate a Scan

SETL ESETL ESETL

PUT X WRITE Free Read r--- User Queue Queue Queue Queue Queue

Scheduling Routine GET/EOB Routine EOB Routine EOB Routine (If PUTX is Issued) End of Buffer or ESETL

(If No PUTX is Issued)

GET/End of Buffer Routine

Figure 18. Buffer Queuing and Movement in Scan Mode

40 OS ISAM Logic An Example of Buffer Movement in Scan Mode For this example, it has been assumed that the number of buffers=3, the number of logical records per buffer=2, and each GET macro instruction issued is followed by a PUTX macro instruction. Macro Instructions Buffer Movement l. OPEN All buffers (3 buffers in this example) are placed on the Free queue. 2. SETL a. Locate the starting record of the file (or string of records) specified in the SETL macro instruction. b. Place buffer 1 on the Read queue and schedule a read of the specified records into buffer 1; wait for completion of the read. 3. GET (1st GET) a. Move buffer 1, which has been filled, to the User queue. b. Move buffers 2 and 3 to the Read queue and schedule a read operation.

c. Return the address of the first r~trieved record to the user. 4. PUTX Any PUTX will set an indicator that the current record is to be written back to the data set and returned. 5. GET (2nd GET) a. If the outstanding reads from the previous GET are completed, move those buffers to the User queue. b. Return the address of the next input record to the user. 6. GET (3rd GET) a. On the third GET macro instruction, move the processed buffer (buffer 1) to the PUTX queue. (It is assumed that a PUTX macro instruction follows each GET macro instruction in the processing program.) b. Move buffers 2 and 3 from the Read queue to the User queue, unless these buffers were moved to the User queue by the Get routine in step 5. c. Return the address of the next input record in the file to the user. 7. GET (4th GET) Return the address of the next input record to the processing program. 8. GET (5th GET) a. Move the processed buffer (buffer 2, in this instance) to the PUTX queue. b. Move two buffers from the PUTX queue to the Write queue and schedule a write operation. Since the PUTX has been executed for two buffers, a Write may now be scheduled. (See "Scheduling Routine" and "EOB Routine.") c. Return the address of the next input record.

Section 2: Method of Operation 41 9. GET (6th GET) a. If the scheduled write is completed (step 8), move the two buffers from the Write queue to the Read queue and schedule a read. b. Return the address of the next input record. 10. GET (7th GET) a. On the seventh GET, the processed buffer (buffer 3, in this example) is moved to the PUTX queue. b. When the scheduled read is completed (step 9), move two buffers to the User queue. (It may be necessary to wait for the last scheduled write, move the buffers to the Read queue, issue a Read, and wait for that Read before this step can be executed.) c. Return the address of the next input record. 11. GET/PUTX The succeeding GET and PUTX macro instructions repeat steps 7 through 10. Every time a read takes place, 2 blocks will have been filled. For a write to occur, 2 buffers must be filled. 12. ESETL a. Wait for any outstanding read or write to be completed. b. Move buffers from the Read or Write queue to the Free queue. c. Move any buffers from the User queue to the PUTX queue or to the Free queue. d. Move any buffers on the PUTX queue to the Write queue and schedule a write. 13. CLOSE a. Wait for any scheduled, but uncompleted writes to be completed. b. Return all buffers to the buffer pool. SETL Routine The SETL routine (shown in Figure 19) determines the start of a scan by executing a channel program (dependent on the SETL option used) to search the indexes for the first record or block to be retrieved. In scan mode, records are retrieved from the beginning of the data set unless a SETL macro instruction is used. In addition to determining the starting point, the SETL routine initializes the buffer queues. When scanning is initiated, all buffers are on the Free queue. (See "Scan Mode Open Phase Operations. ") However, when subsequent scans are to be initiated, it is possible that buffers remain on the Write queue from the previous scan. When this is the case, the SETL routine moves these buffers to the Free queue after awaiting the completion of any writes in progress. The SETL routine then moves a buffer from the Free queue to the Read queue, initiates a read operation, and upon completion of the read operation, returns control to the processing program. If the SETL routine detects any error condition, it sets the corresponding bit for that error in the DCB exceptional condition (DCBEXCDl) field. (The exceptional condition codes are described in "Section 6: Diagnostic Aids. ") After setting this bit, SETL passes control to the processing program's synchronous error routine (SYNAD). If no synchronous error routine is present, the task is abnormally terminated.

42 OS ISAM Logic SVC 54 Yes Refresh DCB

No

Determine start of scan

Write queue empty

Yes

MoveWnte queue to Free queue

Move one buffer from Free queue to Read queue

Move N/2 buffers from Free queue to Read queue

Figure 19. Scan Mode SETL Routine

When the data set is shared (DISP=SHR), the SETL routine issues an SVC 54 instruction to update the DCB field area (DCBFA). (See "The DCB Integrity Feature" under "The ISAM Common Open Executors.")

Get Routine The Get routine (shown in Figure 20) retrieves records from the data set sequentially and gives the processing program access to a record in the current buffer on the User queue. (SETL fills the first buffer.) The Get routine has two subsidiary routines: the end-of-buffer routine and the scheduling routine.

Section 2: Method of Operation 43 If, on entry from the macro instruction, the user has already been given access to the last record of the User queue buffer currently being scanned, the routine links to the end-of-buffer routine to advance to a new buffer. Then, if a write has been initiated and is complete, the Get routine moves the buffers on the Write queue to the Free queue. If the Get routine finds that an appendage routine has indicated unsuccessful completion of a previous write, the exit to the processing program's synchronous error routine is taken. Another GET macro instruction must be issued before a record becomes available for processing. If the previous attempt to schedule a read has been unsuccessful because of a shortage of available buffers (refer to "Scheduling Routine" for criteria for determining the minimum number of buffers necessary), the scheduling routine is used to make another attempt to execute the read.

EOB routme Yes Advance to new buffer

No

Move Write Write No Yes queue empty Queue to Free queue

Yes

Move Read No Read Yes complete queue to New Read User queue

No

Figure 20. Scan Mode Get Routine

If a read has been initiated and is complete, the routine moves the buffers on the Read queue to the User queue and uses the scheduling routine (refer to "Scheduling Routine") to attempt to schedule a new read. If a buffer on the User queue has been incorrectly read, each GET command issued to that buffer causes control to pass to the synchronous error routine. For blocked

44 OS ISAM Logic records, successive GET commands to the buffer give the synchronous error routine access to each record of the buffer in turn. When the buffer is exhausted and another GET macro instruction is issued, the return to the processing program is normal unless another read error occurred.

EOB Routine The end-of-buffer (EOB) routine, which is shown in Figure 21, moves the buffer just completed from the User queue to either the PUTX queue or the Free queue. It moves the buffer to the PUTX queue if the user has issued a PUTX macro instruction for any of the records in that buffer; otherwise, it moves the buffer to the Free queue. If there is a minimum of N/2 buffers on the PUTX queue and a previous write has been completed, the routine moves the Write queue buffers to the Free queue, the PUTX queue buffers to the Write queue, and initiates a write. If at this point there are buffers on the User queue, the routine returns control to the calling routine. Otherwise, the routine must move buffers from the Read queue to the User queue. If the Read queue is empty, the routine waits for completion if a write is in progress, moves the Write queue to the Free queue and uses the scheduling subroutine to initiate a read and, on completion of that read moves the Read queue to the User queue. If the Read queue is not empty, the routine moves the Read queue to the User queue. It then returns control to the calling routine. Before moving a buffer from the Write queue to the Free queue, the routine ensures that the write operation of that buffer was successfully completed. If not, the synchronous error routine is given control.

Scheduling Routine Processing in the scheduling routine (shown in Figure 22) depends primarily on whether the next record to be read is on a prime-data or overflow track. If an overflow record is to be read, a read may be scheduled if there are at least two buffers on the Free queue. It may also be scheduled if there is only one buffer and that buffer is on the Free queue. Before initiating the read, the routine moves the Free queue to the Read queue. It then returns control to the calling routine. If prime data is to be read, it attempts to schedule a read of N/2 buffers. Provided N/2 buffers are available and at least N/2 blocks remain on the track, this can be done. It can also be done with fewer than N/2 blocks remaining on the track if the track is not the last one of a cylinder and no overflow chain is associated with the track. If these conditions are met, the routine moves N/2 buffers from the Free queue to the Read queue, initiates a read, and returns control to the calling routine. If these conditions are not met, the scheduling routine initiates a read operation to complete the last track of a cylinder or a track having an overflow chain associated with it, provided that sufficient buffers are available on the Free queue. As before, it moves the buffers required to the Read queue, initiates a read, and returns control to the calling routine. If a read cannot be initiated, the routine returns control to the calling routine.

Section 2: Method of Operation 45 Move buffer from User queue to PUTX queue

Move buffer from User queue to Free queue

PUTX queue to Write queue

No

Wnte queue to Free queue

Schedule Read

Read queue to User queue

Figure 21. Scan Mode EOB Routine

46 OS ISAM Logic Ves Ves Free queue to Read queue

No Ves

No

Ves Ves

N/2 from Free queue to Read queue

Move buffers to Enough com plete track Ves buffers on Free Free queue to qu eu e to com· Read queue plete track

No

Figure 22. Scan Mode Scheduling Routine

PUTX Routine The PUTX macro is used in updating data sets. When the PUTX macro instruction is issued in the processing program, the PUTX routine of scan mode will be used (see Processing Routines - Figure 24). The PUTX routine causes records obtained by the locate mode GET macro instructions to be written back to the data set.

Section 2: Method of Operation 47 The PUTX routine sets an indicator flag associated with the current buffer on the User queue. The GET macro instruction's end-of-buffer (EOB) routine uses this indicator to determine if the User queue buffer should be moved to the PUTX queue. Eventually, the buffer will be moved from the PUTX queue to the Write queue (it is moved either by the EOB routine for GET or by the ESETL routine when an ESETL is issued in the processing program). Once on the Write queue, the buffer is scheduled to be written - that is, the channel program used to read or write the buffer (a copy of CP 22 is used with each buffer) is reset and scheduled to write the udpated buffer back into the data set.

ESETL Routine The ESETL routine (shown in Figure 23) ends scanning of the data set.

Move buffer Yes PUTX Issued from User queue to PUT X queue

No

Move buffer from User queue to

Read queue to Free queue

No Wnte queue queue empty queue empty to Free queue

Yes Yes

PUT X queue to Wnte queue

Figure 23. Scan Mode ESETL Routine

48 OS ISAM Logic If the user has issued a PUTX macro instruction for any of the records in the current buffer on the User queue, the routine moves the buffer to the PUTX queue. If the Read queue is not empty, the routine awaits completion of pending reads and then moves the Read queue to the Free queue. If the PUTX queue is empty, the routine returns control to the processing program. Otherwise, the routine awaits completion of pending writes and moves the Write queue to the Free queue if the write was successful. (If the write was not successful, the synchronous error routine is entered, and another ESETL macro instruction must be issued to end this scan.) It then moves the PUTX queue to the Write queue, initiates a write, and returns control to the user.

RELSE Routine The RELSE routine links to the end-of-buffer routine causing the current buffer to be released and a new buffer to be initialized. If the current record is the first or last logical record in the buffer, the request is ignored. The RELSE routine then returns to the user. The RELSE routine also determines if there were any write errors for those buffers on the Write queue whose writing had been completed. If so, the processing program's synchronous error routine is given control and another RELSE must be issued to release this buffer.

Appendages There are both channel-end and abnormal-end appendages for those routines that cause input/output operations. (Refer to Figure 24.) The channel-end appendage of the SETL I routine causes a normal return to the I/O supervisor if CP 25 was completely executed. If CP 25 was not completely executed, either the channel-end or abnormal-end appendage of the SETL I routine may be entered, depending on the setting of the CSW status bits. In the case of incomplete execution, an indicator is set so that the SETL I routine can later inform the processing program that the record was unreachable. A normal return to the I/O supervisor is issued. The channel-end and abnormal-end appendages of the SETL K (or SETL KC) routine examine CP 23 to find out where and why the channel program terminated. Based on this examination, either CP 23 is reinitialized to continue searching for the desired key by issuing an EXCP return, or an indicator is set to inform the processing program that the key could not be found and a normal return is issued. Whether the examination is performed by the channel-end or abnormal-end appendage depends on the setting of the CSW status bits and the contents of the higher level indexes. The channel-end appendage of the Get routine issues a normal return to the 1/ 0 supervisor if there are no more buffers on the Read queue, or the last record on a track has been read, or the buffers on the Read queue were filled with records read from a prime-data area. This channel-end appendage issues an EXCP return to the I/O supervisor, or schedules an asynchronous routine to issue an EXCP return if an overflow record was read after it modified CP 22 to continue reading the records in the overflow chain. When the last record of an overflow chain has been read, a normal return is issued. The abnormal-end appendage of the Get routine sets an indicator to mark the buffer that contains the record in error and issues an EXCP return if there are more records to be read. Otherwise, it issues a normal return.

Section 2: Method of Operation 49 The channel-end appendage of the PUTX routine (without write-checking) makes a normal return to the I/O supervisor if there are no more buffers on the Write queue. An EXCP return is issued if there are more buffers on the queue to be written. The abnormal-end appendage makes the same returns under the same conditions, but, in addition, it sets both a write-error indicator and an indicator to inform the processing program which buffer contains the record in error. When a write-checking is in effect, the PUTX routine channel programs are command-chained to write the contents of a set of buffers at a time, rather than writing all the buffers on the Write queue. For prime-data records, a set of buffers is the number of buffers on the queue or the number needed to complete the current track, whichever is lower. For overflow records, a set is one buffer. The contents of a set of buffers is written and checked before the next set is written. If return is to the channel-end appendage after the inital write of a set, CP 22 is modified to accomplish readback, and an EXCP return to the I/O supervisor is issued. If return is made to the abnormal-end appendage after the initial write of any buffer in the set, that buffer is marked unreachable or unwritable and an EXCP return is issued to write the remaining buffers in the set; if no buffers remain in the set, CP 22 is modified to accomplish readback of the successfully written buffers, and an EXCP return is issued. No attempt will be made to rewrite the buffer in error; the processing program will be informed of the error the next time a GET macro instruction is issued for the buffer. If channel-end return is made for both writing buffers and reading them back, an EXCP return is issued if there is another set to be written. Otherwise, a normal return is issued. If a return to the abnormal-end appendage occurs when reading back a buffer that was successfully written, an EXCP return is issued to rewrite, and an additional EXCP return is issued to recheck the buffer in error. Up to ten rewrites and rechecks per buffer are permitted; CP 22 must be modified for each readback and rewrite. If a successful readback cannot be accomplished, or if an abnormal-end return is made on any of the attempts to rewrite the buffer, the buffer is marked as unwritable and an EXCP return is issued to start writing the next set. If there are no more sets to be written, a normal return is issued. When an EXCP return is to be issued and the next record to be written or searched is on another device, the appendage routine cannot issue the EXCP command itself. Instead, it schedules an asynchronous routine (located in the GET appendage). When the asynchronous routine receives control, it issues the EXCP macro instruction.

50 OS ISAM Logic Scan Mode Processing Phase Organization

Processing Routines The modules containing the scan mode processing routines are shown in Figure 24.

Module Name Function

IGG019HB (Fixed- length records) Get, PUTX, RELSE, ESETL, SETL B processing routines IGG019HN (Variable- length records)

IGG019HD SETL K processing routines

IGG019HF SET L I processing routines

Get channel-end and abnormal-end appendages and IGG019HG asynchronous routine

IGG019HH PUTX channel-end and abnormal-end appendages, no write-check

IGG019HI PUTX channel-end and abnormal-end appendages, write-check

IGG019HJ SETL I channel-end and abnormal-end appendages

IGG019HK SETL K channel-end and abnormal-end appendages

IGG019HL channel program skeletons

IGG019HA RPS SIO Appendage

Figure 24. QISAM Scan Mode Processing Modules

Scan Mode Channel Programs The scan mode channel program skeletons are contained in module IGG019HL. The channel program skeletons are moved to a work area and completed during the open phase of scan mode.

Section 2: Method of Operation 51 In processing and updating an ISAM data set, the following scan channel programs are used: Channel Program 22 (CP 22) The two versions of CP 22 are used to read or write data records. Version 22A (CP 22A) is used to read the key and data fields of unblocked records. Version 22B (CP 22B) is used to read either the data field of unblocked records, or any blocked records. Channel Program 23 (CP 23) Used to locate the data record by SETL K or KC; searches the index and data tracks. Channel Program 24 (CP 24) Used to read count and data fields of the track-index entries. Channel Program 25 (CP 25) Used with SETL I to obtain track-index entries. Channel Program 26 (CP 26) Used on overflow chains as an extension of CP 23 (SETL K). If the user has allocated enough buffers and is reading a full track at a time, as many CP 22s as are needed (one for each buffer) are chained together for reading the track; the same is true for writing a full track at one time, that is, all copies of CP 22 are chained together. Assuming the use of a file with no overflow, CP 23 is used by SETL to locate the proper record; then CP 22 is used to read the record; CP 24 then reads the next level of track-index entries and schedules the next CP 22. Figure 25 illustrates the operations of one scan mode channel program (CP 23). Channel program 23 is used by SETL to position to the first record of the specified file. For this example, it is assumed that no master indexes are being used.

Scan Mode Control Blocks and Work Areas Information about the data set and processing requests is carried in various control blocks, work areas, and queues. The address relationships of these areas to each other and processing routines and channel queues are shown in Figure 26.

Scan Mode Close Phase The QISAM scan mode close phase has only one close executor, module IGG02029, which is entered from the I/O support Close routine. Module IGG02029 uses the ESETL routine to terminate scanning and clear the buffer queues. (Refer to "ESETL Routine" and "Buffer Control Techniques.") Even if the user has already issued an ESETL, the close executor issues another one. The close executor then awaits completion of any outstanding writes. If any of these writes are unsuccessful, the user synchronous error is entered. The user must return to the close executor to complete the release of buffers and work areas to the operating system. If the oustanding writes or the return from the synchronous error routine to the close executor have been completed successfully, then the close executor: 1. Returns all buffers to the buffer pool.

52 OS ISAM Logic 1------1 ---, Cylinder Read the home I Read I Index Seek to Read data Index 'Search' address I ROJ of __ cylinder I 1 of the key Entry I the cylinder Index I entry Index track ' I I I I I I I I I I LT I I Read count I I I field of I I I Index entry , I I I I : I ' Read data of Locate the I I Read data I I the cylinder - -correct track I field of I I Index entry Index track I I Index entry L ______J L L--__-r_----l ______J r------, 1------I Flnd I I , Read ID- I Index Seek to the I Data IEntry track Index track I I Seek data track Record I I I I I I I I Read the Position to I Read home home address beginning I I of the track of track I address of I Index Index track I data track I I I I I Read count I I I I I I I I LT I ;;~~~ :~I:eof I I I ~~~n I L ____ _ I I I I I Read Count I L ______-.J

Figure 25. Scan Mode Channel Program 23

2. Releases the work area. 3. Updates the DCB tag deletion count, DCBTDC. 4. Updates the number-of-overflow-references field in the DCB, DCBRORG3. 5. Moves the DCB fields that may have been changed during processing from the DCB field area (DCBFA) to the DCB if the data set was opened for DISP=SHR. Frees the DCB field area if this is the last DCB open for the data set.

Section 2: Method of Operation 53 When finished, the scan close executor, module IGG02029, passes control to the ISAM common close executor.

DCB DeB Work Area B' 0 Input ECB 14 DCBBUFCB 2D DCBDEBAB f-0 Get , 4C DCBSETL 4 Input lOB processing module 54 DCBESETL ~ 30 Output ECB

34 Output lOB C E4 DCBWKPTl ~ SETL 60 Sense bits and pOinters processing module

80 Queue table* r----.

Track mdex information BC E and save area Get ,...... appendage module W1CP23PT Channel (asynchronous r--~ F4 W1CP26PT program @ routme) F W1CP25PT pOinters @r-- DEB 130 CP 24 -20 T SID appendage ~ SETL -18 CE appendage table .. r 150 W1DCBFA r-r. appendage module ~ -14 TAE appendage table - lA4 .. 0 - f-oir- -' 8 DEBIRBAD -., '-- 18 DEBDCBAD CP 22 '-- 16 DEBAPPAD (one copy per buffer) ..-- 2C i ISAM Extension 'a... PUTX appendage module Extent descriptIons '--

----.. 0 T Get or Put module I- 4 T UCB ~® CP 23/26 or CP 25 .... 8 i Get appendage module I-~0 @ C Channel-end A VT I-~® RPS SID appendage module 24 Abnormal-end AVT I-~® IRB' ~ @~ Buffers'

C RBEP HD DCBFA

* Figures 17 and 18 describe the channel ~D program/buffer queues

* * If the prime area IS on a different volume than the high level Indexes, the asynchronous routine IS executed and a dIfferent UCB IS needed. Note DIsplacements are In hexadecimal. D

Figure 26. Scan Mode Control Blocks and Work Areas

54 OS ISAM Logic Basic Indexed Sequential Access Method

The basic indexed sequential access method (BISAM) provides direct storage and retrieval of the records in an indexed sequential data set. The READ K macro instruction permits the retrieval of a logical record from main storage by its record key. The READ KU and WRITE K macro instructions, when used together, provide the ability to update logical fixed-length (or variable-length if the record length does not change) records in place. The WRITE K macro instruction, when used without READ KU, allows the user to replace unblocked fixed-length (or variable-length if the record length does not change) logical records. The WRITE KN macro instruction is used with the READ KU macro instruction to update variable-length records when the record length can change. The WRITE KN macro instruction allows the user to insert new logical records into the data set or to replace a variable-length logical record with one having the same key and possibly a different record length. Since storage and retrieval of records are direct in BISAM, the BISAM routines are not able to read ahead as the QISAM scan mode Get routine can. Consequently, the user must issue aWAIT or CHECK macro instruction in order to determine whether a read operation has been completed. As in QISAM, there are three phases of BISAM routines: • The open phase The processing phase • The close phase

BISAM Open Phase Operations The first BISAM open executor is entered from the last common ISAM open executor. The BISAM open executors load the BISAM processing routines, selecting the processing phase modules according to the processing program options. Particular processing modules are selected depending on such options and considerations as: • The number of levels of index to be searched on the direct-access device (NLSD) Whether the records are blocked or unblocked Whether work areas are supplied by the user or by the access method routines Whether or not write-checking is to be used • Are buffers controlled by the user program or by the ISAM dynamic buffering routine (module IGG019JI) The user's intent to add new records to the data set with the WRITE KN macro instruction

Section 2: Method of Operation 55 Some of these considerations also affect the sequence in which the BISAM open executors are called. Figure 27 illustrates the flow of control through the BISAM open executors. Those BISAM open executors that initialize channel programs include conversion to a non-RPS state as part of their processing. BISAAf Open Phase Organhanon When a DCB is being opened for BISAM processing, one or two of the validation modules are selected to correlate format-2 DSCB and DCB fields. The validation modules (IGGOI920, IGGOI922, and IGGOI950) are also used in open processing for resume load and scan mode. If the records are fixed-length records, modules IGGO 1920 and IGGO 1922 are selected for validation and initial BISAM open processing.

Move format- 2 DSCB Items to DeB

Read high­ Yes level Index Into storage

No

Determine and load modules

Construct work area

Need Yes Construct system area for system area for WRITE KN WRITE KN

Figure 27. BISAM Open Executors

56 OS ISAM Logic These two modules reset certain fields in the DCB and format-2 DSCB which may be incorrect if the data set was previously closed improperly.

If variable-length records are used, module IGGO 1950 is selected to merge end pointers from the format-2 DSCB to the DCB and adjust, if necessary, the independent overflow control information in the DCB. IGG01950 is the VLR counterpart to modules IGGOI920 and IGGOl922. It is the first BISAM open module entered when variable-length records are being added. The validation module may not be executed, although it will be entered, if the user has specified that the data set may be shared by other tasks (DISP=SHR). It will not be executed in that case if another DCB has already been opened for the data set and a DCB field area (DCBFA) set up for the purpose of maintaining the DCB fields. (See "The DCB Integrity Feature" under "The ISAM Common Open Executors" and the description of the DCBF A.) Module IGG0192W or IGGOI92H receives control from modules IGG01920 and IGGOI922, or module IGG01950 during the opening of a DCB for BISAM.

BISAM Open Executor IGG0192H (Fixed-length records)

1. Moves the format-2 DSCB fields needed for BISAM into the DCB. 2. Obtains and structures the work are ass and provides pointers to the work area.

BISAM Open Executor IGG0192W (Variable-length records)

1. Moves the format-2 DSCB fields needed for BISAM into the DCB. 2. Obtains and structures the work areas and provides pointers to the work areas.

BISAM Open Executor IGG0192P

1. When the high-level indexes are to be searched in main storage, module IGGOI92P schedules CP 87 to read the high-level index into the user-specified work area. The work area is specified in the DCB at DCBMSHI. Channel program 87 is contained in module IGGOI92P. 2. After reading the high-level index into the user work area, module IGG0192P saves the address of the last active entry in the high-level index.

BISAM Open Executor IGG01921

1. Selects and loads the proper privileged module, according to the options specified in DCBMACRF by the user. (See Figure 35 for the privileged macro-time modUle.) 2. Selects, loads, and initializes CP 1 when cylinder and master indexes are to be searched on the direct-access device. 3. Selects, loads, and initializes CP 2 when the cylinder index is the highest level index to be searched on the device.

Section 2: Method of Operation 57 4. If an RPS device is being used, IGG0192I saves and restores the high-order byte of DEBISAD when storing the address of the privileged macro-time module. (See step 1.) This is done to preserve the RPS bits at DEBRPSID. 5. This module also initializes RPS fields in the DCB work area. 6. Initializes the error queue counter to 2(NCP) + DCBBUFNO.

BISAM Open Executor IGG0192K (READ K, READ KU, WRITE K) 1. Selects and loads CP 4, CP 5, CP 6, and CP 7; initializes these channel programs. 2. Selects and loads the nonprivileged macro-time routine, module IGGOI9JV, for READ K, READ KU, and WRITE K. 3. If dynamic buffering is specified, loads the dynamic buffering module, IGGO 1911. 4. If RPS is used and the dynamic buffering module loaded, IGGOI92K also sets bit 3 of DEBRPSID.

BISAM Open Executor IGG0192L (WRITE KN) 1. Loads the set of WRITE KN channel programs needed with the data set being processed - blocked or unblocked records, user work area or'system work area, etc. (See BISAM channel programs, Figures 40-52.) 2. Loads the nonprivileged macro-time routines for WRITE KN, module IGGOI9JW. 3. Initializes CP 8 and CP lOB.

BISAM Open Executor IGG0192M (WRITE KN with fixed-length records)

1. Initializes CP 14 which is used to update the cylinder overflow control record (COCR) and writes overflow records. There· are six different versions of this channel program, which are described in "Appendix B: ISAM Channel Programs. "

BISAM Open Executor IGG0192X (WRITE KN with variable-length records) 1. Performs the same functions as IGG0192M as described above. See CP 14 in "Appendix B: ISAM Channel Programs."

BISAM Open Executor IGG0192Q (WRITE KN)

1. Initializes CP 1 or CP 2, CP lOA, CP 15, CP 16, CP 17.

58 OS ISAM Logic ISAM common open executor IGG0192C

Variable-length Records

High-level Index Search In MaIO Storage

No Hlgh­ No H,gh­ level Index level Index Search In Search In Mam Storage Main Storage

WR ITE KN only

Variable-length Records

User Provides Work Area

Input/output support Open routine

Figure 28. Flow of Control through BISAM Open Executors

Section 2: Method of Operation 59 BISAM Open Executor IGG01920 (WRITE KN, fixed-length records, user work area) 1. Initializes CP 12 or CP 13 series, and CP 123W; deletes skeleton channel program modules.

BISAM Open Executor IGG0192N (WRITE KN, fixed-length records, system work area) 1. Initializes CP 9 series or CP 11 series; deletes skeleton channel program modules.

BISAM Open Executor IGG0192Z (WRITE KN, variable-length records) 1. Initializes CP 12AV, CP 12BV, and CP 123WV; deletes skeleton channel program modules.

BISAM Open Executor IGG0192J

1. Module IGG0192J selects and loads the proper appendage modules and one asynchronous module. Refer to the BISAM appendage and asynchronous modules tables shown in Figures 37 and 38. 2. Initializes the interrupt request block (IRB) used by the asynchronous routine. 3. If any of the RPS bits at DEBRPSID in the DEB are set, IGGOI92J loads the RPS SIO appendage, IGGOI9JH. During processing, if bit 3 of DEBRPSID is on, control is passed to IGGO 19JH.

BISAM Processing Phase Operations BISAM processing is performed by channel programs that read and search indexes, prime-data tracks, and overflow chains. They also write prime-data and overflow records and index entries. The channel programs are set up and controlled by the BISAM processing routines. All BISAM READ and WRITE macro instructions enter a nonprivileged macro-time routine, which enters a privileged macro-time routine where I/O interruptions may be readily enabled or disabled. The privileged routine returns to the nonprivileged routine upon completion. The nonprivileged routine then starts a channel program, if possible, and returns control to the user. When a channel program ends, the I/O supervisor passes control to an appendage routine that analyzes the manner in which the channel program ended and determines the action to be taken as a result. This involves either an EXCP return to the I/O supervisor or the scheduling of an asynchronous routine. The overall control flow through these routines is shown in Figure 7. The user can supply his own buffers or use the dynamic buffering option of BISAM. In the latter case, the dynamic buffering routine obtains and frees buffers for each processing request. A check routine is available to all BISAM requests to allow the user to analyze processing errors.

60 OS ISAM Logic Information about the data set and the processing requests is communicated among the processing routines and the channel programs in control blocks, work areas, and queues. This section describes the processing routine logic, the flow of control through the channel programs, and the relations of the data areas to each other and to the processing routines and channel programs. Descriptions of the channel programs are in "Appendix B: ISAM Channel Programs." "Section 5: Data Areas" contains detailed layouts of the data areas.

An Example of BISAM Processing Flow Whenever a BISAM macro is issued, a nonprivileged macro-time module is entered. In this example the nonprivileged module entered will be IGG019JW after a WRITE KN macro instruction is issued. 1. The WRITE KN is issued from the processing program. 2. The nonprivileged module is entered; module IGG019JW issues an SVC 54 to disable interrupts and link to the privileged macro-time routine. In the case of a WRITE KN without READ K, WRITE K, or READ KU, the privileged routine module entered is IGG019JX. (See Figure 35.) 3. Module IGGOI9JX: a. Initializes the lOB. b. Determines if another WKN is in progress; if so, the lOB is added to the on-schedule queue and the on-schedule switch is set on. c. If another WKN is not in progress and it is'necessary to search the high-level index in main storage, the following operations are done: (1) The first WKN channel program is initialized. (2) The Seek address for the channel program is determined, using the DCBFTHI field. (3) If the track index is the highest level of index (this is assumed for this example), the appendage code is set to 8. 4. Channel program 8 is initialized - CP 8 is used to determine where the new record should be inserted. 5. Return to the SVC 54 issued by IGG019JW. 6. The SVC 54 exits to the original nonprivileged module. 7. Module IGGO 19JW tests the on-schedule switch; if it is set, return is made to the processing program. If the on-schedule switch is off, an EXCP is issued using the lOB just created. 8. When the channel program ends, the appendage routine uses the appendage code in the lOB and the appendage vector table in the appendage module to select the needed appendage routine for this particular channel program.

Section 2: Method of Operation 61 Privileged Macro-time Routines A privileged macro-time routine (shown in Figure 29) schedules the first channel program for a given macro instruction. BISAM has several modules of privileged macro-time routines (refer to Figure 35). However, no more than one of these modules is loaded into storage by the BISAM open executor, IGG0192I, for a single DCB.

Isl08 No Ves Remove from on error A

No Signal Ves 8 Invalid request

Obtain 108 Construct from update 8 queue 108

Ves Search

Determine Signal no Ves No first channel record program found

No Place 108 on unscheduled queue

Initialize channel c program

Figure 29. Privileged Macro-time Routines

62 OS ISAM Logic Selection of the macro-time routine module to be loaded depends on the BISAM macro instructions specified in the DCB, the record format, and the number of levels of index searched on a direct-access device (rather than searched in main storage). These factors determine the choice of channel programs needed in a macro-time routine. A nonprivileged macro-time routine enters a privileged macro-time routine by means of an SVC S4 (disable) instruction to disable I/O interruptions. If the lOB being reused has a dynamic buffer associated with it, the buffer is returned to the dynamic buffer pool. For any read or write request, the routine checks the error queue and the update queue to see if any existing lOB refers to the data event control block (DECB) of the present request. If so, the old lOB is reused for the current request. If the lOB being reused has a dynamic buffer associated with it, the buffer is returned to the dynamic buffer pool unless the request requires a dynamic buffer. If no lOB is found that refers to the DECB of the present request, and a dynamic buffer must be assigned to the request, DECBAREA is zeroed to force the assignment of a dynamic buffer in function 1 of the dynamic buffer module (IGG019JI). When a WRITE K macro instruction is issued after a READ KU, both with the same DECB, an lOB for the DECB should be on an update queue (as the result of the READ KU). If the lOB is not on the update queue, an invalid request condition exists and the privileged routine returns to the calling nonprivileged routine. Otherwise, the privileged routine for the WRITE K associated with a previous READ KU removes the lOB from the update queue. In all other cases, the routine constructs an lOB for the request. Subsequently, the privileged routine attempts to schedule the first channel program needed for the user's request. If the channel program is available and the high-level index is to be searched in main storage, the routine performs this search. If the search is unsuccessful, a record-not-found condition exists and the routine posts the DECB as complete, sets the appropriate exceptional condition bit in DECBEXCD, and returns control to the nonprivileged routine. (Searching is always successful in the case of WRITE KN.) If the search is unsuccessful or no search in main storage is necessary, the routine determines the first channel program to be scheduled. If it is available, the routine schedules it. If it is unavailable, an unscheduled condition exists, and the routine queues a request for the channel program by placing the lOB on a queue called the unscheduled queue. The routine then returns to the nonprivileged routine. A special case exists if the WRITE KN macro instruction is being used with other READ or WRITE macro instructions. Possib!~ conflicts between these macro instructions are avoided because WRITE KN changes indexes and record positions. Its channel programs are not scheduled if another WRITE KN, WRITE K, READ K, or READ KU has been scheduled but not completed, or if a READ KU has been completed but a FREEDBUF or a WRITE K for that DECB has not. The WRITE KN channel programs are not scheduled if there are lOBs on the update queue, or if there are lOBs on the unscheduled queue for reasons other than those associated with WRITE KN. Similarly, WRITE K, READ K, and READ KU are not scheduled if a WRITE KN has been scheduled but not completed, or if a previous WRITE KN cannot be scheduled.

Section 2: Method of Operation 63 Note: Entry to the privileged routine from the asynchronous routine is also possible. In this case, the return will be to the asynchronous routine.

Nonprivileged Macro-time Routines There are two modules of nonprivileged macro-time routines. (Refer to Figure 36.) The READ K, READ KU, and WRITE K macro instructions link to one routine and the WRITE KN macro instruction links to the other. The nonprivileged routine is shown in Figure 30.

Signal record length invalid spec record length No rs~~------l I (D,s"ble) I I Ves I I DISP"SHR Refresh DCB I I I I No I I I I I I Execute privileged I I macro time I ! routine I

L ______~

POST Ves Completion

No

No record Ves found

Ves Unscheduled

No

EXCP

Start channel program

Figure 30. Nonprivileged Macro-time Routines and SVC 54

64 OS ISAM Logic If the user has specified a record length in a READ K, READ KU, or WRITE K macro instruction, the respective macro instruction routine checks the record length specified against the logical record length supplied by the user in the DCB (DCBLRECL). If the length specified in the macro instruction is invalid or if the user has specified a record length in a WRITE KN macro instruction, the nonprivileged macro-time routines set the record length check indicator in the DECB exceptional condition code field (DECBEXCDl) and return control to the user. Otherwise, an SVC 54 is issued to link to a privileged macro-time routine. The privileged routine, upon completion, returns to the non privileged routine. If no channel program was scheduled, the nonprivileged macro-time routine issues the EXCP and returns to the user. When the channel program is completed, an I/O interruption takes place and the I/O supervisor links to an appendage routine. (Appendage routines are described in the BISAM "Appendage and Asynchronous Routines" section.) If no channel program was scheduled because of an invalid request, a no-record-found condition, or an unscheduled condition, the nonprivileged routine returns to the user. In the case of an invalid request, the routine posts the DECB as complete and returns to the user.

Appendage and Asynchronous Routines The BISAM appendages and asynchronous routines are shown in Figure 31. The asynchronous modules are listed in Figure 37; the appendage modules are listed in Figure 38. Appendage routines determine the action to be taken when a channel program ends. Asynchronous routines perform that action except in certain cases, which are explained below. Appendage modules consist of an appendage vector table and a group of appendage routines. Asynchronous modules consist of an asynchronous vector table and a group of asynchronous routines. When a channel program ends, a general appendage routine uses a combination of the appendage code in the lOB and the appendage vector table for the module to select the appropriate appendage routine. A list of appendage and asynchronous codes is contained in "Section 6: Diagnostic Aids." If the channel program is complete, the appendage routine schedules an asynchronous routine that sets up the next channel program. If the channel program is not complete, the appendage routine returns to lOS to reschedule that channel program. If the channel program did not end in error, the action taken depends on whether (1) it is the final channel program needed to satisfy the user's request, (2) an additional channel program is needed to satisfy the request and no other requests are waiting for the channel program just completed, or (3) neither of the above conditions exists. In the first case, the appendage routine schedules an asynchronous routine to report completion to the user. If the data set is shared (DISP=SHR), the DCBF A (DCB field area) is reset as needed before completion is posted. In the second case, the appendage routine schedules the additional channel program by a special return to the I/O supervisor. In the third case, the appendage schedules an asynchronous routine which in turn schedules an additional channel program for the current request and, if possible, reschedules the channel program just completed for a waiting request. If the present request used a dynamic buffer, the address of the buffer is saved in the lOB before the lOB is placed on either the update or error queue.

Section 2: Method of Operation 65 Ves No Report error via Error First time asynchronous routine

Set up channel orogram

No

Schedule asynchronous routine (create IRB)

Dispatcher Enter asynchronous routrne

Another

Place lOB B on error queue

Ves Ves Place lOB READ KU on update queue

Place on No Next channel Free lOB unscheduled area queue

POST Refresh CornpletJOn DCBFA

B

Figure 31. BISAM Appendage and Asynchronous Routines

66 OS ISAM Logic The first time a channel program ends in error, the appendage routine returns control to the I/O supervisor to retry the operation. If the I/O supervisor finds the error is permanent, it reenters the appendage routine which schedules an asynchronous routine to report the error to the user and place the request on the error queue.

Dynamic Buffering Routines The READ K and READ KU macro instructions require an area into which a block can be read. The user may supply this area or use BISAM routines to provide the area through the dynamic buffering option of the macro instruction. Figure 32 shows the dynamic buffering routines. When the dynamic buffering option is used, BISAM routines release the buffer when a corresponding WRITE K macro is completed. If no WRITE K is issued, the processing program may release the area obtained with dynamic buffering for a READ K or READ KU by issuing a free dynamic buffer (FREEDBUF) macro instruction. Also, the privileged macro routine automatically releases the buffer if a READ macro instruction is followed by a WRITE KN or another READ. The buffer is released, reusing a DECB, without an intervening WRITE K or FREDBUF. The dynamic buffering module contains two routines. The first, called function 1, obtains buffers in response to the dynamic buffering option of a READ K or READ KU macro instruction. The second routine, called function 2, frees the buffers.

DynamiC buffering

Can Place buffer No another area on lOB use available a buffer list

Yes Yes

Remove lOB Place lOB Any No on queue from on available waiting queue Clwaltlng queue buffers Yes

EXCP Remove buffer Channel from program queue

Return

Figure 32. Dynamic Buffering Routine

Section 2: Method of Operation 67 Function 1 is an appendage routine entered by the 110 supervisor just prior to executing the scheduled channel program. When used by the FREEDBUF macro instruction, function 2 is considered a macro-time routine. When used on completion of a WRITE K macro instruction, function 2 is considered an asynchronous routine. The function 2 routine of IGG019JI, when executed from FREEDBUF, also frees any lOB on the error or update queue that is associated with the DECB, regardless of whether a dynamic buffer is also associated with the DECB. Rather than returning to lOS, IGG019JI passes control to the RPS SIO appendage (IGG019JH) if bit 3 of DEBRPSID is set. A description of the BISAM dynamic buffering buffer control block appears in "Section 5: Data Areas."

Check Routine The check routine module (shown in Figure 33), loaded when check is specified in the DCBMACRF field, gets control each time the user issues a CHECK macro instruction.

Get IOB+2

Is there No aSYNAD

Figure 33. BISAM Check Routine

68 OS ISAM Logic Processing I --- PRiVIlEGED -- -- "I Program I - NONPRIVILEGED - -l t- --- MACR~UTINE --- --j SVRB ~ ~C~ROUT~ --1 I I I I I ~ I I Yes record length BALR-+--.J I specified I EXI r I I I READ/WRITE I I I I I I I I I I I Entry L+-_____.:.:N~o_'Y"'e"-s----+'--i lOB Yes sched u I ed >-...:...::"----+~ routine WAIT L ______J I 1-­ APPENDAGE ROUTINE t-- --j I I I No --.J I Error I I All Yes I I I File protect from I CP 4 I No I

Permanent error I

I/O Yes I Interrupt I I I I L ____L------' J -, ASYNCHRONOUS ROUTINE -1

Another I rf'quest awaiting Yes completed I CP No I IRB Final No CP of request

I I L Figure 34. BISAM Processing Flow (Not WRITE KN)

Section 2: Method of Operation 69 The check routine examines the DECB exception code (DECBEXCD) fields. If a permanent error has been posted, it searches the error queue for the corresponding lOB. The check routine then either gives control to the user's synchronous error (SYNAD) routine or, if the user has no SYNAD routine, issues SVC 55 (EOV) to request an ABEND with a code of 00l. Upon entry to the SYNAD routine, register 0 contains the address of the first sense byte of the lOB (sense information is valid only when a unit check has occurred) and register 1 contains the address of the DECB. In the SYNAD routine, the user can issue a SYNADAF macro instruction. It places all pertinent information on the request in a buffer and returns the buffer's address to the user. For a description of the SYNADAF macro instruction, refer to OS Data Management Macro Instructions, GC26-3794.

Macro Instructions Additional Considerations Module Names

*NLSD=O IGG019J6 READ K, WRITE K Fixed-length Records READ KU NLSDr"O IGG019J7

Variable-length Records IGG019H7

WRITE KN None IGG019JX

READ K, WRITE K NLSD=O IGG019JO READ KU in combination Fixed-length Records with WRITE KN NLSDr"O IGG019J3

Variable-length Records IGG019H3

*NLSD represents the number of levels of indexing (cylinder or master indexes) that are searched on the device.

NLSD=O represents the case where the data set was allocated no more than one cylinder and has no cylinder or master indexes or there is only a cylinder index and it is searched in main storage.

N LSDFO means: (1) there is only a cylinder index that is searched on the device and (2) there are at least two levels of indexing, one of which is searched in main storage and the other is searched on the device.

Figure 35. BISAM Privileged Macro-time Modules

70 OS ISAM Logic Macro Instructions Additional Considerations Module Names

READ K, WRITE K, READ KU None IGG019JV

WRITE KN None IGG019JW

Figure 36. BISAM Nonprivileged Macro-time Modules

Macro Instruction Additional Considerations Modules

Fixed-length Records IGG019GX READ K, WRITE K, READ KU Variable-length Records IGG0191X

No Write Check IGG019GY Fixed-length Records WRITE KN Write Check IGG019GV

Variable-length Records IGG0191Y

No Write Check IGG019GZ READ K, WRITE K, READ KU Fixed-length Records in combination with Write Check IGG019GW WRITE KN Variable-length Records IGG0191Z

Figure 37. BISAM Asynchronous Modules

BISAM Processing Phase Organization

BISAM Channel Programs BISAM uses the channel programs that are enumerated below and described in Appendix B. The flow of control through the READ K, WRITE K, and READ KU channel programs is shown in Figure 40 and the flow for WRITE KN channel programs is shown in Figures 41 through 52. Channel program modules are indicated in Figure 39. Note: Figures 40 through 52 show only the normal (nonerror) flow of control through the channel programs. For WRITE KN, two different methods are used to add records to the data set. For fixed-length records with a system work area, the prime track is rewritten and the index entries are updated before the overflow record is written. For fixed-length records with a user-supplied work area and for variable-length records, the overflow record is written before the prime track and index entries. This requires two different methods for executing CP 14 as explained in "Appendix B: ISAM Channel Programs."

Section 2: Method of Operation 71 Macro Instructions Additional Considerations Module Names

No Write Check IGG019G8 READ K, WRITE K, Fixed-Length Records READ KU Write Check IGG019G9

Variable Length Records IGG01919

Unblocked, System Work IGG019GO and IGG019GL Area, No Write Check

Unblocked, System Work IGG019Gl and IGG019GM Area, Write Check

Unblocked, User Work IGG019G2 and IGG019GL Area, No Write Check

Unblocked, User Work IGG019G3 and IGG019GM Area, Write Check

Blocked, System Work WRITE KN Fixed-Length Records IGG019G4 and IGG019GL Area, No Write Check

Blocked, System Work IGG019G5 and IGG019GM Area, Write Check

Blocked, User Work IGG019G6 and IGG019GL Area, No Write Check

Blocked, User Work IGG019G7 and IGG019GM Area, Write Check

Variable-Length Records IGG01910 and IGG0191M Unblocked, System Work IGG019GO and IGG019GN Area, No Write Check

Unblocked, System Work IGG019Gl and IGG019GO Area, Write Check

Unblocked, User Work IGG019G2 and IGG019GN Area, No Write Check

READ K, WRITE K, Unblocked, User Work IGG019G3 and IGG019GO READ KU in Area, Write Check Fixed-Length Records combination with Blocked, System Work WRITE KN IGG019G4 and IGG019GN Area, No Write Check

Blocked, System Work IGG019G5 and IGG019GO Area, Write Check

Blocked, User Work IGG019G6 and IGG019GN Area, No Write Check

Blocked, User Work IGG019G7 and IGG019GO Area, Write Check

Variable-Length Records IGG01910 and IGG0191N

RPS SIO Appendage IGG019JH

Figure 38. BISAM Appendage Modules

72 as ISAM Logic Macro Instructions Additional Considerations Module Names Channel Programs

NLSD = 1 IGG019JK 2 Any READ or WRITE NLSD> 1 IGG019JJ 1

None IGG019JL 4 5 6 7 READ K, WRITE K, READ KU Write Check IGG019JM 4 5W 6W 7W

Unblocked, System Work IGG019JN 8 9A 9B 9C lOA Area, No Write Check lOB 14 15 16 17

Unblocked, System Work 8 9A 9BW 9CW 10AW IGG019JP Area, Write Check 10BW 14W 15 16 17W

Unblocked, User Work 8 lOA lOB 12A 12B IGG019JR Area, No Write Check 12C 14 15 16 1 7

Unblocked, User Work 8 10AW 10BW 12A 12B IGG019JT Area, Write Check 12CW 14 15 16 17W 123W WRITE KN Fixed-Length Records Blocked, System Work 8 lOA lOB llA 11 B IGG019JO Area, No Write Check 14151617

Blocked, System Work 8 10AW 10BW llA l1BW IGG019JQ Area, Write Check 14W 15 16 17W

Blocked, User Work 8 lOA lOB 13A 13B IGG019JS Area, No Write Check 13C 14 15 16 17

Blocked, User Work 8 10AW 10BW 13A 13B IGG019JU Area, Write Check 13CW 14W 15 16 17W 123W

Variable-Length Records IGG019HP 8 12AV 12BV 14/14W 15 16 17 1 23WV

Figure 39. BISAM Channel Program Modules

CP 1 U .. ed to search master and cylinder indexes. CP 2 Used to search a cylinder index when it is the highest level to be searched on a device. CP 4 Used to search a track index. CP 5 and CP 5W are always appended to this channel program. CP 5 Used to search prime-data tracks and to read or write prime-data records. CP5W Write-checking version of CP 5.

Section 2: Method of Operation 73 CP 6 Used to search an overflow chain and read or write overflow records. CP6W Write-checking version of CP 6. CP 7 Used to write data records when WRITE K is associated with READ KU. CP7W Write-checking version of CP 7. CP 8 Used to search track indexes and search prime-data tracks for the place to insert a new record. There are separate versions for fixed-length records and variable-length records. The following channel programs are used for insertion of fixed-length unblocked prime-data records when the work area is provided by the system. CP9A Used to read into the work area the record occupying the position at which an insertion is to be made. CP 9B Used to read an even-numbered record after writing a record into the previous slot and write back the last record of a non-EOF track when the number of records bumped is odd. CP 9BW Used instead of CP 9B when write-checking is specified. CP 9C Used to read an odd-numbered record after writing a record into the previous slot and write back the last record of a non-EOF track when the number of records bumped is even. CP9CW Used instead of CP 9C when write-checking is specified. The following channel programs are used for fixed-length records regardless of whether they are blocked or unblocked or whether the work area is obtained by the system or the user. CP lOA Used to write a record or block to replace an EOF mark. CP IOAW Used instead of CP lOA when write-checking is specified. CP lOB Used to write an EOF mark. CP IOBW Used instead of CP lOB when write-checking is specified. The following channel programs are used for insertion of fixed-length prime-data records into blocks when the work area is provided by the system. CP IIA Used to read into the work area a block to be bumped. CP lIB Used to write back a rearranged block. CP llBW Used instead of CP lIB when write-checking is specified. The following channel programs are used for insertion of fixed-length unblocked prime-data records when the work area is supplied by the user. CP 12A Used to read all records from the track following the slot into which a new record is to be inserted.

74 OS ISAM Logic CP 12B Used to write a new record followed by the records read by CP 12A. CP 12C Used to write a new record with a key identical to that of a record which, although logically deleted, is still physically present on the track. CP 12CW Used instead of CP 12C when write-checking is specified. The following programs are used for insertion of blocked or unblocked variable-length records. CP 12AV Used to read all records from the track following the slot into which a new record is to be inserted. CP 12BV Used to write a new record and the records read by CP 12AV. The following channel programs are used for insertion of fixed-length prime-data records into blocks when the work area is provided by the user. CP 13A Used to read all blocks from the track following and including the slot into which a record is to be inserted. CP 13B Used to write back the rearranged blocks read by CP 13A. CP 13C Used to write back a block if the insertion is a record with a key identical to that of a record which, although logically deleted, is still physically present within the block. CP 13CW Used instead of CP 13C when write-checking is specified. The following channel programs are used regardless of whether records are fixed-length or variable-length, blocked or unblocked, or whether the work area is obtained by the system or the user. CP 14 Used to update track-index entries, update the cylinder overflow control record (COCR), and write overflow records. The six different setups for this channel program are explained in "Appendix B: ISAM Channel Programs." There are separate versions for fixed-length records and for variable-length records. For variable-length records and fixed-length records with a user-supplied work area, CP 14 is divided into two parts. Part I writes the overflow record and Part II udpates the COCR and index entries. See "Appendix B: ISAM Channel Programs" for details. CP 14W Used instead of CP 14 when write-checking is specified. CP 15 Used to read in the cylinder overflow control record and the overflow track-index entry when a new record is added to the end of a data set. CP 16 Used to search an overflow chain for the record that logically precedes or is equal to the new record to be added, or the last record in the chain.

CP 17 Used to change the key in a normal or normal-and-overflow track-index entry or in a higher-level index entry. CP 17W Used instead of CP 17 when write-checking is specified. CP 87 Used to read a high-level index into main storage.

Section 2: Method of Operation 75 CP 123W Addendum to CP 12A and CP 12B or to CP 13A and CP 13B when write-checking is specified (fixed-length records). CP 123WV Addendum to CP 12BV when write-checking is specified (variable-length records).

READ K Create lOB for WRITE K Request READ KU

Higher level Yes Index searched on >------;~ Search It storage

Cylmder Highest level Cylmder ~I------< Index searched on >-~an':';d:':M;:'a:':'s"'te-r-~ device

READ KU READ K Place IDB on Free IDB f-oI-"7W~R::-I:::T:::E"7K:---::" Type of request update queue

WRITE K

Remove lOB from update queue

NOTE Search IS Key High or Equal If unsuccessful, "No Record Found" condition eXists Free lOB

'FREEDBUF may be ISsued by the user or automatically by the pnvlleged macro-time routine

Figure 40. READ K, WRITE K, READ KU Channel Program Flow

76 OS ISAM Logic WRITE KN Create lOB for request

Yes A

No No

Cylinder and Master '----"='F--'

New key Yes '------....:..;:::...... -{ data set Fixed-length Records, System Work Area -Figure 47 No Fixed-length Records, User Work Area -Figure 48 Variable-length Records -Figure 49

Record on overflow Fixed-length Records, System Work Aren -Figure 50 CP result Fixed-length Records, User Work Area ·Flgure 51 Variable-length Records -Figure 52

Fixed-length Unblocked Records, System Work Area -Figure 42 Fixed-length Unblocked Records, User Work Area ·Flgure 43 Fixed-length Blocked Records, System Work Area -Figure 44 Fixed-length Blocked Records, User Work Area -F Igure 45 Variable-length Records -F Igure 46

Figure 41. WRITE KN Channel Program Flow - Index Searching

Section 2: Method of Operation 77 Fixed-length Unblocked Records, From Figure 41 System Work Area

Last record Yes on track read

Leftover Record Deleted Last record on No track read

Figure 42. WRITE KN Channel Program Flow - Add to Prime (Fixed-Length Unblocked Records, System Work Area)

78 OS ISAM Logic Fixed-length Unblocked Records, From Figure 41 User Work Area

Old record marked for Yes deletion

No

Report "duplicate record" error End of file to user

No

Bumped No No Last prime record marked track of for deletion data set

Yes Yes

Yes Last track full

No

Independent overflow No

Figure 43. WRITE KN Channel Program Flow - Add to Prime (Fixed- Length Unblocked Records, User Work Area)

Section 2: Method of Operation 79 Fixed-length Blocked Records, From Figure 41 System Work Area

Ves

Report "space No not found" ~,-_< eXists for overflow No

Form padding records following bumped record In new block

Set last block and last track No full switches on

Figure 44. WRITE KN Channel Program Flow - Add to Prime (Fixed-Length Blocked Records, System Work Area)

80 OS ISAM Logic Fixed-length Blocked Records, From Figure 41 User Work Area

Y~ O~ Y~ '/4,1----'-''''-<:::: record marked for >..---=< dupllcdte

Report "duplicate Yes LdSt record" error End of file block previously to user full No-Padding R(>cord Yes Bumped

I nSE'rt new record Form padding In block record .. following bumped records Redrrange track In new block

Bumped Last No No recor d marked for pnme track of data deletion set

Yes

Yes Last block full

Independent >...;N~o~ _____---, overflow

Last Last Yes No Set last block prime track of record paddll1g and last track full sWitches ON

Yes

Figure 45. WRITE KN Channel Program Flow - Add to Prime (Fixed- Length Blocked Records, User Work Area)

Section 2: Method of Operation 81 Varlable·length Records From Figure 41

Report" 00 Old Old Ves record to be Yes record marked Yes New key record found" replaced for deletion a duplicate error to user

No No

Old Merge new Yes record to be record and reorganize replaced records

No

All Report "duplicate blocks after No record" error to user insertion pomt read

Yes

Oneor Yes more records No bumped to overflow

More New Yes records to be written

No

Ves t ndependent overflow

No

Figure 46. WRITE KN Channel Program Flow - Add to Prime (Variable- Length Records)

82 OS ISAM Logic FIxed-length Records. From FIgure 41 System Work Area

Ves Overflow Ves No cham already Last track fu II

Executed Once for Each Index Level

Figure 47. WRITE KN Channel Program Flow - Add to End (Fixed-Length Records, System Work Area)

Section 2: Method of Operation 83 Fixed-length Records User Work Area From Figure 41

Overflow Ves Ves No chain already Last track full eXIsts

Independent >_N-'-o____ --, overflow

Figure 48. WRITE KN Channel Program Flow - Add to End (Fixed-Length Records, User Work Area)

84 OS ISAM Logic Variable-length Records From Figure 41

Overflow Yes Yes No chain already Last track full eXists

Independent No overflow

Figure 49. WRITE KN Channel Program Flow - Add to End (Variable- Length Records)

Section 2: Method of Operation 85 Fixed-length Records, System Work Area

c

Ves

Report "duplicate record" error to 1---...... ; user

Figure 50. WRITE KN Channel Program Flow - Add to Overflow (Fixed-Length Records, System Work Area)

86 OS ISAM Logic Flxed·length Records. From Figure 41 User Work Area

No

New Record 1st on Chain

record deleted

No

Report "dupllcate record" error to I-----~ user

Figure 51. WRITE KN Channel Program Flow - Add to Overflow (Fixed-Length Records, User Work Area)

Section 2: Method of Operation 87 Vartable-Iength Records From Figure 41

Does No overflow chain eXist

New Record 1st on Chain

No Independent No overflow

No

Report "duplicate record" error to "'"""------' user

Figure 52. WRITE KN Channel Program Flow - Add to Overflow (Variable-Length Records)

88 OS ISAM Logic BISAM Control Blocks and Work Areas Information about the data set and processing requests is carried in control blocks, work areas, and queues. The address relationships of the control blocks to the processing modules, work areas, buffers, channel programs, lOB, and channel program queues are shown in Figures 54 and 55. Figure 53 below shows the elements of a BISAM READ or WRITE request.

Data set Key I Record I

Buffer I RQ I t-- 1 I Channel lOB DECB program Rl I J r Control blocks and DCB work areas / \ Processing ~ DEB modules

Figure 53. Elements of a BISAM Request

Section 2: Method of Operation 89 DCB Check module

2C DCBDEBAD

4C DCBSETL 5B DCBLRAN Nonpnvlleged Nonpnvlleged 5C DCBLWKN ~ macro module macro module (WRITE KN) (Non-WRITE KN) E8 DCBWKPT2 -

C

DCB Dynamic work area buffermg E -20 r TSIO appendage (See Figure 55) module -18 TCE appendage table ~ -14 TAE appendage table 0

8 DEBIRBAD r----, "-I-- 18 DEBDCBAD '-- 1C DEBAPPAD I@ B I AI Appendage Appendage Vi module '------module TI (part 1) I (part 2) 2C T ISAM extension I l } 0 DEBDISAD 4 DEBWKPT4 .co 8 DEBWKPT5 Privileged RPS SID C DEBFREED ~ appendage 10 DEBRPSIO macro E ~ module module

(If IRB dynamic buffering IS not used.)

C RBEP ~ Asynchronous module

(created dynamically by Open)

Figure 54. BISAM Control Blocks and Processing Modules

90 as ISAM Logic 14 DCBBUFCB Full-track work area for WRITE KN 40 DCBMSWA 49 DCBMSHI ----- Storage area for highest level DCBWKPT1 Index (If searched In storage) DCBWKPT2 DCBWKPT3 DCB Work Area o DCWFCP4 4 DCWFCP7 C DCWFIOBU rUnscheduledl 10 DCWLlOBU Lqueue J r------l There Isene copy of 14 DCWFUPDI rUpdate ] I I CPl/2andtheWRITE 18 DCWLUPDI Lqueue I I KN CPs Theyare I CP 1/2 I described by DSECTS I I rn processing module L_____ --' and addressed by uSing DCBWKTPl/3 as a base register 30 DCWFIOBE hErrorJ 34 DCWLlOBE queue r------, 3C DCWDCBFA I I I I CPS I I followed by I CP4 I other required I I WRITE KN CPs I CP 5 I I L ______J CPS

CP4 lOB CP 5

CPS

Buffer Control Block

4 8 BC8NAVBrNext bUffer] Lavallable

14 Buffer 1

Buffer 2 DCB F,eld Area I ----' Buffer 3

_:9:. .J Buffer 4

Figure 55. BISAM Work Areas and Queues

BISAM Close Phase The BISAM close executor (module IGG0202A) is entered from the I/O support Close routine. It terminates outstanding I/O requests and releases main storage obtained for the work area and for channel programs. If dynamic buffering was used, it releases the system-obtained buffer area. If the data set was opened for DISP=SHR, move the DCB fields that may have been changed during processing from the DCB field area (DCBFA) to the DCB. If this is the last DCB open for the data set, free the DCB field area. The BISAM close executor passes control to the ISAM common close executor.

Section 2: Method of Operation 91

SECTION 3: PROGRAM ORGANIZATION

Section 3: Program Organization 93

IGG0192A fAl '-...__ E_N..,T_R_Y __ )

SCAN DSCB I S FOR j6~~~~L6~D~~TE~D ENTRIES

ISLOOA3 811...1:---.., -8 8-

~ G G- L-___--I

Chart AAl First Common Open Executor (lGGOl92A) (Part 1 of 3)

Section 3: Program Organization 95 ~~--'--'~~CfcO~D»Ei:=~3BB--"1------•• ~AB~!~DEXIT UNSUCCESSFUL \. '''' J.J J>AH J LOAD

L~

Chart AA2 First Common Open Executor (IGG0192A) (Part 2 of 3)

96 OS ISAM Logic TO: IGG0192B

VARIABLE­ LENGTH RECORDS

Chart AA3 First Common Open Executor (IGG0192A) (Part 3 of 3)

Section 3: Program Organization 97 IGGOl92B fAl

'-...__ E_N,..T_R_Y __ )

ISL01E4 ISL01H3 ~ OF IN OF

D5i~--.....,

= 0

ISL02Al

Fl,""' ~--..

r LS_E_T_OC_B.. B_U_F_N_0_=_2..J (0 NO

YES

1----~t"!B~U~F:;Fi;ERRipP;oicoiiL:_1- 3 FROM SUBPOOL 8 L.-~~==~.J 250 Chart ABI Second Common Open Executor (IGGOl92B) (Part 1 of 2)

98 OS ISAM Logic --~)

TO: IGG0192C

Chart AB2 Second Common Open Executor (IGG0192B) (Part 2 of 2)

Section 3: Program Organization 99 IGG0192C CA:~ G- 841---....., IF INDEPENDENT OVERFLOW 2~s~1Fb~§5~~TD~6I~~FEi~¥' PRIME DEVICE TYPE

)

TO: IGG01921, OR IGG01920, OR IGG01950

Chart ACl Third Common Open Executor (IGGOl92C)

100 OS ISAM Logic IGG01920

A1ENTRY ) c-"-----:----" e t YES 831-----.

TCTLRTN

TO: IGG01922

':J.~--..I-C:DDi;-:::3311---_. G:D EXIT)

,-----,,)

TO: IGG01922

-8

Chart AD1 Fixed-length Validation Open Executors (IGG01920)

Section 3: Program Organization 101 IGGOl921 CA:::-J

1----•• G~D EXIT) L-___--I

KJ SAVE DEV TBL PTR AT DCBLRAN ~ & ISLOCNT. SAVE --. AE2 Iy~ty~Kp& B1 Chart AEI First Load Mode Open Executor (IGGOl92l) (Part 1 of 3)

102 OS ISAM Logic ISL02G21~l B1...l.----, SET IOBFLAGS FOR DATA & COMMAND CHAINING

IF DISP= OLD & DATA SET ~~~~~gSF~~ b~~DpR~~ER I------ALLOCATED SPACE

t 8 YES

::L~-lE2!"'""'---.. CALCULATE HIROV (HIGHEST R FOR CYLINDER OVERFLOW)

F3-----,

Chart AE2 First Load Mode Open Executor (IGGOl92l) (Part 2 of 3)

Section 3: Program Organization 103 TCTLRTN

c------:---E3ENTRY ) c------:---E4ENTRY ) FROM: AEl -J4 FROM: AE1-J5 AE2-J4 AE2-K4

DEVRTN TOOLONG~l Fl...J..---, F3,...J..---, F5---., ABEND CODE = 20

TO: AE1-J5 TO: AE1-K5 AE2-J5 AE2-D2

Chart AE3 First Load Mode Open Executor (IGG01921) (Part 3 of 3)

104 OS ISAM Logic IGG0192D CA~::v=)

TOOLONG J ABEND CODE = 20

ISLFB01A ISLFB02 "l ISLFB03 ('ABEND EXIT)

H3-'-==--. CALC & STORE ~~~~~~~i~~~-I------~ NEEDED TO HOLD HIGHEST INDEX)

ISLFB04

Chart AFl First Initial Load Mode Open Executor (IGGOl92D) (Part 1 of 3)

Section 3: Program Organization 105 Chart AF2 First Initial Load Mode Open Executor (IGG0192D) (Part 2 of 3)

106 as ISAM Logic GET NUMBER OF INITIALIZE INDEX EXTENTS ISLAREAZ IN (DEBNIEE) ISLCOMON

mz:::c j E41-'----, PERFORM WHERE-TO-GO LOGIC

TO: IGG0192D, OR IGG0192E

OF ATI------~

Chart AF3 First Initial Load Mode Open Executor (IGGO 192D) (Part 3 of 3)

Section 3: Program Organization 107 IGGOl96D CA~~

B1 !

_J.l___ ..., ~mXIT D4 INITIALIZE WHERE-TO-GO LOG I C TO LOAD MODULE IGG0195G

SETTYPEJ RELOOP E1-'~_-. SAVE INDEX DEV INIT RFP BYTES TYPE (USE PRIME OF JISLODAT NO INDEPENDENT (CURRENT INDEX AREA) OVERFLOW TRK INDEX ENTRY)

TO: IGG0195G

H2'-----,

CHANNEL PROGRAM 31 INITIALIZED ------USING SKELETON IN THIS MODULE

INITIALIZE ISLBUFNO CP31BJ TO READ COUNT &, DATA OF 2 LAST PRIME (INTO FIRST BUFFER L-______-JSPECIFIED IN IOBBeT) L..-----I~ G Le Chart AGI First Resume Load Open Executor (IGG0196D)

108 OS ISAM Logic IGG01924

SETD~~1 ~IC~N~O~T--' "'""" SMALLESTI INTEGER CONTAINING BUFNO/2

------,------r---E3------~ SEE SCHEDULING RTN USE OF ICNOT FIELD

Chart AHI Last Scan Mode Open Executor (IGGOl924)

Section 3: Program Organization 109 IGG01928 SlS04A2

ONE CP22 FOR EACH BUFFER IN SCAN MODE

5I504D2

SETJ RELOC'D PTR5 TO APPDGE RTNS IN CHAN --"'1 QUI2 ~~g ~E~B¥~~~ B 1 '----'--=~ Chart All First Scan Mode Open Executor Module (IGG01928) (Part 1 of 4)

11 0 OS ISAM Logic D31------,---~~ LOADING FIXED LENGTH GET MODULE

Chart AI2 First Scan Mode Open Executor Module (IGGOl928) (Part 2 of 4)

Section 3: Program Organization 111 MOVE 1 COPY OF CP 2 2 FOR EACH BUFFER INTO SPACE FOLLOWING WORK AREA

SET ~~lF~R~L-A-S~T--="(PTR TO LAST CP22 ~~~~S~IT~ST ON FREE QUEUE) AFTER WORK AREA L~

Chart AI3 First Scan Mode Open Executor Module (IGGOl928) (Part 3 of 4)

112 OS ISAM Logic 83,----,

TO: 1GG01929

Chart AI4 First Scan Mode Open Executor Module (IGG01928) (Part 4 of 4)

Section 3: Program Organization 113 IGG0202D C-A1ENTRY ) IF DCB BEING CLOSED IS FOR GET WITHOUT PUTX OR READ WITHOUT WRITE, FMT-2 DSCB IS NOT UPDATED

Chart AJI ISAM Common Close Executor Module (IGG0202D) (Part I of 2)

114 OS ISAM Logic ITISSCAN E2:....:..-----.1 MOVE FIELD FOR SCAN (DCBTDC) FROM DeB TO FORMAT-2 DSCB

SET STATUS BIT (DCBST) FOR RESUME LOAD

Chart AJ2 ISAM Common Close Executor Module (IGG0202D) (Part 2 of 2)

Section 3: Program Organization 115 SISCTSA CA:~ 8-

TO END OF FILE IN SIs~-l END-DF-BUFFER RTN ADD ~6"":'C~U-R~R~EN~T~ BUFFER LENGTH WITH LENGTH OF CURRENT LOGICAL RECORD

AKll-Al NO t (0 YES

SISTAE2 SISTAE23 G4 YES

CHECK FOR READ ERROR THIS BUFFER IF ERROR CHECK RTN GOES TO USER

NO

Chart AK1 QISAM Scan Processing Module (IGG019HB) GET Macro Routine (Part 1 of 14)

116 OS ISAM Logic 02....;.----.

SISSAD42 1 MOV~ 1~L-:-A~ST::-':"(O~R~ ONLY) PART OF RECORD TO USER AREA

r;:;:}.._ l...:Y' SISSAE3

SISSAH3

GETOUT -----) TO: USER

Chart AK2 QISAM Scan Processing Module (IGG029HB) GET Macro Routine (Part 2 of 14)

Section 3: Program Organization 117 SISREA2 CA~~ CA:~

(PUTX RTNJ RELSE RTN

NOPUTX SISREA3 B4 >-N-O-----;~G:~R""EXIT) AX14-A3

SETJ PUTX FLAG ON IN CP OF RELSE BIT SET CURRENT BUFFER BY LAST RELSE ON USER QUEUE MACRO OR A SETL NOT FOLLOWED BY A GET "~""' j C=~~ TO: USER

SISREB2

TO: USER

Chart AK3 QISAM Scan Processing Module (IGGOI9HB) PUTX Macro Routine, RELSE Macro Routine (Part 3 of 14)

118 OS ISAM Logic SISCTBS CA:::=J

__""" SIs~l_.l...B3

TO USER

FOR WRITE ERROR

IAKsl ~

SIs~-l Hl-'---.....,

SISBSE1 1----•. cm:D EXIT) L-___-.J

ER:OR IN SPECIFYING SETL SISBSFl j SISBSAB G:~D""OOTJ Chart AK4 QISAM Scan Processing Module (IGG019HB) SETL B Macro Routine (Part 4 of 14)

Section 3: Program Organization 119 ~~- SISBSB4

SISBSC4 1 QUEU~3:"'AK=1':"O-~A~1" MOVE ENTIRE WRITE QQTO FREE L~ E2---....,

SISBSH1

READ 1ST RECORD & TRACK INDEX ENTRY

SISBSHS

1---->C!TURN )

'------..... TO: USER

""'"""fK1~ j '- RETURN )

TO: GET

Chart AK5 QISAM Scan Processing Module (IGGOI9HB) SETL B Macro Routine (Part 5 of 14)

120 OS ISAM Logic SISCTES

A1ENTRY ) C-"-----'

AK14-A3 OF

AKIO-AI FROM

SISESC3 PREPARE WRITE l~·~------~ CP FOR OUTPUT QU ED ~"'AK~l:-:O:-:--A-:I" MOVE ALL OF U~~hQg5M5ETO

!lm!l j C C~:~ TO: USER TO: CLOSE EXECUTOR IGG02029

Chart AK6 QISAM Scan Processing Module (IGG019HB) ESETL Macro Routine (Part 6 of 14)

Section 3: Program Organization 121 SISCTSB

A1ENTRY ) c-"'----:--- G SISSBB32 B4... -- ......

>Y:..:E...:S__ ..... C:~w:=) j

SET READ TRACK INDEX SWITCH ON (WlOSBITl )

r;;;'\. .... l.!.Y SISSBA2

SISSBB31 K2... -- ......

Chart AK7 QISAM Scan Processing Module (IGGOI9HB) Schedule Routine (Part 7 of 14)

122 OS ISAM Logic DETERMINE WHAT IS TO BE READ

COMPARE rAKe\. W1 ICNOT ~~ SISSBK3 D4...l.----, ON CYLINDER BIT

SCHEDULE . ~~-+j SUCCESSFUL SISSBD51 5,-'----,

J~p-j H1...l.----, SAME rH5'~ '-- RETURN ) SWITCH l,--_~~~~~~""'--"""

Chart AK8 QISAM Scan Processing Module (IGG019HB) Schedule Routine (Part 8 of 14)

Section 3: Program Organization 123 SISSCF2~l 84...1.-- .....

L~ L.:o/

""'~, El ...... I---.,

L~ L!V

Chart AK9 QISAM Scan Processing Module (IGG019HB) Schedule Routine (Part 9 of 14)

124 as ISAM Logic SISCTSD CA~::=)

>----.. C::::=-)

TO: CALLING ROUTINE

E2-----,

~§O;M~¥~UE 1 SISSDF3 Fl~------~ MOVE FIRST POINTER FROM "Fl\~~:: 8 TO

Chart AK10 QISAM Scan Processing Module (IGG019HB) Queue Routine (Part 10 of 14)

Section 3: Program Organization 125 SISCTSE

t G

,K/I \.. EXIT )I".~---I L-___---I

Chart AK11 QISAM Scan Processing Module (IGG019HB) End-of-Buffer Routine (Part 11 of 14)

126 OS ISAM Logic SET lOBI COMPLETED BIT ~ TO ZERO '------' r;::;;l ~

OF

LQu

Chart AK12 QISAM Scan Processing Module (IGG019HB) End-of-Buffer Routine (Part 12 of 14)

Section 3: Program Organization 127 SISCTSF

A1ENTRY ) C-"------,----"

SISSFA2 _1~ ____ '"1 81 SET PTR (W1FCPS) TO FIRST CHAN PROG ON QUEUE

D3:---...,

F3,...I.----.

TO: CALLING ROUTINE

SIs0-1SISSFH2 K1...1.--..., CHAIN TO PREVIOUS CHAN ~81 PROG GET THE ~ NEXT CHAN PROG

Chart AK13 QISAM Scan Processing Module (IGG019HB) SETC4 Subroutine (Part 13 of 14)

128 OS ISAM Logic SISCTSGC SISCTSGE

CHECK RTN {A3~ EINFO RTN A1 ) .... __E_N~T_R_Y ___" c- " ENTRY J

B2-----, SET ON DCBEXCD1 ON READABLE BLOCK BIT

JSET ON UNREACHAB"LE OUTPUT BIT IN I DCBEXCD1 "----===---' '------' ! ,,",~n [, E3:....J.. __...., (0 SET OFF ALL FLAG BITS EXCEPT DATA -KEY/DATA

SISSGAB "l >N_O ___ (AB::D EXIT) ABEND CODE 31 C EXIT )

TO: EINFO RTN

ERROUT (H/I NO >---+" EXIT )

TO: 'JSER SYNAD

I--t--··CK~::=J G TO: IGG02029

Chart AK14 QISAM Scan Processing Module (IGGOI9HB) Check Routine and EINFO (Error Information) Routine (Part 14 of 14)

Section 3: Program Organization 129 SISSAPRET SISCERTN SISABRTN (A" CA~~ CA~~ '-.. __E_N_T_R_Y_....,)

FROM: lOS CHANNEL­ ABNORMAL­ END ON READ JEND ON REAl '---:==-----,1'------'

SISAPAS4 CD~~ YES

ASYNCHRONOUS j ROUTINE ENTRY

SISAPOl El"'!---...... , E4"'!---...... , GET lOB DCB ADD APPENDAGE ADD 8 TO GET CODE TO GET D~~B ~g~~E~~~· MODULE BASE MODULE BASE FROM RQE ADDRESS 1 ADDRESS j~. '------'

(F3....:..--...... '- EXIT )

TO: APPENDAGE ROUTINE

Chart ALl Scan Mode Appendage (IGGO 19HG) (Part 1 of 3)

130 OS ISAM Logic SISRAB2 CA~::=J

ABNORMAL-END APPENDAGE READ QUEUE SISRAC2

~---,l G

MOVE JroB FIELDS INTO CHANNEL PROG FOR USER ERROR EXIT

(K3 YES tWC3- ----+.~ EXIT )

TO: lOS EXCP ROUTINE

Chart AL2 Scan Mode Appendage (IGG019HG) Abnormal-end, Read Queue (Part 2 of 3)

Section 3: Program Organization 131 SISCTRG C-A1ENTRY )

NO

""---) TO: lOS

NO H2 ) ~------. C-, ___E_X_I_T ____ ~ TO: ASYNCHRONOUS ROUTINE

Chart AL3 Scan Mode Appendage (IGG019HG) Channel-end, Read Queue (Part 3 of 3)

132 OS ISAM Logic SISC4Al

A1ENTRY ) C-'----:---

RETURN POINT WBEN ALL BUFS WITH WRITE ERRORS HAVE BEEN HANDLED

PREPARE FOR ERROR EXIT 8- SISC4Fl El...1.--..., ESETL AK6-Al INITIATE LAST WRITES. MOVE BUFS TO FREE Q

SISC4Cl FJ...I--...., USER SYNAn MUST RETURN TO CLOSE EXECUTOR

SISC4J3 TCTLRTN Kl .....--...., r-

TO: 10002020 Chart AMI Scan Mode Close Executor Module (IGG02029)

Section 3: Program Organization 133 IGG0192I

E3:-l.-----. TEST IF READ & UPDATE OR WRITE K~PEg~F¥~6H ------~~

ON o

OPN07K2D OPN07K2F j OPN07K2EK5,....l ___.., ADJUST ADDR OF ~ CHECK MODULE AN2 AND I~O¥5 ~~~ULE ----+ B 1

Chart ANI BISAM Open Executor - Load Privileged Module (IGGOI92I) (Part 1 of 2)

134 OS ISAM Logic 8-

TCTLRTN,KS 1----+-L XCTL ) ...... _-----'

Chart AN2 BISAM Open Executor - Load Privileged Module (IGG0192I) (Part 2 of 2)

Section 3: Program Organization 135 IGG019JV

------..~:~ L-______-' TO: USER- (PROCESSING PROGRAM)

Chart API BISAM Nonprivileged Macro-time Processing - READ K, READ KU, WRITE K (IGGOI9JV)

136 OS ISAM Logic IGG019JX

A1ENTRY ) C-"'-----:--- FROM: NON-PRIVILEGED MACRO-TIME ROUTINE VIA QING SVC

WKNN2J2

TO: NONPRIVILEGED l AT SVC ROUTINE)

Chart AQI BISAM Privileged Macro-time Processing Module (WRITE KN, without Read and Update) (IGG019JX) (Part 1 of 2)

Section 3: Program Organization 137 C-A1ENTRY ) --~---FROM: CC1-J5, OR ASYNCHRONOUS RTN

D2----.. SET lOB SEEK ADDRESS = DCBFTHI

F2:----,

CYLINDER INDEX HIGHEST LEVEL, USE CP 2 8- WKNS5G2 H3..... --.....,

TO: CC1-K5, OR ASYNCHRONOUS RTN

Kl .....---,

Chart AQ2 BISAM Privileged Macro-Time Processing Module (WRITE KN, without Read and Update) (IGG019JX) (Part 2 of 2)

138 OS ISAM Logic SECTION 4: DIRECTORY

Section 4: Directory 139

ISAM Modules Identified in Alphameric Sequence

All ISAM modules are listed according to function and mode in Figure 56 and in alphameric order in Figure 57.

Section 4: Directory 141 OISAM Load Mode OISAM Scan Mode 8iSAM ~Function Common 192A 1928 192C 192A 1928 192C 192A 1928 192C

Validation 1920 1950 1922 1920 1950 1922 1920 1950 1922 Modules Open Executor 192D 192T 195D 1924 192H 192N 192Z 192E 192U 195G 1928 1921 1920 Mode- 192F 192V 195T 1929 192J 192P oriented 192G 1921 195U 192K 1920 192R 1925 196D 192L 192W 1925 1927 196G 192M 192X

19GA 191A 1911 19H8 19HD 19HF 19JV 19JO 19H3 Macro-time 19GB 191B 1912 19HN 19JW 19J3 19H7 19JX 19J6 19J7

Channel-end 19GC 19HG 19GL 19G3 191M and 19GD 19HH 19GM 19G4 191N Abnormal-end 19HI 19GN 19G5 1910 Appendages 19HJ 19GO 19G6 1919 19HK 19GO 19G7 19G1 19G8 19G2 19G9

Processing SIO 19GG 19HA 19JH Modules Appendage

19GE 19HL 19HP 19JO 19JU 19GF 19JJ 19JP Channel 191E 19JK 19JO Program 191F 19JL 19JR 19JM 19J5 19JN 19JT

19GV 19GY 191X Asynchronous 19GW 19GZ 191Y 19GX 191Z

054(SVC54) 054(SVC54) Other 19JC (CHECK) 19JI (Dynamic Buffer)

Mode- 2021 202K 202M 2029 202A Close oriented 202J 202L 2028 Executor Common 202D 202D 202D

Figure 56. ISAM Modules Identified by Function and Mode

142 OS ISAM Logic References Module Mode and Function Text Figures Flowcharts Pages Pages Pages

IGG019GA QISAM load (macro routines) 30 IGG019GB QISAM load (macro routines) 30 IGG019GC QISAM load (appendage routines) 30 IGG019GD QISAM load (appendage routines) 30 IGG019GE QISAM load (channel programs) 30 IGG019GF QISAM load (channel programs) 30 IGG019GG QISAM load (RPS appendage routine) 30 IGG019GL BISAM (appendage routines) 72 IGG019GM BISAM (appendage routines) 72 IGG019GN BISAM (appendage routines) 72 IGG019GO BISAM (appendage routines) 72 IGG019GV BISAM (asynchronous routines) 71 IGG019GW BISAM (asynchronous routines) 71 IGG019GX BISAM (asynchronous routines) 71 IGG019GY BISAM (asynchronous routines) 71 IGG019GZ BISAM (asynchronous routines) 71 IGG019GO BISAM (appendage routines) 72 IGG019G1 BISAM (appendage routines) 72 IGG019G2 BISAM (appendage routines) 72 IGG019G3 BISAM (appendage routines) 72 IGG019G4 BISAM (appendage routines) 72 IGG019G5 BISAM (appendage routines) 72 IGG019G6 BISAM (appendage routines) 72 IGG019G7 BISAM (appendage routines) 72 IGG019G8 BISAM (appendage routines) 72 IGG019G9 BISAM (appendage routines) 72 IGG019HA QISAM scan (RPS appendage routines) 51 IGG019HB QISAM scan (macro routines) 51 116 IGG019HD QISAM scan (macro routines) 51 IGG019HF QISAM scan (macro routines) 51 IGG019HG QISAM scan (appendage routines) 51 130 IGG019HH QISAM scan (appendage routines) 51 IGG019HI QISAM scan (appendage routines) 51 IGG019HJ QISAM scan (appendage routines) 51 IGG019HK QISAM scan (appendages) 51 IGG019HL QISAM scan (channel programs) 51 IGG019HN QISAM scan (macro routines) 51 IGG019HP BISAM (channel programs) 73 IGG019H3 BISAM (macro routines) 70 IGG019H7 BISAM (macro routines) 70 IGG0191A QISAM load (macro routines) 30 IGG0191B QISAM load (macro routines) 30 IGG0191E QISAM load (channel programs) 30 IGG0191F QISAM load (channel programs) 30 IGG0191M BISAM (appendage routines) 72 IGG0191N BISAM (appendage routines) 72 IGG01910 BISAM (appendage routines) 72 IGG0191X BISAM (asynchronous routines) 71 IGG0191Y BISAM (asynchronous routines) 71 IGG0191Z BISAM (asynchronous routines) 71 IGG01911 QISAM load (macro routines) 30 IGG01912 QISAM load (macro routines) 30

Figure 57 (Part 1 of 3). ISAM Modules Identified in Alphameric Sequence

Section 4: Directory 143 References Module Mode and Function Text Figures Flowcharts Pages Pages Pages IGG01919 BISAM (appendage routines) 72 IGG019JC BISAM (check routine) 68 IGG019JH BISAM (RPS appendage routine) 68 72 IGG019JI BISAM (dynamic buffering routine) 67-68 IGG019JJ BISAM (channel programs) 73 IGG019JK BISAM (channel programs) 73 IGG019JL BISAM (channel programs) 73 IGG019JM BISAM (channel programs) 73 IGG019JN BISAM (channel programs) 73 IGG019JO BISAM (channel programs) 73 IGG019JP BISAM (channel programs) 73 IGG019JQ BISAM (channel programs) 73 IGG019JR BISAM (channel programs) 73 IGG019JS BISAM (channel programs) 73 IGG019JT BISAM (channel programs) 73 IGG019JU BISAM (channel programs) 73 IGG019JV BISAM (macro routines) 71 136 IGG019JW BISAM (macro routines) 71 IGG019JX BISAM (macro routines) 70 137 IGG019JO BISAM (macro routines) 70 IGG019J3 BISAM (macro routines) 70 IGG019J6 BISAM (macro routines) 70 IGG019J7 BISAM (macro routines) 70 IGG0192A Common open executor 9 10 95 IGG0192B Common open executor 9 10 98 IGG0192C Common open executor 9 10,17,38,59 100 IGG0192D QISAM load (open executor) 19 17 105 IGG0192E QISAM load (open executor) 19 17 IGG0192F QISAM load (open executor) 20 17 IGG0192G QISAM load (open executor) 20 17 IGG0192H BISAM (open executor) 58 59 IGG01921 BISAM (open executor) 57 59 134 IGG0192J BISAM (open executor) 60 59 IGG0192K BISAM (open executor) 58 59 IGG0192L BISAM (open executor) 58 59 IGG0192M BISAM (open executor) 58 59 IGG0192N BISAM (open executor) 60 59 IGG01920 BISAM (open executor) 60 59 IGG0192P BISAM (open executor) 57 59 IGG0192Q BISAM (open executor) 58 59 IGG0192R QISAM load (open executor) 23 17 IGG0192S QISAM load (open executor) 23 17 IGG0192T QISAM load (open executor) 17 IGG0192U QISAM load (open executor) 23 17 101 IGG0192V QISAM load (open executor) 17 IGG0192W BISAM (open executor) 57 59 IGG0192X BISAM (open executor) 58 59 IGG0192Z BISAM (open executor) 60 59 IGG01920 Common open executor (validation) 12 17,38,59 101 IGG01921 QISAM load (open executor) 16 17 102 IGG01922 Common open executor (validation) 12 17,38,59 103 IGG01924 QISAM scan (open executor) 37 38 109

Figure 57 (Part 2 of 3). ISAM Modules Identified in Alphameric Sequence

144 OS ISAM Logic References Module Mode and Function Text Figures Flowcharts

Pages Pages Pages

IGG01925 QISAM load (open executor) 19 17 IGG01927 QISAM load (open executor) 19 17 IGG01928 QISAM scan (open executor) 37 38 110 IGG01929 QISAM scan (open executor) 37 38 IGG0195G QISAM load (open executor) 22 17 IGG0195G QISAM load (open executor) 21 17 IGG0195T QISAM load (open executor) 22 17 IGG0195U QISAM load (open executor) 22 17 IGG01950 Common open executor (validation) 12 17,38,59 IGG0196D QISAM load (open executor) 21 17 108 IGG0196G QISAM load (open executor) 21 17 IGG0202A BISAM (close executor) 13 14 IGG0202D Common close executor 13 14,36 114 IGG02021 QISAM load (close executor) 34 14,36 IGG0202J QISAM load (close executor) 35 14,36 IGG0202K QISAM load (close executor) 35 14,36 IGG0202L QISAM load (close executor) 35 14,36 IGG0202M QISAM load (close executor) 35 14,36 IGG02028 QISAM load (close executor) 35 14,36 IGG02029 QISAM scan (close executor) 52 14 133

Figure 57 (Part 3 of 3). ISAM Modules Identified in Alphameric Sequence

Section 4: Directory 145

SECTION 5: DATA AREAS

Section 5: Data Areas 147

ISAM Control Blocks and Data Areas

Indexed sequential access method (ISAM) routines use a number of control blocks that are common to all of data management. The control blocks are:

Data control block (DCB) Data event control block (DECB) Data set control block (DSCB) Data extent block (DEB) Input/ output block (lOB)

ISAM routines also use certain work areas and buffer control areas. The ISAM work areas are:

QISAM load mode work area QISAM scan mode work area BISAM work area QISAM load mode track-index save area (TISA) ISAM DCB field area

The ISAM buffer control areas are:

BISAM dynamic buffering buffer control block (BCB) QISAM buffer control block (BCB) QISAM load mode buffer control table (IOBBCT) Data Control Block (DCB) The data control block (DCB) is the major means of communication between the problem program and the control program. The sources for ISAM DCB information are: the open executors, the DCB macro instruction, the problem program, the data definition (DO) statement, and the data set control block (DSCB). Figure 58 shows the portion of the DCB that is unique to ISAM.

Section 5: Data Areas 149 49(31) DCBG ETIDCBPUT

52(34) DCBOPTCD 53(35) DCBMAC 54(36) DCBNTM 153(17) DCBCYLOV

56(38) DCBSYNAD

60(3C) DCBRKP 62(3E) DCBBLKSI

64(40) DCBMSWA

68(44) DCBSMSI 70(46) DCBSMSW

72(48) DCBNCP 73(49) DCBMSHI

76(4C) DCBSETL

80(50) DCBEXCD1 81 (51) DCBEXCD2 82(52) DCBLRECL

84(54) DCBESETL

88(58) DCBLRAN

92(5C) DCBLWKN

96(60) DCBRELSE

100(64) DCBPUTX

104(68) DCBRELX

108(6C) DCBFREED

112(70) DCBHIRTI 113(71)

DCBFTMI2

120(78) DCBLEMI2

125(70)

DCBFTMI3

132(84) DCBLEMI3

137(89) DCBNLEV 138(8A) DCBFIRSH

DCBFIRSH (cont.) 141(80) DCBHMASK 142(8E) DCBLDT

144(90) DCBHIRCM 145(91) DCBHIRPD 146(92) DCBHIROV 1 147(93) DCBHIRSH

148/941 DCBTDC 150(96) DCBNCHRI

Figure 58 (Part 1 of 2). BISAM/QISAM DeB

150 as ISAM Logic 152(98) DCBRORG3

156(9C) DCBNREC

160(AO) DCBST I 161(A1) DCBFTCI

168(A8) DCBHIIOV I 169(A9) DCBFTMI1

176(BO) DCBNTHI 1 177(B1) DCBFTHI

184(B8) DCBLPOA

192(CO)

DCBLETI I197(C5) OCBOVDEV I 198(C6) DCBNBOV 200(C8)

OCBLECI 1205(CO) Reserved 1206(CE) OCBRORG2

208(DO)

OCBLEMI1 1 213(D5) Reserved 1 214(06) OCBNOREC

216(08) OCBLlOV

224(EO) OCBRORG1 1 226(E2) Reserved

228(E4) OCBWKPT1

232(E8) OCBWKPT2

236(EC) OCBWKPT3

240(FO) OCBWKPT4

244(F4) DCBWKPT5

248(F8) DCBWKPT6

Figure 58 (Part 2 of 2). BISAM/QISAM DeB

Section 5: Data Areas 151 Offset Field Name Bytes Field Description 49(31) DCBGET /DCBPUT 3 Address of Get module or address of Put module.

Note: This field is not used by ISAM routines. See the extension of the data extent block (DEB).

53(34) DCBOPTCD 1 Option codes:

Bit 0 W - Write validity-check 1 U - Full track-index write 2 M - Master index(es) 3 I - Independent overflow area 4 Y - Cylinder overflow area 5 Reserved 6 L - Delete option 7 R - Reorganization criteria

53(35) DCBMAC 1 MACRF Extension for ISAM

Bit 0 3 - Reserved 4 U - Update type of READ 5 U - Update type of WRITE 6 A - Add type of WRITE 7 Reserved

54(36) DCBNTM 1 The number of tracks that determine the development of a master index. If the number of tracks in the cylinder index exceeds this number, a master index is developed. If the number of tracks in the master index in turn exceeds this number, then a higher level master index is developed, and so forth. Maximum permissible value: 99.

55(37) DCBCYLOV 1 The number of tracks to be reserved on each prime-data cylinder to hold records that overflow from other tracks on that cylinder. Refer to the section on allocating space for an ISAM data set in the as Data Management Services Guide, GC28-3746, to determine how to calculate the maximum number.

56(38) DCBSYNAD 4 Address of user's synchronous error routine to be entered when uncorrectable errors are detected in processing data records.

152 OS ISAM Logic Offset Field Name Bytes Field Description

60(3C) DCBRKP 2 The relative position of the first byte of the key within each logical record. Maximum permissible value: logical record minus key length. 62(3E) DCBBLKSI 2 Blocksize. For fixed-length record formats, this must be an integral multiple of DCBLRECL. For variable-length record formats, it must be maximum blocksize and must include the 4-byte block length field. 64(40) DCBMSWA 4 Address of a work area supplied by the user when new records are being added to an existing data set. 68(44) DCBSMSI 2 Number of bytes in an area reserved to hold the highest level index. The address of this area is in DCBMSHI. Maximum size allowed is 65,535 bytes. 70(46) DCBSMSW 2 Number of bytes in work area used by the control program when new records are being added to the data set. The address of this area is in DCBMSWA. Maximum size allowed is 32,767 bytes. 72(48) DCBNCP 1 Number of copies of the READ/WRITE type K channel programs that are to be established for this data control block (99 maximum). 73(49) DCBMSHI 3 Address of a main-storage area to hold the highest level index. 76(4C) DCBSETL 4 Address of SETL module for QISAM. Address of Check module for BISAM. 80(50) DCBEXCD1 1 First byte in which exceptional conditions detected in processing data records are reported to the user (see "Appendix B: ISAM Channel Programs").

Bit 0 -Lower key limit not found 1 - Invalid device address for lower limit 2 -Space not found 3 -Invalid request 4 - Uncorrectable input error 5 - Uncorrectable output error 6 -Unreachable block (input) 7 -Unreachable block (update)

Section 5: Data Areas 153 Offset Field Name Bytes Field Description 81(51) DCBEXCD2 1 Second byte in which exceptional conditions detected in processing data records are reported to the user (See "Appendix B: ISAM Channel Programs").

Bit 0 - Sequence check 1 - Duplicate record 2 - DCB closed when error was detected 3 -Overflow record 4 -The logical record length specified in the record field is greater than that specified ip DCBLRECL. (Variable-length records only).

82(52) DCBLRECL 2 Logical record length for fixed-length record formats. For variable-length record formats, may either be maximum logical record length or an actual logical record length changed dynamically by the user when creating the data set.

84(54) DCBESETL 4 QISAM: Address of the ESETL routine in the Get module.

88(58) DCBLRAN 4 Address of READ/WRITE K module.

92(5C) DCBLWKN 4 Address of WRITE KN module.

96(60) DCBRELSE 4 Work area for temporary storage of register contents.

100(64) DCBPUTX 4 Work area for temporary storage of register contents.

104(68) DCBRELX 4 Reserved.

108(6C) DCBFREED 4 Address of dynamic buffering module.

Note: This field is not used by ISAM routines. See the extension of the data extent block (DEB).

112(70) DCBHIRTI 1 Highest number of index entries that fit on a prime-data track.

154 OS ISAM Logic Offset Field Name Bytes Field Description

113(71) DCBFTMI2 7 Direct-access device address of the first track of the second level master index (in the form MBBCCHH). If the second level master index crosses an extent boundary, the first B byte holds the M of the last active entry in this master index (LEMI2). Otherwise, the first B byte will be O.

120(78) DCBLEMI2 5 Direct-access device address of the last active entry in the second level master index (in the form CCHHR). The M for this address is the same as the M contained in the field DCBFTMI2 (above) if the first B byte of that field is o. Otherwise, the M for the address is contained in the first B byte of DCBFTMI2.

125(7D) DCBFTMI3 7 Direct-access device of the first track of the third level master index (in the form MBBCCHH). As for FTMI2, the first B byte will either be 0 or will hold the M of the last active entry in the index (in this case, the M for LEMI3).

132(84) DCBLEMI3 5 Direct-access device address of the last active entry in the third level master index (in the form CCHHR). The M for this address is the same as the M for FTMI3 if the first B byte is contained in the first B byte of FTMI3.

137(89) DCBNLEV 1 Number of levels of index. Has a maximum value of 4, corresponding to the case where there is a cylinder index and three master indexes. If the track index is the highest level index, then NLEV =0.

138(8A) DCBFIRSH 3 HHR of the first data record on each cylinder. The first data record on each cylinder may be on the last track of the track index for that cylinder (in which case, the track is said to be shared).

141(8D) DCBHMASK 1 If the device is a 2301 drum, HMASK = X'37'; otherwise, HMASK = X'FF'.

Section 5: Data Areas 155 Offset Field Name Bytes Field Description

142(8E) DCBLDT 2 HH of the last prime-data track on each cylinder. This differs from the last physical track on a cylinder when the user has reqeusted cylinder overflow areas.

144(90) DCBHIRCM 1 Highest possible R for tracks of the cylinder and master indexes. This is the number of index entries that fits on a track. Note that these indexes may be on a different type of device than the rest of the data set.

145(91) DCBHIRPD 1 Highest possible R for any prime-data track. This is the number of records or blocks that fits on a prime-data track.

146(92) DCBHIROV 1 Highest possible R for overflow data tracks, fixed-length record formats' only. This is the number of fixed-length records or blocks that fits on an overflow data track.

147(93) DCBHIRSH 1 R of the last data record on a shared track, if applicable (fixed-length records only).

148(94) DCBTDC 2 Tag deletion count. A field reserved for the user in which he may keep the number of records that have been tagged for deletion. It is merged to and from the format-2 DSCB for BISAM, scan mode, and load mode resume load.

150(96) DCBNCHRI 2 Number of storage locations needed to hold the highest level index. This is equal to (KL + 10) (N), where N is the total number of index entries, including dummy entries. Note that the track index may be the highest level index, and the track index is never held and searched in main storage.

152(98) DCBRORG3 4 For each use of the data set, the number of Read or Write accesses to an overflow record which is not the first in a chain of such records.

156(9C) DCBNREC 4 N1.Jmber of logical records in the prime-data area.

156 OS ISAM Logic Offset Field Name Bytes Field Description

160(AO) DCBST Status indicators.

Bit 0 - Single schedule mode 1 - Key sequence to be checked 2 - Initial load has been completed 3 - Data set extension (resume loading) will begin on new cylinder 4 -Reserved 5 - First macro not yet received 6 - Last block full 7 - Last track full

161(Al) DCBFTCI 7 Direct-access device address of the first track of the cylinder index (in the form MBBCCHH). As for FTMI2, the first B byte will either be 0 or will hold the M of the last active entry in the index (in this case, the M for LEMI).

168(A8) DCBHIIOV 1 Highest R for independent overflow track.

169(A9) DCBFTMII 7 Direct-access device address of the first track of the first level master index (in the form MBBCCHH). As for FTMI2, the first B byte will either be 0 or will hold the M of the last active entry in the index (in this case, the M for LEMIl).

176(BO) DCBNTHI Number of tracks of the high-level index.

177(Bl) DCBFTHI 7 Direct-access device address of the first track of the highest level index (in the form MBBCCHH). Note that this may be the track index.

184(B8) DCBLPDA 8 Direct-access device address of the last prime-data record in the prime-data area (in the form MBBCCHHR).

192(CO) DCBLETI 5 Direct-access device address of the last active normal entry of the track index on the last active cylinder (in the form CCHHR). The M of this entry is the same as the M of LPDA.

197(C5) DCBOVDEV Independent overflow device type (field description same as DCBDEVT).

Section 5: Data Areas 157 Offset Field Name Bytes Field Description

198(C6) DCBNBOV 2 Number of bytes remaining on current overflow track (variable-length records only).

200(C8) DCBLECI 5 Direct-access device address of the last active entry in the cylinder index (in the form CCHHR). The M for this address is the same as the M for FTC I if the first B byte in FTCI is O. Otherwise the M for this address is contained in the first B byte of FTCI.

205(CD) Reserved for future use.

206(CE) DCBRORG2 2 Number of tracks (partially or wholly) remaining in the independent overflow area.

208(DO) DCBLEMIl 5 Direct-access device address of the last active entry in the first level index (in the form CCHHR). The M for this address is the same as the M for FTMIl if the first B byte in FTMIl is O. Otherwise the M. for this address is contained in the first B byte of FTMll.

213(D5) Reserved for future use.

214(D6) DCBNOREC 2 Number of logical records in an overflow area.

216(D8) DCBLIOV 8 Direct-access device address of the last record written in the independent overflow area (in the form MBBCCHHR).

224(EO) DCBRORGI 2 Number of cylinder overflow areas that are full. 226(E2) 2 Reserved for future use.

228(E4) DCBWKPTl 4 BISAM: pointer to CP 1 or CP 2. QISAM: pointer to DCB work area.

232(E8) DCBWKPT2 4 BISAM: pointer to DCB work area.

236(EC) DCBWKPT3 4 BISAM: pointer to CP 8.

240(FO) DCBWKPT4 4 BISAM: pointer to appendage module (part 1). QISAM: pointer to VCB.

Note: This field is not used by ISAM routines. See the extension of the data extent block (DEB).

244(F4) DCBWKPT5 4 BISAM: pointer to appendage module (part 2). QISAM: pointer to appendage module.

Note: This field is not used by ISAM routines. See the extension of the data extent block (DEB).

248(F8) DCBWKPT6 4 QISAM: pointer to DCB work area vector pointers (ISLVPTRS).

158 OS ISAM Logic Data Event Control Block (DECB) The data event control block is constructed as part of the expansion of a READ or WRITE macro instruction. The DECB contains a parameter list, an event control block, a pointer to the desired logical reco::d, and an exception code. Figure 59 shows the format of the DECB.

~.~------4bytes------~.

0(0) DECBECB

4(4) DECBTYP1 1 5(5) DECBTYP2 16(6) DECBLGTH

8(8) DECBDCBA

12(C) DECBAREA

16(10) DECBLOGR

20(14) DECBKEY

24(18) DECBEXC1 1 25(19) DECBEXC2 1

Figure 59. Data Event Control Block

Offset Field Name Bytes Field Description 0(0) DECBECB 4 Standard ECB 4(4) DECBTYP1 1 First byte of macro type field Bit 0-5 - Reserved 6 - Length coded as'S' (take length from DCBBLKSI) 7 - Area coded as'S' (dynamic buffer option) 5(5) DECBTYP2 1 Second byte of macro type Bit 0 - READ K 1 - Reserved 2 - READ KU 3 - Reserved 4 - WRITE K 5 - WRITE KN 6-7 - Reserved 6(6) DECBLGTH 2 Number of bytes read or written 8(8) DECBDCBA 4 Data control block address

Section 5: Data Areas 159 Offset Field Name Bytes Field Description 12(C) DECBAREA 4 Address of storage area for record 16(0) DECBLOGR 4 Pointer to logical record 20(14) DECBKEY 4 Record key address 24(18) DECBEXCI 1 Exceptional condition code byte (see "Appendix B: ISAM Channel Programs") Bit 0 Record not found 1 Record length check 2 Space not found in which to add a record 3 Invalid request 4 - Uncorrectable I/O error 5 Unreachable block 6 Overflow record 7 - Duplicate record presented for inclusion in data set 25(19) DECBEXC2 1 Exceptional condition code byte (see "Appendix B: ISAM Channel Programs") Bit 0-5 - Reserved 6 Channel program initiated by an asynchronous routine (variable­ length records only) 7 - Previous macro was READ KU Data Set Control Block (DSCB) Data sets on direct-access devices use a control block called a data set control block (DSCB) as their data set label. There are actually three kinds of DSCBs used to describe the attributes and extents of an ISAM data set. The information in the attribute fields of the DSCBs includes data set organization, record format, and other information needed to refer to and use a data set. The extent entries in the DSCBs describe the physical boundaries of a data set. The three kinds of DSCBs used to describe ISAM data sets are: • The identifier (format-I) DSCB contains such items as the data set name, the number of extents on the volume, creation and expiration dates, block length, logical record length, and three extent entries that are used to build the DEB. There is one format-l DSCB for each volume of a data set. (OS DADSM Logic, GY28-6607, provides additional details on the construction of the DSCBs at allocation of the data set.) The index (format-2) DSCB is used only for ISAM data sets. There is one format-2 DSCB for each data set; it is used in constructing the ISAM DCB interface. The format-2 DSCB resides in the VTOC of the first volume on which the data set was allocated. When the QISAM scan mode open executor module (IGGOI928) or the BISAM open executor module (IGGOI92H) is executed, data

160 OS ISAM Logic in the associated format-2 DSCB are moved to the BISAM/QISAM interface portion of the DCB. The DCB field corresponding to each DSCB field is shown in the following detailed description of the format-2 DSCB. The format-2 DSCB is shown in Figure 60. • The extension (format-3) DSCB is required on each volume of a data set that contains more than three extents. It contains as many as 13 additional extent entries, permitting a maximum of 16 extent entries per volume.

Detailed descriptions of DSCBs are given in OS System Control Blocks, GC28-6628.

~.~------4bytes------~.

0(0) 11 (1 ) OS22MINO

8(8) OS2L2MEN

1 13(0) OS23MINO

20(14) OS2L3MIN

1 25(19)

Reserved

44(2C) OS2FMTI0 145(20) OS2NOLEV 1 46(2E) OS20VINO \47(2F) OS21 RCYL

Figure 60 (Part 1 of 2). Format-2 DSCB

Section 5: Data Areas 161 (Continued)

DS21 RCYL (cont.) 50(32) DS2LTCYL

52(34) DS2CYLOV 53(35) DS2HIRIN 54(36) DS2HiRPR 55(37) DS2HIROV

56(38) DS2RSHTR 57(39) DS2HIRTI 58(3A) DS2HIIOV 59(3B) DS2TAGDT

DS2TAGDT (cont.) 61(3D) DS2RORG3

64(40) DS2NOBYT 66(42) DS2NOTRK 67(43) DS2PRCTR

DS2P RCTR (cont.) 71(47) DS2STIND

72(48)

DS2CYLAD

79(4F)

DS2ADLIN

86(56)

DS2ADHIN

93(5D) DS2LPRAD

101 (65) DS2LTRAD

DS2L TRAD (cont.) 106(6A)

DS2LCYAD 111(6F)

DS2LMSAD

116(74) DS2LOVAD

124(7C) DS2BYOVL 126(7E) DS2RORG2

128(80) DS20VRCT 130(82) DS2RORGl

132(84) DS2NIRT 135(87)

DS2PTRDS

Figure 60 (Part 2 of 2). Format-2 DSCB

162 OS ISAM Logic DeB Field to Which Offset Field Name Bytes Field Description 'Moved

0(0) 1 Contains hexadecimal code 02 in order to avoid conflict with a data set name.

1(1) DS22MIND 7 Address of the first track of the DCBFTMI2 second-level master index (in the form MBBCCHH).

8(8) DS2L2MEN 5 Contains the CCHHR of the last active DCBLEMI2 index entry in the second-level master index.

13(D) DS23MIND 7 Address of the first track of the DCBFTM3 third-level master index (in the form MBBCCHH).

20(14) DS2L3MIN 5 Contains the CCHHR of the last active DCBLIMI3 index entry in the third-level master index.

25(19) 19 Reserved.

44(2C) DS2FMTID 1 Format identification for format-2 DSCB (EBCDIC "2").

45(20) DS2NOLEV 1 Number of index levels. DCBNLEV

46(2E) DS2DVIND 1 Number of tracks determining DCBNTM development of the master index.

47(2F) DS21RCYL 3 Contains the HHR of the first data DCBFIRSH record on each cylinder.

50(32) DS2LTCYL 2 Contains the HH of the last data DCBLDT track on each cylinder.

52(34) DS2CYLOV 1 Number of tracks of cylinder overflow DCBCYLOF area on each cylinder.

53(35) DS2HIRIN 1 Highest possible R on a track DCBHIRCM containing high-level index entries.

54(36) DS2HIRPR 1 Highest possible R on prime-data DCBHIRPD tracks for format-F records.

Section 5: Data Areas 163 DeB Field to Which Offset Field Name Bytes Field Description Moved

55(37) DS2HIROV 1 Highest possible R on overflow data DCBHIROV tracks for format-F records.

56(38) DS2RSHTR 1 Contains the R of the last data DCBHIRSH record on a shared track.

57(39) DS2HIRTI 1 Highest number of index entries that DCBHIRTI fit on a prime-data track.

58(3A) DS2HIIOV 1 Highest R for independent overflow DCBHIIOV track.

59(3B) DS2TAGDT 2 The number of records that have been DCBTCD tagged for deletion. This field is updated by the user during BISAM, scan mode, and load mode resume loading.

61(3D) DS2RORG3 3 The number of random references to DCBRORG3 overflow records other than the first overflow record in a chain.

64(40) DS2NOBYT 2 The number of bytes needed to hold the DCBNCRHI highest-level index in main storage.

66(42) DS2NOTRK 1 The number of tracks occupied by the DCBNTHI highest-level index.

67(43) DS2PRCTR 4 The number of records in the prime- DCBNREC data area.

71(47) DS2STIND 1 Status indicators. DCBST

Bits Bit Setting Meaning 0 0 Reserved 1 1 Key sequence to be checked 2 1 Initial load has been completed 3-5 1 Reserved (must remain zero) 6 1 Last block full 7 1 Last track full 72(48) DS2CYLAD 7 Address of the first track of the DCBFTCI cylinder index (in the form MBBCCHH).

164 OS ISAM Logic DCB Field ~, , to Which Offset Field Name Bytes Field Description Moved

79(4F) DS2ADLIN 7 Address of the first track of the DCBFTMll lowest-level master index (in the form MBBCCHH).

86(56) DS2ADHIN 7 Address of the first track of the DCBFTHI highest-level master index (in the form MBBCCHH).

93(5D) DS2LPRAD 8 Address of the last record in the DCBLPDA prime-data area (in the form MBBCCHHR).

101(65) DS2LTRAD 5 Contains the CCHHR of the last normal DCBLETI entry in the track index on the last cylinder.

106(6A) DS2LCYAD 5 Contains the CCHHR of the last index DCBLECI entry in the cylinder index.

111(6F) DS2LMSAD 5 Contains the CCHHR of the last index DCBLEMIl entry in the master index.

'", 116(74) DS2LOVAD 8 Address of the last record written in DCBLIOV the current independent overflow area (in the form MBBCCHHR).

124(7C) DS2BYOVL 2 The number of bytes remaining on the DCBNBOV current independent overflow track.

126(7E) DS2RORG2 2 The number of tracks remaining in the DCBRORG2 independent overflow area.

128(80) DS20VRCT 2 The number of records in the overflow DCBNOREC area.

130(82) DS2RORGI 2 The number of cylinder overflow areas DCBRORGI that are full.

132(84) DS2NIRT 3 HHR of the dummy track-index entry.

135(87) DS2PTRDS 5 If there are more than 3 extent segments for the data set on this volume, this field contains the address of a format-3 DSCB (in the form CCHHR). Otherwise, this field contains binary Os.

Section 5: Data Areas 165 ISAM-dependent Section (Occurs only once) ( 32(20) DEBNIEE 33(21 ) DEBFIEAD

36(24) DEBNPEE 37(25) DEBFPEAD

40(28) DEBNOEE 41(29) DEBFOEAD

44(2C) DEBRPSID 45(2D) DEBEXPTR

Device-dependent Section (Occurs once for each extent) +0(0) DEBDVMOD I+1 (1) DEBUCBAD

+4(4) DEBBINUM +6(6) DEBSTRCC

+8(8) DEBSTRHH +10(A) DEBENDCC

+12(C) DEBENDHH +14(E) DEBNMTRK

DEBSUBID Subroutine Name Section (Occurs once for eacti subroutine)

ISAM Extension Load Mode Extension 1+0(0) DEBPUT

Scan Mode Extension

+0(0) DEBGET,DEBPUT +4(4) DEBWKPT4

+8(8) DEBWKPT5 +12(C) DEBCREAD

+16(10) DEBCSETL +20(14) DEBCWRIT

+24(18) DEBCCHK +28(1C) DEBCREWT

+32(20) DEBCRECK +36(24) DEBAREAD

+40(28) DEBASETL +44(2C) DEBAWRIT

+48(30) DEBACHK +52(34) DEBAREWT

+56(38) DEBARECK

BISAM Extension

+0(0) DEBDISAD +4(4) DEBWKPT4

+8(8) DEBWKPT5 +12(C) DEBFREED

+16(10) DEBRPSIO

Figure 61. ISAM Extensions to DEB (

166 OS ISAM Logic Data Extent Block (DEB) The ISAM open executors construct the data extent block (DEB). The DEB contains ) the extents of the opened data set, pointers to the unit control blocks (UCBs) for the extents, and the names of access method routines to be used. The ISAM-dependent, device-dependent, and subroutine name sections of the DEB are shown in Figure 61. ISAM-DEPENDENT SECTION

Offset Field Name Bytes Field Description

32(20) DEBNIEE 1 Number of extents of independent index area

33(21) DEBFIEAD 3 Address of first index extent

36(24) DEBNPEE 1 Number of extents of prime-data area

37(25) DEBFPEAD 3 Address of the first prime-data extent

40(28) DEBNOEE 1 Number of extents of independent overflow area

41(29) DEBFOEAD 3 Address of the first overflow extent

44(2C) DEBRPSID 1 Identifiers for prime, index, or overflow areas on an RPS direct-access storage device. ... Bits Meaning \ I 0 Prime area is on an RPS device. 1 Index area is on an RPS device. 2 Overflow area is on an RPS device. 3 An SIO appendage for RPS has been loaded. (This bit set by IGG0192K.) 4-7 Reserved. 45(2D) DEBEXPTR 3 Address of ISAM DEB extension.

The device-dependent sections (one for each extent) are in the following order: prime extents, index extents, overflow extents.

DEVICE-DEPENDENT SECTION

Offset Field Name Bytes Field Description

+0(0) DEBDVMOD 1 Device modifier: file mask.

) Section 5: Data Areas 167 Offset Field Name Bytes Field Description

+1(1) DEBUCBAD 3 Address of UCB associated with this data extent. (

+4(4) DEBBINUM 2 Bin number if the device is a 2321 data cell drive, 0 for other devices.

+6(6) DEBSTRCC 2 Cylinder address for the start of an extent limit.

+8(8) DEBSTRHH 2 Read/write track address for the start of an extent limit.

+lO(A) DEBENDCC 2 Cylinder address for the end of an extent limit.

+12(C) DEBENDHH 2 Read/write track address for the end of an extent limit.

+14(E) DEBNMTRK 2 Number of tracks allocated to a given extent.

SUBROUTINE NAME SECTION

DEBSUBID 2n Subroutine identification. Each access method subroutine, appendage subroutine, and IRB routine has a unique 8-byte name. The low-order two bytes of each routine name are in this field if the subroutine is loaded by the open routine.

ISAM EXTENSION

Load Mode Extension

+0(0) DEBPUT 4 Address of the PUT processing module

Scan Mode Extension

+0(0) DEBGET, DEBPUT 4 Address of the Get processing module

+4(4) DEBWKPT4 4 Address of the UCB

+8(8) DEBWKPT5 4 Pointer to the Get appendage module

+ 12(C) DEBCREAD 4 Address of channel-end appendage for Read

+16(10) DEBCSETL 4 Address of channel-end appendage for SETL

+20(14) DEBCWRIT 4 Address of the channel-end appendage for Write

+24(18) DEBCCHK 4 Address of the channel-end appendage for Write-validity-check

168 OS ISAM Logic Offset Field Name Bytes Field Description

+28(1C) DEBCREWT 4 Address of the channel-end appendage for Rewrite

+32(20) DEBCRECK 4 Address of the channel-end appendage for Recheck

+36(24) DEBAREAD 4 Address of the abnormal-end appendage for Read

+40(28) DEBASETL 4 Address of the abnormal-end appendage for SETL

+44(2C) DEBAWRIT 4 Address of the abnormal-end appendage for Write

+48(30) DEBACHK 4 Address of the abnormal-end appendage for Write-validity-check

+52(34) DEBAREWT 4 Address of the abnormal-end appendage for Rewrite

+56(38) DEBARECK 4 Address of the abnormal-end appendage for Recheck

BISAM Extension

+0(0) DEBDISAD 4 Address of the privileged module entered when a BISAM macro instruction is executed.

+4(4) DEBWKPT4 4 Address of the Part 1 appendage module (abnormal-and channel-end appendages).

+8(8) DEBWKPT5 4 Address of the Part 2 appendage module (abnormal-and channel-end appendages).

+12(C) DEBFREED 4 Address of the dynamic buffering module.

+16(10) DEBRPSIO 4 Address of the RPS SIO appendage module if dynamic buffering is used. (If dynamic buffering is not used, the appendage vector table of the DEB contains the address of the RPS SIO appendage module.)

Section 5: Data Areas 169 Input/Output Block (lOB) The input/output block (lOB) contains information required by the I/O supervisor to perform an input/output operation. The ISAM routine constructs an lOB for each such operation.

The lOB consists of 40 bytes of standard information as described in OS System Control Blocks, GC28-6628. The standard information is common to all access methods. BISAM and QISAM (scan mode) use extensions of the standard lOB, and QISAM uses an lOB prefix. The ISAM extensions and prefix are shown in Figure 62.

OISAM Prefix ------~ 1-4(-4) Event Control Block

BISAM Extension

40(28) IOBCCWAD

44(2C) IOBINDCT 45(2D) IOBUNSOR I46(2E) IOBAPP I47(2F) IOBASYN

48(30) IOBCOUNT 49(31) IOBFCHAD

52(34) IOBBCHAD

56(38) IOBCCW1

64(40) IOBCCW2

OISAM Extension (scan mode)

140(28) 011 EXTEN·W1 OEXTEN

Figure 62. ISAM Extensions to lOB

Offset Field Name Bytes Field Description

QISAM Prefix

-4(-4) 4 Event control block.

BISAM Extension

40(28) 10BCCWAD 4 Address of first CCW of channel program or address of buffer after completion of a READ KU (BISAM dynamic buffering).

170 OS ISAM Logic Offset Field Name Bytes Field Description

44(2C) IOBINDCT 1 Indicators.

Bit Bit Setting Meaning

0 1 Remove channel program from queue. 1 1 lOB is on the unscheduled queue. 2 0 DECBAREA (+6) points to overflow record data; DCBMSW A points to the key and data of an overflow record. 3 0 DECBKEY points to overflow record key. 1 DCBMSWA (+8) points to overflow record key. 4-6 0 Reserved. 7 0 Normal channel end has occurred. 1 Abnormal channel end has occurred. 45(2D) IOBUNSQR 1 Reason for unscheduled or error queue. Bit Bit Setting Meaning 0 1 CP I or CP 2 busy. 1 1 No CP 4, CP 5, or CP 6. 2 1 No CP 7. 3 1 WRITE KN is in effect (unscheduled lOB is for WRITE KN). 4 1 WRITE KN is in effect (unscheduled lOB is for READ or WRITE K). 5 1 An error condition is associated with this lOB. 6-7 0 Reserved. 46(2E) IOBAPP 1 Appendage code (see "Section 6: Diagnostic Aids"). 47(2F) IOBASYN 1 Asynchronous routine code (see "Section 6: Diagnostic Aids"). 48(30) IOBCOUNT 1 Write-check counter. 49(31) IOBFCHAD 3 Forward chain address. 52(34) IOBBCHAD 4 Backward chain address. 56(38) IOBCCWI 8 Set sector CCW for use with RPS direct-access storage devices. 64(40) IOBCCW2 8 TIC CCW to the channel program, used with RPS devices.

Section 5: Data Areas 171 Offset Field Name Bytes Field Description QISAM Extension (scan mode) 40(32) QlIEXTEN 2 Appendage codes (see "Section 6: Diagnostic Aids"). WIOEXTEN Buffer Control Block (BCB)-BISAM The buffer control block (BCB) used to control dynamic buffering in BISAM is structured by the stage 2 Open executor IGG0293B if the problem program has requested dynamic buffering. If the user does not specify the number of buffers he desires, two buffers are provided. The fields of the BISAM BCB are shown schematically in Figure 63.

~~~------4bytes------~)

0(0) BCBFIOB

4(4) BCBLlOB

8(8) BCBNAVB

12(C) BCBSIZE

16( 10) Reserved (for doubleword alignment)

20(14) First Buffer (Link Field) 1

24(18) First Buffer (continued)

Second Buffer (Link Field)

Second Buffer (continued)

Nth Buffer (Link Field)

Nth Buffer (continued)

1 The first buffer begins at 20( 14) if buffer alignment specified was fullword; it begins at 24(18) if alignment was at doubleword.

Figure 63. Fields of the BISAM Dynamic Buffering Buffer Control Block

The following describes the contents and uses of the fields of the BISAM BCB.

Field Name: BCBFIOB Offset: 0(0) Bytes: 4

172 OS ISAM Logic Field Description: If there are not enough buffers available for the number of READ K or READ KU requests issued, the dynamic buffering routine, entered from the start I/O appendage routine, activates this field as a pointer to the first lOB that needs a buffer. Later, when a buffer has become available (because it was released by either the WRITE K macro instruction or the FREEDBUF macro instruction), the dynamic buffering routine, entered through one of those macro routines, updates BCBFIOB to point to the next lOB that needs a buffer. If there are no more lOBs on queue for a buffer, this field is then reset to O. Initially, this field is set to 0 by the IS AM open module IGGOI92B.

Field Name: BCBLIOB Offset: 4(4) Bytes: 4 Field Description: If there are not enough buffers available for the number of READ K or READ KU requests issued, the dynamic buffering routine, entered from the start I/O appendage routine, activates this field as a pointer to the last lOB that needs a buffer (the lOB of the latest Read requested). The lOB forward chain address (IOBFCHAD) of the lOB previously pointed to by this field, if BCBLIOB has been previously activated, is also set to point to this latest lOB. 10BFCHADs thus provide the linkage between BCBFIOB and BCBLIOB. BCBLIOB is initialized and reset whenever BCBFIOB is.

Field Name: BCBNAVB Offset: 8(8) Bytes: 4 Field Description: Points to the next buffer available to a READ K or READ KU request. Initially, BCBNAVB is set to point to the first buffer by ISAM Open module IGGOI92B. The dynamic buffering routine is entered from the start I/O appendage routine to select the buffer pointed to by this field when a read is issued. The link field of the buffer selected is placed into BCBNAVB. When a buffer has been released either by a FREEDBUF macro instruction or because it has been written back into the data set, entry is made to the dynamic buffering routine. If an lOB is waiting for a buffer (see BCBFIOB), the buffer just released is assigned to the lOB, and an EXCP is issued. If, however, the lOB queue is empty, the buffer is placed on the available queue. This is accomplished by placing a pointer to the buffer in BCBNAVB after moving the contents of BCBNAVB into the link field of the buffer. When there are no buffers on the available queue, BCBNAVB contains O.

Section 5: Data Areas 173 Field Name: BCBSIZE Offset: 12(C) Bytes: 4 Field Description: Total main-storage size of the BCB and the attached buffers. Calculated by open module IGGOl92B. Used by Close module IGG0202A to free the buffer control block and the associated buffers.

Field Name: First Buffer (Link Field) Offset: 20(14) Bytes: 4 (first 4 bytes of each buffer)

Field Description: If a buffer is on the available queue, its link field contains the address of the following buffer to be made available. When a buffer is the last buffer on the available queue, its link field contains O. When a buffer is not on the available queue, these 4 bytes are used as a part of the buffer.

Buffer Control Block (BCB)-QISAM

The BCB used in QISAM differs in format from the BISAM BCB. Figure 64 pictures schematically the fields of the QISAM BCB. This BCB may result from a GETPOOL or BUILD macro instruction issued by the processing program, or it may be constructed by the stage 1 open executors. The information it contains is needed by the stage 2 open executors.

0(0) ADDRESS OF FIRST BUFFER

4(4) 6(6)

NUMBER OF BUFFERS LENGTH OF EACH BUFFER

Figure 64. Fields of the QISAM Buffer Control Block

The following is a description of the contents and uses of the fields of the QISAM BCB. Field Name: Address of first buffer Offset: 0(0)

Bytes: 4

174 OS ISAM Logic Field Description: Load mode open module IGGOl92G uses this address to initialize the load mode buffer control table field named IOBABUF. Scan mode open module IGGOl929 uses the address (in conjunction with the link field of each buffer) to initialize its channel programs.

Field Name: Number of buffers Offset: 4(4) Bytes: 2 Field Description: The number of buffers in this buffer pool.

Field Name: Length of each buffer Offset: 6(6)

Bytes: 2 Field Description: Scan mode open module IGG01929 uses this field to ensure the buffer size is adequate for the records to be retrieved.

Buffer Control Table (JOBBCT) The buffer control table, used by QISAM load mode to control the filling of buffers, is initialized by Stage 2 Open executor module IGGOl92G. The area for the IOBBCT is obtained by Stage 1 Open executor module IGGOl92B. The fields of the buffer control table are shown schematically in Figure 65.

0(0) 10BFLAGS 1 (1) IOBPTRA

4(4) 10BB 5(5) 10BPTRB

lOBS 8(8) 9(9) 10BABUF (1st Buffer) (1st Buffer)

.., lJ

,.

lOBS 10BABUF 2N+10 2N+11 (Nth Buffer) (Nth Buffer)

Figure 65. QISAM Load Mode Buffer Control Table

Section 5: Data Areas 175 The following is a description of the contents and uses of the fields of the IOBBCT.

Field Name: IOBFLAGS Offset: 0(0) Bytes: 1 Field Description: General I/O conditions pertaining to all buffers. IOBFLAGS is initialized by open executor IGG0192G. At this time, bit 4 is set; all other bits are reset. Bit 0: When the end-of-buffer routine schedules an EXCP to use CP 18/CP 20 (to write data records and the associated track indexes), the bit is set on to indicate CP 18/CP 20 are busy.

The CP 18/CP 20 appendage routine resets the bit. Bit 1: When the end-of-buffer routine cannot schedule the EXCP because CP 18/CP 20 are busy (bit 0 = 1), this bit is set. It is interrogated after every PUT macro instruction and, if set, another attempt is made to schedule the EXCP. If the attempt is successful, the bit is reset. Bit 2: When bit 1 = 1 and an attempt is being made to write previously filled buffers, but the current buffer is not full, this bit must be set to tell the end-of-buffer routine, which schedules the EXCP, to return to the Put routine. Bit 3: This bit is set by close executor module IGG0202I. It ensures return to closing routines after using channel programs to complete processing of the final buffers. Bit 4: This bit is set by the Put routine (in move mode only) when the last record PUT filled a buffer. It is interrogated by the Put routine to determine if a new buffer must be initialized before moving the current record and is reset by the beginning-of-buffer routine after the new buffer has been intialized. Bit 5: When the Put routine determines that there is enough space on the current track-index track for only one more normal and overflow track-index entry, it sets this bit. Prior to this determination, it has reset this bit. If the Put routine determines that an end-of-cylinder condition exists, it interrogates the bit to see if the extra track-index dummy entry will fit on the current track (bit 5 = 0), or whether a new track is needed (bit 5 = 1). Bit 6: This bit is set by close executor module IGG0202I. It ensures return to closing routines after completing the data set's high-level index.

176 OS ISAM Logic Bit 7: Set by open executor module IGGOl92R (or IGG0192U) if the data set consists of unblocked records whose relative key position (RKP) is O. The bit is interrogated during initialization of CP 18.

Field Name: IOBPTRA Offset: 1(1) Bytes: 3 Field Description: This field serves as a pointer to the address of the first buffer of the group that is written next. During the execution of CP 18, it points to the address of the first buffer of the group currently being written. When CP 18 is completed, the appendage r~utine updates this field to point to the address of the first buffer of the next group. IOBPTRA is needed to initialize CP 18 before CP 18 is executed. IOBPTRA is initialized by open executor module IGGOl92G to point to the address of the first buffer.

Field Name: IOBB Offset: 4(4) Bytes: 1 Field Description: IOBB contains the number of buffers filled but not yet scheduled for writing. It is updated by the Put routine as each buffer is filled and reset to 0 by the end-of-buffer routine when the buffers are scheduled for writing. IOBB is initialized to 0 by open executor module IGG0192G.

Field Name: IOBPTRB Offset: 5(5) Bytes: 3 Field Description: This field serves as a pointer to the address of the buffer currently being filled. It is updated when the beginning-of-buffer routine is called to prepare a new buffer before executing a PUT command. IOBPTRB is initialized by open executor module IGG0192G to point to the address of the first buffer.

Field Name: lOBS Offset: 2n+ 10 where n is the buffer number. Bytes: 1

Section 5: Data Areas 177 Field Description: There is one status byte (lOBS) for each buffer. The bits are used to indicate conditions peculiar to each buffer. All status bits (except bit 0) are initially reset by open executor module IGGOI92G.

Bit 0: Set (by open executor module IGGOI92G) if this is lOBS field for buffer N (last buffer); otherwise reset. Interrogated to ensure proper sequence of buffering when going from last to first buffer.

Bits 1 and 2: A 2-bit code indicating buffer availability as follows: 00 buffer available - set by CP 18/CP 20 appendage routine after writing; interrogated by beginning-of­ buffer routine prior to using buffer again. 01 contents of buffer caused permanent write error - set by CP 18/CP 20 appendage routine; interrogated by beginning-of-buffer routine prior to using buffer again. 10 buffer full, but not yet scheduled for writing - set by Put routine when buffer becomes full; prevents refilling of buffer before writing. 11 buffer scheduled for writing - set by end-of-buffer routine when scheduled; interrogated by appendage routine to reset these bits and to update 10BPTRA.

Bit 3: This bit is set by the beginning-of-buffer routine when it determines that this buffer, when written, will begin a new extent. Interrogated, then reset, by end-of-buffer routine before scheduling writing of this buffer in the new extent.

Bit 4: This bit (the T-Bit) is set by the beginning-of-buffer routine when it determines that this buffer will be the last written on a track. Interrogated by end-of-buffer routine so that CP 20 is executed to write the track index. The T-Bit is reset by the CP 18/CP 20 appendage routine.

Bit 5: This bit (the C-Bit) is set by the beginning-of-buffer routine when it determines that this buffer, in addition to being the last written on a track, is also the last written on a cylinder. Interrogated by end-of-buffer routine so that CP 21 is executed to write the cylinder index when necessary. The C-Bit is reset by the CP 21 appendage routine.

Bit 6: This bit (the PF-Bit) is set by the beginning-of-buffer routine when it determines that this buffer is the first buffer written on a cylinder and track-sharing is in effect. CP 19 is used to preformat the shared track. The end-ofbuffer-routine interrogates this bit and does not schedule a write on the new cylinder until the CP 19 appendage routine has reset the bit.

178 OS ISAM Logic Bit 7: Not used.

Field Name: IOBABUF Offset: 2n+ 11 where n is the buffer number. Bytes: 3

Field Description: There is one IOBABUF field for each buffer, and it contains the address of its associated buffer. Stage 1 open executor module IGG0192B provides the address of the first buffer (through DCBBUFCB) and Stage 2 open executor module IGGGOI92G uses the buffer link field of each buffer to fill out the r~maining IOBABUFs. (When buffers are structured, the first four bytes of each buffer - the buffer link field - contain the address of the next buffer in the chain. After these addresses are put into the IOBBCT, these four bytes become part of the buffer.) Buffer addresses are used for initialization of CP 18 and provide the storage location into which records are to be moved. QISAM Load Mode DCB Work Area

The QISAM load mode DCB work area is pointed to by the DCBWKPTl field of the DCB. The DCB work area format is shown in Figure 66. Offset Field Name Bytes Field Description 0(0) ISLECBA 4 The ECB for CP 18 and CP 20. 4(4) ISLIOBA 40 The lOB for CP 18 and CP 20. 44(2C) ISLECBB 4 The ECB for CP 21. 48(30) ISLIOBB 40 The lOB for CP 21. 88(58) ISLECBC 4 The ECB for CP 19 and CP 91. 92(5C) ISLIOBC 40 The lOB for CP 19 and CP 91. 132(84) ISLAREAZ 88 This area contains the data field for cylinder overflow records and the count field for ten index entries. These are used to preformat shared tracks during the Put load mode function and to pad dummy track indexes on unused cylinders during the Close routine. Area Z appears as follows:

CYL.OVL. CTRL.RCD. COUNT 1 COUNT 2 COUNT 10 HHRYVT

z Z+6(6) Z+14(E) Z+78(4E)

Section 5: Data Areas 179 ~.~--~------8bytes ------~)

0(0) ISLECBA 4(4)

ISLIOBA

44(2C) ISLECBB

48(30)

ISLIOBB

88(58) ISLECBC 92(5C)

ISLIOBC

132(84)

ISLAREAZ

220(DC)

ISLlXL T

324(144) ISLNIRT 1327(147) ISLHIRT

328(148) ISLCBF 332(14C) ISLBMPR

336(150) ISLFBW 340(154) ISLEOB

344(158) ISLNCNT

352(160) ISLOCNT

Figure 66 (Part 1 of 2). QISAM Load Mode DeB Work Area

180 OS ISAM Logic (Continued)

360(168) ISLDCNT

368(170) ISLNDAT

I378(17A) Reserved 380(17C) ISLODAT 1290(176) 1391(187) Reserved ISLBUFNO

392(188) ISLBUFN 396(18C) ISLMVC

400(190) ISLMVCT 404(194)

ISLVRSAV

476(1DC)

ISLAPSAV

516(204)

ISLWRSAV

580(244) TSTWK1C

584(248) TSTWK2C 588(24C) Reserved

592(250) ISLNOENT 596(254) ISLOFFST

600(258) ISLD 604(25C) ISLFSTBF

608(260) ISLLSTBF 612(264) ISLCCFAD

616(268) ISLKEYAD 620(26C) CL 1AD/ISLF8AD

624(270) CM1AD/ISLFXAD 628(274) C01 AD/ISLFYAD

632(278) COT1AD/ISLFZAD 636(27C) C040AD/ISLPAAD

640(280) C045AD/ISLF1AD 644(284)

ISLVPTRS (pointed to by DCBWKPT6)

704(2CO) ISLIGAP 1 706(2C2) ISLLGAP 708(2C4) ISLRPSSS

Variable-length areas follow: Pointed to by 1SLVPTRS Area Y (See Figure 67) Key save area Buffer control table Channel programs

Figure 66 (Part 2 of 2). QISAM Load Mode DeB Work Area

Section 5: Data Areas 181 Offset Field Name Bytes Field Description 220(DC) ISLIXLT 104 The index location table contains the direct-access device addresses for high-level indexes.

IND. BEGIN STEPPING END

0(0) MBBCCHHR MBBCCHHR MBBCCHHR CYL

26(lA) MBBCCHHR MBBCCHHR MBBCCHHR Ml

52(34) MBBCCHHR MBBCCHHR MBBCCHHR M2

78(4E) MBBCCHHR MBBCCHHR MBBCCHHR M3

There is an indicator byte and three device addresses for each level of index; cylinder, and up to three master index levels. The begin and end addresses are set during the Open routine according to formulas based on space allocation. The stepping addresses are used during data set creation to point to the current index entry location at each level. The indicator byte is as follows: Bit 0 = 1 for last level = o otherwise 1 = 1 for dummy switch on = o for dummy switch off 2 = 1 for current level o otherwise 3 = 1 during Close = o otherwise 4 = 1 when track index has been written but not cylinder index o when cylinder index has been written Indicator bit 4 only applies to the first level of the index location table. 324(144) ISLNIRT 3 HHR of the dummy track-index entry. It is used in Close to signal the end-of-track index padding. 327(147) ISLHIRT 1 The number of index entries that fit on a prime-data track. 328(148) ISLCBF 4 Buffer control pointer. This field contains the address of the current record in the current buffer. It is used to move records into a buffer. 332(14C) ISLBMPR 4 Size of individual records (equal DCBLRECL or DCBLRECL + DCBKEYLE). This field is used to bump ISLCBF to next record location in a buffer.

182 as ISAM Logic Offset Field Name Bytes Field Description 336(150) ISLFBW 4 The number of buffers scheduled to be written. This number is determined immediately following each execution of CP 18. It is the number of buffers (DCBBUFNO) minus one, or the number of buffers that completes a track, whichever is smaller. 340(154) ISLEOB 4 End-of-buffer address. When ISLCBF and ISLEOB are equal, a buffer has been filled. 344(158) ISLNCNT 8 CCHHRKDD. This is the count field for the current normal track-index entry. 352(160) ISLOCNT 8 CCHHRKDD. This is the count field for the current overflow track-index entry. 360(168) ISLDCNT 8 CCHHRKDD. This is the count field for the current dummy track-index entry. 368(170) ISLNDAT 10 MBBCCHHRFP. This is the data field for the current normal track-index entry. 378(17A) 2 Reserved. 380(17C) ISLODAT 10 MBBCCHHRFP. This is the data field for the current overflow track-index entry. 390(186) 1 Reserved. 391(187) ISLBUFNO 1 Number of buffers. ISLBUFNO equals DCBBUFNO. 392(188) ISLBUFN 4 Address of Slot N in buffer control table. 396(18C) ISLMVC 4 The count used for the Executed Move at ISLFX21 when moving a record from the user's work area into a buffer. This count equals R-1 where R is the remainder when dividing ISLBMPR by 255. If R=O, ISLMVC is set decreased (see ISLMVCT). 400(190) ISLMVCT 4 The count used for the BCT at ISLFX21 when moving a record from the user's work area into a buffer. This is the number of 255-byte moves, plus one, needed to move the record. This count equals Q+ 1 where Q is the quotient when dividing ISLBMPR by 255. When R, alone, equals 0, ISLMVCT is set to equal Q. 404(194) ISLVRSAV 72 Index register save area. This area is used during load mode macro time to save index registers within load mode. 476(1DC) ISLAPSAV 40 Index register save area. This area is used during load mode appendage time to save index registers belonging to either the I/O supervisor or load mode Close. 516(204) ISLWRSAV 64 Index register save area. This area is used during load mode Close to save index registers belonging to common Close.

Section 5: Data Areas 183 Offset Field Name Bytes Field Description 580(244) TSTWKIC 4 Open work field. 584(248) TSTWK2C 4 Open work field. 588(24C) 4 Reserved. 592(250) ISLNOENT 4 Number of spaces for track-index entries remaining on the current track-index track. 596(254) ISLOFFST 4 Size of WRITE channel commands in CP 18. If unblocked records, RKP=O, ISLOFFST=8. Otherwise, ISLOFFST=24. 600(258) ISLD 4 At Macro Time: ISLD is the displacement from the start of CP 18 to the CC flag in the first WRITE CCW in the chain. If unblocked records, RKP=O, ISLD=28. Otherwise, ISLD=44. (ISLOFFST+20) During Close: ISLD is a set of switches used when padding indexes: Bit 0 1 for new cylinder; 0 otherwise 1 = 1 for end entry; 0 otherwise 2 = 1 for chained entry; 0 otherwise 604(250) ISLFSTBF 4 Pointer to first buffer scheduled for writing. This is the slot number in the buffer control table associated with the first buffer to be written in the current output chain. 608(260) ISLLSTBF 4 Pointer to last buffer scheduled for writing. This is the slot number in the buffer control table associated with the last buffer to be written in the current output chain. 612(264) ISLCCFAD 4 Address of CC flag in the last WR CKD CCW in CP 18 chain. This CC flag is turned off to stop the write chain. 616(268) ISLKEYAD 4 Address of the key in the last record that is placed on the current prime--data track. This key becomes the track-index key for the given track. 620(26C) CLIAD 4 Address of the CP 18 skeleton (Open). ISLF8AD Address of instruction at ISLF800+6=PUT base (Close). 624(270) CMIAD 4 Address of the CP 19 skeleton (Open). ISLFXAD Address of the instruction at ISLFYOI (Close). 628(274) CQIAD 4 Address of the CP 20 skeleton (Open). ISLFYAD Address of the instruction at ISLFYOI (Close). 632(278) CQT1AD 4 Address of CP 20 write-check extension skeleton (Open). ISLFZAD Address of the instruction at ISLFZOI (Close). 636(27C) CQ40AD 4 Address of the CP 21 skeleton (Open). ISLPAAD Address of the instruction at ISLPAOI (Close).

184 OS ISAM Logic Offset Field Name Bytes Field Description 640(280) CQ45AD 4 Address of CP 21 write-check extension skeleton (Open). ISLFIAD Address of the instruction at ISLF 11 0 (Close). 644(284) ISLVPTRS 60 Address of variable-length areas and channel programs. 0(0) - A(Area Y) (Figure 67) + 4(4) - A(Key save) + 8(8) - A(IOBBCT) + 12(C) - A(CP 18) + 16(10) - A(CP 19) + 20(14) - A(CP 20A or Os) - full track-index write option + 24(18) - A (CP 21) + 28( 1 C) - Size of DCB work area - ISLCOMON (for FREEMAIN in Close) + 32(20) - Size of channel program area for FREEMAIN + 36(24) - A (TISA) Bit 0 - full track-index write Bit 1 - successful GETMAIN + 40(28) - A (CP 31A/3IB) - resume load A (CP 20B or Os) - full track- index write option + 44(2C) - A (CP 20C or Os) - full track- index write option + 48(30) - ISLFXWKI (macro work field) + 52(34) - ISLFXWK2 (macro work field) + 56(38) - ISLF9WKI (work field) Note: When there is a permanent I/O error, ISLVPTRS+ 36 is overlaid with the address of the buffer that caused the error if CP 18 failed; otherwise, it is set to O. ISLVPTRS+40 is overlaid with the SYNAD address and ISLVPTRS+44 is overlaid with the second word of the lOB. 704(2CO) ISLIGAP 2 Overhead (record gap) for other than the last record. Used in RPS device space allocation calculations for VLR track capacity of prime-data records. 706(2C2) ISLLGAP 2 Last record overhead for RPS devices. Used to calculate VLR track capacity of prime-data records. 708(2C4) ISLRPSSS 4 Sectors values used in CP 18, CP 19, CP 20, and CP 21 for RPS devices.

Section 5: Data Areas 185 HIGH LEVEL INDEX ENTRY COUNT DATA

CCHHRKDD MBBCCHHRFP

y y+8(8)

TRACK INDEX ENTRIES NORMAL OVERFLOW COUNT DATA COUNT DATA

CCHHRKDD MBBCCHHRFP CCHHRKDD MBBCCHHRFP y+18(12) y+26(lA) y+36(24) y+44(2C)

DUMMY ENTRY

CCHHRKDD KEY OF ALL ls MBBCCHHRFP y+54(36) y+62(3E) y+62(3E) +key length

Figure 67. Area Y: QISAM Load Index Fields

186 OS ISAM Logic QISAM Scan Mode DCB Work Area The QISAM scan mode DCB work area is pointed to by.the DCBWKPTI field of the DCB. The DCB work area format is shown in Figure 68.

~.~------8bytes------~~~

0(0) W1 ECBI 4(4)

W110B

44(2C) W11EXTEN I46(2E) W1CPNUP

48(30) W1 ECBO 52(34)

W110BO

92(5C) WlOEXTEN 194(5E) W1SAV7

99 96(60) 197(61) 198(62) 1 (63) 100(64) W1KEYBLK WlOSBIT1 WlOSBIT2 W10SBIT3 W11CNOT

104(68) W1 LPDR

112(70) W1CBF 116(74) W1EOB

120(78) W1COUNTR 1 PRIMEIND 1 FIXIND 124(7C) W1 FCPS

W10TABLE

128(80) W1FR1ST 132(84) W1 FRLAST

136(88) Reserved W1 FREEC 140(8C) W1 RDIST 1 144(90) W1RDLAST 148(94) W1 READR 1150(96) W1READC

152(96) W1US1ST 156(9C) W1USLAST

160(AO) Reserved 1162(A2) W1USERC 164(A4) W1PX1ST

168(A8) W1PXLAST 172(AC) Reserved 1174(AE) W1PUTXC

176(BO) W1WR1ST 180(B4) W1WRLAST

184(B8) Reserved I186(BA) W1WRITEC

Figure 68 (Part 1 of 2). QISAM Scan Mode DCB Work Area

Section 5: Data Areas 187 (Continued) W1WAREA

188(BC) W1WCOUNT

W1WCOUNT (cont.) 196(C4) W1WCNXDM

W1WCNXDM (cont.) 204(CC) W1WOVFL

W1WOVFL (cont.) 1214(D6) W1WDNXDM

W1WDNXDM (cont.)

224(EO) W1WPLEN 1226(E2) W1CURLEN 228(E4) W1TEMPSA

232(E8) W1REGSV2 236(EC) W1REGSAV

240(FO) W1REGSV3 244(F4) W1CP23PT

248(F8) W1CP26PT 252(FC) W1CP25PT

256(100) W1CP24

324(144) W1WDCXDM

W11SECT 335(14F) 1336(150) 1334(14E) W10SECT W1DCBFA 340(154) W11CPEXT

356(164) W10CPEXT

372(174) W1RDCNT

380(17C) W1 RDSECT

388(184) W1CN5SAV 392(188)

W1 RPSSA

408(198) W1TOTAL 410(19A) W1RECLEN

416(lAO) 417(lA1) 418(lA2) 419(lA3) 412(19C) WlOVLEN 1414 (19E) W1FSTSH I I Wl RPSC1 W1RPSC2 W1 RPSl1 W1RPSI2

Figure 68 (Part 2 of 2). QISAM Scan Mode DCB Work Area

188 OS ISAM Logic Offset Field Name Bytes Field Description 0(0) WIECBI 4 Input ECB.

4(4) WHOBI 44 Input lOB and extension. This includes: 40 lOB.

44(2C) WIIEXTEN 2 Input appendage code.

46(2E) WICPNUP 2 Save area for schedule routine.

48(30) WIECBO 4 Output ECB.

52(34) WHOBO 44 Output lOB and extension. This includes: 40 lOB.

92(5C) WIOEXTEN 2 Output appendage code.

8 - Write C - Check 10 - Rewrite 14 - Recheck

94(5E) W1SAV7 2 Save area for schedule routine.

96(60) WIOSBITl 1 Overall status, byte 1.

Bit 0 Scan mode 1 End of data set 2 Overflow 3 Read track index 4 Key found (for SETL K) 5 Unreachable record 6 lOBI completion 7 lOBO completion

97(61) WI0SBIT2 1 Overall status, byte 2.

Bit 0 Unwritable record 1 Work bit for write appendage 2 Same-cylinder indicator 3 Shared track 4 GET - SETL communication 5 Scheduling 6 RELSE 7 SETL K blocked

Section 5: Data Areas 189 Offset Field Name Bytes Field Description

98(62) WI0SBIT3 1 Overall status, byte 3.

Bit 0 Buffer size 1 CLOSE - ESETL communication 2 Bad set indicator for write-checking 3-7 Unused

99(63) WlICNOT 1 BUFNO/2- used to schedule input/output.

100(64) WIKEYBLK 4 Used by SETL K for address within the block of the requested record.

104(68) WILPDR 8 Seek - Search address of the last prime-data record read.

112(70) WICBF 4 Current buffer address.

116(74) WlEOB 4 End-of-buffer address.

120(78) WI COUNTER 2 Counter used to count number of retries for Write-validity-checking.

122(7A) PRIMEIND 1 Switch for testing same device.

123(7B) FIXIND 1 Temporary storage.

124(7C) WIFCPS 4 First Write channel program scheduled.

128(80) WIQTABLE 60 Queue table (comprising the following fields)

128(80) WIFR1ST 4 Pointer to first channel program on the Free queue.

132(84) WIFRLAST 4 Pointer to last channel program on the Free queue.

136(88) 2 Reserved.

138(8A) WIFREEC 2 Number of buffers on the Free queue.

140(8C) WIRD1ST 4 Pointer to first channel program on the Read queue.

144(90) WIRDLAST 4 Pointer to last channel program on the Read queue.

148(94) WIREADR 2 Number of unusued buffers on the Read queue.

150(96) WIREADC 2 Number of buffers on the Read queue.

152(98) WIUS1ST 4 Pointer to the first channel program on the User queue.

190 OS ISAM Logic Offset Field Name Bytes Field Description

156(9C) WIUSLAST 4 Pointer to the last channel program on the User queue.

160(AO) 2 Reserved.

162(A2) WIUSERC 2 Number of buffers on the User queue.

164(A4) WIPX1ST 4 Pointer to first channel program on the PUTX queue.

168(A8) WIPXLAST 4 Pointer to last channel program on the PUTX queue.

172(AC) 2 Reserved.

174(AE) WIPUTXC 2 Number of buffers on the PUTX queue.

176(BO) WIWRIST 4 Pointer to the first channel program on the Write queue.

180(B4) WIWRLAST 4 Pointer to the last channel program on the Write queue.

184(B8) 2 Reserved.

186(BA) WIWRITEC 2 Number of buffers on the Write queue.

188(BC) WIWAREA 36 Area for track-index entries (comprising the following three fields).

188(BC) WIWCOUNT 8 Count of current index entry.

196(C4) WIWCNXDM 8 Count of next normal or dummy entry.

204(CC) WIWOVFL 10 Data of current, overflow entry.

214(D6) WIWDNXDM 10 Data of next normal or dummy entry.

224(EO) WIWPLEN 2 Byte length of work area.

226(E2) WICURLEN 2 Length of current logical record.

228(E2) WITEMPSA 4 Temporary storage.

232(E8) WIREGSV2 4 Area to save contents of a register.

236(EC) WIREGSAV 4 Area to save contents of a register.

240(FO) WIREGSV3 4 Temporary storage.

244(F4) WICP23PT 4 Address of CP 23.

248(F8) WICP26PT 4 Address of CP 26.

Section 5: Data Areas 191 Offset Field Name Bytes Field Description

252(FC) W1CP25PT 4 Address of CP 25.

256(100) W1CP24 68 CP 24 - read track indexes.

324(144) W1WDCXDM 10 Data of current normal track-index entry (variable-length records only).

334(14E) WlISECT 1 Current input channel program sector value.

335(14F) W10SECT 1 Current output channel program sector value.

336(150) W1DCBFA 4 Pointer to DCB field area.

340(154) WlICPEXT 16 Extension to the input channel program used with an RPS device. Set sector and TIC to input channel program.

356(164) W10CPEXT 16 Extension to the output (PUTX) channel program used with an RPS device.

372(174) W1RDCNT 8 Read count of next block for channel program.

380(17C) W1RDSECT 8 Read Sector of next block for channel program.

388(184) W1CN5SAV 4 Save area to restore TIC address CN5 during overflow processing.

392(188) W1RPSSA 16 Register save area for RPS processing.

408(198) W1TOTAL 2 Byte count on track.

41O(19A) W1RECLEN 2 Minimum record length, prime records.

412(19C) W10VLEN 2 Minimum record length, overflow records.

414(19E) W1FSTSH 2 Byte count to first shared track.

416(1AO) W1RPSC1 1 Lower limit cylinder overflow.

417(1A1) W1RPSC2 1 Upper limit cylinder overflow.

418(1A2) W1RPSIl 1 Lower limit independent overflow.

419(1A3) S1RPSI2 1 Upper limit independent overflow.

192 OS ISAM Logic BISAM DCB Work Area

The BISAM DCB work area is pointed to by the DCBWKPT2 field of the DCB. The DCB work area format is shown in Figure 69.

0(0) DCWFCP4

4(4) DCWFCP7

8(8) DCWNUCPS 19(9) DCWNUCP4 10(A) DCWNUCP7 111 (B) DCWNLSD

12(C) DCWFIOBU

16(10) DCWLlOBU

20(14) DCWFUPDI

24(18) DCWLUPDI

28(lC) DCWHIAV 129(10) DCWWKNI 30(lE) DCWLEVC 131!lF) DCWNUWKN

32(20) . DCWMSHIL

36(24) DCWHIRPS 137(25) DCWNACT 38(26) DCWSIZE

40(28) DCWOPCLS

48(30) DCWERRCT 149(31) DCWFIOBE

52(34) DCWLlOBE

56(38) DCWSIOA

60(3C) DCWDCBFA

64(40) DCWIPG 66(42) DCWLPG

68(44) DCWIOG 70(46) DCWLOG ,

Figure 69. BISAM Work Area

Section 5: Data Areas 193 Offset Field Name Bytes Field Description

0(0) DCWFCP4 4 Pointer to the first available set of channel programs in the CP 4-CP 5-CP 6 or CP 4-CP 5W-CP 6W queue. The second word of the second CCW in the channel program set points to the next set of channel programs. The pointer is 0 in the last set on the queue. If no set of channel programs is available, this field is O. 4(4) DCWFCP7 4 Pointer to the first available CP 7 or CP 7W. This queue is handled similarly to the one pointed to by DCWFCP4. 8(8) DCWNUCPS 1 The number of lOBs awaiting CP 1 or CP 2. 9(9) DCWNUCP4 1 The nuptber of lOBs awaiting CP 4-CP 5-CP 6 or CP 4-CP 5W-CP 6W. lO(A) DCWNUCP7 1 The number of lOBs awaiting CP 7 or CP 7W. 11(B) DCWNLSD 1 The number of high-level indexes searched on a device. This number equals DCBNLEV unless the highest level index is searched in main storage in which case the number equals DCBNLEV minus 1. 12(C) DCWFIOBU 4 Address of the first lOB in the queue of unscheduled lOBs. This field is 0 if no lOBs are unscheduled. 16(10) DCWLIOBU 4 Address of the last lOB in the queue of unscheduled lOBs. This field is 0 if no lOBs are unscheduled. 20(14) DCWFUPDI 4 Address of the first lOB in the update queue, that is, the queue of lOBs for which a READ KU has been successfully completed, but for which no WRITE K has yet been issued. This field is 0 when the queue is empty. 24(18) DCWLUPDI 4 Address of the last lOB in the update queue. This field is 0 when the queue is empty. 28(1C) DCWHIAV 1 Switches Bit Meaning 0 CP 1 or CP 2 is available. 1 Highest-level index must be searched in main storage. 2-7 Reserved. 29(1D) DCWWKNI 1 0 WRITE KN is in process. 1 First time switch (used with various WRITE KN channel programs which are executed repetitively). 2 Same module switch. 3 Add to the end of the data set. 4 CP 12A or CP 13A detected an end-of-file mark. 5 CP llA-First use by a given WRITE KN. 6 Work area for WRITE KN was obtained by Open (VLR only) 7 Reserved.

194 as ISAM Logic Offset Field Name Bytes Field Description 30(1E) DCWNLEVC 1 Counter used when rewriting high-level indexes. 31(1F) DCWNUWKN 1 The number of WRITE KN lOBs awaiting completion of WRITE KN. 32(20) DCWMSHIL 4 Address of the last active high-level index entry in main storage. This field is 0 when the high-level index is not searched in main storage. 36(24) DCWHIRPS 1 Used with WRITE KN. It contains DCBHIRPD if the current track of prime data being processed is not shared with a track index or DCBHIRSH if it is. 37(25) DCWNACT 1 The number of READ or WRITE K lOBs awaiting completion of WRITE KN. 38(26) DCWSIZE 2 The total size, in doublewords, of (1) the DCB work area, (2) all the channel programs, and (3) the minimum size work area used by WRITE KN if the user has not supplied a work area. 40(28) DCWOPCLS 8 Data saved by common ISAM open executor in DCBWKPT3 and DCBWKPT4. This data will be restored in these two fields by the BISAM Close routine and used by the common ISAM close executor. (The data saved is the address of the format-2 DSCB and the UCB address of the device on which the volume containing the DSCB is mounted. This address has 5 bytes for CCHHR and 3 bytes for UCB address.) 48(30) DCWERRCT 1 Number of positions left for lOBs to be placed on the error queue. Maximum value = 2(NCP)+DCBUFNO. 49(31) DCWFIOBE 3 Address of the first lOB on the error queue, which contains requests that ended with a permanent error or used a dynamic buffer. This address is 0 if the queue is empty. 52(34) DCWLIOBE 3 Address of the last lOB on the error queue. This address is o if the queue is empty. 56(38) DCWSIOA 4 Address of the RPS SIO appendage.

Note: This field is not used by ISAM routines. See the ISAM extension of the DEB.

60(3C) DCWDCBFA 4 Pointer to DCB field area.

64(40) DCWIPG 2 Prime record (other than the last) overhead (variable-length records only). 66(42) DCWLPG 2 Last prime record overhead (variable-length records only). 68(44) DCWIOG 2 Overflow record (other than the last) overhead (variable- length records only). 70(46) DCWLOG 2 Last overflow record overhead (variable-length records only).

Section 5: Data Areas 195 QISAM Track-Index Save Area Calculations for the track-index save area The size of the track-index save area (TISA) is equal to the total of the following five items: 1. TISA control fields - 20 bytes. 2. Area for the track-index entries a. Number of entries equal to the maximum number of entries on a track. This is ISLNIRT if the track index is on one track; otherwise, ISLHIRT is used. If ISLHIRT is odd, then the calculations are performed with the number of entries equal to ISLHIRT + 1 to allow the save area enough space for the last pair of entries. b. Size of each entry equals COUNT + KEY + DATA COUNT = 8 KEY =KEY LENGTH DATA = 10

Pointers To Save Area Save Area

ISLVPTRS +36

TISA CONTROL FIELDS

TRACK INDEX ENTRIES

ISL VPTRS +20

CP20A ISLVPTRS +40

CP20B ISLVPTRS +44

CP20C

Figure 70. Track-Index Save Area

3. Channel program 20A if no shared track. 4. Channel program 20B if shared track. 5. Channel program 20C if write-check.

196 OS ISAM Logic Track-Index Save Area (TISA)

+0 FTIWIOB

+8 SIZE FLAGS HIGHR CURRR NEXTTI +16 TISASIZE

Figure 71. TISA Control Fields

Field Name Bytes Description

FTIWIOB 8 MBBCCHHR for the prime-data track which is pointed to by the seek CCW in CP 20 and the search CCW in CP 18.

SIZE 2 Length of one track-index entry (8+KL+ to).

FLAGS 1 X'80' Resume load. Turned on for the first track index write.

X'40' Close. Turned on by 2021 to force writing of the l. ack index.

X'20' End of track-index track.

X'to' End of cylinder.

X'08' Execute CP 20 alone (with one CP 18).

X'04' Close. Track-index entries previously generated.

HIGHR 1 Highest record number for the current track of track index (either ISLHIRT or ISLNIRT).

CURRR 1 Current record number (last record moved to TISA). Initialized to O.

NEXTTI 3 Address in TISA where the next track-index entry will be placed. Initialized to TISA + 20.

TISASIZE 4 Size of TISA saved for the Close routine to issue a FREEMAIN.

Section 5: Data Areas 197 ISAM DeB Field Area

00(00) DFATDC 02(02) DFARORG3 106(06) DFANREC

10(OA) DFANREC (cent.) 11 (OB) DFALPDA DFAST. 23( 17) 19(13) DFARORG2 DFALPDA (cent.) DFANBOV 121 (15) T DFANOREC DFANOREC 25(19) DFALIOV (cent.) DFALIOV 35(23) 33(21 ) DFARORG1 DFACOUNT (cent.) Net used /36(24)

Figure 72. DCB Field Area

Offset Field Name Bytes Field Description 00(00) DFATDC 2 Tag deletion count. User's count field for records marked for deletion. (Refer to DCBTDC in the data control block.) 02(02) DFARORG3 4 The number of times an overflow record was referred to by a READ or WRITE instruction. 06(06) DFANREC 4 Number of logical records in the prime-data area. lO(OA) DFAST 1 Status indicators. Bit 0 Single schedule mode Key sequence to be checked 2 Initial load has been completed 3 Data set extension (resume loading) will begin on new cylinder. 4 Reserved 5 First macro not yet received 6 Last block full 7 Last track full 11(OB) DFALPDA 8 Direct-access device address of the last prime-data record in the prime-data area (in the form MBBCCHHR). 19(13) DFANBOV 2 Number of bytes remaining on current overflow track (variable-length records only). 21(15) DFARORG2 2 Number of tracks (partially or wholly) remaining in the independent overflow area. 23(17) DFANOREC 2 Number of logical records in a overflow area. 25(19) DFALIOV 8 Direct-access device address of the last record written in independent overflow area (in the form MBBCCHHR). 33(21) DFARORGI 2 Number of full cylinder overflow areas. 35(23) Not used. 36(24) DFACOUNT 4 Number of open DCBs on this data set.

198 OS ISAM Logic SECTION 6: DIAGNOSTIC AIDS

Section 6: Diagnostic Aids 199 ( Appendage Codes

Before an EXCP command is issued, QISAM scan mode and BISAM enter an appendage code into the lOB extension. When the appendage is entered from the I/O supervisor, the appendage routine tests the code to determine which functions to perform to complete processing for the input/output request. When an appendage routine schedules an asynchronous routine, it puts an asynchronous code into the lOB extension. When the asynchronous routine gains control it tests the asynchronous code to determine the functions it must perform.

QISAM Scan Mode Appendage Codes The following codes apply under both channel-end and abnormal-end conditions: Code Meaning o Completion of READ 4 Completion of SETL (K or I) 8 Completion of WRITE (with or without write-checking) 12 Completion of CHECK (read-back for write-checking) 16 Completion of REWRITE (write-back when write-checking) 20 Completion of RECHECK (read-back after REWRITE during write-checking)

BISAM READ and WRITE K Appendage Codes The following codes apply under both channel-end and abnormal-end conditions: Code Meaning o Completion of CP 4-S-SW for READ 1 Completion of CP 4-S-SW for WRITE 2 Completion of CP 7 or 7W 3 Completion of CP 1 or 2 5 Completion of CP 6 or 6W 6 Compietion of CP 5W for wnte-checking after WRITE

BISAM WRITE KN Appendage Codes The following codes apply under both channel-end and abnormal-end conditions: Code Meaning 4 Completion of CP 14 part 2 (fixed-length records with user work area) 7 Completion of CP 1 or CP 2 for WRITE KN

Section 6: Diagnostic Aids 201 Code Meaning 8 Completion of CP 8 9 Completion of CP lOA for true insert or part 2 of CP 14 (variable-length records), for EOF extension 10 Completion of CP lOB for true insert or part 2 of CP 14 (variable-length records), when part 1 has been executed 11 Completion of CP lOB for addition to end-of-data set 12 Completion of CP 14 or part 1 of CP 14 (fixed-length records with user work area and variable-length records), for setups 1, 2, and 5 (asynchronous routine codes 9, 10, and 13) 13 Completion of CP 14 or part 1 of CP 14 (fixed-length records with user work area and variable-length records), for setups 3, 4, and 6 (asynchronous routine codes 11, 12, and 14) 14 Completion of CP 15 15 Completion of CP 16 for setup 2 (search overflow chain for last overflow record in the chain: addition to end-of-data set) 16 Completion of CP 16 for setup 2 (search overflow chain for record which logically precedes or is equal to new record to be added: true insertion) 17 Completion of CP 17 when used for track index only or part 2 of CP 14 (variable-length records) when part 1 has not been executed (no overflow) 18 Completion of CP 17 when used for track index and when it is to be continued for higher level indexes 19 Completion of CP 17 when it is to be started or continued for higher level indexes 20 Completion of CP 9A, CP l1A, CP 12A, CP 13A, or CP 12AV 21 Completion of CP 9B, CP 11B, CP 12B, CP 13B, or CP 12BV 22 Completion of CP 9C, CP 123W, or CP 123WV 23 Completion of CP lOA for addition to end of data set 24 Completion of CP 12C or CP 13C

Asynchronous Codes

BISAM READ and WRITE KN Asynchronous Codes The following codes direct asynchronous coding to the proper routines: Code Condition o Successful completion of CP 4-5-6

202 OS ISAM Logic Code Condition

1 EXCP macro instruction to be issued

2 Successful completion of CP 7

3 Successful completion of CP 1 or CP 2

4 Unsuccessful completion of CP 4-5-6

6 Unsuccessful completion of CP 1

7 Unsuccessful completion of CP 1 or CP 2

BISAM WRITE KN Asynchronous Codes

The following codes direct asynchronous coding to the proper routines:

Code Condition

1 Scheduled to issue an EXCP which could not be done in an appendage routine because a different device (UCB) was involved.

8 Scheduled upon the successful or unsuccessful completion of a WRITE KN macro instruction.

9 Scheduled to set up and execute CP 14 when a record is bumped from a prime-data track as a result of a new record being placed on that track (setup 1).

10 Scheduled to set up and execute CP 14 when a new record is to be added to the end of the data set, the last track is full, and no overflow chain currently exists for the last track (setup 2).

11 Scheduled to set up and execute CP 14 when a new record is to be added to the end of the data set, the last track is full, but an overflow chain already exists for the last track (setup 3).

12 Scheduled to set up and execute CP 14 when a new record is a true insert and is to go in the middle of an overflow chain (setup 4).

13 Scheduled to set up and execute CP 14 when a new record is a true insert and it is to become the first record in an already existing overflow chain (setup 5).

14 Scheduled to set up and execute CP 14 when a new record is a true insert and it has a key equal to that of the key of a record in the overflow chain (the record is marked for deletion). The new record simply replaces the deleted record (setup 6).

15 Scheduled to set up and execute CP 14 (for variable-length records only) when more than one record is bumped from a prime-data track (setup 1).

16 Scheduled to set up and execute the CP 14 extension (the variable-length records only) to write an EOF mark in independent overflow.

Section 6: Diagnostic Aids 203 Exception Codes

QISAM Exception Codes

QISAM exception codes and the macro instructions which set them are summarized in Figure 73.

Exception Code Code Set By Condition if On Field Bit CLOSE GET PUT PUTX SETL

DCBEXCDl 0 Type K Record is not found

Invalid actual address 1 Type I for lower limit

Space is not found in 2 X which to add a record

3 X Invalid request

4 X Uncorrectable input error

5 X X X Uncorrectable output error

Block could not be 6 X X reached (input)

Block could not be 7 X X reached (update)

DCBEXCD2 0 X Sequence check

1 X Duplicate record

Data control block is closed 2 X when error routine is entered

3 X Overflow record'

Length of logical record is 4 X greater than DCBLRECL (Variable length records only)

5-7 Reserved for future use

'The SYNAD routine is entered only if bit 4,5,6, or 7 of DCBEXCDl is also on.

Figure 73. QISAM Exception Code Summary

204 OS ISAM Logic BISAM Exception Codes

BISAM exception codes and the macro instructions which set them are summarized in Figure 74.

Exception Code Code Set By Condition if On Field Bit READ WRITE

DECBEXCDl 0 X Type K Record is not found

1 X X Record length is checked

2 Type KN Space is not found

3 Type K Invalid request

4 X X Uncorrectable I/O error

5 X X Unreachable block

6 X Overflow record

7 Type KN Duplicate record

DECBEXCD2 0-5 Reserved for future use

Channel program initiated 6 X X by an asynchronous routine (variable length records only)

Previous macro was 7 X READ KU

Figure 74. BISAM Exception Code Summary

Section 6: Diagnostic Aids 205

SECTION 7: APPENDIXES

Section 7: Appendixes 207

Appendix A: ISAM Data Set Organization

Introduction

The indexed sequential access methods (ISAM) can be defined as the combination of data set organization and the techniques used to process the data. With the indexed sequential organization, data records are arranged in logical sequence by a key field. An indexed sequential data set resides on direct-access storage devices and can occupy up to three different areas:

• Prime area

This area contains data records and related track indexes. It exists for all ISAM data sets.

• Overflow area

This area contains overflow from the prime area when new data records are added. It is optional.

• Index area

This area contains master and cylinder indexes associated with the data set. It exists for a data set that has a prime area occupying more than one cylinder.

The indexes of an ISAM data set are analogous to the card index in a library. For example, if the library user knows the name of the book or the author, he can look in the card index and obtain a catalog number which will enable him to locate the book in the book files. He would then go to the shelves and proceed through each row until he found the shelf containing the book. Usually each row contains a sign to indicate the beginning and ending numbers of all books in that particular row. Thus, as he proceeded through the rows, he would compare the catalog number obtained from the index with the numbers posted on each row. Upon locating the proper row, he would then search that row for the shelf that contained the book. Then he would look at the individual book's numbers on that shelf until he found the particular book.

ISAM uses the indexes in much the same way to locate records in an indexed sequential data set. The operating system provides both the queued and basic access techniques to process an indexed sequential data set. The queued access technique is used to create the data set and add records to the end. It can also be used to sequentially process or update the records. The basic technique is used to read or update records and to insert ne\v records at any place in the data seL

Data Set Structure

The overall structure of an indexed sequential data set is shown in Figure 75. The prime area contains data records arranged according to the collating sequence of a key field in each record. As the records are stored (written) in the prime area, the system prepares a track index. Each entry in the track index identifies the key of the last record on each track. There is a track index for each cylinder in the data set. If more than one cylinder is used, the system develops a higher level index called a cylinder

Section 7: Appendixes 209 index. Each entry in the cylinder index identifies the key of the last record in the cylinder.

CYLINDER 1 CYLINDER 2 CYLINDER N Track Index Track Index ~ ~ .. crrack Index PRIME AREA 100 200 6850

I 100 200 550 CYLINDER INDEX r---+ 800

r 6850 f0o- I 550 800 1650 MASTER INDEX (1st LEVEL) ~ 2300

~ 3550 r 6850 - I 1650 2300 3550 4700 MASTER INDEX (2nd LEVEL)

6850 ~ ~ I 4700 6850 MASTER INDEX (3rd LEVEL)

Figure 75. Indexed Sequential Data Set Structure

To increase the speed of searching the cylinder index, you can request the system to create a master index that indexes the cylinder index. You can specify through the data control block (NTM and OPTeD operands) that, if the size of a cylinder index exceeds a certain number of tracks, a master index should be created. The example in Figure 75 shows an entry in the master index (first level) for each one track of cylinder index entries. If the size of the master index exceeds the number of tracks specified in the data control block the master index is automatically indexed by a higher level master. This is illustrated in Figure 75 by the second level master. Three such higher level master indexes can be constructed.

210 OS ISAM Logic Prime Data Area

Records are written in the prime area when the data set is created or updated. Figure 76 illustrates the initial structure of a cylinder of the prime area. The track index is contained on the first track of the cylinder. Note that a pair of track index entries is associated with each prime track in the cylinder. In this example, the last track of the cylinder is reserved for a cylinder overflow area.

I N 0 N 0 N 0 TRACK 8 8 19 19 2~1~1 100 100 INDEX

-+- 2 4 6 8 PRIME DATA 14 15 16 19

22 24 26 27 ...-- -

90 93 97 100

CYLINDER OVERFLOW

Figure 76. Initial Structure of Prime Cylinder

Index Areas

The operating system automatically generates at least two levels of indexes: a track index and a cylinder index. (Up to three levels of master indexes are created if requested. )

Track Index: This is the lowest level of index and is always present. There is one such index for each cylinder in the prime area; it is written on the first track of the cylinder that contains the indexes. The index consists of a series of paired entries; that is, a normal and an overflow entry for each prime track. The normal entry contains the home address of the prime track and the key of the highest record on the track. The

Section 7: Appendixes 211 overflow entry is originally the same as the normal entry but is changed when records are added to the data set.

In Figure 77, the track index is an expanded detail of the index shown in Figure 76. Note that the data area of the first normal entry points to track 01 and the key area represents the highest key on track 01. Since this figure illustrates the initial structure of the data set, the first overflow entry is the same as the normal entry.

Cylinder Index

200 310 03000 ..... I 02000 I I I IDUmmyl Data: Home address of track One such entry for index for cylinder 01 each cylinder of Key: Highest key on the prime data area cylinder 01 1

Track Index Normal Overflow Normal Overflow 008 01011 I I'--_-.a..._0_l_02_1 019 I ...... 1 I 019 I 01021 Home Data: Home address of One normal and one Addr. prime data track 01 overflow entry for Key: Highest key on each prime data track prime data track 01 }on cylinder 01

,/ ... 100 I 01031 I I 100 01031 IDummyl I Data Records \. Figure 77. Structure of Cylinder Index and Track Index

Cylinder Index: For every track index created, the system generates a cylinder index entry. There is one cylinder index for a data set, each entry of which points to a track index. Since there is one track index per cylinder, there is one cylinder index entry for each cylinder in the prime area. In Figure 77, the data area of the first cylinder index entry points to the home address of the track index for cylinder 01. The key area contains the number 100 which represents the highest key on the cylinder. For simplicity, in Figure 77 only the cylinder, track, and record number portion of the address in the data areas is shown.

Overflow Areas: As records are added to an indexed sequential data set, space is required to contain those records that do not fit on the prime data track on which they belong. You can request that a number of tracks be set aside as a cylinder overflow area to contain overflows from prime tracks in each cylinder. When a cylinder overflow area is specified, record 0 of the track index is used as a cylinder overflow control record (see Figure 77). ISAM uses this record to keep such information as the address of the last the overflow record in cylinder and the number of bytes remaining on the current overflow track.

An advantage of using cylinder overflow areas is a reduction of search time required to locate overflow records. To access the cylinder overflow area requires only a seek to

212 OS ISAM Logic another track within the cylinder. This can be performed with less system overhead than a seek to another cylinder as is required to access an independent overflow area.

Instead of, or in addition to, cylinder overflow areas, you can request an independent overflow area. Overflow from anywhere in the prime data area is placed in a specified number of cylinders reserved for this area. An advantage for having an independent overflow area is a reduction in unused space reserved for overflow. A disadvantage is the increased search time required to locate overflow records in an independent area (see Figure 79).

It is good practice to request cylinder overflow areas large enough to contain a reasonable number of additional records, and an independent overflow area to be used as the cylinder overflow areas are filled.

Adding Records to a Data Set

A new record added to an indexed sequential data set is placed into a location on a track determined by the value of its key field. If records were inserted (added) in precise physical sequence, insertion would require shifting all records of the data set with keys higher than that of the one inserted. However, because an overflow area

,- -- Key of normal entry changed I ,/ f -- Data of overflow entry changed TRACK N 10 1 Nil 0 6 8 15 19 ~I~I 11~011~0 INDEX 2 3 4 6 PRIME DATA 9 10 14 15

22 24 26 27 --- - 90 93 97 100

CYLINDER - .~ .I~ - IU OVERFLOW

Figure 78. Structure of Prime Cylinder After Cylinder Overflow

exists, the indexed sequential data organization allows a record to be inserted into its proper position with only the records on the track in which the insertion is made being shifted. When a record is to be inserted, the records already on the prime track that

Section 7: Appendixes 213 are to follow the new record are written back on the track after the new record. If the addition of records results in insufficient track space for all the records to be written onto the track, the records that do not fit are written onto an overflow track. This technique maintains the sequential order of records on the prime track. Three situations may occur when a record is added to a data set. Each is discussed below.

First Addition to a Prime Track: When a data set is created, its records are placed on the prime tracks in the storage area allocated to the data set as shown in Figure 76. If a record (for example, record 3) is to be inserted into the data set, the indexes indicate that record 3 belongs on prime track 01. Record 3 is written immediately following record 2, and records 4 and 6 are retained on prime track 01 (see Figure 78). Since record 8 no longer fits on this track, it is written on track 09 (cylinder overflow track).

The key area of the normal index entry is changed, since record 6 is now the highest record on the track. The data area of the overflow index entry is changed; it no~ points to record 8 as the first record on track 09. The first addition to a track is always handled in this way.

When records 9 and 10 are added, prime track 02 receives these records as shown in Figure 78. Record 19 is shifted to track 09 (cylinder overflow track). Record 16 is also shifted to the overflow track after record 19. Note that records 16 and 19 are chained together to show the logical sequence and to indicate that they are associated with the same prime track. (Overflow records are chained through a link field which forms the first 10 bytes of each overflow record.)

Subsequent Additions to a Track: Subsequent additions are written either on the prime track where they belong or as part of the overflow chain from that track. If the addition belongs between the last prime record on a track and a previous overflow from "" that track, it is written in the first available location in the overflow area, with its link field containing the address of the next record in the chain. Because the data area of the overflow index entry always refers to the address of the lowest key in a chain, it is changed.

If subsequent additions belong on a prime track, they are written in proper sequential location on the prime track. For example, records 11 and 13, as shown in Figure 79, are written in proper sequential position on track 01. Record 15 (previously the highest record on the prime track) is shifted to the cylinder overflow area with its link field chaining to record 16. Record 14 is shifted to the independent overflow area since the cylinder overflow area is full. The link field in record 14 points to record 15, the next record in the chain. The key area of the normal index entry is changed to indicate that record 13 is the highest on the prime track. The data area of the overflow index entry is changed to point to record 14 in the independent overflow area as the first record in the overflow chain.

Addition of High Keys: A record with a key higher than the current highest key in the data set is placed at the end of the prime area, if there is room. Such an addition is handled, in effect, as if it had been presented when the file was first created.

214 OS ISAM Logic I TRACK NIOINIO 6 8 13 19 ~I~I 11~011~0 INDEX 2 3 4 6

PRIME DATA 9 10 11 13

22 24 26 27

---...-

90 93 97 100

CYLINDER 8 19 16 15 OVERFLOW -+ / . / t t / • INDEPENDENT 14 EOF OVERFLOW - Figure 79. Structure of Prime Cylinder After Independent Overflow

If the prime area is full, the new record is written in the overflow area and linked to the overflow chain from the last prime track. The key area of higher level indexes is changed to reflect the addition.

Detailed Index Description

An index records have three stcii(J11s: count, key, diid data (except the cylinder overflow control record, which has no key section). Index records are formed in main storage and written on direct-access devices by QISAM load mode channel programs operating with I/O supervisor. BISAM channel programs may later cause sections of the indexes to be updated when deleting and/or adding records to the data set. In all records (index and data), the BB portion of MBBCCHHR is o. The BB portion of the lOB is filled prior to EXCP from the DEB. This avoids having to mount 2321 bins back into their original position. Figure 80 shows the ISAM index entry format.

Section 7: Appendixes 215 if \~ ------8 Bytes ----...- .. K - 4 1 D Bytes .. ID K D D I INDEX ENTRY cl HH[ R 'DDDA' l ~ M P COUNT KEY DATA

Figure 80. Format of ISAM Index Entry

The count section is 8 bytes in length, in the following format: CC HH R K D D.

CC HHR is the direct-access device address of this index entry; the components of this address vary with the type of device.

K is the length of the key of each record in the data set. It is also the length of the key section of each index entry.

DD is the length of the data section of each index record. It is always hexadecimal 'OOOA' (indicating 10 bytes) except for the cylinder overflow control record, whose data section is 8 bytes long.

The key section is always the same length as the key of each record in the data set and has a value equal to the highest key referenced by this entry.

The data section is always (except for the cylinder overflow control record) 10 bytes in length, in the following format:

M BB CC HH R F P.

The first 8 bytes contain the direct-access device address of the data record whose key is equal to the key section of this index entry.

This address is represented as follows:

M is the DEB extent serial number.

BB CC HH R is the direct-access device address of the data record. The components of the address vary with the type of device.

F, the flag reference code byte, is broken down into bits, as follows:

Bh a 1 2 3 4 5 6 7 CCCCCI I

where CCCCC is the index entry type code and I I I indicates the level of index entry. ({

216 OS ISAM Logic The following are valid index entry type codes:

CCCCC 00000 normal entry data record resides on unshared track 00001 normal entry data record resides on shared track 00010 overflow entry end (last entry in chain) 00011 overflow entry chained (not last entry in chain) 00100 dummy entry end of index 00101 dummy entry chained 00110 inactive entry

Inactive entries are written by QISAM load mode Close executors to fill out allocated, but unused, space at the end of each index.

The following are valid codes for level of index entry:

II I = 000 The track index 001 The cylinder index 010 The first level master index 011 The second level master index 100 The third level master index

P, the command code byte, is referenced by channel programs. The three valid hexadecimal command codes are 1B, OB, and 07.

1B = Seek HH These are used for entries whose data records are on the same volume as the index entry.

OB = Seek CC HH

07 = Seek BB CC HH This is used when the data record is on a volume other than the one on which the index entry resides. For the 2321 data cell drive, the seek code must be 07 if the data set crosses a strip. It is also used in all overflow and dummy index entries. Its purpose is to cause an interrupt during the execution of ISAM channel programs (protection check) so that the ISAM appendage routines can issue another EXCP or check for an error or special procedure.

Track-Index Records: Track-index entries consist of a series of paired entries; that is, a normal and an overflow entry for each track. A dummy end entry indicates the end of the index, which may be padded with inactive entries. The first track of a track index may contain a cylinder overflow control record.

TrA~k Cap~::ity R~::crd: The tra!:k caps!!)' record is RO of e~ch prlme-data track for variable-length records. Bytes 0-1 of the data portion contain the number of unused bytes currently left on the track. Byte 2 contains the highest record ID currently on the track.

Section 7: Appendixes 217 Cylinder Overflow Control Record: The cylinder overflow control record is the RO record on the first track of the track index, if the DCBOPTCD field has specified the cylinder overflow option. It has no key section. The 8-byte data section is in the following format:

HHR YYTOO

Initially,

HHR indicates the first track of the cylinder overflow area, and R = O.

After overflow has occurred,

HHR indicates the track and record number of the last overflow record.

YY indicates the number of unused bytes remaining on the current overflow track, but is not maintained when the data records are of fixed length.

T indicates the number of tracks remaining unused in the cylinder overflow area.

00 indicates that these two bytes are not used.

Figure 81, which follows, contains a detailed explanation of track-index records.

Overflow Linkage: On the first overflow from a prime-data track:

1. The data portion of that track's overflow index entry is written onto the overflow track as a link field in front of the data section of the overflow record.

2. The key of the prime-data track's normal index entry is updated to contain the key of the last record remaining on the prime-data track.

3. M BB CC HH R in the data portion of the prime-data track's overflow index entry is updated to contain the address of the overflow record. The F byte is changed from CCCCC = 00010 to CCCCC = 00011 to indicate that this overflow index entry is pointing to an overflow chain.

On subsequent overflows from the prime-data track:

1. The link fields of all but the highest overflow record are modified to contain the location of the next higher overflow record. The F byte indicates CCCCC = 000 11 (overflow chain).

2. The link field of the highest overflow record will contain a meaningless address and the F byte indicates CCCCC = 00010 (end of the overflow chain).

3. The key of the overflow index entry for the prime-data track is modified, if necessary, to contain the highest overflow key. This occurs only when adding a record to the end of the data set.

218 OS ISAM Logic 4. The key of the normal index entry for the prime-data track is modified to contain the key of the last record on the prime-data track.

5. The data portion of the overflow index entry for the prime-data track is modified, if necessary, to contain the location of the lowest overflow record.

Data Type of Entry Key M BB CC HH R F P

Normal, Data Highest key on prime Location of track whose Hexadecimal '00' CCCCC = Hexadecimal '1 B' Record on data track pointed highest key equals the 00000, Unshared Track to by data portion of key field of this index III = 000 this index entry. entry. (The cylinder is the same cylinder on which this index entry resides.)

Normal, Data Same as Normal, Same as Normal, Data Record number of CCCCC = Hexadecimal '1 B' Record on Data Record on Record on Unshared first data record 00001, Shared Track Unshared Track. Track. on the shared track. III = 000 For variable length records, R equals the highest record I D currently on the track that the index entry references.

Overflow, End End-same as pre- End-same as preceding End-Hexadecimal End- Hexadecimal '07' and Chained ceding normal index normal index entry. 'FF'. Chained- CCCCC = entry. Chained- Chained-location of record number with 00010, highest key to over- record with lowest key lowest key to 111=000 flow from the track to overflow from the overflow the track Chained- referenced by this track referenced by referenced by CCCCC = entry. this entry. this entry. 00011, III = 000

Dummy, End Maximum value Minimum Value (each Hexadecimal '00' CCCCC = Hexadecimal '07' of Index (each byte equal to byte equal to 00100, hexadecimal 'FF'). hexadecimal '00'). III = 000

1\ II __ • _ _ _ I _ I\II~_:_. _ ._ ... 1. .... 1 ___ L I. t~.~ __L ..,_:~_1 'n,,' irJd(,;i.iv~ IVldAlIllUll1 VdIUt: IVIIIIIIIIUII. VQIUt:: \va""ll IICAOUG\.oIIIIOI vv CCCCC = H~xud~c;iTiu! '07' (each byte equal to byte equal to 00110, hexadecimal 'FF'). hexadecimal '00'). III = 000

Figure 81. Description of Track Indexes

Section 7: Appendixes 219 Data Type of Entry Key M BB CC HH R F P

Normal Highest key on the Location of start of track Record number CCCCC = Hexadecimal '07' cylinder whose track index on the cylinder of first data 00000, if this cylinder index begins at whose highest key record on first III = 001 index entry location specified equals the key of this track of the track references a by data portion of index entry. index. If no data track entry on this index entry. records on that eith er a different track ( an unshared volume, or on a track), R = different strip hexadecimal '00'. if the device is a 2321 data drive. Hexa· decimal 'OB' if same volume or strip.

Dummy, Maximum value, Minimum value, (each Hexadecimal '00' CCCCC = Hexadecimal '07' End (each byte equal to byte equal to hexa- 00100, hexadecimal 'FF'). decimal '00'). III'" 001.

Dummy, Maximum value Location of next track Hexadecimal '00' ccccc = Hexadecimal '07' Chained (each byte equal of this cylinder index. 00101, to hexadecimal III = 001 'FF').

Inactive Maximum value Minimum value (each Hexadecimal '00' ccccc = Hexadecimal '07' (each byte equal byte equal to hexa- 00110, to hexadecimal 'FF'). decimal '00'). III = 001

Figure 82. Description of Cylinder Indexes

Cylinder Index Records: A cylinder index is created for the data set if the processing program has requested space that extends over more than one cylinder. Figure 82 contains a detailed explanation of cylinder index records.

Master Index Records: One or more levels of master indexes are created if the DCBOPTCD field has specified this option.

Figure 83 contains a detailed explanation of master index records.

220 as ISAM Logic Data Type of Entry Key M BB CC HH R F P

Normal Highest key on a Location of the track Hexadecimal '00' ccccc = Hexadecimal '1 B' track of the next within next lower level 00000 if next lowest lower level index. index, whose highest III = 010, level index is on That track is key equals the key of 011, or same cylinder pointed to by the this index entry. 100 as this index data portion of entry. this index entry. Hexadecimal 'DB' if not on same cylinder, but, for 2321 data cell drive, on same strip. Hexadecimal '07' for 2321 data cell drive if indexes cross strip boundaries.

Dummy, Maximum value Minimum value (each Hexadecimal '00' ccccc = Hexadecimal '07' End (each byte equal to byte equal to hexa- 00100, hexadecimal 'FF'). decimal '00'). III = 010, 011, or 100 Dummy, Maximum value Location of next track Hexadecimal '00' ccccc = Hexadecimal '07' Chained (each byte equal to of this level master 00101, Hexadecimal 'FF'). index. III =010, 011, or 100 Inactive Maximum value Minimum value (each Hexadecimal '00' CCCCC= Hexadecimal '07' (each byte equal to byte equal to hexa- 00110 hexadecimal 'FF'). decimal '00'). III = 010, 011, or 100

Figure 83. Description of Master Indexes

Section 7: Appendixes 221 Appendix B: ISAM Channel Programs

The channel program for each request using ISAM is constructed by the appropriate module. All ISAM channel programs are listed in Figure 84. The address of the channel program is placed in the lOB for that request. A channel program consists of a group of channel command words (CCWs), each word of which has the following format:

Command Code Address Flags 000 (ignored) Count (1 byte) (3 bytes) (5 bits) (3 bits) (1 byte) (2 bytes)

Note: The last 4 bytes are ignored by a transfer-in--channel (TIC) command word.

(In some TIC CCWs, these bytes contain flags or a chain address.) The entry in the address field is one of the following:

• The main-storage address where data is to be placed or found; for a Read or a Write command word

• The location of the seek or search argument; for a Seek or Search command word

• The CCW to which a transfer is made; for a transfer-in-channel command word

The entry (or entries) in the flags field has the following meanings:

CC Command chaining

DC Data chaining between gaps of a record

SK Skip the transferring of data

SLI Suppress incorrect length indication

The entry in the count field represents either the number of data that are to be transferred or the number of bytes of data on which a search is to be made for comparison.

The function or purpose of each command word or group of words is given in the comment following the count field. The channel command words are identified by the number to the left of the command code.

The following abbreviations are used in the address and count fields:

WA Work area

KL Key length

DL Data length

CF Storage area for count fields (8 x DCBHIRPD bytes)

222 OS ISAM Logic Those BISAM or QISAM scan mode channel programs beginning with a Search ID with a count of 5 bytes are executed with a channel program prefix if a rotational position sensing (RPS) device is being used. The prefix will be a Set Sector followed by a TIC to the regular channel program. The channel command words that vary depending on the presence of RPS are shown in the following channel programs with both possible command codes.

Channel Program Description Mode

Searches cylinder and master indexes. BISAM (all)

2 Searches a cylinder index when it is the highest­ BISAM (all) level index searched on the device.

4 Searches a track index. BISAM (no WRITE KN)

5/5W Searches prime-data tracks and reads or wntes BISAM (no prime-data records. WRITE KN)

6/6W Searches an overflow chain and reads or writes BISAM (no overflow records. WRITE KN)

7/7W Writes data records when WRITE K is associated BISAM (no with READ KU. WRITE KN)

8 Searches the track index and the prime-data track BISAM (WRITE KN) for place to Insert new record.

9A Reads the record occupying the position at which BISAM (WRITE KN) a new record is to be inserted into the work area.

9B/9BW Reads an even-numbered record after writing a record BISAM (WRITE KN) Into the previous slot and wntes back the last record of a non-EOF track when the number of records bumped is odd.

9C/9CW Reads an odd-numbered record after writing a BISAM (WRITE KN) record Into the previous slot and writes back the last record of a non-EOF track when the number of records bumped is even.

10A/10AW Writes a record or block to replace an EOF mark. BISAM (WRITE KN)

10B/10BW Writes an EOF mark. BISAM (WRITE KN)

11 A Reads an odd-numbered record after writing a BISAM (WRITE KN) record into the previous slot.

11B/11BW Writes a rearranged block back onto the prime­ BISAM (WRITE KN) Ui::Ild hack.

12A Reads data records following slot into which new BISAM (WRITE KN) records are to be inserted.

12AV Records variable-length data records or blocks BISAM (WRITE KN) following point at which a new record is to be inserted.

Figure 84 (Part 1 of 3). ISAM Channel Program Summary

Section 7: Appendixes 223 Channel Program Description Mode

12B Writes back prime-data records. BISAM (WRITE KN)

12BV Writes back variable-length prime-data records BISAM (WRITE KN) or blocks.

12C/12CW Writes a new record which has replaced a deleted BISAM (WRITE KN) record.

13A Reads all blocks from the track following and BISAM (WRITE KN) including the slot Into which a record is to be Inserted.

13B Writes back the blocks read by CP 13A after they BISAM (WRITE KN) have been rearranged.

13C/13CW Writes back a block If the record Inserted has the BISAM (WRITE KN) same key as a record which has been logically deleted but is still physically present in the block.

14/14W Writes some combination of COCR, normal and over- BISAM (WRITE KN) flow track-index entries, and overflow records.

15 Reads In the COCR and the overflow track-Index BISAM (WRITE KN) entry when a new record is added to the end of a data set.

16 Searches an overflow chain for (1) the record that BISAM (WRITE KN) logically precedes or IS equal to the new record to be added or (2) the last record In the chain.

17/17W Changes the key in a normal or overflow-track-index BISAM (WRITE KN) entry or in a higher level Index entry.

18 Writes prime-data records or blocks. QISAM load

19 Preformats the shared track and/or writes the COeR. QISAM load

20 Writes track-Index entries. QISAM load

20A Writes a full track of a nonshared track Index. QISAM load

20B Writes a full track of a shared track index. QISAM load

20C Write-check for CP 20A and 20B. QISAM load

21 Writes high-level (cylinder and master) index QISAM load entries and end-of-data marks.

22A Reads or writes prime-data records (key and data, QISAM scan unblocked records).

22B Reads or writes prime-data records (data only, QISAM scan unblocked records, and all blocked records).

23 Searches high-level indexes, the track index, and QISAM scan the prime-data track when a SETL K is issued.

Figure 84 (Part 2 of 3). ISAM Channel Program Summary

224 OS ISAM Logic Channel Program Description Mode

24 Reads track-Index entries. QISAM scan

25 Reads track-Index entries when SETL I IS Issued. QISAM scan

26 Extension of CP 23 to read overflow chains QISAM scan

31A Reads the key of the last overflow track-Index QISAM load entry Into the Key save area (resume loading only).

31B Reads the count and data of the last prime-data QISAM load block Into the first buffer specified In the buffer control table (resume loading only).

87 Reads the highest level Index Into the user work BISAM (all) area (specified by DCBMSHI).

91 Fills unused Index tracks with Inactive and dummy QISAM load (end-of-index) entries (same as CP 19).

123W Extension of CP 12A and CP 12B or CP 13A and BISAM (WRITE KN) CP 13B when write-checking IS specified.

123WV Extension of CP 12AV and CP 12BV when wrlte­ BISAM (WRITE KN) checking is specified.

CLOSE Reads the format-2 DSCB for updating by close Common Close CCW(1) phase.

CLOSE Writes the format-2 DSCB back in the volume table Common Close CCW(2) of contents (VTOC).

VXCCW Reads to the end of the file or the end of the Common Open (1A) last track in the prime-data area. (validation)

VXCCW Reads to end of file of Independent overflow Common Open (1 B) area. (validation)

'!XCCW Reads to the end of the prime-data track. Common Open (2) (validation)

Figure 84 (Part 3 of 3). ISAM Channel Program Summary

Section 7: Appendixes 225 CHANNEL PROGRAM 1

Searches cylinder and master indexes

Flags CCW Command Code Address Count Comments No. Hex Description Hex Description

COl 31 Search 10 equal IOBSEEK+3 60 CC, SLI 4 Search for equal CCHH to verify seek- IOBSEEK set from either DCBFTHI or CO2 08 TIC COl 00 0 index entry in main storage

Cl 69 Search key high Contents of 60 CC, SLI KL Too far along index? Search for or equal DECBKEY master index entry C2 08 TIC C4 00 0 No

C2B 03 NOP C2B+5 60 CC,SLI 1 Set sector to zero 23 Set sector

C3 lA Read home C8 50 CC,SK 5 Yes, pOSition to address start of track

C4 E9 Search key high Contents of 40 CC KL. Search for entry or equal (MT) DECBKEY

C5 08 TIC C4 00

C6 06 Read data C8+7 00 CC (lowest 10 When found, read master index, CC off if 40 master) lower level master index is to be searched

C7 08 TIC Cl0 00 0 Go search cylinder index

C8 ------M Master index entry-IOBSEEK set to C8+ 7 when this CP is restarted for C9 B B C C H H R F lower level master index

Cl0 P Seek C9 40 CC 6 Seek cylinder index (Figure 83)

Cl0A 31 Search 10 equal C9+2 40 CC 4 Search for equal CCHH to verify seek

Cl0B 08 TIC Cl0A 40 CC 0

Cll 69 Search key high Contents of 40 CC KL Too far along index? Search for or equal DECBKEY cylinder index entry

C12 08 TIC C14 00 0 No

C12B 03 NOP C12B+5 60 CC, SLI 1 Set sector to zero 23 Set sector

C13 lA Read home C8 50 CC,SK 5 Position to start of track address

C14 E9 Search key high Contents of 40 CC KL Search for entry or equal (MT) DECBKEY

C15 08 TIC C14 00 0

226 OS ISAM Logic CHANNEL PROGRAM 1 (continued)

Searches cylinder and master indexes

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

C16 06 Read data C17 00 DL Read in cylinder index entry

C17 MBBC C H H R Cylinder index entry-IOBSEEK for CP4 set to C17 C18 FP------

Section 7: Appendixes 227 CHANNEL PROGRAM 2

Searches a cylinder index when it is the highest level index searched on the device

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

C28 31 Search ID equal IOBSEEK+3 60 CC, SLI 4 Search for equal CCHH to verify seek- IOBSEEK set from either DCBFTHI or C29 08 TIC C28 00 0 index entry in main storage

C30 69 Search key high Contents of 60 CC, SLI KL Too far along index? Search for or equal DECBKEY cylinder index entry

C31 08 TIC C33 00 0 No

C31B 03 NOP C31B+5 60 CC, SLI 1 Set sector to zero 23 Set sector

C32 1A Read home C37 50 CC, SK 5 Yes, position to start address of track

C33 E9 Search key high Contents of 40 CC KL Search for entry or equal (MT) DECBKEY

C34 08 TIC C33 00 0

C35 06 Read data C36 00 10 Read in cylinder index entry.

C36 MB B C C H H R Cylinder index entry-IOBSEEK set to C36 when CP4 is executed C37 F P ------

228 OS ISAM Logic CHANNEL PROGRAM 4

Searches a track index

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CAOl 31 Search I D equal IOBSEEK+3 60 CC 4 Search for equal CCHH to verify seek- IOBSEEK set from C17 (CP1), C36 (CP2), DCBFTHI or entry in main storage CA02 08 TIC CAOl Address of CP5 in CP 4-5-6 chain (see Figure 55)

CA03 08 TIC CAlor CA5 00 0 TIC to CA 1 if shared track is present. Otherwise, TIC to CA5.

CAl 71 Search ID high IOBSEEK+3 40 CC 5 I n prime data part of track? Search or equal track index

CA2 08 TIC CA5 00 0 No

CA4 08 TIC CA7 or CA6B 00 0 Yes

CA5 69 Search key high Contents of 60 CC, SLI KL Too far along in index? or equal DECBKEY

CA6 08 TIC CA8 00 0 No

03 NOP CA6B CA6B+5 60 CC, SLI 1 Set sector to zero 23 Set sector

CA7 lA Read home 50 CC,SK 5 Yes, position to start of track address

CA8 E9 Search key high Contents of 40 CC KL Search for entry or equal (MT) DECBKEY

CA9 08 TIC CA8 00 0

CAlO 06 Read data CA12+7 40 CC 10 If found, read index entry

CAll 08 TIC CA14 00 0

C,A.12 ------II!! Track: inde")( entry

CA13 B B C C H H R F

CA14 P Seek CA13 40 CC (to CP5) 6 Seek prime-data track (see Figure 81)

Section 7: Appendixes 229 CHANNEL PROGRAM 5i5W

Searches prime data tracks and reads or writes prime data records

CCW Command Code Flags Address Count Comments N'o. Hex Oescription Hex Oescription

23 Set sector Position to beginning of track if RPS CA15 CA15+5 60 CC, SLI 1 03 NOP device. Set sector to zero if RPS.

CA16A 31 Search 10 equal CA13+2 40 CC 5 Search past index on shared track or past RO on normal track. Should be RHA and TIC to CA20 for VLR.

CA16B 08 TIC CA16A 00 0

CA16C 08 TIC CA21 00 0 Avoid read count of FIRSH+1. (CA25+3 set to FIRSH prior to execution.)

CA20 12 Read count CA25+3 60 ce, SLI 5 Read count of record (see CA25)

CA21 29 Search key equal Contents of Search (29) if Read, Records Unblocked, 60 CC, SLI KL 69 Search key equal OECBKEY or Write. Search (69) if Read, Records or high Blocked.

CA22 08 TIC CA20 00 0

06 Read data Contents of Read prime data or write prime data CA23 40 CC OL 05 Write data OECBAREA

03 NOP Obtain address of record just read or CA24 IOBSECT 60 CC, SLI 1 22 Read sector written. No CC if read.

03 CA240' Set sector IOBSECT 40 CC 1 23

CA24A* 31 Search 10 equal CA25+3 40 CC 5 Search for record again

CA24B* 08 TIC CA24A 00 0

CA24C* 06 Read data 10 SK OL Read it back

CA240" 31 Search 10 equal IOBSEEK+3 40 CC 5 Rewrite record if necessary

CA24E* 08 TIC CA240 00 0

CA24F* 05 Write data Contents of 40 CC OL OECBAREA

CA24G* 08 TIC CA24A or 40 CC 0 Write check again CA240

CA25 - - -CCHHR If Read KU, CHHR of count is moved into IOBSEEK+4 (without destroying MBBC in IOBSEEK) when record is written back (CP7)

*Write Validity Check

230 OS ISAM Logic CHANNEL PROGRAM 6/6W

Searches an overflow chain and reads or writes overflow records

CCW Command Code Flags Address Count Comments No. Hex Descn ptlon Hex Description

CA26* 31 Search 10 equal IOBSEEK+3 40 CC 5 Search for first record in overflow chain-IOBSEEK set from CA12+7 CA27 OB TIC CA26 00 0 (CP4)

69 Search key RKP=Q and blocked or RKP*O; read CA28 equal or high 29 Search key Contents of 40 CC 0 Check key In overflow record. If equal, equal DECBKEY read (CA31) or write (CA40) record; otherwise, go to next one in chain CA29 08 TIC CA32 00 0

CA31 CA30 08 TIC 00 0 CA40 iContents of CA31 06 Read data DECBAREA 00 ** DL40 Read the overflow record (end of CP) (+6) CA31B 22 Read sector 10BSECT 00 1

CA32 06 Read data CA34+7 60 CC, SLI 10 Read link field to next record

CA33 08 TIC CA36 00 0

CA34 ------M Link field from overflow entry

CA35 B B C C H H R F Seek next record in overflow chain P(07) CA36 Seek CA35 40 CC 6 (see Figure 81 for value of P-seek command code)

03 NOP CA36B 10BSECT 60 CC, SLI 1 NOP if CP unbroken. Set sector if stop 23 Set sector at CA32 or CA30 (estimate if VLR).

CA37 31 Search ID equal CA35+2 40 CC 5 Search for overflow record

CA38 08 TIC CA37 00 0

CA39 08 TIC CA28 00 0 If found, check key

CA40 06 Read data Contents 60 ce;, fiLl iO Reaa link fieid Write (+6) of overflow DECBAREA record

08 TIC CA41 CA40A 40 CC 1 Read sector 22 10BSECT Position to record again

CA40B 23 Set sector 10BSECT 40 CC 1

*This channel program is preceded by a set sector-TIC if RPS is present. This prefix is located in (continued) the lOB extension. **CC if RPS

Section 7: Appendixes 231 CHANNEL PROGRAM 6/6W (continued)

Searches an overflow chain and reads or writes overflow records

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CA41 31 Search I D equal CA35+2 40 CC 5 Position to record again Write overflow CA42 08 TIC CA41 00 0 record

CA43 05 Write data Contents (+6) 40 CC Write record of DECBAREA

03 NOP CA430* IOBSECT 60 CC, SLI 1 Reposition to correct record 23 Set sector

CA43A 31 Search I D equal CA35+2 40 CC 5 Find record again

CA43B* 08 TIC CA43A 00 0

CA43C* 06 Read data 10 SK 0 Read it back

"Write Validity Check

232 OS ISAM Logic CHANNEL PROGRAM 7!7W

Writes data records when WRITE K is associated with READ KU

Flags CCW Command Code Address Count Comments No. Hex Description Hex Description

CA44* 31 Search ID equal IOBSEEK+3 40 CC 5 Search for record to be updated- See CA25 (CP5)

CA45 08 TIC CA44 Address of nex t CP7 in queue (see Figure 55)

CA46 05 Write data Contents of 40 CC DL Write updated record DECBAREA

03 NOP CA460** 10BSECT 60 CC,SLI 1 23 Set sector

CA46A** 31 Search I D equal IOBSEEK+3 40 CC 5 Fi~d record again

CA46B** 08 TIC CA46A 00 0

CA46C** 06 Read data 10 SK Read it back

*This channel program is preceded by a prefix if RPS is present. The prefix consists of a set sector and TIC which are located in the lOB extension. **Write Validity Check

Section 7: Appendixes 233 CHANNEL PROGRAM 8

Searches track index and prime data track to determine first record to be moved and position to insert it.

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CB1* 31 Search I D equal IOBSEEK+3 40 CC 5 Search for (COCR) RO

CB2 08 TIC CBl 00 0

CB3 06 Read data CB22 60 CC, SLI 6 Read RO COCR (HHRYYT) into CB22

CB4 92 Read count (MT CB22+6 60 CC, SLI 5 Read count of index entry

CB5 69 Search key equal Contents of 40 CC KL Search for index entry or high DECBKEY

CB6 08 TIC CB4 00 0

CB7 06 Read data CB10+7 40 CC 10 Read data of track index entry

CB8 92 Read count (MT CB24 40 CC 8 Read count of following entry

CB8A 06 Read data CB25 40 CC** 10 Read data of next entry

CB9 08 TIC CB12 00 0

CB10 ------M Track-index entry contains search address for prime or overflow data CBll B B C C H H R F

Seek prime or overflow track. CB12 P Seek CBll 40 CC 6 See Figure 81 for value of P (Seek Command Code).

03 NOP Position to beginning of track if RPS. CB16 CB16+5 60 CC, SLI 1 23 Set sector Set sector to 0 if R PS.

The following versions of CB17-CB20 are used with fixed-length records

CB17 31 Search ID equal CB11+2 40 CC 5 Search for prime record CB18 08 TIC CB17 00 0

CB18A 08 TIC CB19 00 0 Avoid skipping first record

CB18B 12 Read count CB23+3 60 CC,SLI 5 Get count of insertion record

CB19 69 Search key equal Contents of or high DECBKEY 60 CC,SLI KL Search track for insertion block

CB20 08 TIC CB18B 00 0

*This channel program is preceded by ... lOB extension.

234 OS ISAM Logic CHANNEL PROGRAM 8- (Continued)

Searches track index and prime data track to determine first record to be bumped and place to insert it.

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

The following versions of CB17-CB20 are used with variable-length records Read home CB17 0 70 CC,SK,SLI 1 Position to beginning of track 16 address

CB18 08 TIC CB18B 00 0 Avoid skipping first record

CB18A 06 Read data WATKL 60 CC,SLI 0 Read in block prior to insertion block

CB18B 12 Read count CB23+3 60 CC,SLI 5 Get count, probable insertion block Contents of CB19 69 Search key equal 40 CC KL or high DECBKEY Search for probable insertion block CB20 08 TIC CB18A 00 0

CB21 03 NOP IOBSECT 20 SLI 1 Read insert-block sector for RPS 22 Read sector

CB22 HHRYYTCC COCR--start of count of index entry

CB23 HHRCCHHR Finish count of index entry and count of record after insertion (record to be bumped)

CB24 C C H H R KL DL DL Count of the index entry following the entry that meets the search conditions

CB25 MBBCCHHR Data field of the index entry following the entry that meets the search CB26 FP------conditions

Section 7: Appendixes 235 CHANNEL PROGRAM 9A

Read into work area an unblocked record occupying the position at which an insertion is to be made

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CB30 31 Search I D equal IOBSEEK+3 40 CC 5 Search for record

CB31 08 TIC CB30 00 0

CB32 OE Read key and WA 80 DC KL Read record into work area data

CB33 00 WA+KL+16 00 DL

CHANNEL PROGRAM 9BroBW

Reads an even numbered record after writing a record into the previous slot and writes back the last record of a non-EOF track when the number of records bumped is odd.

Command Code Flags CCW Address Count Comments No. Hex Description Hex Description

CB34* 31 Search I D equal IOBSEEK+3 40 CC 5 Search for record

CB35 08 TIC CB34 00 0

CB36 OD Write key and Contents of 80 DC KL Write new record or record pointed to data DECBKEY by DECB

CB37 00 Contents of 00 DL DECBAREA

03 NOP CB370** 10BSECT 60 CC. SLI 1 23 Set sector

CB37A* 31 Search ID equal 40 CC 5 Search for record again

CB37B** 08 TIC CB37A 00 0

CB37C** OE Read key and 10 SK KL+DL Read it back data

CB38 OE Read key and Contents of 80 DC KL Read next record data DECBKEY

CB39 00 Contents of 00 DL DECBAREA *This channel program is preceded by a set sector-TIC if RPS is present. This prefix is locatlld in the lOB extension. **Write Validity Check

236 OS ISAM Logic CHANNEL PROGRAM 9C/9CW

Reads an odd numbered record after writing a record into the previous slot and writes back the last record of a non-EOF track when the number of records bumped is even.

Command Code Flags CCW Address Count Comments No. Hex Description Hex Description

CB40* 31 Search I D equal IOBSEEK+3 40 CC 5 Search for record

CB41 08 TIC CB40 00 0

CB42 OD Write key and WA 80 DC KL Write record into work area data

CB43 00 WA+KL+16 00 DL

03 NOP CB430** 10BSECT 60 CC, SLI 1 23 Set sector

CB43A ** 31 Search I D equal IOBSEEK+3 40 CC 5 Search for record again

CB43B** 08 TIC CB43A 00 0

CB43C** OE Read key and 10 SK KL+DL Read it back data

CB44 OE Read key and WA 80 DC KL Read record and point DECB to that data area

CB45 00 WA+KL+16 00 DL

*This channel program is preceded by a set sector-TIC if RPS is present. This prefix is located in the lOB extension. **Write Validity Check

Section 7: Appendixes 237 CHANNEL PROGRAM 10A/10AW

Writes a record or block to replace an EOF mark

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CB46* 31 Search ID equal IOBSEEK+3 40 CC 5 Search for last data record

CB47 08 TIC CB46 00 0

CB48-' ID Write count, key, CB51 80 DC 8 Write record or block over EOF mark and data

CB49 00 Contents of 80 DC KL DECBKEY

CB50 00 WA+KL+16 40 CC DL

03 NOP CB500** IOBCCW2+4 60 CC, SLI 1 23 Set sector

CB50A** 31 Search I D equal IOBSEEK+3 40 CC 5 Search for record again

CB50B** 08 TIC CB50A 00 0

CB50C** 1E Read count, key, 10 SK 8+KL Read it back and data +DL

~B51 C C H H R KL DL DL Count of record or block which replaces EOF

*This channel program is preceded by a set sector-TIC if RPS is present. This prefix is located in the lOB extension. **Write Validity Check.

238 OS ISAM Logic CHANNEL PROGRAM 10B/10BW

Writes an EOF mark

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CB52* 31 Search ID equal IOBSEEK+3 40 CC 5 Search for last data record

CB53 08 TIC CB52 00 0

CB54 10 Write count, CB55 40 CC 8 Write EO F mark key, and data

03 NOP CB540** 10BSECT 60 CC, SLI 1 23 Set sector

CB54A ** 31 Search I D equal IOBSEEK+3 40 CC 5 Search for EOF mark

CB54B** 08 TIC CB54A 00 0

CB54C** 1E Read count, 10 SK 8 Read it back key, and data

CB55 C C H R R 000 EOF mark (count field)

*This channel program is preceded by a set sector-TIC if RPS is present. This prefix is located in the lOB extension. **Write Validity Check

Section 7: Appendixes 239 CHANNELPROGRAMllA

Reads an odd numbered record after writing a record Into the previous slot

CCW Command Code Flags Address Count Comments No Hex Description Hex Description

CC1 31 Search 10 equal IOBSEEK+3 40 CC 5 Search for block

CC2 08 TIC CCl 00 0

CC2A DE Read key and WA 80 DC KL Read in block data

CC3 00 WA+KL+RL 00 DL

CHANNEL PROGRAM llB/llBW

Writes a re-arranged block back onto the prime data track

CCW Command Code Flags Address Count Comments No. Hex Description Hex DesCription

CC4* 31 Search 10 equal IOBSEEK+3 40 CC 5 Search for insertion point

CC5 08 TIC CC4 00 0

CC6 00 Write key and WA 40 CC KL+DL Write block data

03 NOP CC60* 10BSECT 60 CC, SLI 1 23 Set sector

CC6A* 31 Search 10 equal IOBSEEK+3 40 CC 5 Search for block again

CC6B* 08 TIC CC6A 00 0

CC6C* DE Read key and 10 SK KL+DL Read it back data

"This channel program is preceded by a set sector - TIC if RPS is present. This prefix is located in the lOB extension. * 'Write Validity Check

240 OS ISAM Logic CHANNELPROGRAM12A

Reads data records following slot in which new record is to be inserted

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CD1 31 Search ID equal IOBSEEK+3 40 CC 5 Search for block prior to insert

CD2 08 TIC CD1 00 0 CD3 OE Read key and WA+10 60 CC,SLI KL+DL Read first prime data block data

CD4 1E Read count, key. WA+10+ 60 CC, SLI DL Read successive prime data record. and data KL+DL There is one copy of CD4 for each record on a prime data track; the CC bit is set off in the appropriate copy depending on how many blocks are to be read.

Section 7: Appendixes 241 CHANNEL PROGRAM 12AV

Reads variable length data records or blocks following point at which new record is to be inserted

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

COO CCHHR008 Capacity record for prime data track

COOA Y Y R- - - --

COOA1* 31 Search 10 equal COO 40 CC 5 Search for RO (track capacity record)

COOA2 08 TIC COOAl 00 0

COOB 06 Read data COOA 60 CC, SLI 3 Read capacity record

COOC 08 TIC COOO or 00 0 TIC to C03 if a full track is to be read C03 or prior block full

03 NOP COOO 10BSECT+l 60 CC, SLI 1 23 Set sector

COl 31 Search 10 equal IOBSEEK+3 40 CC 5 Search for record prior to insert point

CO2 08 TIC COl 00 0

C02A 08 TIC C02B or 00 0 TIC to C02B if this is first execution of C03 channel program * *

C02B OE Read key and WA 60 CC, SLI KL Read key of record prior to insert point data

C03 06 Read data WA+KL+CF 60 CC,SLI OL Read data portion of record. There is +LRECL one copy of C03 for each record which can be read in a single execution. *

*This channel program is preceded by a set sector-TIC if RPS is present. This prefix is located in the lOB extension. **With unblocked records and a large HIRPO, the WRITE KN work area (DCBMSWA) may not be large enough to contain all records past the insertion point. CP 12AV is then executed more than once. "ISAM Buffer and Work AREA Requirements" in Data Management Services Guide, GC26-3746, tells how to determine the best size for the work area.

242 OS ISAM Logic CHANNELPROGRAM12B

Writes back prime data records

CCW Command Code Flags Address Count Comments No. Hex Desert ption Hex Description

CE1 31 Search I D equal IOBSEEK+3 40 CC 5 Search for block prior to insert

CE2 08 TIC CE1 00 0

CE3 10 Write count, key, WA+2 80 DC 8 Write prime data records. There is one and data set of CE6-CE7 for each record on a prime data track; the CC bit is set off CE4 00 DECBKEY 80 DC KL in the appropriate copy of CE7 depending on how many records are CE5 00 DECBAREA 40 CC DL written back.

CE6 10 Write count, key. WA+KL+ 80 DC 8 and data DL+10

CE7 00 WA+10 40 CC KL+DL

Section 7: Appendixes 243 CHANNEL PROGRAM 12BV

Writes back variable length prime data records or blocks

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CEO* 31 Search 10 equal COO 40 CC 5 Search for RO

CEOA 08 TIC CEO 00 0

CEOB 05 Write data CODA 60 CC, SLI 3 Write updated track capacity record

03 NOP CEOC 10BSECT+l 60 CC, SLI 1 23 Set sector

CEl 31 Search ID equal IOBSEEK+3 40 CC 5 Search for record prior to insert point

CE2 08 TIC CEl 00 0

CE3 08 TIC CE4 00 0 TIC to CE4 to write partial track

CE3A 39 Search home COO 40 CC 4 Search for start of track address

CE3B 08 TIC CE3A 00 0

CE3C 15 Write RO COO 60 CC, SLI 11 Write updated track capacity record again

CE4 10 Write count, WA+KL 80 DC 8 Write prime data record. The number of key, and data sets of CE4·CE6 equals DCBH I RPD; the CC bit is set off in the appropriate CE5 00 WA+KL+CF 80 DC KL copy of CE6 depending on how many +(DL-LRECL records are written back +RKP

CE6 00 WA+KL+CF 40 CC OL - ! *This channel program is preceded by a set sector-TIC if RPS is present. The prefix is located in the lOB extension.

244 OS ISAM Logic CHANNEL PROGRAM 12C/12CW

Writes a new record which has replaced a deleted record

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CL1* 31 Search I D equal IOBSEEK+3 40 CC 5 Search for deleted record

CL2 08 TIC CLl 00 0

CL3 05 Write data Contents of 40 CC DL Replace deleted record DECBAREA

03 NOP CL30** 10BSECT 60 CC, SLI 1 23 Set sector

CL3A** 31 Search ID equal IOBSEEK+3 40 CC 0 Search for record aga i n

CL3B** 08 TIC CL3A 00 0

CL3C** 06 Read data 10 SK DL Read it back

*This channel program is preceded by a set sector- TIC if RPS is present. This prefix is located in the lOB extension. **Write Validity Check

Section 7: Appendixes 245 CHANNELPROGRAM13A

Reads all blocks from the track following and including the slot into which a record is to be inserted

CCW Command Code Flags Address Count Comments No. Hex Description , Hex Description

CF1 31 Search I D equal IOBSEEK+3 40 CC 5 Search for first record to be read

CF2 08 TIC CF1 00 0

CF3 06 Read data Data address 00 DL Read first prime data block

CF4 12 Read count WA 40 CC 8 Read successive prime data block. There is one copy of CF4·CF5 for each block CF5 06 Read data Data address 40 CC DL on a prime data track; the CC bit is set off in the appropriate copy of CF5 depending on how many blocks are to be read.

CHANNELPROGRAM13B

Writes back the rearranged blocks read by CP13A

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CG1 31 Search I D equal IOBSEEK+3 40 CC 5 Search for record before insertion pOint

CG2 08 TIC CG1 00 0

CG3 10 Write count, WA 80 DC 8 Write back prime data block. There is key, and data one copy of CG3·CG4·CG5 for each block on a prime data track; the CC bit CG4 00 Key address 80 DC KL is set off in the appropriate copy of CF5 depending on how many blocks CG5 00 Data address 00 DL are to be written.

246 OS ISAM Logic CHANNEL PROGRAM 13C/13CW

Writes back a block if the insertion is a record with a key identical to that of a record, which although logically deleted, is still physically present within the block.

Command Code Flags CCW Address Count Comments No. Hex Description Hex Description

Cl5* 31 Search ID equal IOBSEEK+3 40 CC 5

Cl6 08 TIC Cl5 00 0 Search for block insertion point

Cl7 05 Write data Data address 40 CC Dl Replace block

03 NOP CL70** 10BSECT 60 CC, SLI 1 Find record again 23 Set sector

Cl7A** 31 Search I D equal IOBSEEK+3 40 5

Cl7B** 08 TIC Cl7A 00 0

CL7C** 06 Read data 10 SK Dl Read it back

*This channel program is preceded by a set sector-TIC if RPS is present. The prefix is located in the lOB extension. **Write Validity Check

Section 7: Appendixes 247 CHANNEL PROGRAM 14/14W - Fixed Length Records

Writes some combination of COCR, normal and overflow track Index entries, and overflow records. (See BISAM Write KN Asynchronous Codes in Section 6 for descriptions of the setups of this channel program.)

Part II-Rewrites COCR and track index *

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CH1** 31 Search I D equal IOBSEEK+3 40 CC 5 Search for COCR Entry pOint for Setups 1·5 (add to cylinder overflow)

CH2 08 TIC CH1 00

CH3 05 W rite data CB22 60 CC, SLI 6 Write updated COCR from CP8

Set sector CH3A,.** 23 CH3A1+5 60 CC, SLI 1 Set sector to zero If RPS 03 NOP

CH3A** 31 Search I D equal IOBSEEK+3 40 CC 5 Search for COCR again

CH3B"* 08 TIC CH3A 00 0

CH3C*" 06 Read data 70 CC, SK,SLI Read It back

CH5,CH9, CH4 08 TIC 00 0 TIC to CH5 for Setup 1, CH9 for Setups 2,3 CH55,CH14, 5; CH 14 for Setup 4 orCH8D 03 NOP 10BSECT CH5 23 Set sector 60 CC, SLI 6 1B Seek head CI5

CH55 31 Search I D equal CB22+6 40 CC 5 Search for prime index entry; entry pOint for Setups 1·2 (add to Independent overflow)

CH6 08 TIC CH55 00 0

CH7 OD Write key and data Contents of 80 DC 0 Write new hl·key prime data chain DECBKEY

CH8 00 CB10+7 40 CC 10 Write prime Index entry

03 NOP CH80'" 10BSECT 60 CC, SLI 1 23 Set sector

CH8A*' 31 Search I D equal CB22+6 40 CC 5 Search for entry again

CH8B'" 08 TIC CH8A 00 0

CH8C*" OE Read key and data 50 CC,SK 0 Read It back

CH8D 31 Search I D equal CB24 40 CC 5 Search for overflow track Index entry

CH8E 08 TIC CH8D 00 0

CH8F 05 Write data CB25 10 SK 10

CH8G 08 TIC CH13t8 00 0

'CP14 IS executed in two parts only when the work area IS provided by the user. "This channel program IS preceded by a set sector-TIC If RPS IS present. This prefix IS located In the lOB extension. ""Write Validity Check (Continued)

248 OS ISAM Logic CHANNEL PROGRAM 14/14W - Fixed Length Records (continued)

Writes some combination of COCR, normal and overflow track Index entries, and overflow records (See 81SAM Wote KN Asynchronous Codes in Section 6 for descriptions of the setups of this channel program.)

Part II-Rewrites COCR and track Index"

CCW Command Code Flags Address Count Comments No. Hex Descr i pt i on Hex Description

03 NOP CH9 IOBSECT+1 60 CC, SLI 1 23 Set sector

CH95 31 Search 10 equal CB24 40 CC 5 Search overflow track mdex entry

CH10 08 TIC CH95 00 0

CH12 00 Write key and data 80 DC 0 Write new overflow key·data cham

CH13 05 Write data CB25 40 CC 10 Write overflow Index entry

03 NOP CH130* IOBSECT+1 60 CC, SLI 1 23 Set sector

CH13A* 31 Search 10 equal CB24 40 CC 5 Search for entry agam

CH13B* 08 TIC CH13A 00 0

CH13C* OE Read key and data 50 CC,SK KL+OL Read It back

07 Seek CH14 CH23+1 40 CC Seek new overflow record (seek IS set by OB Seek cy linder appendage rout me) . For user work area 1B Seek head thiS CCW IS a NOP. 03 NOP

Part I-Writes overflow record."

03 NOP CH150 IOBSECT+2 60 CC, SLI 1 Entry pomt for Setup 6 23 Set sector

CH15 31 Search 10 equal CH23+3 40 CC 5 Search for overflow slot

CH15A 08 TIC CH15 00 0

CH16 10 Write count, key, CH24 80 DC 8 Write new overflow record and data

CH17 00 Contents of 80 DC KL DECBKEY

Contents of CH18 00 40 CC DL OECBAREA

03 NOP CH180* IOBSECT+2 60 CC,SLI 1 23 Set sector

CH18A* 31 Search 10 equal CH23+3 40 CC 0 !)earch tor new overflOw recora agam

CH18B* 08 TIC CH18A 00 0

CH18C* 1E Read count, key, 10 SK 0 Read It back. Termination for Setups 1,2, and data 5,6

CH19 07 Seek CJ11+1 40 CC 6 Seek previous overflow record (appropriate OB Seek cylinder seek set by appendage routine). 1B Seek head

'Wrlte Validity Check (continued) * *CP14 IS executed In two parts only when the work area IS provided together

Section 7: Appendixes 249 CHANNEL PROGRAM 14/14W - Fixed Length Records (continued)

Writes some combinatIon of COCR, normal and overflow track Index entries, and overflow records. (See B/SAM Write KN Asynchronous Codes In Section 6 for descriptions of the Setups of this channel program.)

Command Code Flags CCW Address Count Comments No. Hex Description Hex Description

03 NOP CH200 IOBSECT+3 60 CC, SLI 1 23 Set sector

CH20 31 Search I D equal CJ11+3 40 CC 5 Search for record

CH21 08 TIC CH20 00 0

CH22 05 Wrote data WA 40 CC 0 Wrote back prevIous overflow record

03 NOP CH220' IOBSECT+3 60 CC, SLI 1 23 Set sector

CH22A* 31 Search I D equal CJ11+3 40 CC 5 Search for prevIous overflow record again

CH22B* 08 TIC CH22A 00 0

CH22C* 06 Read data 10 SK DL Read It back. TerminatIon for Setups 3-4.

CH23 M B B C C H H R Search address of new overflow record

CH24 C C H H R KL DL DL Count of new overflow

'Wrote ValIdIty Check

250 OS ISAM Logic CHANNEL PROGRAM 14/14W-Variable Length Records

Writes some combination of COCR, normal and overflow track index entries, and overflow records. (See BISAM Write KN Asynchronous Codes in Section 6 for descriptions of the Setups of this channel program.)

Command Code Flags CCW Address Count Comments No. Hex Description Hex Description

Part II-ReWrites COCR and Track Index

CH1* 31 Search I D equal CH23+3 40 CC 5 Search for COCR Entry point for Setups 1·5 (add to cylinder overflow)

CH2 08 TIC CHl 00

CH3 05 Write data CB22 60 CC, SLI 6 Write updated COCR from CP8

23 Set sector CH3Al CHA1+5 60 CC, SLI 1 Set sector to zero if RPS 03 NOP

CH3A* 31 Search I D equal CH23+3 40 CC 5 Search for COCR again

CH3B** 08 TIC CH3A 00 0

CH3C** 06 Read data 70 CC, SK, SLI Read it back

CH4 08 TIC CH50, CH5, 00 0 TIC to CH5 for Setup 1; CH8G for CH3FO,CH3GV Setups 2, 3, 5; CH14 for Setup 4 or CH14

03 NOP CH5 10BSECT 60 CC, SLI 6 23 Set sector 1B Seek head CI5

CH55 31 Search I D equal CB22+6 40 CC 5 Search for prime index entry; Entry point for Setups 1-2 (add to CH6 08 TIC CH55 00 0 independent overflow)

CH7 OD Write key and Contents of 80 DC 0 Write new hi-key prime data chain data DECBKEY

CH8 00 CB10+7 40 CC 10 Write prime index entry

03 NOP CH80* 10BSECT 60 CC, SLI 1 23 Set sector --- CH8A** 31 Search I D equal CB22+6 40 CC 5 Search for entry again

CH8B** 08 TIC CH8A 00 0

CH8C"* OE Read key and 50 CC,SK 0 Read it back data

*This channel program is preceded by a prefix if RPS is present. The prefix consists of a set sector and TIC, which are located in the lOB extension. **Write Validity Check (continued)

Section 7: Appendixes 251 CHANNEL PROGRAM 14/14W-Variable Length Records (continued)

Writes some combination of COCR, normal and overflow track index entries, and overflow records. (See BISAM Write KN Asynchronous Codes in Section 6 for descriptions of the setups of this channel program.)

Command Code Flags CCW Address Count Comments No. Hex Description Hex Description

CH8D 08 TIC CH8G5 00 0

CH8F This CCW not used

Part II-Rewrites COCR and Track Index

23 Set sector CH8G IOBCCW2+5 60 CC,SLI 1 03 NOP

CH8G5 31 Search I D equal CB24 40 CC 5 Search overflow track index entry

CH9 08 TIC CH8G5 00 0

CH10 08 TIC CH12orCH13 00 0 TIC to CH13 to write data only of overflow record

CH12 OD Write key and data 80 DC 0 Write new overflow key-data chain

CH13 05 Write data CB25 40 CC 10 Write overflow index entry

03 NOP CH130* IOBSECT+1 60 CC, SLI 1 23 Set sector

CH13A* 31 Search I D equal CB24 40 CC 5 Search for entry again

CH13B* 08 TIC CH13A 00 0

CH13C* OE Read key and data 50 CC,SK KL+10 Read it back

CH14 03 NOP 20 SLI 1

*Write Validity Check (continued)

252 OS ISAM Logic CHANNEL PROGRAM 14/14W-Variable Length Records (continued)

Writes some combination of COCR, normal and overflow track index entries, and overflow records. (See BISAM Write KN Asynchronous Codes in Section 6 for descriptions of the setups of this channel program.)

Command Code Flags CCW Address Count Comments No. Hex Description Hex Description

Part I-Writes Overflow Record

03 NOP CH150 IOBSECT+2 CC, SLI 23 Set sector

CH15 31 Search I D equal CH23+3 40 CC 5 Search for overflow slot

CH15A 08 TIC CH15 00 0

CH16 10 Write count, key. CH24 80 DC 8 and data

Write new overflow record CH17 00 Contents of 80 DC KL DECBKEY

Contents of CH18 00 40 CC DL DECBAREA

03 NOP CH180* IOBSECT+2 60 CC, SLI 1 23 Set sector

CH18A 31 Search I D equal CH23+3 40 CC 5 Search for new overflow record again

CH18B* 08 TIC CH18A 00 0

CH18C* 1E Read count, key, 10 SK 0 Read it back. Termination for Setups and data 1,2,5,6

07 Seek Seek previous overflow record CH19 CJ11+1 40 CC 6 OB Seek cylinder (appropriate seek set by appendage SECT+3 1B Seek head routine).

03 NOP CH200 I o BCCW2+7 60 CC, SLI 1 23 Set sector Search for record CH20 31 Search I D equal CJ11+3 40 CC 5

CH21 08 TIC CH20 00 0

CH22 05 Write data WA 40 CC 0 Write back previous overflow record

03 NOP CH220 IOBSECT+3 60 CC, SLI 1 23 Set sector

CH22A* 31 Search I D equal CJ11+3 40 CC 5 Search for previous overflow record again CH22B* 08 TIC CH22A 00 0

CH22C" 06 Read data 10 SK DL Read it back. Termination for Setups 3-4

*Write Validity Check (continued)

Section 7: Appendixes 253 CHANNEL PROGRAM14/14W-Variable Length Records (continued)

CH23 MBBCCHHR Search address of new overflow record

Writes some combination of COCR, normal and overflow track index entries, and overflow records. (See BISAM Write KN Asynchronous Codes in Section 6 for descriptions of the Setups of this channel program.)

Command Code Flags CCW Address Count Comments No. Hex Description Hex Description

CH24 C C H H R KL DL DL Count of new overflow

EOF Extension

CH25 31 Search I D equal CH31+3 40 CC 5 Search for last overflow record CH26 08 TIC CH25 00 0

Write count, key, CH27 1D CH32 40 CC 8 Write EOF mark and data

03 NOP CH280* IOBSECT 60 CC,SLI 1 23 Set sector Search for record again CH28* 31 Search I D equal CH31+3 40 CC 5

CH29* 08 TIC CH28 00 0

Read count,key, CH30* 1E 30 SK, SLI 8 Read it back and data

CH31 M B B C C H H R Address of last overflow record

CH32 C C H H R K K D EOF mark

*Write Validity Check

254 OS ISAM Logic CHANNEL PROGRAM 15

Reads in the cylinder overflow control record and the overflow track index entry when a new record is added to the end of a data set

Command Code Flags CCW Address Count Comments No. Hex Description Hex Description

Cil * 31 Search I D equal IOBSEEK+3 40 CC 5 Search for COCR CllA 08 TIC Cil 00 0

CllB 06 Read data CB22 60 CC, SLI 6 Read RO (COCR) into CP8

CllC lB Seek head CI5 40 CC 6 Find last active index track

03 NOP CllD IOBSECT+1 60 CC, SLI 1 23 Set sector Search for last active normal track Cl1E 31 Search I D equal C15+2 40 CC 5 index entry

CI2 08 TIC Cl1E 00 0

CI3 92 Read count CB24 40 CC 8 Read count of last overflow entry into CP8

CI4 06 Read data CB25 00 10 Read data of last overflow entry into CP8

CI5 BBCCHHR- ID of last active normal track index entry

*This channel program preceded by a set sector-TIC if RPS is present. This prefix is located in the lOB extension.

Section 7: Appendixes 255 CHANNEL PROGRAM 16

Searches an overflow chain for (1) the record that logically precedes or is equal to the new record to be added or (2) the last record in the chain.

Command Code Flags CCW Address Count Comments No. Hex DeSCription Hex Description

CJ1** 31 Search I D equal IOBSEEK+3 40 CC 5 Search for next overflow record in chain

CJ2 08 TIC CJ1 00 0

CJ3 69 Search key Contents of 40 CC KL Is this the desired record? equal or high DECBKEY

CJ4 08 TIC CJ10 00 0 No

03 NOP CJ4A 10BSECT 60 CC, SLI 1 23 Set sector

CJ5 31 Search I D equal IOBSEEK+3 40 CC 5 Search for overflow record

CJ6 08 TIC CJ5 00 0

CJ7 29 Search key Contents of 40 CC 0 Test If key equals user key equal DECBKEY

CJ8 03 NOP 0 20 SLI 1 No, stop here

CJ9 06 Read data WA 20 SLI 11 Yes, read 11 bytes of equal key record

DL CJ10 06 Read data WA* OOt Read next overflow record in chain +10***

CJ11 M B B C C H H R Address of record in chain before insert

*The address is WA+20 for variable length records **This channel program preceded by a prefix if RPS is present. The prefix consists of a set sector and TIC which are located in the lOB extension. ***DL+14 if VLR tSLI if VLR

256 as ISAM Logic CHANNEL PROGRAM 17/17W

Changes the key In a normal or overflow track Index entry or In a higher level Index entry

Flags CCW Command Code Address Count Comments No. Hex Description Hex Description

CK1* 31 Search 10 equal IOBSEEK+3 40 CC 5 Search for last entry In index

CK2 08 TIC CK1 00 0

CK3 06 Read data CK8 40 CC 10 Read data of last entry

03 NOP CK30 10BSECT 80 CC, SLI 1 23 Set sector Search for entry aga in

CK4 31 Search 10 equal IOBSEEK+3 40 CC 5

CK5 08 TIC CK4 00 0

CK6 00 Write key Contents of 80 DC KL and data DECBKEY Write new high key and rewrite data of entry CK7 00 CK8 40 CC 10

CK70" 03 NOP 10BSECT 60 CC,SLI 1 23 Set sector Search for updated entry CK7A*" 31 Search I 0 equal IOBSEEK+3 40 CC 5 CK7B** 08 TIC CK7A 00 0

~K7C** OE Read key and data 10 SK KL+10 Read it back

CK8 M B B C C H H R Data of Index entry

CK9 F p------

*Write Validity Check **This channel program preceded by a prefix if RPS is present. The prefix consists of a set sector and TIC which are located in the lOB extension.

Section 7: Appendixes 257 CHANNEL PROGRAM 18

Write Prime Data Blocks-load Mode, ISAM.

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

ClO 23 Set sector ISlRPSSS 40 CC 1 Position for first record

CL1 1 31 Search ID equal IOBSEEK+3 40 CC 5 Search for count field of the block pre- COl, C014A ceding the block to be written next

Cl21 08 TIC Cll 1 00 0 The count field contains the address of the write check segment of this channel

program (Cl 12 )

Cl31 08 TIC Cl4 or Cl6 00 0 Transfer to the first CCW of the group of write CCWs to be executed next. The count field contains the address of the last read CCW in the write check segment of this channel program +8.

One copy of Cl4 for each buffer. Cl4 is used to write blocks for fixed length, unblocked record formats where R KP = 0 because count, key, and data are contiguous.

Cl4a 10 Write count, Buffer N 40 CC 8+Kl Write prime data records when key data +Dl RECFM=F, RKP=O

One copy of Cl6, CL7, Cl8 for each buffer. Cl6, CL7, Cl8 are used to write blocks for fixed length, unblocked formats where RKPfO, fixed length, blocked formats because count, key, and data are not contiguous.

Cl6a 10 Write count Buffer N 80 DC 8 Write prime data records when RECFM=F; RKP~O or RECFM=FB; RKP-N/A CL7 00 Write key Buffer 80 DC KL N+8+RKP Buffer CL8 00 Write data N+8 40 CC# DL

The next CCW follows each copy of CL4 or CL8 except the last. It transfers to the beginning of the Write Validity Check

segment of this channel program (CL 12 ), If this is the last of the current group of write CCWS; otherwise it transfers to the next copy of CL4 or CL6. This CCW is omitted if Write Validity Check is not specified.

08 TIC CL 12 , 00 0 The count field of this CCW contains CL4n, or the address of the next sequential CL6n copy of CL4 or CL6

The next CCW (CL5) follows the last copy of CL4 or CL8. It transfers to the beginning of the Write Validity Check

segment of this channel program (CL0 2 ), if this is the last of the current group of write CCWs; otherwise it transters to the first copy of CL4 or Cl6. If Write Validity Check is not specified, this CCW points to the first copy of Cl4 or Cl6.

CL5 08 TIC CL1 2 ,Cl02 , 00 0 The count field of this CCW contains

CL4 1 I the address of CL4 1 or CL6 1 or CL6 1 (continued)

258 OS ISAM Logic CHANNEL PROGRAM 18 (continued)

Write Prime Data Blocks-Load Mode, ISAM.

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

23 Set Sector CL0 ISLRPSSS 60 CC, SLI 1 Position for first record 2 03 NOP

CL1 2 * 31 Search I D equal IOBSEEK+3 40 CC 5 Search for the count field of block or Buffer N preceding the first block of the group last written; Buffer N is the address of CL22 * 08 TIC CL1 2 60 0 the count field if this is a shared track.

The following CCW (CL32 ) transfers to the first read CCW to be executed.

CL32 * 08 TIC CL9 00 0

One copy of CL9 IS generated for each buffer. Each copy of CL9 is command chained except the last. CL3 transfers to the copy of CL9 whose position in relation to the last copy of CL9 is equal to the number of blocks written by this execution of channel program 18.

CL9* 1E Read count, 50 CC, SK# 0 key, and data #Command chain is off if this is the last read or write of a group to be executed. *Write Validity Check aFor shared (preformatted) tracks. The count field is not written.

Section 7: Appendixes 259 CHANNEL PROGRAM 19m1

CP19-Preformat shared track and/or write cylinder overflow control record (COCR) CP91-Fill unused index tracks with inactive and dummy (end of index) entries

Command Code Flags CCW Address Count Comments No. Hex Description Hex Description

CMO#t 23 Set sector CMO+5 40 CC 1 Position for COCR

CM1# 31 Search I D equal DCBLPDA 40 CC 5 When CP is being generated, DCBLPDA contains the DAD AD of the record preceding the first prime data record CM2# 08 TIC CM1 00

CM3# 05 Write data Area Z 60 CC, SLI 8 Write COCR

CM4# 1B Seek head DCBLPDA 40 CC 6 DCBLPDA if COCR and DCBFIRSH or CM27+1 are same track, otherwise CM27+1

23 Set sector CM40 ISLRPSSS+1 60 CC, SLI 1 Position to index entries 03 NOP

CM5 31 Search I D equal DCBLPDA 40 CC 5 DCBLPDA if COCR and DCBFIRSH or CM27+3 are same track, otherwise CM27+3

CM6 08 TIC CM5 00

CM7 10 Write count,key, Area Z+6 80 DC 8 data

CM8 00 Buffer 40 CC KL+10 Write inactive track index entries

CM9 10 Write count,key Area Z+14 80 DC 8 data

CMlO 00 Buffer 40 CC KL+10

CM11 10 Write count, Area Z+22 80 DC 8 key. data

CM12 00 Buffer 40 CC KL+l0

CM13 10 Write count, Area Z+30 80 DC 8 key, data

CM14 00 Buffer 40 CC KL+l0

CM15 10 Write count, Area Z+38 80 DC 8 key, data

CM16 00 Buffer 40 CC KL+10

CM17 10 Write count, Area Z+46 80 DC 8 key, data #Cylinder Overflow Control Record (COCR) to be written. With variable length records, (continued) CP19 consists of CMl through CM4 only because the track index is not preformatted. tSet sector to zero if RPS.

260 OS ISAM Logic CHANNEL PROGRAM 19/91 (continued)

CP19-Preformat shared track and/or write cylinder overflow control record (COCR) CP91-Fill unused index tracks with inactive and dummy (end of index) entries

Command Code Flags CCW Address Count Comments No. Hex Description Hex Descri ption

CM21 10 Write count, Area Z+62 80 DC 8 key, data

CM22 00 Buffer 40 CC KL+lO

CM23 10 Write count, Area Z+70 80 DC 8 key, data

CM24 00 Buffer 40 CC KL+10

CM25 10 Write count, Area Z+78 80 DC 8 key, data

CM26 00 Buffer 00 KL+10

CM27 M B B C C H H R If the COCR and the Shared Track are not the same track; this field is used to store the Seek and Search arguments for CM4 and CM5.

This CCW resides in the CM27 08 TIC CM5 00 0 CP91 skeleton only and replaces CM 1 only when COCR is not to be written.

CM28 OD Write key and data Buffer 00 0 This CCW can replace CM8

CM29 10 Write count, Area Z+6 80 DC 8 This CCW can replace CM7 key, and data

Section 7: Appendixes 261 CHANNEL PROGRAM 20--Fixed Length Records

Writes Track Index Entry(s)

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

The following segment of CP20 is executed for fixed length record formats when shared tracks are in effect. CP19 has preformatted the track index by writing a count field for each entry.

COO 23 Set sector ISLRPSSS+2 40 CC 1 Position for normal track Index entry

Cal 31 Search 10 equal ISLIOBA 40 CC 5 Search for normal track index entry to be written next

CO2 08 TIC Cal 00 0

C03 00 Write key, data Buffer N+8 80 DC KL Write normal track index entry +RKP

C04 00 Area Y+26 40 CC 10

C05 Bl Search 10 equal Area Y+36 40 CC 5 Search for track to write overflow track (MT) index entry

C06 08 TIC C05 00 0

COl 00 Write key, data Buffer N+8 80 DC KL Wnte overflow track index entry +RKP

C08 00 Area Y+44 40 CC 10

C09 08 TIC COlO, COT1, 00 0 Transfer to write dummy track index or C013 entry (COlO) or to COTl if Write Validity Check is specified, or transfer to to CO 13 if CP 18 (write prime data) is to be executed next

COlO Bl Search 10 equal Area Y+54 40 CC 5 Search for dummy track entry to be (MT) written next

Call 08 TIC COlO 00 0

C012 00 Write key, data Area Y+62 40 CC KL+l0 Write key, data fields of dummy track index entry

CO 13 lB Seek HH ISLIOBA+33 40 CC 6

C014 08 TIC COT1 or CL 1 20 SLI 5 Transfer to COTl if Write Validity Check is specified, or to CL 1 (CP18); this CCW is a NOP during Close processing. (continued)

262 OS ISAM Logic CHANNEL PROGRAM 20--Fixed Length Records (continued)

Writes Track Index Entry(s)

CCW Command Code Flags Address Count Comments No. Hex Descri ptlon Hex Description

C014A MBBCCHHR Seek address for CP18

C014B 23 Set sector ISLRPSSS+2 40 CC 1 Position to next index entry

C015 31 Search I D equal Area Y+18 40 CC Index entry to be written next (R=R-l)

CO 16 08 TIC C015 00 0

CO 17 10 Write count, Area Y+18 80 DC 8 Write count, key,and data fields of key, data normal track index entry ISLKEYAD points to key C018 00 Buffer N+8 80 DC KL +RKP

C019 00 Area Y+26 40 CC 10

C020 08 TIC C0210rC027 00 0 Transfer to C021 if normal and overflow entries are on the same track, or to C027 if normal and overflow entries are on different tracks

C021 10 Write count, Area Y+36 80 OC 8 Write overflow index entry key, data ISLKEYAD points to key

C022 00 Buffer N+8 80 DC KL

C023 00 Area Y+44 40 CC 10

C024 08 TIC COT1 00 0 Transfer to COT1 if Write Validity C013 Check is specified, or to C013 if C025 CP18 is to be executed next, or to C027 C025 if overflow and dummy track index entries are on the same tracks, or to C027 if overflow and dummy track index entries are on different tracks

C025 10 Write count, Area Y+54 40 CC 8+KL+10 Write count, key, and data of dummy of

" __1_- __ ... ~ key, data IIIUt::1\ t::IILI y

C026 08 TIC con 00 0 Transfer to COTl if Write Validity or C013 Check is specified, or to C013 if CP18 is to be executed next

C027 Bl Search I D equal C030+3 40 CC 5 I ndex entries are spl it across tracks. Search for next physical track

C028 08 TIC C027 00 0

(continued)

Section 7: Appendixes 263 CHANNEL PROGRAM 20-Fixed-length Records (continued)

Writes Track-index Entry(s)

CCW Command Code Flags Address Count Comments No. Hex DescriptIOn Hex Description

C029 08 TIC C021orC025 00 0 Transfer to write overflow track index entry (C021), or to write dummy track index entry (C025)

C030 MBBCCHHR Search argument for next track if index entries are spl it across track boundary

COTO' 23 Set sector ISLRPSSS+2 40 CC 1 Position for track index

COT1' 31 Search 10 equal Area Y+18 40 CC 5 Find last normal entry written

COT2* 08 TIC COT1 00 0

COT3* OE Read key 50 CC,SK KL+10 Read entry back and data

COT4* B1 Search 10 Area Y+36 40 CC 5 Find last overflow entry written equal (MT)

* COT4A 08 TIC COT4 00 0

COT5* OE Read key 50 CC,SK KL+10 Read entry back and data

08 TIC COT7 60 CC,SLI 1 No inactive entry written COT5A• 08 TIC COT7 60 CC,SLI 1 Inactive entry written

COT5B* B1 Search ID Area Y+54 40 CC 5 Find inactive entry equal (MT)

COT5C* 08 TIC COT5B 00 0

COT6* OE Read key 50 CC,SK KL+10 Read entry back and data

COT7* 1B Seek head C014A+1 40 CC 6 FLR - Prime track

COT8* 08 TIC CL1 0 0 FLR - Transfer to write prime-CP 18

*Write-validity-check

264 OS ISAM Logic CHANNEL PROGRAM 20-Variable Length Records

Writes Track Index Entry(s)

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

COOt 23 Set sector COO+5 40 CC 1 Position for RD

COl 31 Search I D equal C05+3 40 CC 5 Search for RO on current prime track

CO2 08 TIC COl 00 0

C03 05 Write data C07 40 CC 3 Write track capacity record

C04 08 TIC CLl 00 0 TIC to CP18 to write prime data

C05 LL-CCHHR Maximum record length (LL) and RD I D for current prime track

C06 This CCW not used

C07 YYR------Data of track capacity record (RO)

C08 This CCW not used

C09 --YYR--- Running capacity

COlO This CCW not used

CO 11 PPLL---- PP-pointer to last used CCW In CP18, LL-Iength of current record

C012 This CCW not used

C013 lB Seek HH ISLIOBA 40 CC 6

C014 08 TIC IcOT1 or CL 1 20 SLI 5 Transfer to COTl if Write Validity Check is specified, or to CL 1 (CP18) if it is not specified; this CCW is a NOP during close processing

C014A MBBCCHHR Seek address for CP18

C014B 23 Set sector ISLRPSSS+2 40 CC 1 Position for next entry

C015 31 Search I D equal IOBSEEK+3 40 CC 5 I ndex entry to be written next

C016 08 TIC C015 00 0

CO 17 lD Write count, Area Y+18 80 DC 8 Write count, keY,and data fields of key, and data normal track index entry ISLKEYAD points to key C018 00 Buffer N+8 80 DC KL +RKP

C019 00 Area Y+26 40 CC 10 tSet sector to zero if RPS (continued)

Section 7: Appendixes 265 CHANNEL PROGRAM 20-Variable-length Records (continued)

Writes Track Index Entry(s)

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

C020 08 TIC C021orC027 00 0 Transfer to C021 if normal and overflow entries are on the same track, or to C027 if normal and overflow entries are on different tracks

C021 10 Write count, Area Y+36 80 DC 8 Write overflow index entry key, data

C022 00 Buffer N+8 80 DC KL ISLKEYAD points to key +RKP

C023 00 Area Y+44 40 CC 10

C024 08 TIC COT1 or 00 0 Transfer to COT1 if Write Validity C013 or Check is specified, or to C013 if CP18 C025 or is to be executed next, or to C025 if C027 overflow and dummy track index entries are on the same tracks, or to C027 if overflow and dummy track index entries are on different tracks

C025 10 Write count, Area Y+54 40 CC ~KL+10 Write count, key, and data of dummy key, data index entry

C026 08 TIC COT1orC013 00 0 Transfer to COT1 if Write Validity Check is specified, or to C013 if CP18 is to be executed next

C027 B1 Search I D equal C030+3 40 CC 5 I ndex entries are split across tracks. (MT) Search for next physical track

C028 08 TIC C027 00 0

C029 08 TIC C0210rC025 00 0 Transfer to write overflow track index entry (C021), or to write dummy track index entry (C025)

C030 MBBCCHHR Search argument for next track, if track entries are spl it across track boundary

COTO* 23 Set sector ISLRPSSS+2 40 CC 1 Position for track index

COT1* 31 Search I D equal Area Y+18 40 CC 5 Find last normal entry written COT2* 08 TIC COT 1 00 0

*Write-validity-check

266 OS ISAM Logic CHANNEL PROGRAM 20-Variable length Records (continued)

Writes Track Index Entry(s)

Command Code Flags CCW Address Count Comments No. Hex Description Hex Description

COT3* OE Read key and data * SO CC,SK KL+l0 Read entry back

COT4* Bl Search ID Area Y+36 40 CC S Find last overflow entry written equal (MT) * COT4A 08 TIC COT4 00 0

COTS * OE Read key * 50 CC,SK KL+l0 Read entry back and data

COTSA* 08 TIC COT7 60 CC,SLI 1 No inactive entry written

08 TIC COT7 60 CC,SLI 1 Inactive entry written

COTSB* Bl Search ID Area Y+54 40 CC S equal (MT) Find inactive entry .. COTSC 08 TIC COTSB 00 0

COT6* OE Read key * 50 CC,SK KL+l0 Read entry back and data

COT7* lB Seek head COS+2 40 CC 6 VLR-Track capacity record

COT8* 08 TIC COl 0 0 VLR-Write track capacity record

*Write-validity Check

Section 7: Appendixes 267 CHANNEL PROGRAM 20A

Write a non-shared track of track index

CCW Command Code Flags Address Count Comments No_ Hex Description Hex Description

COO 23 Set sector ISLRPSSS+2 40 CC 1 Position for the track index entry

COl 31 Search I D equal IOBASEEK+:1 40 CC 5 Search for the Count Field of the record preceding the record to be written next

CO2 08 TIC COl 00 The count field contains the address of the CCW that TICs to CP18 when non- write check

C03 08 TIC C04 00 TIC to the first write CCW to be executed, as follows: 1_ C04 2_ Resume Load write CCW (some C04) 3_ Non-shared last track of track Index_ The address of some C04 is stored in the count portion of this TIC (may be C04)

One copy of C04 for each track index entry

C04 10 Write count, TISA+20 or 40 CC 8+KL+l0 Write a track index entry key, and data TISA+20+N (8+KL+l0)

For non-write checking, the following two CCW's are at the end of CP20A

lB Seek head TISA+l 40 CC 6 Seek on the prime data track to be written

08 TIC CP18 00 0 TIC to CP18

For write checking, the following CCW is at the end of CP20A

08 TIC CP20C 00 0 TIC to CP20C

268 OS ISAM Logic CHANNEL PROGRAM 20B

Write a shared track of track index

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

COO 23 Set sector ISLRPSSS+2 40 CC 1 Position for the next index entry

COl 31 Search I D equal IOBASEEK+3 40 CC 5 Search for the count field of the record to be written next

CO2 08 TIC COl 00 The count field contains the address of the CCW that TICs to CP18 for non- write check

C03 08 TIC C04 00 TI C to the first write key, data CCW to be executed, as follows: 1. C04 2. Resume Load write KD CCW (some C07)

C04 OD Write key, data TISA+20+80r 40 CC KL+l0 Write the first track index entry on a TISA+20+8+N shared track (8+KL+l0)

One copy of C05, C06, and C07 for each remaining track index entry

C05 31 Search I D equal TISA+20+N 40 CC 5 Search for the count field of the record (8+KL+l0) to be written next

C06 08 TIC C05 00 0 TIC to C05

COl OD Write key, data TISA+20+8+ 40 CC KL+l0 Write the key and data portion of a N (8+KL+l0) track index entry

For non-write checking, the following two CCW's are at the end of CP20B

lB Seek head TISA+l 40 CC 6 Seek on the prime data track to be written

08 TIC CP18 00 0 TIC to CP18

For write checking, the following CCW is at the end of CP20B

ICP20C 0 I TIC to CP20C 1 08 ITiC I 00 I I

Section 7: Appendixes 269 CHANNEL PROGRAM 20C

Write check for CP20A and B

CCW Command Code Flags Address Count Comments No. Hex Descri ption Hex Description

03 NOP CC,SLI CQO 23 Set sector ISLRPSSS+2 60 1 Position for the next index entry

CQl 31 Search I D equal IOBASEEK+~ 40 CC 5 Search for the count field of the record to be written next

CQ2 08 TIC CQl 00 CQg The count field contains the address of the CCW that TICs to CP18

CQ3 08 TIC CQ4 00 TIC to the first read CCW to be executed as follows: 1. CQ4 2. Resume Load read CCW (some CQl) 3. Read CCW for non-shared last track or shared track. The address of th is CCW is stored in the count portion of this TIC (may be CQ4).

CQ4 OE Read key, data TISA+20+8 50 CC,SK KL+l0 Read back a track index entry or TISA+20+ 8+N (8+KL+1O)

One copy of CQ5, CQ6, and CQ7 for each remaining track index entry.

CQ5 31 Search I D equal TISA+20+N 40 CC 5 Search for the count field of the record (8+KL+l0) to be written next

CQ6 08 TIC CQ5 00 0 TIC to CQ5

CQ7 OE Read key, data TISA+20+8+ 50 CC,SK KL+l0 Read back a track index entry N (8+KL+l0)

CQ8 lB Seek head TISA+l 40 CC 6 Seek on the prime data track to be written

CQg 08 TIC CP18 00 0 TIC to CP18

270 OS ISAM Logic CHANNEL PROGRAM 21

Write High Level Index and End of Data (EOD) Mark(s)'

CCW Command Code Flags Address Count Comments No, Hex Description Hex Description

CQ39A 23 Set sector ISLRPSSS+3 40 CC 1 Position for entry

CQ40 31 Search ID equal Area Y 40 CC 5 Search for ID of index entry to be written with R=R·1

CQ41 08 TIC CQ40 00

CQ42 10 Write count, Area Y 80 DC# 8 Write count field of current under entry key, data

CQ43 00 ISLKEYA or 80 DC KL ISLKEYAD is used for normal entry Area Y+62 area Y+62 is used for dummy and inactive entry

00 CC (Write 10 Write data field of high level index entry CQ44 00 Area Y+8 40 validity check)

03 NOP CQ44A* ISLRPSSS+3 60 CC,SLI 1 Position for entry 23 Set sector

CQ45* 31 Search ID equal Area Y 40 CC 5 Search for ID (CCHHR) of current index entry with R=R· 1

CQ46* 08 TIC CQ45 00 0

CQ47* 1E Read count, 10 SK KL+18 Read back current high level index key, data entry

#Close processing utilizes CP21 to write end of data marks in the prime data area and independent overflow area. ISL area Y is initialized with the 'KDD' portion of the count field set to zero, The data chain bit is turned off. *Write Validity Check

Section 7: Appendixes 271 CHANNEL PROGRAM 22A

Read/Write data record - key and data, unblocked records

CCW Command Code Flags Address Count Comments No. Hex Oescri ptlOn Hex Description

CN1* B1 Search 10 CN6+3 40 CC 5 MT set off for 1st CP 22 in chain equal (MT)

CN2 08 TIC CN1 XX CN2+4 used 0 See description of CN2+4 and CN2+5 as buffer below flags

Transfer is set when records are blocked CN3 08 TIC CN4 00 0 or when data only (instead of key and data) is read or written

Read key and Buffer OE SKIP bits set on in CN3 and CN4 for data address and 80 DC KL 00 Write key and write check processi ng data offset

06 Read data Buffer CC (off when Fixed-length records: the blocksize CN4 40 OL 05 Write data address end of chain) (OLl is constant so the count field is and offset unless CN5 is set at open used for RPS) Variable-length records: the actual block size is set in the count field by the EOB routine each time this CP is executed

CN5 08 TIC Next CN1 00 0 Transfer to next CP 22 in chain if record is not last or not RPS

** If RPS, and record is not last on track 88 TIC WIREAOSC 00 0 and last in chain, transfer to ROCNT and ROSECTOR for read only. 22 Read sector CN2+6 00 1 Save sector of record read for PUTX.

CN6 M B B C C H H R Set from W1 LPOR or link field in overflow record

CN7 Address buffer and offset Set from OCBBUFCB init.

* If RPS is present and this channel program is not chained from CP 24, it will be preceded by a set sector and a TIC. The set sector and TIC are located in the work area. If the channel program is chained from CP 24, the set sector will be per­ formed in CP 24. **Wl0SECT of channel program is writing.

The following is a description of buffer flags at CN2+4 and CN2+5.

CN2+4 CN2+5

BIT 0 Buffer marked for PUT X BIT 0 1 . . End of track 1 Overflow record 2 1 Key and data to be read 0 Data only to be read 3 End of data buffer 4 Input error 5 Unwritable block 6 Unreachable block 7 Reserved

272 OS ISAM Logic CHANNEL PROGRAM 22B

Read/Write data records-data only, unblocked records; all blocked records

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CN1* B1 Search I D equal CN6+3 40 CC 5 MT is set for first CP 22 In chain (MT)

CN2 08 TIC CN1 XX CN2+4 used 0 See description of CN2+4 and CN2+5 as flags for below, CP 22A buffer de· scription

CN3 08 TIC CN4 80 DC (ignored) KL

06 Read data Buffer CC (off when Fixed length records: the block size CN4 40 DL 05 Write data address last in chain (D L) is constant so the count field is and offset unless CN5 set, at open time. is used for RPS) Variable length records: the actual block size is set in the count field by the EOB routine each time this CP is executed.

Transfer to 1st CCW in next CP22 CN5 08 TIC Next CN 1 00 0 in chain if not lost in chain or if not RPS

WIREADSEC** If RPS, and record is not last on track 88 TIC 00 0 and last in chain, transfer to RDCNT and RDSECTOR for read only. - 22 Read sector CN2+6 00 1 Save sector of record read for PUTX

CN6 M B B C C H H R Set from WI LPDR or link field in overflow record

CN7 Address buffer and offset Set from DCBBUFCB

*See note to CP22A. **W10SECT if channel program is writing.

Section 7: Appendixes 273 CHANNEL PROGRAM 23

Search hi-level indexes, track index, and data track for SETL K or KC

Flags CCW Command Code Address Count Comments No. Hex Description Hex Description

CS1 31 Search I D equal W1IMBBCC+3 40 CC 4 Position read head to first index track

CS1A 08 TIC CS1 00 0

CS1B 69 Search key high Key address 60 CC, SLI KL Too far along index or equal

CS1C 08 TIC CS2 00 0 No

03 NOP Set sector to zero if R PS CSlO CSlO+5 60 CC, SLI 1 23 Set sector Yes, position to index point.

CS1E 1A Read home 50 CC,SK 5 Position to home address address

CS2 E9 Search key high Key address 40 CC KL Key address passed in register 0 or equal (MT)

CS3 08 TIC CS2 00 0

CS4 06 Read data CS6+7 40 CC (off for 10 CC set on when read cylinder index; master indexes) read data of current index entry

CS5 08 TIC CS8 00 0

CS6 ------M CS7 B B C C H H R F Address of next lower level index

CS8 P Seek CS7 40 CC 6 Seek track index. See Figure 82 for value of P (seek command code).

03 NOP CS80 CS80+5 60 CC, SLI 1 23 Set sector

CS9 31 Search I D equal CS7+2 40 CC 5 Starting CCW when only track index; position read head to RO to track index CS9A 08 TIC CS9 00 0

CS10 92 Read count (MT) W1WCOUNT 40 CC 8 Read count of current index entry (normal or overflow)

CS11 69 Search key high Key address 40 CC KL Key address passed in register 0 or equal

CS12 08 TIC CS10 00 0

CS13 06 Read data CS17+7 40 CC 10 Read data of current index entry (normal or overflow)

CS14 92 Read count (MT) W1WCNXDM 40 CC 8 Read count of next Index entry (normal or overflow)

(continued)

274 OS ISAM Logic CHANNEL PROGRAM 23 (continued)

Search hi-level indexes, track index, and data track for SETL K or KC

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CS15 06 Read data W1WDNXDM 60 CC, SLI 10 Read data of next index entry (normal or overflow)

CS16 08 TIC CS19 00 0

CS17 ------M B B C C H H R F Track index entry contains address of CS18 prime data or overflow track containing record

C19 P Seek CS18 40 CC 6 Seek data track_ (Figure 81)

03 NOP Set sector to zero if R PS CS19A CS19A+5 60 CC, SLI 1 23 Set sector Position to start of track if RPS

CS20 31 Search 10 equal CS18+2 40 CC 5 Search to the first data record on track

CS21 08 TIC CS20 00 0

CS26 08 TIC CS22 00 0

CS25 12 Read count First CN6+3 60 CC, SLI 5 Read count (CCHHR) of record into first CP22; R set to 0

29 Search key equal Key address 60 CC, SLI (on KL CS22 Search for desired record (29) or search 69 Search key high for KC) for desired block (69) or equal

CS23 08 TIC CS25 00 0

03 NOP 00 CS24 20 SLI 1 Exit when record found 22 Read sector W11SECT

Section 7: Appendixes 275 CHANNEL PROGRAM 24

Read track index entries

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CNS' 31 Search ID equal W1WCOUNT 40 CC 5 W1WCOUNT - count of current index entry; set from W1WCNXDM

CN9 OS TIC CNS 00 0

CN10 06 Read data WlDCXDM 40 CC 10 Read data of current normal index entry

CN 11 S6 Read data (MT) W1WOVFL 40 CC 10 Read data of current overflow index entry

CN12 92 Read count (MT) W1WCNXDM 40 CC S Read count of next normal or dummy entry

CN13 06 Read data W1WDNXDM 40 CC 10 Read data of next normal or dummy entry

CN14 1B Seek HH CN6+1 40 CC 6 Seek to track in W1 LPDR

03 NOP Set sector to zero CN14A CN14A+5 60 CC, SLI 1 23 Set sector Position to first record next track

CN15 OS TIC CN1 00 0 Transfer to read or write the record

* If RPS is present this channel program will be preceded by a set sector - TI C located in the work area.

276 OS ISAM Logic CHANNEL PROGRAM 25

Read track index entries for SETL I

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CN20* 31 Search I D equal W1IDAD 40 CC 5 Search to record at actual direct·access address CN21 08 TIC CN20 00 0

CN22 DE Read key and CN7+5 60 CC, SLI KL Read record key into 1st buffer data

~N23 18 Seek head CN31+1 40 CC 6 Seek to beginning of track index

)3 NOP Set sector to zero N23A CN23A+5 60 CC, SLI 1 iC 23 Set sector Position to first record of next track

CN24 1A Read home CN31 50 CC,SK 5 Position read head to start of track address

CN25 E9 Search key high CN7+5 40 CC KL Serially search index tracks for index or equal (MT) entry containing key

CN26 08 TIC CN25 00 0

CN27 06 Read data W1WDCXDM 40 CC 10 Read data of current normal index entry

CN28 86 Read data (MT) W1WOVFL 40 CC 10 Read data of current overflow index entry

CN29 92 Read count (MT) W1WCNXDM 40 CC 8 Read count of next normal or dummy entry

CN30 06 Read data W1WDNXDM 00 10 Read data of next normal or dummy entry

CN31 MBBCCHHR Address of track index; set from lower entry with HH=O, R=l

* If RPS is present this channel program will be preceded by a set sector-TIC located in the work area.

Section 7: Appendixes 277 CHANNEL PROGRAM 26

Extension of CP23 to read overflow chains

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CS27* 31 Search I D equal W1IMBBCC+3 40 CC 5 Search to first record of overflow chain

CS28 08 TIC icS27 00 0

CS29** 69 Search key high Key address 40 CC KL SLI on when KC, search for desired or equal record in chain

CS30 08 TIC CS32 00 0

CS31 03 NOP 20 SLI 1 Exit when record found if RKP = 0, unblocked

08 TIC CN4 of buffer 20 1 Read in record if R KP=O or blocked format

CS32 06 Read data CS34+7 60 CC, SLI 10 Read link field of overflow record

CS33 08 TIC CS36 00 0

CS34 ------M Address of overflow record

CS35 B B C C H H R F

Seek overflow track containing next CS36 P Seek CS35 40 CC 6 record in chain. See Figure 81 for value of P (seek command code).

CS37 31 Search I D equal CS35+2 40 CC 5 Search for overflow record

CS38 08 TIC CS37 00 0

CS39 08 TIC CS29 00 0

*If RPS is present this channel program will be preceded by a set sector-TIC located in the work area. **Search key equal if RKP=O, RECFM=F and not SETL KH or SETL KDH.

278 OS ISAM Logic CHANNEL PROGRAM 31A

Reads the key of the last overflow track index en.try into the Key save area

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CAl 31 Search 10 equal IOBASEEK+3 40 CC 5 Search for the last normal track index entry

CA2 08 TIC CAl 00

CA3 9E Read count, 90 DC, SK 8 Read last overflow track index entry key, data

CA4 00 Key save 80 DC KL Read key of last overflow track index area entry into key save area

CA5 00 10 SK 10 50 CC, SK is turned on if CP31B is executed

CHANNEL PROGRAM 31B

Reads the count and data of the last prime data block into the first buffer specified in the Buffer Control Table

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CAl lB Seek head CA6+1 40 CC 6 Seek to the head of the last prime data block

CA2 31 Search 10 equal CA6+3 40 CC 5 Search for the next to last prime data record

CA3 08 TIC CA2

CA4 12 Read count First bu ffer 40 CC 8 Read count of the last prime data block into the first buffer (buffer control table + 9)

CA5 06 Read data First buffer 00 DL Read data of the last prime data block +8 into the first buffer + 8

CA6 M B BCCHHR MBBCCHHR of DCBLPDA, R is set to R-l

Section 7: Appendixes 279 CHANNEL PROGRAM 87

Reads high-level Index into user work area (specified by DCBMSHI)-thls channel program is in module IGG0192P

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

CZl 31 Search ID equal IOBSEEK+3 40 CC 5 Search for first entry of high level index CZ2 08 TIC CZl 00 0

CZ3 8E Read key and DCBMSHI 40 CC 0 Read it into the work area. There are data (MT) several copies of CZ3. The channel program is executed as many times as needed to read in the entire index.

280 OS ISAM Logic CHANNEL PROGRAM 123W

Addendum to CP 12A and CP 12B or to CP 13A and CP 13B when write-checking is specified

CCW Command Code Flags Address Count Comments No. Hex Descrtption Hex Description

03 NOP CEAOO IOBSECT 60 CC, SLI 1 23 Set sector

Search for record or block again CEA 31 Search 10 equal 40 CC 5

CEB 08 TIC CEA 00 0

CEE 1E Read count, 10 SK 0 Read It back key, and data

CHANNEL PROGRAM 123WV

Addendum to CP 12AV and CP 12B V when write-checking is specified

Flags CCW Command Code Address Count Comments No. Hex Description Hex Descrtption

03 NOP CEAOO CEAOO+5 40 CC 1 Set sector to 0 23 Set sector

CEAO 31 Search 10 equal COO 40 CC 5 Search for track capacity record (RO) CEA05 08 TIC CEAO 00 0

CEA1 06 Read data 70 CC, SK, SLI 3 Read capacity record

CEA2 08 TIC CEO or CEA3 00 0 Transfer to CEO if the full track is being checked

03 NOP CEA3 IOBSECT+1 40 CC, SLI 1 23 Set sector Search for first data record written CEA 31 Search 10 equal IOBSEEK+3 40 CC 5

CEB 08 TIC CEA 00 0

CEO 1E Read count, 90 DC, SK !:l I keY,and data Read record back. The number of CEE-CEF sets equals CEE OE Read key and 50 CC,SK KL+DL DCBHI RPD, the CC flag is set off in data the appropriate CCW depending on how many records are read. CEF 1E Read count, key, 90 DC, SK 8+KL+ and data DL

Section 7: Appendixes 281 CHANNEL PROGRAM CLOSECCW(l)

Reads format-2 DSCB-this channel program is in module IGG0202D

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

DXCCW1 31 Search 10 equal Format-2 60 CC, SLI 5 Search for format-2 DSCB DSCB address

DXCCW2 08 TIC DXCCW1 00 0

DXCCW3 DE Read key and DXDADDR 00 140 Read format-2 DSCB into work area data

CHANNEL PROGRAM CLOSECCW(2)

Writes format-2 DSCB back in the VTOC- this channel program is in module IGG0202D

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

OX 31 Search 10 equal Format-2 60 CC, SLI 5 Search for format-2 DSCB position CCWl DSCB address

OX 08 TIC DXCCW1 00 0 CCW2

DX 00 Write key and DXDADDR 40 CC 140 Write format-2 DSCB back in VTOC CCW3 data

OX 31 Search 10 equal Format-2 60 CC, SLI 5 Search to format-2 DSCB again CCW4* DSCB address

OX 08 TIC CCW4 00 0 CCW5*

OX OE Read key and 10 SK 140 Read back CCW6* data

*Write-validity-check

282 OS ISAM Logic CHANNEL PROGRAM VXCCW (lA)

Reads to EOF or end of LPDA track for prime data-this channel program is in module IGG01920

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

VX 31 Search I D equal DS2LPRAD+3 40 CC 5 CCWl Search to the last prime data record VX 08 TIC VXCCWl 00 0 CCW2

VX 08 TIC VXCCW3A 00 0 Skip first read count CCW2A

VX 92 Read count, VXCCW6 60 CC, SLI 8 Read count field (normally, count of CCW3 (MT) EOF)

VX 06 Read data WA* 60 CC,SLI DL Read in block CCW3A

VX 92 Read count, VXCCW7 60 CC, SLI 8 Executed when DS2LPRAD IS incorrect CCW4 (MT)

VX 06 Read data WA* 60 CC,SLI DL Read in block CCW4A

VX 08 TIC VXCCW3 00 0 CCW5

VX C C H H R KL DL DL Count field CCW6

VX C C H H R KL DL DL Count field CCW7

*The work area is obtained by a GETMAIN.

Section 7: Appendixes 283 CHANNEL PROGRAM VXCCW(lB)

Reads to EOF for independent overflow or end of LPDA track for prime data -this channel program is in modules IGG01922 and IGG01950

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

VX 31 Search I D equal DS2LOVAD+3 40 CC 5 Search to the last overflow record CCW1

VX 08 TIC VXCCW1 00 0 CCW2

VX 9E Read count, key, VXCCW6 60 CC, SLI 8 Read count field (should be count of CCW3 and data (MT) EOF)

VX 9E Read count, key, VXCCW7 60 CC, SLI 8 Executed when DS2LOVAD is incorrect CCW4 and data (MT)

VX 08 TIC VXCCW3 00 0 CCW5

VX C C H H R KL DL DL Count field CCW6

VX C C H H R KL DL DL Count field CCW7

CHANNEL PROGRAM VXCCW(2)

Reads to end of track - this channel program is in module IGG01920

CCW Command Code Flags Address Count Comments No. Hex Description Hex Description

VX 12 Read count SAVEREG 60 CC, SLI 8 Read count of each record on track CCW4

VX 08 TIC VXCCW4 00 0 CP will end with count of last record on CCW5 track in SAVEREG

284 as ISAM Logic INDEX

Indexes to program logic manuals are consolidated in the publication IBM System/360 Operating System: Program Logic Manual Master Index, GY28-6717. For additional information about any subject listed below, refer to other publications listed for the same subject in the Master Index.

II abnormal end appendages BCB (see Appendages) (see buffer control block) adding records to data set BCT basic description 213-214 (see buffer control table) allocating space on ISAM data set 152 beginning-of-buffer (BOB) routine appendage codes 201-202 flow diagrams 26,30,31,32 appendage definition 2 processing 27 appendages BISAM BISAM channel programs codes 201-202 (see Channel programs, BlSAM) diagram 66 code phase 91 modules 72 control blocks and work areas 89-91 pointers to 90 DCB work area 193-195 processing 65,69 flowcharts vector table 65,90 processing routines 134-138 QISAM (load mode) channel program flow 76-88 abnormal end 29 open phase 55 channel-end 28 processing flow 69 pointers to 34 processing phase 61 processing 23,30 buffer control block vector table 34 BISAM write checking functions 29 format 172-174 QISAM (scan mode) pointers to 91 abnormal end 49 use by dynamic buffering routine 67 channel-end 49 use by open routines 172 codes 201 QISAM 174 GET 49,44 buffer control table (load mode) modules 52 format 175-179 pointers to 54 pointers to 34 processing 49,50 use by open routines 175 PUTX 50,47 Buffers SETL 49,42 BlSAM vector table 54 conuoi biock i 72-i 74 write-checking function 50 dynamic buffering 67-68 Area Y 185,181,34 pointers to 90 Area Z 180,179,34 queues 91 asynchronous codes QISAM(scan mode) asynchronous routines -- BISAM control block 174 codes 202 control technique 39 flow diagram 66,69 initialization 37 modules 72 pointers to 40,54 pointers to 90 queues and processing 39-42 vector table 65 scheduling 45

Section 7: Appendixes 285 Buffers (continued) 22A 272 QISAM (load mode) 22B 273 closing functions 33 23 274-275 control block 174 24 276 control table 175-179 25 277 pointers to 34 26 278 processing 15,34,35 31A 279 scheduling 23-27 31B 279 87 280 123W 281 123WV 281 Channel programs BISAM C-bit 178 flow-of-control (non write KN) 76 CCWs, explanation of 222 flow-of-control (write KN) 77-78 Chaining functions 71-76,60 channel program 22 modules 73 scan mode 38,45 list of 143 Chains QISAM (load mode) (see overflow clnins) flow-of-control 31-32 Channel program descriptions and functions 32-33 formats 226-290 modules 30 CLOSECCW(I) 286 QISAM (scan mode) CLOSECCW(2) 287 functions 51-52 VXCCW(1A) 288 modules 51 VXCCW(1B) 289 queues 55 VXCCW(2) 290 Check routine - BISAM 1 226-227 description 68 2 226 flow diagram 68 4 229 Close phase executors and modules 5/5W 230 common 13-14 6/6W 231-232 BISAM 91 I 7/7W 233 errors during 205-205,53 \ 8 234-235 flow-of-control 14 9A 236 QISAM 9B/9BW 236 load mode 33-35 9C/9CW 237 scan mode 52,204 lOA/lOAW 238 COCR lOB/lOBW 239 (see cylinder overflow control record) llA 240 codes llB/llBW 241 appendage 201-202 12A 242 asynchronous 202-203 12B 243 exception (error) 204,205 12C/12CW 244 common close 13-14,9 12AV 245 channel programs used 286-287 12BV 246 flow diagram 14 13A 247 module 13 13B 248 common open 9-12 13C/13CW 249 channel programs used 288-289 14/14W (fixed length records) 250-252 modules 9 14/14W (variable length records) 253-256 count field 216 15 257 CP 16 258 (see channel programs) 17/17W 259 cylinder index 18 260-261 BISAM processing 77,71 19/91 260-261 definition 212 20 (fixed length records) 262-264 direct access extents 157,158,182 20 (variable length records) 265-267 format 216 20A 268 load mode processing 31-32 20B 269 Cylinder overflow area 212 20C 270 cylinder overflow control record (COCR) 21 271 definition 212

286 OS ISAM Logic cylinder overflow control record (COCR) (continued) deletion, record BISAM processing 77-88 BISAM asynchronous code 202 format 218 count fields tagged for deletion 156,164 processing 78-88 disable SVC 63-64 DSCB (see data set control block) DS2 data control block (DCB) (see data set control block) BISAM processing use 89-91 dummy index entries format 149-158 creation 35 initialization format 212,216-217 BISAM 56 duplicate records common 9 error indications 204-205 QISAM processing 78-88 load mode 16 dynamic buffering routine - BISAM scan mode 37 description 67,60 integrity feature 9 control block 170-172 QISAM - load mode processing use 34 flow diagram 67 QISAM - scan mode processing use 54 initialization 58 data extent block (DEB) pointers to 90 BISAM processing use 89-91 format 166-169 initialization 11 QISAM load mode processing use 34 scan mode processing use 54 data event control block (DECB) II BISAM processing use 89,69 format 159-160 ECB data set control block (DSCB) (see event control block) format 161-165 enable, BISAM I/O interruptions 61 use by open routines 9,12 end-of-buffer (EOB) routine use by close routines 13 load mode data set organization 209 description 27,30 adding records of data set 213 fields used 174-179 indexes 211 flow diagram 27 detail description 215 scan mode overflow area 212 description 45,46 prime data area 211 flowchart 126 DCB end-of-cylinder processing (see data control block) fields used DCB work area flowcharts 31,32 BISAM end-of-extent processing format 193-195 fields used 174-179 initialization 57 flowcharts 31,32 pointers to 90-91 end-of-file (EOF) mark processing 78-88 QISAM end-of-track processing load mode fields used 174-179 fmmat 180-185 flowcharts 31,32 pointers to 34 end index entries, format 212 QISAM cylinder 220 scan mode master 221 format 187-192 track 219 pointers to 54 EOB DCW (see end-of-buffer routine) (see DCB work area - BISAM) EOF DEB (see end-of-file mark) (see data extent block) error codes DECB BISAM 205 (see data event control block) QISAM 204

Section 7: Appendixes 287 error descriptions description 49 duplicate record 78-88 module 51 record length - BISAM 65 pointers to 54 sequence error 24 GET macro instruction 39,204 write K with read KU 63 GET routine - scan mode error queue - BISAM description 43-44 format 91,195 flowchart 116 flowchart references 137 module 51 use in processing 65,69 pointers to 54,149 ESETL macro instruction 39 ESETL routine - scan mode description 48 flowchart 121 event control block BISAM 159 a QISAM inactive index entries 219-221 load mode 170,34 index scan moae 170,54 (see cylinder, master, or track) exception codes index location table -- load mode BISAM 205 format 180,182 QISAM 204 initialization EXCP pointers to 34 BISAM 69,201 input/output block (lOB) QISAM BISAM load mode 28,29 pointers to 90-91 scan mode 49 processing use 61-62,106,172-174 executors queues 91,193 (see open executors and close executors) format 170-172 extents 157,163 channel program use 226 codes 201-203 QISAM load mode 34,179 scan mode 54,189 II lOB (see buffer control table) flowcharts integrity feature, DCB BlSAM macro time routines 136-138 (see data control block integrity feature) BISAM open executor 134-136 ISAM data set common close executor 114-115 (see data set organization) common open executors 95-100 ISL load mode open executors 101-108 (see DCB work area - load mode) scan mode appendage routines 130-132 scan mode close executors 133 scan mode open executors lO9-113 scan mode processing routines 116-129 format, data set (see data set organization) II free queue - scan mode keysave area - load mode 33,34 format 40 flow diagram references 43-48 use in processing 43-48 FREEDBUF macro instruction 63,173 (see also dynamic buffering routine) full track index II full track index write 16 levels of indexes track index save area 196 description 211-212 format 216-221 library, SVC 1 load mode 14 channel programs 31 descriptions flow of control 31-32 close phase 33-35 GET appendage routine - scan mode control block and work areas 34

288 OS ISAM Logic load mode (continued) DCB work area 180-185,34 flow diagrams 25-29 II open phase 15-23 processing phase 23-33 padding records 35 locate mode processing 26 PF-bit 178 phase (see open, close, or processing) pointer diagrams BISAM 89-92 QISAM II load mode 34 M=O DEB extent 34,167 scan mode 54 macro instructions prime data area (see GET, PUT, etc.) adding records to 213 Macro-time routines pointers to 31 (see privileged and nonprivileged) prime data track, shared master indexes (see shared track) format 221 privileged macro-time routine - BISAM BISAM processing 76,77 description 62-64 direct access extents 149,163,182 flow diagrams 62,69 QISAM load mode processing 31-32 modules 70 MBBCCHHRFP 216 pointers to 90 modules directory 143-145 processing phase move mode processing 24 BISAM 60 QISAM load mode 23 scan mode 38 PUT appendage (see appendage routines -load mode) II PUT macro instruction 23 N/2 buffers 45 exception codes set 204 new high key records PUT routine - load mode BISAM 78,83-85 description 24-25 QISAM load mode 24 flow diagrams 25 nonprivileged macro-time routine - BISAM pointers to 34 description 64 PUTX appendage flow diagram 64,69 (see appendage routines scan mode) modules 70 PUTX macro instruction 39 pointers to 90 exception codes set 204 normal track index entry PUTX queue - scan mode description 212 format 40,54,191 format 216-219 flow diagram references 46,48 use in processing 39-42 PUTX routine - scan mode description 47 flowchart 118 pointers to 54

nrO'Qni'7~tin.... A~i'Q fIlPt ...... c-...... _ ...... , --- .. ~- (see data set organization) open phase executors and modules BISAM 59-60 common 9-12 QISAMmodes QISAM (see load mode and scan mode) load mode 15-16 queues scan mode 37-38 BISAM load mode 34 overflow records and chains QISAM BISAM processing 76-77 scan mode 40-42,54 description 212 format 218 QISAM - scan mode processing 38,53,54 overflow track index entry II description 212 reopen data set format 216-219 (see resume loading) Section 7: Appendixes 289 Read appendages address 152 (see appendage routines - BISAM) BISAM use 68-70 READ macro instruction 56 QISAM exception codes set 205 load mode use 24,27 Read queue - scan mode scan mode use 42-49,52 format 40-42,54 flow diagram references 43-48 use in processing 38-48 RELSE macro instruction 39 RELSE routine description 49 a flowchart 118 T-bit 178 pointers to 54 TISA resume loading 20 (see track index save area) channel programs 31-33 track index initialization 21-22 BISAM processing 76-89 rotational position sensing description 219 devices 3 format 216-217 identification in DEB 11 QISAM start I/O appendages 2-3 load mode processing 31-32 track index save area (TISA) 196-197 track, shared II (see shared track) scan mode channel programs 51,52 close phase 52 control blocks and work areas 52,54 DCB work area 187-192,54 flowcharts 116-133 II (UCB), pointers to 34,54 open phase 37 unreachable block error 205 processing phase 38 unscheduled queue - BISAM queues 40-42,54 format 91 schedule routine -- scan mode pointers to 91,194 description 45 use in processing 62,64,66,171 flowchart 122 update processing - BISAM 76,60 pointers to 54 update queue - BISAM scheduling of BISAM format 91 channel programs 61-63 pointers to 91,194 SELT macro instruction 39 use in processing 60 exception codes set 204 User queue - scan mode SETL routine - scan mode format 40,54,190-191 description 42 flowchart references 44,46,47 flowchart 119 use in processing 39-42 pointers to 54 shared track channel programs used 51,33 fields used BCB 178 DCB 156 DCB work area (load) 180 II DSCB 164 WAIT macro instruction - BISAM 55 initialization 23 Write appendages index format 216-217 (see appendage routine - BISAM) processing 33 WRITE macro instructions 55 stages of open and close executors 1-4 exception codes set 205 status indicators WRITE K processing 58,76 buffers - load mode 173 channel programs 73 DCB 157 flow of control 77,88 DSCB 164 differing methods of adding records to a data scan mode 189 set 71-72 SYNAD macro instruction Write queue - scan mode (see synchronous error routine) format 40,54,191 SYNADAF macro instruction 70 flowchart references 44,46,47,48 synchronous error routine use in processing 39-42

290 OS ISAM Logic READER'S COMMENT FORM

OS ISAM Logic Order Number GY28-6618-1)

Your comments about this publication will help us to produce better publications for your use. If you wish to comment, please use the space provided below, givin~ specific page and paragraph references.

Please do not use this form to ask technical questions about the system or equipment or to make requests for copies of publications. Instead, make such inquiries or requests to your IBM represen­ tative or to the IBM Branch Office serving your locality.

Reply requested Name Yes D Job Title No D Address ______up ______

No postage necessary if mailed in the USA Order Number GY28-6618-5

YOUR COMMENTS, PLEASE ...

This publication is one of a series which serves as a reference source for systems analysts, programmers, and operators of IBM systems. Your answers to the questions on the back.of this form, together with your comments, will help us produce better publications for your use. Each reply will be carefully reviewed by the persons responsible for writing and publishing this material. All comments and suggestions become the property of IBM.

Please note: Requests for copies of publications and for assistance in utilizing your IBM system should be directed to your IBM representative or to the IBM sales office serving your locality.

fold fold

FIRST CLASS PERMIT NO. 2078 SAN JOSE, CALIF.

BUSINESS REPLY MAIL NO POSTAGE STAMP NECESSARY IF MAILED IN U. S. A.

POSTAGE WILL BE PAID BY.

IBM Corporation Monterey & Cottle Rds. San Jose, California 95114

Attention: Programming Publications, Dept. D78

fold fold

International Buslne.. Machines Corporation Data Proce.. lng Division 1133 Westchester Avenue, White Plains, New York 10604 (U.S.A. only)

IBM World Trade Corporation 821 United Nations Plaza, New York, New York 10017 (International)

Order Number GY28-6618-5

Ii,

Intematlonal Business Machines Corporation Da.. Proce.. lng Division 1133 Westchester Avenue, White Plains, New York 10804 (U.S.A. only)

IBM World Trade Corporation 821 United Nations Piau, New York, New York 10017 (lntematlonal)