File Numbel: 8360-36 Form C28-6535-0

Systems Reference

IBM /360

Concepts and Facilities

This publication describes the basic concepts of Operating System/360 and guides the programmer in the use of its various facilities. Operating System/360 is a comprehensive set of language translators and service programs, operating under the supervisory control and coordination of an integrated control program. It is designed for use with Groups 30, 40, 50, 60, 62, 70, and 92 of System/360. It assists the programmer by extending the performance and application of the computing system. PREFACE

This publication introduces and interre­ The publication is divided into two lates all Operating System/360 control pro­ parts, an introduction and survey, and a gram facilities. It shows how these facil­ detailed description. The first part con­ ities work with the language translators tains a general description of subjects of and service programs, so the programmer can interest to all users. The second part, better learn to use the system. It also meant for programmers, is a more thorough directs the programmer to related Operating discussion of the same topics. System/360 publications for specific details. Even though many details are expressed in assembler language terminology, this Many combinations of programming facili­ publication is addressed to every program­ ties are possible with Operating mer who will use System/360, and familiari­ System/360. The programmer will work with ty ~ith the assembler language is not a a particular set of these facilities, requirement. depending on the language he uses (FORTRAN, COBOL, Report Program Generator, Assembler, or New Programming Language), and the modu­ PREREQUISITE PUBLICATION: IBM Operating lar programs chosen when his operating System/360: Introduction. This publication system is generated. Although all the describes the general organization, func­ control program facilities are described tion, and application of the operating herein, all of them may not be included in system. It also describes the other relat­ every installation. ed Operating System/360 publications.

This publication was prepared for production using an IBM to update the text and to control the page and line format. Page impressions for photo-offset printing were obtained from an IBM 1403 Printer using a special print chain.

Copies of this and other IBM publications can be cbtained through IBM Branch Offices.

A form for readers' comments appears at the back of this publication. It may be mailed directly to IEM. Address any additional comments concerning this publication to the IBM Corporation, programming Systems publications, Department D58, PO Box 390, Poughkeepsie, N. Y. 12602

©1965 by International Business Machines Corporation CONTENTS

PART I: INTRODUCTION AND SURVEY •• 7 Blocking and Buffering Facilities 29 Block Formats • • • • • 29 SECTION 1: INTRODUCTION. 8 Buffering Facilities •••••• 30 Buffer Pools •••••••••• 30 Elements of the Ope:r:ating System 8 Buffer Assignment Techniques and Transmittal Modes 30 Benefits to the Programmer 8 ! The Data Control Block 33 SECTION 2: SURVEY 10 OPEN and CLOSE Macro-Instructions 33 Data Access Routines • • • • •• 34 Data Management • 10 Identifying and Locating Data 10 SECTION 4: PROGRAM DESIGN AND Organizing Data •••• 11 PREPARATION ••• • 39 Storing and Retrieving Data • • • • 11 Device Independence • • • • • 12 Program Segmentation 39

Program Design and Preparation 13 Program Structures 39 programs and Subprograms • 13 Simple Structures •••• 40 Combining Subprograms 13 Deferred Exits 41 Planned OVerlay Structures 42 Management ••••• 15 Dynamic Serial Structures 43 Job Control ••••• 15 Link Macro-Instruction 43 The Input Job Stream • 15 Transfer Control (XCTL) Job Scheduler •••••••• 16 Macro-Instruction 44 Sequential System 16 LOAD Macro-Instruction 45 Priority Scheduling Systems 17 Planned Overlay versus Dynamic Structures • • • • • • • • 46 Task Management • 18 Dynamic Parallel Structures • • • • 46

PART II: DETAILED DESCRIPTION 21 Program Design Facilities • • • • 47 Reusability ••••• • • • • 47 SECTION 3: DATA MANAGEMENT 22 Design of Reenterable Programs 48 Checkpoint and Restart • • 49 Data Set Identification and Extent Timer •• • • • • 49 Control ••••••• • • • • 22 Direct-Access Volume Identification Debugging Facilities 50 and the Volume Table of Contents 22 Assembler Language Program Magnetic Tape Volumes ••••••• 22 Debugging: Test Translator 50 Cataloging and Library Management 23 Test Output ••••• 51 Control Volumes • • • • • • • 24 Generation Data Groups ••••• 24 SECTION 5: JOB MANAGEMENT 52 Password Protection of Data Sets • • 25 Editing of Space, Indexes, and Control Statement Capabilities 52 Catalogs •••• 25 Scheduling Controls 53 Job Priority 53 Data Access Methods • 25 Dependencies 53 The Access Methods • • 26 Maximum Execution Time 53 Queued Sequential Non-Setup Jobs •••• 53 (QSAM) • • • • • • • • • • 26 Job Log • • • • • 54 Basic Sequential Access Method Program Source Selection • 54 (BSAM) • • • • • • • • • • • • • 26 Data Set Identification And Basic Partitioned Access Method Disposition • • • • • • • • • 54 (BPAM) • • • • • • • • • • • • • 26 SYSIN and the DD * Statement 55 Indexed Sequential Access Methods Concatenated Data Sets 55 - Basic and Queued (BISAM and Generation Data Groups 55 QISAM) • • • • • • • • • • • • • 26 Dummy Data Sets • • • • 55 Basic Direct~Access Method (BDAM) 27 Data Set Disposition • • • • 56 Queued Telecommunications Access Input/Output Device Allocation 56 Method (QTAM) ••••••••• 27 Deferred Mounting of Tapes 58 Basic Telecommunica.tions Access Direct-Access Storage Space Method (BTAM) ••••••••• 29 Allocation ••••• • • • • • 58 Cataloged pr9cedures • • • • • • •• 58 Passing And Sharing Of Main Storage Job Scheduler and Master Scheduler Areas • • • • • • • • • • • • 75 Functions • • • • • • • • • • • 58 Task Priorities And Roll-Out • 76 Job Scheduler •••• 59 Reader/Interpreter ••••••• 59 APPENDIX: SYSTEM CONVENTIONS 77 Initiator/Terminator • • • • 59 Output Writers 60 Names •• 77 Master Scheduler • • • • • 61 Subprogram Linkage 78 SECTION 6: TASK MANAGEMENT 63 Program sharing • • 78 Single-Task Operations 63 Actual Flow of Control 64 Intertask communication • 78 Multitask Operation ••• 64 Use of WAIT • • • • 78 Task Creation -- ATTACH 65 Resource Allocation 66 Operator messages • '78 Tasks As Users of Resources • 67 passing Resources to Subtasks 68 Control Section size 78 Event Synchronization ••••• 68 WAIT and POST Macro-Instructions 68 Character set considerations 78 Enqueue (ENQ) and Dequeue (DEQ) Source Language Debugging and Macro-Instructions 70 Maintenance 79 Task Priorities 71 Task Termination • • • 72 Volume Labels 79

Main Storage Allocation • 74 Track Address Independence 79 Main Storage Allocation in a Multitask Environment 75 GLOSSARY 80 Storage Protection And Protection Boundaries •••••••••••• 75 INDEX •• 87

11 S $ ILLUSTRATIONS

FIGURES

Figure 1. Operating System/360 . • • 8 Figure 30. Delays Expected in Sub- Figure 2. Subprograms Existing at program • •• .•••. 47 Different Levels of Control Figure 31. No Delays Expected. . . . 47 13 Figure 32. A Reenterable Program that Figure 3. Subprograms Existing at the Requests Its Own Temporary Same and Different Levels Storage •• .... 49 of Control • • • • • • 14 Figure 33. Chain of Symbolic Figure 4. Program Preparation. • 14 References ...•.. 54 Figure 5. The Input Job Stream • • • 15 Figure 34. Typical Input/Output Figure 6. Sequential Scheduling Devices • • • • • • • • • 56 System • • • • • • • • 16 Figure 35. Multijob Initiation • 60 Figure 7. Priority Scheduling System 17 Figure 36. Actual Flow of Control. • 64 Figure 8. Task Representation. • • • 18 Figure 37. Job Step-Task Relation- Figure 9. Switching Control Among ship...... 65 Tasks ••••••••••• 19 Figure 38. Situation Immediately After Figure 10. Volume Initialization and Initial Program Loading • 66 the Volume Table of Contents Figure 39. Situation With Reader, 23 Writer, Initiator, and ~"igure 11. Catalog Search Procedure • 24 One Job Step. • • • • • • 66 Figure 12. The Queued Figure 40. Situation After Initiating Telecommunications Access Three Concurrent Jobs • • 66 Method • • • • • • • • • • 28 Figure 41. Resource Queues • • • • • 68 Figure 13. Components of a Message •• 29 Figure 42. Intertask Synchronization 69 Figure 14. Dynamic Buffering ••••• 31 Figure 43. Situation After READ ••• 69 Figure 15. Simple Buffering - Move Figure 44. Situation After Execution Mode • • • • • • • • • • • 32 of WAIT • • • . • • • • • 70 Figure 16. Simple Buffering - Locate Figure 45. Situation at Completion Mode • • • • • • • • 32 of Input/Output Operation Figure 17. Exchange Buffering - 70 Substitute Mode •••••• 33 Figure 46. Abnormal Termination of a Figure 18. Data Control Block Being Task. • • • . • • • • • • 73 Filled in. • • • • . • • 34 Figure 47. Abnormal Termination of a Figure 19. Actual Program Flow That Subtask • • • • • • • • • 73 Starts on Input/Output • . 35 Figure 48. Deferred Exit at Abnormal Figure 20. Execution of a Load Module End of Task • • • • • • • 74 Within a Task •••.• ~ • 40 Figure 21. Subprogram Within a Program 40 Figure 22. Deferred Exit to Subroutine 42 Figure 23. Overlay Tree Structure 42 Figure 24. The LINK Operation . 44 Figure 25. Nested Subprograms • • 45 Figure 26. Use of XCTL Macro­ TABLES Instructions • . • • 45 Figure 2 7. Uses of LOAD Macro­ Table 1. Access Method Summary 37 Instructions • • .. . 46 Table 2. Names of Installation Figure 28. Immediate Requirement for Devices. ••.•• 58 Subprogram . • . • . • • 46 Table 3. Specifications That Figure 29. Delays Expected in Higher Achieve Input/Output Level Subprograms ...•. 47 Overlap • • • • • • • 59

PART I: INTRODUCTION AND SURVEY

This part contains a concise description of the significant features of the operat­ ing system. It is intended to serve as an introduction to the concepts, facilities, and terminology described in greater detail in Part II and in other Operating System/360 Publications.

Since the Survey is self-contained, how­ ever, it should also prove useful to anyone wanting a general familiarity with the system.

7 SECTION 1: INTRODUCTION

Operating System/360 has been designed ELEMENTS OF THE OPERATING SYSTEM to shorten the period between the time a problem is submitted for solution and the time results are received 7 to increase the The processing programs consist of lan­ volume of work that can be handled over a guage translators, service programs, and given period of time7 and to assist those user-written problem programs. The pro­ concerned with the system: installation grammer uses them to define the work that managers, operators, and above all, pro­ the computing system is to perform and to grammers. The operating system consists of simplify program preparation. a number of processing programs and a control program (Figure 1). The control program supervises the exe­ cution of the processing programs7 controls the location, storage, and retrieval of data 7 and schedules jobs for continuous processing.

S~stem users may also include their own serv1ce programs or language translators. The programmer can then use these programs as he would use IBM-written programs.

Operating System/360 BENEFITS TO THE PROGRAMMER

Control Program Processing Programs The programmer can take advantage of a Language unified system that allows him: Translators Data • New • To write programs that are independent Programming Management Language of input/output requirements or charac­ Function • FORTRAN teristics of the operating environment. • COBOL Such requirements can be specified when • Assembler the jobs are set up, without modifying • Report the programs. Program • To place information (programs or col­ Generator lections of data) in the system's • Telecommuni- Job cations library without specifying or keeping Management Program track of the identification of the Function Generator auxiliary storage volume used7 and then • System to obtain access to the information by Generator merely providing a symbolic reference • Test Translator to it. The system automatically locates the information, issues Service Programs instructions to the operator to place the information on-line, and provides • Linkage Task Editor the descriptive material that is subse­ Management • Sort/Merge quently used to retrieve the informa­ Function • Utilities tion properly. • To store frequently used series of User-Written statements that specify job require­ Problem Programs ments as ncataloged procedures,n and to easily call them for use. • To receive the results of a computer run soon after submitting a job because of a nonstop operation that does not require jobs to be delayed until a batch is accumulated. • To design efficient programs that make balanced use of system resources in Figure 1. Operating System/360 an easy and direct way. Programs may

8 be divided into simple subprograms that The various facilities provided by proc­ are executed concurrEmtly under manage­ essing programs and the control program are ment of the control program; there is described under four topics: no need to rely on a complex, intricate design to achieve thE~ same effect. • To divide a problem into a set of • Information to be processed is organ­ subprograms, and codE~ each in the lan­ ized and stored in a particular way guage best suited to it. related to its use. It may be named • To divide a large program into smaller and may be easily retrieved. These sections that can be overlayed after operations are described. under Data they have been executed, to conserve Management. ---- main storage space. • The user's programs are prepared under • To easily test and modify programs and certain constraints, such as available data. storage space and the characteristics • To choose between immediately executing of the problem to be solved. The compiled or assembled programs (or programmer should take full advantage parts of programs) or storing them on of available programming aids (such as auxiliary devices for later use with inclusion of existing subroutines) • other compiler or assembler outputs. System features in this area are des­ The system can locatE~ such routines if cribed under Program Design and Prepar­ given only their names, and can pass ation. control to them in several different • Processes can be specified as sequences ways. of steps. These steps are then sche­ • To use the same program without recom­ duled to maintain a continuous flow; piling it, even if the installation this is described under Job Management. chooses to add features to the control • Elements of work can be performed indi­ program. vidually or concurrently. This is des­ cribed under Task Management.

Section 1: Introduction 9 SECTION 2: SURVEY

DATA MANAGEMENT access to security files (containing, for example, payroll information) by use of The manner in which data is transferred npasswords.n between main storage and external devices 3. Protection against concurrent is of paramount importance in most data­ updates of the same record, in processing installations. Earlier systems multiprogrammed systems. provided a number of facilities that together were named an input/output control The following paragraphs describe the system (IOCS). Most of these systems were means of identifying, locating, organizing, limited to tape and unit record equipment. storing, and retrieving data in general They consisted primarily of routines that terms. Data management is discussed in managed buffers and hardware interfaces, greater detail in Section 3. and controlled access to labeled tapes. Other versions, usually independent, included facilities for reading and writing IDENTIFYING AND LOCATING DATA on direct-access devices, and still others controlled telecommunications activities. Facilities to build and retrieve from pro­ Whenever a programmer indicates that a gram libraries were at times also new is to be created and placed on available, but were usually not incorporat­ auxiliary storage, he (or the control ed into the input/output control systems. program) must give the data set a name. The name is used when the data is to be The data management facilities of Oper­ retrieved. ating System/360 handle all of these func­ tions, and do it in a consistent manner. In some cases, the name assigned to a Data from a direct-access device, a remote data set must be qualified to avoid ambi­ terminal, or a tape; data organized sequen­ guity. For example, the qualified names tially, or like a library; all may be COLOR. CHERRY and TREE.CHERRY describe two requested by the programmer in essentially qifferent data sets having the simple name the same way. CHERRY. In addition, data management provides: A standard unit of auxiliary storage is called a volume. A volume may be, for • Allocation of space on direct-access example, any of the following: devices. Flexibility and efficiency of these devices is improved through bet­ • A reel of tape ter use of available space. • A disk pack • Automatic location of data sets* by • A data cell name alone. • A drum • Freedom to defer specifications such as • The part of an IBM 2302 Disk Storage buffer size, blocking factors, device device served by one access mechanism identification, and device type until (the device would have either two or the job is submitted for processing. four volumes in all) This permits the creation of programs that are in many ways independent of A direct-access volume (everyone of the their operating environments. above except the tape reel) has a volume • Protection of data sets. This ~abel in a standard location. The label includes: specifies the location of a volume table of contents. Each data set stored on the 1. Protection of data sets that share volume has its name, location, a common device. An accidental organization, and other control information attempt to write outside of speci­ stored in the table of contents. (Similar fied boundaries is detected and information is stored in labels of data prevented. sets stored on tape.) Thus, if the name of 2. Protection against unauthorized a data set and the volume on which it is stored is made known to the control program, a complete description of the data *Collections of data, described by control set, including its location on the volume, information stored within the system, are can be retrieved. Following this, the data called "data sets" as opposed to the more itself can be retrieved, or new data can be common term "file." added to the data set.

10 However, keeping track of the volume on for data sets on direct-access volumes. which a particular data set resides is a The records within the data set may be burden, and often a source of error. A organized in any manner chosen by the provision for catalogin9 data sets allows programmer. All space allocated to the the system to do this for the user. data set is available for data records (i.e., no space is required for A cataloged data SE~t can be located by indexes) • Records are stored and the control program, if given only its retrieved directly, with addressing name. The catalog consists of a series of specified by the programmer. indexes stored on direct-access devices. • Partitioned. This structure has char­ Each qualif ier of a delta set name corres­ acteristics of both the sequential and ponds to one of the indE~xes in the series. indexed sequential organizations. For example, the data set TREE.FRUIT.APPLE Independent groups of sequentially is found by searching cl master index to organized data, each called a member, obtain the location of the index named are in direct-access storage. Each TREE. The TREE index is searched to find member has a simple name stored in a the location of the index named FRUIT. directory that is part of the data set Lastly, this index is searched for APPLE to and contains the location of that find the identification of the volume con­ member's starting point. An example of taining the required dat:a set. partitioned data set use is the storage of programs; as a result, partitioned By use of the catalog, collections of data sets are often referred to as data sets that are related by a common libraries. external name and the time sequence in • Telecommunications. This organization which they were cataloged (i.e., their deals exclusively with data going to or generation) can be identified, and are coming from remote on-line terminals. called generation data groups. Thus Such data ~essages) may be processed LAB. PAYROLL (0) refers to the most recent directly from main storage or from data set of the group, LAB. PAYROLL (-1) queues in direct-access storage. refers to the second mo~~t recent data set, and so on. In applications which, for example, regularly use t.he two most recent generations of a group to produce a new STORING AND RETRIEVING DATA generation, the same collection of data set names can be repeatedly used with no requirement to know or keep track of the Data management includes facilities that serial numbers of the volumes used. simplify storing and retrieving data: • Input-output device control - The con­ trol program generates, schedules, and ORGANIZING DATA executes the instructions that transfer data to or from a particular device. Transient device errors and errors Operating System/360 data sets can be resulting from local recording surface organized in five ways. They are: defects are corrected automatically. • Buffering To achieve input-output- • Sequential. This is the familiar tape­ overlap in data organizations like structure, in which physical with sequential characteristics, the records are placed in sequence. Thus, control program anticipates input given one record, the "next" record is transfer requests, and defers output uniquely determined. The sequential requests. organization is used for all magnetic • Blocking - The control program permits tapes, and may be selected for direct­ the user to request and store logical access devices. Punched tape, punched records, which it automatically groups cards, and printed output are into long physical blocks as part of considered to be sequentially its buffering activity. This blocking organized. of records permits more data to be • Indexed Seguentia:~. Records are stored within a given area, and hence arranged in logical sequence (according permits faster data transmission. For to a key which is part of every record) example: on an IBM 2400 Series Magnetic on the tracks of a direct-access Tape Unit, an SO-character card image device. In addition, a separate index record occupies 0.1 inch; the inter­ or set of indexes maintained by the block gap occupies 0.6 inch. Effective system gives the location of certain transfer rates are therefore only one­ principal records. This permits direct seventh of potential rates if such as well as sequential access to any records were written individually. record. Similar considerations apply to direct­ • Direct. This organization is available access devices. The access routines

Section 2: Survey 11 for these facilities are called by programmer in using computing system facil­ simple input/output macro-instructions ities directly. or statements in each program's source coding. Two categories of access language are provided to satisfy speci­ DEVICE INDEPENDENCE fic user requirements. An important feature of data management The queued access language is designed is that much of the detailed information to furnish a full range of buffering and needed to store and retrieve data, such as blocking facilities with maximum program­ device type and identification, buffer han­ ming simplicity. It applies only to organ­ dling techniques, and format of output izations with sequential characteristics. records, need not be supplied until a job The macro-instructions GET and PUT are used is ready to be executed. This device for retrieval and storage of logical independence permits changes to be made in records. those details without requiring changes in the affected programs. Therefore, a pro­ The basic access language furnishes gram may be designed and debugged without device control without automatic buffering any knowledge of the input/output devices and blocking. Input/output operations are that will be used when it is executed. scheduled at the time they are requested. Device independence allows the following: Characteristically, the macro-instructions READ and WRITE retrieve and store entire • A user may prepare a program that may physical blocks of data. be executed without change at different installations with different This more primitive language may be used input/output configurations. to give the programmer more direct control • An installation may take advantage of over functions such as seeking, back­ new devices without reprogramming, or spacing tape, etc., that depend on recompilation. particular input/output devices. It also • To optimize performance, a user may may serve as the base for any special experiment with different combinations buffering or blocking methods constructed and types of input/output units and by the user. buffers. • A programmer may prepare a report for Each combination of data organization printing by using conventional control and access language is defined as an access characters rather than system macro­ method. There are eight access methods in instructions to describe his format. the operating system. For convenience He need not know whether the output their names are shortened to the initial will be placed in auxiliary storage for letters of the language category and the later printing, or whether it will be organization used, followed by AM for printed directly. access method, as shown: Device independence is a feature of both categories of access language. The degree i- of device independence attained is to some Ir------T------, Organization I Language Category I extent determined by the programmer. Many I ~------~------~ useful device-dependent features are I I Queued I Basic I available as part of special macro­ ~------+------+------~ instructions, and attaining device I Sequential I QSAM I BSAM I independence requires some selectivity in I I I I their use. As an example, assume that a I Indexed Sequential I QISAM I BISAM I programmer selects the queued sequential I I I I access method (QS~ and restricts his use I Direct I I BDAM I of macro-instructions to certain ones that I I l'll I affect data transmission rather than device I Parti tioned I I BPAM I control (specifically, GET, PUT, PUTX, I I I I TRUNC, and RELSE). Because he did this,

IL ______Telecommunication ~I QTAM______L_ I ______BTAM JI any of these devices could be used without requiring program modification: IBM 2400 Magnetic Tape Units In addition to these methods, an elemen­ IBM 7340 Hypertape Drive tary access method called execute channel IBM 2311 Disk Storage Drive program (EXCP) is also provided. The pro­ IBM 2302 Disk Storage grammer who uses this method must establish IBM 2321 Data Cell Drive his own techniques for organizing, storing, IBM 7320 Drum Storage and retrieving data. Its primary advantage IBM 2301 Drum Storage is the complete flexibility it allows the Card Readers, Punches, Printers

12 Macro-instructions are available in the In a slightly different sense (having basic direct-access method (BD~ that nothing to do with control levels), program affect device control as well ,as data is used to describe a set of interrelated transmission, and yet are device indepen­ programs. Thus, in the illustration, dent. For example, a NOTE macro­ A,B,C, and D together form a program. From instruction may appear in a series of READ that point of view, each is a SUbprogram of (or WRITE) macro-instructions. If a POINT the whole. macro-instruction is subsequently issued, the volume will be repositioned to read at Now suppose that program A calls upon the NOTE location regardless of whether, program B in such a way that it does not for example, a direct seek or a tape expect a return from B (for example A backspace is required. represents an initialization procedure; B represents the main process). A and Bare said to be at the same control level.

PROGRAM DESIGN AND PREPARATION

c Operating System/360 allows the programmer great flexibility in the design and preparation of programs. He may design A B his programs in segments that overlay each other, or as subprograms that may be indi­ vidually coded, stored, and linked in var­ ious ways before and during execution. He specifies his requirements for necessary D facilities by use of control statements and by including macro-instructions in his assembler language coding; many of the facilities can also be used in programs coded in FORTRAN, COBOL, and the New Pro­ gramming Language. Figure 2. Subprograms Existing at Differ­ ent Levels of Control The process by which programs are pre­ pared for execution in Operating System/360 differs from previous methods in three In Figure 3, A and B are at the same ways: control level; similarly C and D are at the same control level, which is lower. C and • Greater emphasis is placed on program D are each said to be subprograms of B. modularity, and the ability to link (Note that although B expects a return of programs together in a variety of ways. control, it does not receive it from the • All executable programs are placed in same program to which it relinquished con­ libraries where they are immediately trol.) available. • All programs are capable of being load­ ed and executed anywhere in main stor­ age. Their locations in storage are COMBINING SUBPROGRAMS determined at the time they are loaded. Subprograms may be combined in several different ways and at several different PROGRAMS AND SUBPROGRAMS times. The earliest time is when a set of source language statements (called a source module) is prepared for input to a language A hierarchy of programs is recognized, translator (Figure 4). Such source modules based on the way one program is associated may be placed in libraries (partitioned with another. If progr~n A calls program data sets) and modified there by a utility B, and expects control to be returned, B is program, rather than by manipulating card called a SUbprogram of A, and is said to be decks. Input to the language translators at a lower level of control. can be from libraries, from card decks, and from other sources in combination. The output of the language translator, called In Figure 2, C and D are subprograms of B, an object module, is in machine language, which in turn is a SUbprogram of A. A is but is not yet executable. It may still at the highest control level; B is at a contain unresolved symbols (i.e., referen­ higher control level than C or D; C and D ces to symbolic addresses that did not are at the same control level. appear in the source module) •

Section 2: Survey 13 by code contained in newly prepared object modules. The units of deletion and :replacement are control sections. (A con­ 'trol section is a sequence of code that 'is independent of the location of other similar sequences. Thus, a single address constant, a value used when loading a base register, can never be used to address locations within two different control sec­ tions.) In addition, the control state­ ments for the linkage editor can direct that the resulting load module be segmented for overlaying, a technique that allows the entire load module to be executed, even though it is too large to fit into availa­ ble main storage at one time. This subject is discussed thoroughly in the publication IBM Operating System/360: Linkage Editor. Figure 3. Subprograms Existing at the Same and Different Levels of Control

Finally, subprograms may be combined at All executable code is prepared by the the time jobs are submitted and executed. linkage editor, one of the service programs This may be done by specifying in job of the operating system. The output code control statements the sequence of subpro­ produced by the linkage editor is called a grams to be executed, a procedure further load module. The input to the linkage defined in wJob Management- later in this editor may be any number of object modules, :survey, and Section 5. Subprograms may previously prepared load modules, and con­ also be requested dynamically at the time a trol statements. This permits previously load module is being executed. In this completed programs to be included as sub­ case, the subprogram requested is always programs of new, more complex programs. It itself a load module. The control program also permits changes to be made in pre­ finds the subprogram in the indicated viously prepared load modules, obviating library, allocates main storage, loads the the need for recompiling the entire program, and when appropriate, passes con­ program. Specifically, the control state­ trol to it. This feature greatly simpli- ments can direct that various sections of fies the planning needed when complex pro­ an old load module be deleted, or replaced cedures are programmed. o Q

Control Q ( Program

Main Storage

Source Object Load Module Module Module

Figure 4. Program Preparation

14 JOB MANAGEMENT

Job management improves processing effi­ ciency by: ,------,Job A I I • Using the computing system to perform I I I I routine job handling activities in a L _____ J rapid, precise manner. • Eliminating nonessential operator deci­ Job B sions with their attendant delays and r ------1 possible human errors. liB JOB I I • Allowing the programmer to defer speci­ IISTEP 1 EXEC PGM=ONE I I IIDDNAME DD DSNAME= I Step 1 I fication of input/output facilities I I until after his program is compiled. I I I I This improves program flexibility and I I eliminates the need for recompilation ------1 L ------1 I I if the situation changes. IISTEP2 EXEC PGM=TWO I I IIDDNAME DD DSNAME= I I I Step 2 I I I I I ------1 IISTEP3 EXEC PGM=THREE r------lI I JOB CONTROL IIDDNAME DD DSNAME= I Step 3 I I I I ______--1 L ----__ --1I Jobs are controlled by the programmer Job C r -----~ through a , and by the operator through system communication. The I Input I job control language is a formalized method Job Control Statements Job Stream of requesting, in advance of job processing, functions previously performed Figure 5. The Input Job Stream by the operator. The programmer can define his requirements in a precise manner, when the job is set up. System communication enables the operating system to respond to operator commands, and to request that the Job steps can be related to each other operator perform actions such as mounting as follows: volumes; it also permits the program to communicate with the operator. • One job step may pass intermediate results recorded on an external storage volume to a later job step. • Whether or not a job step is executed may depend on results of preceding THE INPUT JOB STREAM steps. All the steps that follow one JOB state­ Job control statements come into the ment belong to the same job. There is no system in a sequence called the input job relationship between job steps that are not stream (Figure 5). Of these statements, part of the same job. the essential three are the job (JO~, execute (EXEC), and data definition (DD) A data set, such as source coding for a statements. compilation, may be put in the input job stream immediately following the DD state­ A JOB statement signifies the beginning ment identifying it and before subsequent of each job. A job may consist of several control statements. Alternatively, the interdependent job steps, such as a compi­ data set named in the DD statement may be lation, linkage edit, and execution. For on an input/output device which is indepen­ each job step, an EXEC statement and neces­ dent of the input job stream. sary DD statements are included in the input job stream. In the EXEC statement, The flexibility of the job control lan­ 'the programmer names the first program guage allows the programmer to specify his (load module) to be used in the job step. requirements for a large variety of facili­ (Other load modules may be dynamically ties when he prepares his control state­ called by the first, but these are not ments. He may specify job priority, set-up named in the EXEC statement.) In DD state­ information, buffering and blocking ments, he describes data sets to be used in methods, space requirements, etc. In most ·the job step. installations, many job step sequences will

Section 2: Survey 15 be used repeatedly with little or no Sequential Scheduling System change. To simplify job requests and reduce mistakes, whole control statement sequences (including DD statements) may be The sequential scheduling system is stored in the library as cataloged proce­ shown in Figure 6. This consists of a dures. Each cataloged procedure may be reader/interpreter, an initiator, and a initiated by a single EXEC statement in the master scheduler. The reader/interpreter input job stream. Further, individual reads in job control statements for a statements in a cataloged procedure can be single job step. The initiator then allo­ temporarily overridden by like-named con­ cates the required input/output devices, trol statements in the input job stream. potifies the operator of volumes to be ~ounted, and when all required volumes are mounted, requests the supervisor to execute the named program.

The master scheduler program carries out JOB SCHEDULER operator commands that control or inquire about system functions. It also relays messages to the operator, such as the The input job stream is read and ana­ volume mounting instructions. The variety lyzed by the job scheduler, part of the of commands available depends on the con­ control program. The job scheduler allo­ trol program configuration, as is discussed cates the input/output units needed and in IBM Operating System/360: Operating then requests the supervisor program to Considerations. Operator commands, which initiate the execution of the programs normally are entered via console specified in the control statements. input/output devices, may also be put in the input job stream as a type of control statement. By selecting optional scheduler features, the user can tailor job manage­ , An optional feature is automatic volume ment capabilities to his requirements. recognition (AVR). This feature lets the operator mount labeled input tape on any The schedulers are discussed on two available unit before receiving a message general levels in the following paragraphs: telling him to do so. The initiator recog­ the simple sequential scheduling and the nizes the volumes by their labels, and more powerful priority scheduling systems. later assigns these premounted units to the

INPUT JOB STREAM AND COMMANDS MASTER SCHEDULER

COMMANDS MESSAGES

JOB INITIATOR STEP

OTHER

Figure 6. Sequential Scheduling System

16 job steps calling for the corresponding priorities whenever a job step is delayed volumes. waiting for volumes to be mounted. It uses such a delay to select a step from a non-setup job in the input work queue, and run it. Priority Scheduling SystE~ms Similarly, instead of user programs printing or punching output data directly, In priority scheduling systems (Figure designated output (system output data) can 7), jobs are not executed as soon as they be stored at high speed on a direct-access are encountered in an input job stream. device for later transcription. To provide In$tead, a summary of the control informa­ for the later transcription, a summary of tion associated with each job is placed on control information for each job's system a direct-access device from which it may output data (such as location boundaries later be selected. The set of summary and device type) is also placed on a information is called the input work queue. direct-access device. The set of summary More than one input job stream can feed information is called the output work this queue. queue. Using the output work queue, system output data is selected for printing or Use of the input work queue permits punching, in priority sequence, by compo­ greater flexibility in the sequence in nents of the job scheduler called system which jobs are selected for execution. The output writers. system can react to job priorities and to delays caused by the mounting and demount­ Other job management options available ing of input/output volumes. The are: initiator/terminator can look ahead to future job steps (within the same job) and • Job Account Log. A log of all jobs can issue volume-mounting instructions to the be kept by the job scheduler. For each operator to mount volumes for them in job, the log shows job name, assigned advance. account number, and the time used for execution of each job step. Also Jobs that can be run without having the recorded on the log may be information operator mount or dismount volumes are from user-written routines and operator designated as non-setup.. An optional non­ commands • setup padding feature lets the • Multijob Initiation. This feature initiator/terminator iqnore the usual allows several different jobs to be

INPUT JOB STREAM AND COMMANDS MASTER SCHEDULER

COMMANDS MESSAGES

READER - INITIATOR- JOB INTERPRETER 14------i TERMINATOR 14----1 STEP

OUTPUT WRITER

OTHER

Figure 7. Priority Scheduling System

Section 2: Survey 17 processed concurrently. Each job needs a way of identifying them, assigning selected is initiated one step at a priorities to them, and allocating resour­ time, sequentially, just as in systems ces to them based on these priorities. without the multijob initiation feature. On completion of any job, the highest priority job in the input work queue is selected and initiated • • Remote Stacked Job processing. Job control information may be submitted to ..------Represents Task Control Block the system from remote on-line termi­ nals. All job management functions TCB specified by the job control language are available to remote locations. This "remote batch" feature provides a Program practical and convenient method for many users to share the power of a large centralized computing system. Figure 8. Task Representation TASK MANAGEMENT The resources that must be allocated to tasks include input/output channels, con­ trol units and devices, main and auxiliary Control Program functions are performed storage space, library programs, the for units of work known as tasks. (The operator's console, and most important, the performance of a task is requested by a job central processing unit. step.) The difference between a task and a program must be clearly understood. A Tasks may be created in only two ways: program is a sequence of instructions. A either they exist from the time the system tas~ is the work to be done by the execu­ is initialized (prepared to handle the tion of a program. In a multiprogramming installation's work flow) or they are environment, the task competes with other created dynamically by the macro­ tasks for control of the central processing instruction ATTACH. ATTACH indicates that unit and other system resources. a new task is to be attached to the queue of tasks that already exist in the system. In the past this distinction between program and task was unnecessary because at In all multi task configurations, anyone time a program was used for only regardless of the manner in which tasks are one task. Now, with multiprogramming and created, existing tasks are arranged in a the possibility of shared code, the dis­ task queue according to priority. If a tinction is necessary because the same task can make immediate use of the central program may be in use by many different processing unit, it is in a ready tasks. Consider, for instance, a discus­ condition; if the task is waiting for the sion of priorities: associating priority completion of some event, such as an with a program would be confusing because input/output operation, it is in a wait the same program may be serving many tasks, condition The purpose of the multitask each with a different priority. It is the operation is to keep the central processing task that has a priority, not the program. unit busy; when a task being performed Multiprogramming in Operating System/360 is enters a wait condition, another task is task management rather than program manage­ allowed to be performed. Control is always ment. given to the highest priority task in the ready condition. How this is applied is As a reminder of the distinction between illustrated in Figure 9. In the figure, an a task and the associated program, a con­ asterisk indicates the active task. venient representation is often used (Figure 8) • Three tasks are shown on the task queue: A, B, and C (each represented by their task The lower box represents the program control blocks). They are arranged in instructions; the upper box represents the priority sequence, from high to low: 14, 5, task control block (TC~, a consolidation 3. At time 1, A is in a wait condition of all control information related to the (depicted by Vi) ; B is in a ready condition task. (depicted by R). Control is therefore given to task B. At time 2, the program An operating system in which one task is being executed under task B indicates that performed at a time needs relatively simple it has reached a point where it must wait controls. Each task uses the resources it for some asynchronous event; hence control needs, when it needs them. But a system is given to task C. At time 3, an inter­ that handles a number of tasks concurrently ruption indicates that the event B was

18 waiting for has occurred; control is to be "dispatched," the task control block returned to B. At time 4, task B has been contains all the information necessary to completed and control returned to task C. restore the machine to its status at the Task C is unaffected by its interruption time control was relinquished. (As used and later resumption. throughout this manual, "task control block" refers not only to the fixed-sized block which also goes by that name, but also to a number of other areas containing task control information that are adjuncts of that block) • Multitask operation is a very powerful [J [] [0 facility. It permits fast turn-around in batched job operations by allowing concur­ Time 1 W *R R rent operation of input readers, output Time 2 W W *R writers, and userls programs. It provides Time 3 W *R R *R a means for handling a wide variety of Time 4 W telecommunications activities, which are * Tasks in control of central processing unit characterized by many tasks, most of them in wait conditions. It also permits com­ Figure 9. Switching Control Among Tasks plex problems to be programmed in segments that concurrently share system resources Whenever control is switched from one and hence optimize the use of those resour­ task to another, the contents of registers ces. With some versions of the job schedu­ and the program status word for the task ler, it permits job steps from several relinquishing control are stored in its different jobs to be established as concur­ task control block. When. the task is again rent tasks.

Section 2: Survey 19

PART II: DETAILED DESCRIPTION

Operating system facilities are des­ cribed in greater detail in this part of the publication. Since most experienced programmers have some familiarity with assembly-level language, the use of operat­ ing system facilities is described in terms of the assembler language.

21 SECTION 3: DATA MANAGEMENT

A data set is a named collection of data serial number and the data set name, it can whose extent (physical boundaries) is known retrieve information from the data set to the system. The name, extent, and other control block, which permits subsequent descriptive data having to do with format access to the data set itself. and organization method, is contained in a data set label recorded in most cases with Each direct-access volume is initialized the data itself. Optionally, the name and by a utility program before being used on properties of a data set may be entered in the system. The initialization program the input job stream. It is the informa­ generates the proper volume label and con­ tion identifying the data organization that structs the table of contents. distinguishes a Rdata set" from a "file," as used in other systems. The word "file" Figure 10 illustrates the contents of a is generally not used in the Operating direct-access volume after initialization. System/360 publications, to avoid possible The volume label is at a fixed location, ambiguity with the auxiliary storage devi­ starting in track zero of cylinder zero. ces on which the data sets appear. This : The user may specify up to seven additional section describes the operating system's labels for further identification. These data management facilities in two parts. will be located following the standard The first includes the identification of . volume label. data sets, and control of their physical location. The second includes the func­ The volume table of contents contains tions concerned with data organization and space for a series of data set control its storage and retrieval. A more complete blocks, one for each data set to be written description of these facilities is con­ on the volume. Control blocks are also tained in the publications IBM Operating included to account for the space allocated System/360: Data Management, and IBM Oper­ to the table of contents itself, and to ating System/360: Telecommunications. account for any space not yet allocated. At the time of initialization, all remain­ ing space on the volume is available for allocation. DATA SET IDENTIFICATION AND EXTENT CONTROL When a data set is to be created in direct-access storage, the steps are: All Operating System/360 configurations use direct-access devices to store execut­ 1. The volume specifications and data set able programs, including control programs. name are given in a DD statement Direct-access storage is also used for data associated with the job step in which and for temporary working storage. One the writing operation will take place. direct-access storage volume may be used 2. Allocation of space is requested, also for many different data sets, and space on by means of the DD statement. it may be reallocated and reused. A volume 3. When the job step is initiated, the table of contents ~OC) is used to account system allocates space and creates a for each data set and available space on data set control block. the volume. 4. The OPEN and CLOSE functions, per­ formed when the job step is being executed, complete the data set con­ trol block to reflect the charac­ DIRECT-ACCESS VOLUME IDENTIFICATION AND THE teristics and extent actually written. VOLUME TABLE OF CONTENTS

Each direct-access volume is identified MAGNETIC TAPE VOLUMES by a volume label, stored in a standard location. This label contains a volume serial number and gives the location of the The system controls magnetic tape volume table of contents. The table of volumes and identifies data sets residing contents, in turn, contains the data set on tape in a slightly different way from labels that describe each data set stored that used for direct-access volumes. This on that volume. The special form of data is due to several factors: set label used for direct-access devices is called a data set control block (DSCB). If • Tape is serial, and data set labels on the control program is given the volume tape immediately precede and follow the

22 Cylinder 0

Track 0 ------i.-l Volume Label

Additional ) Labels (Optional)

~

VTOC DSCB Space Accounting DSCB

Space for Additional DSCB'S = Figure 10. Volume Initialization and the Volume Table of Contents

data they describe. Tape data set beled tapes are correctly mounted, and that labels are therefore not quickly acces­ the number of reels in the data set is sible. stated in the DD control statement describ­ • Space allocation procedures are not ing the data set. Data set label informa­ necessary, since da1:a sets on tape tion describing unlabeled tapes may be follow one another sequentially. New provided in a DD statement. data sets may be added beyond any others already there, and overflow from one volume always goes to the beginning of the next. • Location on a tape volume, once the CATALOGING AND LIBRARY MANAGEMENT volume is identified, is given by a sequence number. • The existence of magnetic tape librar­ To retrieve a data set, the system needs ies using different labeling procedures the data set name, the volume serial is recognized and provided for. Some number, the device type, and in some tape reels may be unlabeled. instances, the data set sequence number. Specifying these can sometimes be inconven­ The standard label procedure calls for a ient for the programmer. The catalog per­ volume label, data set labels for each data mits storage and retrieval of a data set set, and additional optional labels. Data based on name alone. The items mentioned set labels on tape are in two parts: data previously are stored in the system set header labels that precede the data, catalog. This is a series of indexes, each and data set trailer labels that follow it. corresponding to a qualification level of The data set location on the tape (called a the d~ta set name. The number of levels is data set sequence number) is part of the determined by the user. data set label, but since it is not quickly accessible it is used only for checking A data set name consists of a simple purposes. For purposes of tape name preceded by qualifiers (index names) positioning, the data set sequence number separated by periods. Each component of must be either stated in a DD statement, or the full name can be up to 8 characters stored in the catalog. long; the entire name, including periods, can be up to 44 characters long. Each Use of non-standard tape labels is component name starts with an alphabetic facilitated by a provision for executing character, and may contain any letter or special installation label-checking rou­ number. Indexes, linked together in a tines. Since the iden"ti ty of unlabeled hierarchy specified by the user, contain tapes cannot be verified by the operating pointers to subordinate indexes, to system, the operator must ensure that unla- volumes, or to both.

Data Management 23 Find: Data S~t TREE. FRUIT. APPLE A horizontal index structure with many different names and few index levels will 'ystem Resi d ence V o I ume require fewer seeks than will a vertical index structure with many levels and few Catalog (Directory) TREE (Index) -----Search · names in each level. The vertical struc- Starts · ture is likely to give less conflict TREE *Y FRUIT between duplicate names. The system will ~* · not accept two identical names in the same ~ ...... - @ index. Attempts to catalog identical fully qualified names will be rejected. FRUIT ( Index) * APPLE Control Volumes -...,.326) ./ A control volume contains all or part of Volume 326 the catalog. The operating system resides VTOC (Index) in a control volume, generally referred to as the system residence volume. Additional ~r Volume 1326 1* control volumes are established upon speci­ Label * fication of the user. The use of separate (DSCB) _ TREE. FRUIT. APPLE * control volumes permits data sets that are functionally related to be cataloged separ­ ~-- - ately from other parts of the catalog, and separately from the system residence Data Set: volume. Advantages are: * TREE. FRUIT. APPLE I I • Control volumes can be moved from one processing system to another. • Storage requirements in the system Figure 11. Catalog Search Procedure residence volume can be reduced by placing seldom used indexes on a con­ trol volume. • Both the catalog and data can be stored in such a fashion that they can be The automatic cata'log search procedure removed entirely from the system. is illustrated in Figure 11. The search starts in a volume designated when the From the user's viewpoint, access to system is generated, which contains the cataloged data sets using control volumes highest level index. The highest order is the same as if separate volumes were not qualifier is sought, which provides the involved. location of the index for that qualifier. The search continues for the next level qualifier, and for its index. When a volume number is found, the catalog search Generation Data Groups is completed. If the required volume is not already mounted, a mounting message will be issued. Some data sets are periodically updated, or are logically part of a group of data If the data set is on a direct-access sets, each of which is created at a differ­ device, the search for the data set loca­ ent time. For example, a payroll tion resumes with the volume label of the ·year-to-date- file is updated each pay indicated volume, continues to its volume period, and a new generation of the file is table of contents, and from there to the · produced. Each generation is itself a data data set's starting location. All volume set. A special catalog facility maintains tables of contents are designed so that an the identity of each generation and allows "in channel" search can be used, i.e., a the same external name to be used at each single search request allows the channel updating. A collection of data sets of program to continue through the necessary this kind is called a generation data series of seeks and reads until the named group. data set is located, without intermediate interruptions of other processing that may The external data set name for all data be in progress. sets within a generation data group for a · payroll might be named A.YTDPAY. Each data The index design is left to the user, so set is also automatically assigned a simple that logical divisions between index levels name in the form of a generation and can be arranged to meet installation needs. version number, e.g., G0032VOO, which rep-

24 resents generation 32, version zero. The The password data set has its own next data set name which will be automat­ ~ecurity flag and master password; thus it ically assigned is G0033VOO. The external 1S secure against access except by the name qualifies the generation and version system supervisor program, when searching number. This automatic naming permits the for a match, and by programmers knowing the user to refer to generations by either an master password. The password data set absolute name, e.g., A.Y'TDPAY.G0032VOO; or could be changed periodically to alter by a relative name. An example of the passwords for added security. relative notation is A.YTDPAY(O); this refers to the latest cataloged version. A .. YTDPAY (+1) identifies a. new data set to be added to the group, and A.YTDPAY(-1) identifies the next to the latest genera­ EDITING OF SPACE, INDEXES, AND CATALOGS tion. When the index for the generation data Operating System/360 users maintain data group is established, the programmer speci­ sets and the catalog by means of utility fies how many generations he wants saved. programs and system subroutines. These If he wants a "grandfather, father, son" programs and subroutines can reorganize or series maintained, he specifies three gen­ edit volumes, data sets, and indexes. erations. As a new generation is cataloged, the oldest generation is either Data sets may be deleted, or transferred automatically destroyed, or it is merely from one volume to another, and fragmented deleted from the catalog. volumes may be reorganized to consolidate available space. Data set names may be Alternatively, the user may specify that changed. New members may be added to a all old generations of a full generation partitioned data set. Data sets may be data group series be deleted from the cataloged or removed from the catalog; catalog when the succeeding generation is generation data groups may be established. added, so that the new ,entry effectively Indexes of the catalog may be created or becomes the newest and only member of the deleted, and the catalog may be series. This facility is useful in appli­ reorganized. New control volumes may be cations where several data sets are accumu­ established. lated for a fixed period of time, then the entire set is processed and a new series started. When. the generation data group index is DATA ACCESS METHODS established, a model da1ta set label is built for it. This model is used for each succeeding generation, to supply uniform System facilities are provided for attributes. retrieving and storing data once the data set has been located and is ready to be used in processing. When preparing a pro­ gram, its designer must consider: PASSWORD PROTECTION OF DA~[,A SETS • The way data is arranged within the data set. Most computer users have data sets that • The selection, where applicable, of one contain sensitive information, and want to of the two categories of language restrict access to them. Examples of such statements, queued or basic, that indi­ records are payroll inforI~tion, corporate cate ~mong other things) whether input financial records, and the like. To safe­ requirements may be anticipated, and guard such data, the system allows any data output requirements deferred; or wheth­ set to be flagged as "protected." This er input and output are to be initiated protection flag is tested by the control as an immediate consequence of a lan­ program as part of the OPEN macro­ guage statement. instruction routine. If the protection flag is on, a special handling procedure The combination of these two factors requires that a correct ~lssword be entered defines the access method. Each of the from the console. The password is appended eight access methods has its features, from to the data set name, which then serves as which the programmer can select those suit­ an argument for a search of a password data ed to the application. set. If a matching namE~-plus-password is found, the OPEN routine is permitted to The presentation of the data access continue. Reference to a flagged data set methods is divided into two parts: a des­ is not allowed by the system until the cription of access methods and a descrip­ password is verified. tion of blocking and buffering facilities.

Data Management 25 THE ACCESS METHODS Basic Partitioned Access Method (BPAM)

The first of the access methods to be described is the queued sequential access This method is designed for efficient method (QSAM), the most widely used method storage and retrieval of sequences of data in older input/output control systems. (members) belonging to a data set stored on a direct-access device. Each member has a simple name. Included in the data set is a Queued Sequential Access Method (QSAM) directory that relates the member name with the track address where the sequence starts. The FIND macro-instruction The organization may be characterized as searches the directory for a simple name "tape-like," even when storage is on a and prepares for gaining access to the direct-access device. associated member. Once a member is found it may be retrieved using successive READ Logical records are retrieved by use of macro-instructions; new members are written the GET macro-instruction, which supplies using successive WRITE's, followed by a one logical data record (or a pointer to STOW macro-instruction that updates the its starting location) to the program. The directory. Members may be added to a access method anticipates the need for partitioned data set as long as there is records based on their sequential order, space in the volume, and in the directory. and normally will have the desired record CHECK is used to synchronize the program in storage, ready for use, before the GET with the completion of each data transmis­ is issued. Logical records are designated sion operation. for output by use of the PUT macro­ instruction. The program normally can continue as if the data record were written immediately, although the access method's Indexed Sequential Access Methods - Basic routines actually may perform blocking with and Queued (EISAM and QISAffl other logical records, and the actual writ­ ing is performed after the output buffer has been filled. Since both GET and PUT Because of their complementary use of rely on use of buffers supplied automat­ the indexed sequential data organization, ically, there may be a delay if computation BISAM and QISAM are discussed together. gets ahead of the actual data transfer operations. This kind of delay is called With the indexed sequential an implied wait; its frequency of occur­ organization, data records on direct-access rence depends on many factors, including storage devices are arranged in logical relative input/output and processing sequence on a data key. The data key will speeds, and total load on the input/output normally be a control field which is an channels. intrinsic part of the information in the record (e.g., a part number); it may, however, be some arbitrary identifier asso­ ciated with the record, such as a record Basic Sequential Access Method (BSAffl serial number. When a record is stored, the data key is placed in a hardware­ defined key field associated with the Data is sequentially organized. Physi­ record. (If records are blocked, then the cal blocks of data are dealt with rather highest data key in the block is placed in than logical records. Input operations are the key field.) initiated only when called for by a READ macro-instruction. The program may contin­ The data set also contains indexes ue following a READ, before the data called relating the data keys of records to physi­ for is retrieved. The user must specify cal addresses. For the data set as a when the data is required by using the whole, there is a cylinder index that CHECK macro-instruction, which in turn indicates the address of the cylinder on calls upon the wait function. Program which a record with a given data key can be execution is suspended at a CHECK until the found. On each cylinder there is a track retrieval is completed. In addition, a index that indicates the address of the validity check of the retrieved record is track on which a record with a given data made. Similarly, an output operation is key can be found. On an optional basis, initiated for each WRITE. The program may the cylinder index may be indexed by a continue immediately following the WRITE, higher level index. before the output operation is completed. To ensure that it was completed, the pro­ To create the data set initially, QISAM grammer must again use the CHECK macro­ is used in the "load mode." In this mode, instruction. successive PUT macro-instructions place the

26 records (which must be in data key they are being updated. In that way, sequence) into the data set and create the records being updated by one task are not indexes. destroyed by the concurrent updating by another task. To retrieve records in sequential fash­ ion, QISAM is used in the "scan mode.- In this mode, successivE~ GET macro­ instructions retrieve logical records Basic Direct-Access Method (BDAM) sequentially. A SETL (set lower limit) macro-instruction may specify the data key of the first record to bf:'! retrieved with a This access method allows records within subsequent GET. If the GET macro­ a data set to be organized on direct-access instruction is used without a prior SETL, volumes in any manner chosen by the pro­ retrieval starts at the beginning of the grammer. When a request to store or data set. retrieve a record is made, an address either relative to the beginning of the While in the scan mode~ the PUTX macro­ data set or an actual address (i.e., instruction may be used following a GET to device, cylinder, track, record position) return an updated or replacement record to must be furnished. This address can be the data set, or to mask out an old record. specified as being the address of the desired record or as a starting point Selective reading is p,:!rformed by BISAM, within the data set, where the search for using the READ macro-instruction, and the record begins. When a record search is specifying the key of the logical record to specified, the programmer must also furnish be retrieved. In this case, the entire the data key (e.g., part number, customer physical block containing the logical name) that is associated with the desired record is read into storage, and the record. address of the specified logical record within that block is returned to the user's When adding a new record to the data program. An indexed sf::'!quential data set set, the address is used by the access can be updated in place, or new records method as a starting point at which to inserted, by using BISAM and the WRITE begin a search for available space. Thus macro-instruction. An important point is the programmer doesn't have to keep track that BISAM is the only one of the basic of available space within the data set. access methods that can deal with logical The extent of the search for available records rather than blocks. space (or record) can be controlled by the programmer. In the event that an intended insertion cannot fit in the available space on a The READ and WRITE macro-instructions track, one or more records on the track are are used to request data transfer. To automatically moved to an overflow area determine if a request has been completed, that may be on the same cylinder, on the the programmer must use the WAIT macro­ same volume, or on a different volume. instruction. When the WAIT has been OVerflow records are indicated in the satisfied (a record has been read or appropriate indexes. written), the status of the completion (e.g., no error, record not found) will The fact that some records are stored in also be available. There can be any number overflow areas, physically out of sequence, of READ or WRITE requests in effect at any does not change the ability of QISAM to one time. read the data set in logical sequence as previously described. Exclusive control of input records is available, as with BISAM. A data control block for an indexed sequential data set can be opened for both QISAM and BISAM at the same time. Queued Telecommunications Access Method When using the READ or WRITE of BISAM, (QTAM) WAIT must be used to synchroni2e the pro­ gram with the completion of the input/output transfer. Synchronization Telecommunications devices have some with QISAM is automatic. characteristics that are significantly dif­ ferent from local input/output devices. In multitask environments, two or more For example: concurrent tasks can refer to the same data set, or even the same logical record. In • Remote terminals are not under positive this environment, if the ·tasks use the same control of the central processing unit, data control block, each program should particularly when the data source is a request exclusive control of records while keyboard. These factors complicate

Data Management 27 Monitoring of Control C!f GET/PUT Telecommunications Record transmittal

User Program

QTAM QTAM -- Input --z--- Input Input -- Enqueuer Dequeuer -- GET -- -- I -- I Input I Queue I I I User Program I QTAM QTAM -- Output Output I Output -- ...-z--- Dequeuer I Enqueuer -- I --PUT I -- I --

Output Queue I

Figure 12. The Queued Telecommunications Access Method

error recovery procedures, and cause an Both input and output records are placed unpredictable speed and sequence of on queues specified by the programmer. The input data. determination of which queue a record • In some applications, messages of should be placed on may be influenced, for unpredictable length must be handled. example, by the priority of the message, • The number of remote terminals may be the receiving or transmitting terminal, and very large relative to the number of the identification of the processing rou­ local input/output units, such as tapes tine. The sequence of records in each and disks. queue is based on their time of entry into the queue; the earliest record on an input Although the control of communications (or "processing") queue is provided when devices is considerably different from the data is requested from the queue by a GET. control of local input/output equipment, Similarly, messages are selected for trans­ the transmittal of data records between mission from output (or "destination") buffers and the user's program is much the queues in the same sequence they were same in both cases. This similarity allows placed on the queue by a PUT. the programmer to design processing pro­ grams for QTAM in much the same way as he In addition to buffer controls, many would for QSAM, despite differences between other message-related functions can be per­ telecommunications and local input/output formed automatically by the QTAM programs, devices. according to the programmer's specification. These functions are summar­ The result of this, as illustrated in ized as follows: Figure 12, is that the programmer using GET and PUT does not deal at all with remote • Terminals sharing the same transmission terminals: he deals instead with locally line are addressed and polled, to per­ available queues of data records from which mit contention for line use on a con­ he may receive input, and to which he may trolled basis. add output. • Message headers are analyzed to deter-

28 mine where messages are to be routed. format is unpredictable but is specified in Routing of an incoming message may be a count field at the beginning of each to another terminal, or to a group of block; the size of blocks with the U format terminals. Some may be routed to a is also unpredictable, but there is no processing queue, from which they will corresponding count field. be moved with a subsequent GET. • Automatic functions are available, such as queueing, checking the sequence num­ Format F and V data blocks may contain ber of incoming messages, assigning a blocked logical records. If so, the logi­ transmission sequence number to outgo­ cal records in the F format are all of a ing messages, validating source and fixed Size, and normally, the same number destination codes, logging, translating of records appears in each block. The between external transmission code and logical records in the V format may be of internal processor code, checking for different sizes; each must be preceded by a transmission errors and taking correc­ length field specifying the record size. tive action, and placing the date and Normally, a V format block contains the time of day in messages for control largest number of records that can fit purposes. within the specified maximum size. A telecommunications language, based on the operating system assembler, allows a Blocks that are shorter than the maximum programmer to specify these functions in may be deliberately created. Such blocks convenient problem-oriented terms. will be properly handled when subsequently read.

Basic Telecommunications Access Method Data formats used in the telecommunica­ (BTAM) tions access methods are necessarily dif­ ferent from those described thus far. A message is that unit of text that is The same polling and line control fUnc­ terminated by a special Rend-of-messagen tions of QTAM are provided in BTAM. The text character or set of characters READ and WRITE macro-ins·tructions are used (depicted by nEOM n in Figure 13). A block to request data transmission; the WAIT is a portion of a message terminated by a macro-instruction is used to synchronize special nend-of-blockn text character or program execution with data transmission. set of characters (depicted by nEOB n in Figure 13). An e~ception is the last block of a message which need not have the end-of-block characters. A segment is that BLOCKING AND BUFFERING FACILITIES portion of a message contained in a buffer, the size of which is specified by the user. As shown in Figure 13, a message is divided Because of the similarity in block for­ into segments without reference to the mats and buffering facilities in many of length of its blocks. the access methods, these topics are des­ cribed separately rather than being repeat­ ed in the discussion of each access method. Records for BTAM consist of blocks; To assist the reader furt,her, a summary of records for QTAM can be either messages, the access methods is pr'esented in a fold­ blocks, or segments. out chart (Table 1) that may be kept open. The chart associates the features discussed with the access methods in which they are used.

Block Formats - Message Segment I Segment I Segment I Segment Data blocks (i.e., physical records with (1) (2) (3) (4) hardware-defined boundaries) that are ~ stored on external storage devices may have :;~i~:ting -1 ! I [ any of three different formats: fixed (~, I ! I variable W), or unspecified (U). In all I Block (1) 1 Block (2) 1 Block (3) 1 cases, a maximum length must be specified in advance. The size of blocks with the F EOB EOB EOM format is normally equal to the maximum length; the size of blocks with the V Figure 13. Components of a Message

Data Management 29 Buffering Facilities The second method is to use the GETPOOL macro-instruction which obtains main storage space dynamically, and performs the A buffer, as described in this manual, functions of BUILD. is the area of main storage used for data that is being transmitted between main The third method is to let the system storage and an external medium. When using perform both the buffer area allocation and the basic access methods, individual buf­ buffer structuring automatically, as part fers need not be identified to the control of the OPEN operation. program before a READ or WRITE macro­ instruction is issued; when using the A special macro-instruction (BUFFER) is queued access method, more buffer space is available for use with QTAM to do much the generally required, and it is required in same thing as GETPOOL. However, the struc­ advance of the GET and PUT to permit ture of the buffer pool obtained by BUFFER automatic overlap of reading, writing, and is tailored for the unique requirements of processing. As a result of these differen­ QTAM. The size of each buffer, specified ces, the buffer facilities available for by the user, determines the size of a the basic access methods are relatively nmessage segment. n simple; those available for the queued access methods, are more numerous and flex­ ible. Three aspects of buffering facilities Buffer Assignment Techniques and are discussed in the following paragraphs: Transmittal Modes • Buffer pools the means by which storage may be set aside and initial­ The assignment techniques and transmit­ ized for use as buffers. tal modes are discussed as they pertain to • Buffer assignment techniques - the sel­ basic or queued access methods. ection of particular buffers from the pool. BASIC ACCESS METHODS: In all basic access • Transmittal modes - the manner in which methods, buffers are controlled by the a buffer routine and the using program programmer. He may obtain and return -transmitn the buffer contents to each pooled buffer space using the GETBUF and other. FREEBUF macro-instructions; or he may use storage areas that are not in any pool. The only requirement (normally) is that he specify the buffer to be used as part of Buffer Pools each READ or WRITE macro-instruction. Since he controls the buffer, input A buffer pool is assigned to specific buffers are available as work areas after data control blocks (DCB's). A data con­ completion of the READ operation; output trol block is a region in storage used for buffers are available as work areas prior communication between the user's program, to the execution of the WRITE operation. the control program, and the access rou­ tines. (The method of creating the data Some access methods permit multiple READ control block and its role in the system requests to be queued. In such cases, each are described later. For now, it is suffi­ request may be assigned a buffer dynamical­ cient to point out that the only way to ly, just before the transfer of data obtain access to a data set is by reference begins. To conserve main storage, this to a data control block.) option should be used whenever multiple READ requests are common and the processing Before space in a buffer pool is used time for each record is short. for buffers, information describing the size and number of buffers is stored in the For example, it may be sufficient to use pool area. This is called constructing the a buffer pool containing only 4 buffers, buffer pool. The programmer may assign and even though 15 READ requests are normally construct buffer pools in three different on the queue ~igure 14). At a typical ways. The first method is to define a pOint, 1 buffer (A) may be available in the buffer area when the program is assembled. buffer.pool, 2 may be in use as work areas The structure is created when the program (C and D) , and only 1 -- not 15 -- would be is executed, using the BUILD macro­ assigned to the queue for the input opera­ instruction. This method allows the buffer tion in process (B). Buffers obtained pool to be assigned to more than one data dynamically, after their use as work areas, control block, and thus be available for may be returned to the pool with either a processing more than one data set at a WRITE or a free dynamic buffer (FREEDBUF) time. macro-instruction.

30 QUEUED ACCESS METHODS: With the queued available to the user program; or by which access methods, all control over buffers is output data created by the user program can made automatic, to ensurE~ overlap between be placed in a buffer for output. input, output, and processing. To accomplish these functions, three There are two closely related aspects of transmittal modes are defined~: queued access buffer management that need to be taken into account to make most • Move Mode The GET jand PUT macro- effective use of buffers. Both relate to instructions transfer data from an how frequently data must be moved after its input buffer to a work area, and from a initial entry or creation in main storage. work area to an output buffer. For example, input data records may be: • Locate Mode - GET and PUT do not move data, but provide a pointer to a record • Moved from the buffer to a user work location in a buffer. area. • Substitute Mode - Similar to the locate • Worked on while still in the buffer mode, except that the programmer must area. provide a storage area equal in size to the buffer that is being pointed to. The storage area is exchanged for a buffer segment. The buffer and work area, in effect, change roles.

I Buffer techniques refer to the various Queue of Buffer ways in which the control program can READ Requests I Pool allocate buffers from the pool for use in I input/output operations. Depending on the ~, ,I access method, a number of automatic A buffering techniques are available, as ~ shown in Table 1. 2 I I \ I \ Simple buffering, the most flexible 3 \ B technique, uses one or more buffers for I \ wai ~ each data set, each long enough for a \ maximum length block. I \ 4 I c ~~ Exchange buffering, is used with two • J data control blocks, one associated with an • input data set, the other with an output • I data set. Control is by buffer segment, • 1 D with each segment holding a logical record. I ~ Data need not be moved in storage; instead 15 the control of each buffer segment may be I treated, in turn, as an input area, work I area, and output area. Data chaining is used to allow noncontiguous segments to be Figure 14. Dynamic Buffering treated as blocks. Buffer segments are fixed in length, so that any record length Or, if the input records are also to be changes must stay within the preplanned used as output, possibly after some modi­ length. fication, they may be: Chained segment buffering accomodates • Moved from the input: buffer to a work messages of variable sizes. Since a mes­ area, and from the work area to the sage will normally not fit into a single output buffer. segment, segments are assigned dynamically, • Worked on while sti.ll in the input during data transfer. Address chaining buffer and then moved to the output techniques are used to relate physically buffer. separated 'segments. In this way, the .. Worked on while sti.ll in the input amount of main storage in use for buffers buffer and then be the output from that is controlled by the system, and buffer same buffer. space is used effectively for all transmis­ sion, rather than being allocated on a The two aspects of buffer management fixed basis to lines or terminals not in that affect the movement of data within operation at the moment. main storage are transm~ttal modes and buffer techniques. As described in the detailed publica­ tions, only certain combinations of trans­ Transmittal modes refer to the options mittal modes and buffering techniques are by which input data in a buffer is made used. Here, illustrations will be given of

Data Management 31 Input Buffers OutPl-'t Buffers

A

B

Figure 15. Simple Buffering - Move Mode

only the most common combinations, where needed. The PUT or PUTX macro-instructions input and output data sets are controlled are used to move logical records from the as follows: input buffer directly to the output buffer. Insertion and deletion of records are allowed. This technique is illustrated in INPUT OUTPUT Figure 16. simple, move simple, move simple, locate simple, move exchange, substitute exchange, sUbstitute

SIMPLE BUFFERING, MOVE MODE: Simple buf­ fering for an input data set with three Input Buffers Output Buffers logical records in one block is illustrated ,I.-- Output in Figure 15. Data is moved to a work area In-put-~: I ~ :> large enough for one logical record. Each logical record, after processing, is moved ._p_u_~_~_ro:_~_~_x_._ I to an output buffer, and a new (updated) data set is written. Overlapping of input and output operations is achieved by having GET (Locate) two buffer areas for each data set, as illustrated. Simultaneously: 1) input buf­ Figure 16. Simple Buffering - Locate Mode fer A is filled. 2) logical records are moved from input buffer B to the work area, EXCHANGE BUFFERING-SUBSTITUTE MODE: This and then to output buffer A. 3) the method is especially applicable for fixed contents of output buffer B are being length records where insertions and dele­ written out. The roles of input buffers A tions are expected. Exchange buffering and B are alternated; the roles of output with the substitute mode is illustrated in buffers are alternated also. Figure 17. The illustration shows the status of 12 buffer segments (corresponding This type of simple buffering is the to 4 blocks of 3 logical records each) and most flexible kind of processing, but is an original work area after 100 cycles of not always the fastest, because two moves operation. By now the physical location of are required. Movement of data from an the buffer segments (labeled A-L) is total­ input buffer to the work area is requested ly unrelated to the records (101-108) they by the move mode GET, and to the output contain. A set of tables (at the bottom of buffer by the move mode PUT. the figur~ indicates the current usage of SIMPLE BUFFER-LOCATE MODE INPUT, MOVE MODE THE SEGMENt'S. OUTPUT: In applications where processing does not increase the length of a logical In the example, E, D, and I are in use record, it is practical to process data for input (the only input so far has been while it is still in an input buffer. In record 108); and G, A, and C containing this case, the locate mode of GET is used, records 101-103 are in use for output. and time is saved because only one move is Record 104, in area H has been processed;

32 Record Storage Area

Output ~ ~ _'OP"':> ----'----V

Original Work Area 1M '\ GET (Subs) M 104 H .... 101 G L:~ D 106 F J 102 A 107 K ¢ I B 103 C PUT (Subs) Current Process Process Current Input Input Work Area"- Output Output Block List Pointer List Block

Figure 17. Exchange Buffering - Substitute Mode

record 105 in area L is being processed, to a number of different data sets1 and a and will be placed (lo9ically, but not data set may be referred to through several physically moved) by the PUT substitute concurrently open data control blocks. mode in the output buffer.. The PUT exchan­ Nevertheless, when there is no ambiguity, ges pOinters Land J. Following that, the it is often convenient to talk of opening next GET will exchange pointers J and F. and cloSing a data set (rather than the associated control block). Data access statements in a program, such as GET and PUT, also logically refer to a data set THE DATA CONTROL BLOCK even though their actual reference is also to the control block. The data control block and the procedure Some data sets are opened automatically by which it is initialized provide the key by the control program, and may be indi­ to the system's data handling flexibility. rectly referred to or used in a problem It is by means of the ini"tialization proce­ program without additional opening or clos­ dure caused by the OPEN macro-instruction ing. One example is the catalog data set. that many of the specifications needed for input/output operations, in particular The OPEN routine, at the time of its those dealing with device identification execution, has three primary functions: and buffer sizes, can be made when the job is to be executed rathe:r- than at the time • It completes the data control block. the program is written. • It ensures that all needed access rou­ tines are loaded, and necessary address relations completed. • It initializes data sets by reading or OPEN AND CLOSE MACRO-INSTRUCTIONS writing labels, and performs other related housekeeping operations. Each data set to be di:rectly referred to The data control block is created when by a problem program is associated with a the program is compiled, even though all of data control block that must be initial;ized its fields may not be filled in at that (opened) before any data transfer takes time. place and suitably modified (closed) after all data transfer is completed. Under Information from two additional sources certain circumstances the same opened data is used by the OPEN routines. These sour­ control block may be used to control access ces and the fill-in sequence of the control

Data Management 33 block are illustrated in Figure 18. The This procedure permits full flexibility first is the source program itself. Any to change data control block fields at job parameter stated in the source program DCB time, without requiring that all DCB macro­ macro-instruction (which contains only instruction parameters be restated each nonexecutable data) is used. In general, time a job is run. These macro-instruction only those DCB macro-instruction parameters parameters and possible sources for each should be stated in the source program that are given in the publication, IBM Operating are needed to ensure correct program opera­ System/360: Control Program Services. tion. Other parameters should be omitted, to allow for filling in from one or the Each data set's data control block other of the two remaining sources when the should be closed after use. The CLOSE job is to be executed. In the macro-instruction restores a data control illustration, A is filled first when the block to its original condition, so that it program is compiled. may be reused in the same program for a different data set. The closing operation also writes the trailer label on tape, or completes the data set control block for direct-access storage. In the event any data control block is still open when the task is terminated, the system performs the CLOSE functions automatically.

DeB Macro DD Statement Data Set Label

A e D DATA ACCESS ROUTINES

After all data control block fields have been filled in, the next step is to ensure o that all access method routines are loaded and ready for use, and that all channel command word (CC~ lists and buffer areas are ready, if the access method requires them. DeB Area The selection and loading of the access A method routines is made according to data control block fields that tell the data organization, buffering technique, access language features to be used, input/output DeB Fill-In at OPEN unit characteristics, and other factors. The identification of all needed access Figure 18. Data Control Block Being Filled routines is relayed to the supervisor, In which allocates main storage space and loads them into main storage. They remain The second source of data control block there until the CLOSE routine signals that fields is the DD statement from either the they are no longer in use by that data input job stream or from a cataloged proce­ control block. Access routines are written dure called upon by an EXEC statement in so that the same copy may be shared by all the input job stream. programs in the system that need them. Sharing may be between two data sets within In the illustration, Band C are stated one program, between two independent tasks, in the DD statement but only B is used, and between the user's programs and the since the third field, the intended desti­ control programs. nation for C, is already filled with A. The access routines are treated as if The third source is a data set label. they were a part of the user's program, and Label fields are used to fill in any fields are entered directly rather than through a still blank after the first two sources supervisor call interruption. The routines have been used. For data sets being read, block and deblock records, control buffers, the actua~ data set label information is and communicate with the input/output used. For data sets being created, a supervisor when a request for data input or nmodel" can be designated. The model can output is needed. The input/output super­ be the label of some data set already in visor, part of the supervisor nucleus, the library, or it can be a different DD performs all actual device control. It statement in the same job step. In the accepts all input/output requests, queues example, the second field is filled from them if necessary, and issues them whenever the data set label. a path to the desired input/output unit is

34 available. It also e:nsures that all obtained by OPEN are included in the prob­ input/output requests are '~ithin the extent lem program main storage area (not within allocated to a data set, posts the comple­ -the problem program itself) • tion of each input/output operation, and performs standard input/output error recov­ ery procedures where possible. Figure 19 illustrates the relationships All communication between access method between the user-written program that con...:. routines and the input/output supervisor is ·tains DCB, OPEN, and GET statements, and by means of a standard interface, using the ·the other programs and data areas that are (EXCP) system part of the data accessing operation. The macro-instruction. actions depicted are as follows:

The EXCP macro-instruction will usually not be used directly by programmers, but will be used indirectly through the access 1. The expansion of the DCB macro­ method routines. Those programmers who instruction creates a skeleton data want more control over input/output opera­ control block. tions, or who develop their own access 2. OPEN routines, part of the control methods, may use EXCP. One of the parame­ program, complete the data control ters that must be passed to . the block, load the access and buffer input/output supervisor by the EXCP is a control routines, and prepare buffer pointer to a list of channel command words, areas and CCW lists. in the user's program area, that are to be 3. GET refers to the data control block, used in the input/output operation. which routes control directly to an access routine. 4. The access routine handles deblocking, One of the functions of OPEN is to and returns control directly to the prepare and place into proper format the problem program. It may also request lists of CCW's to be used by the access an input operation by EXCP. routines. These lists, the access routine, 5. The input/output supervisor performs and any buffer areas that are automatically the operation, or queues it if the channels are busy.

Problem Program I Pool I I ./ Data Control BI~Ck __ --.... I /,,/// 1 1.- - -- : CDDCBL~:------11 11 .. _____ ~ I -- ~ I OPEN ®OPEN ____-r ______~------s~v~c~:(O~P-EN~)------~~ Routines

®GET I I I I cp I I Access Routines 0 I I/O Buffer Controls I ~ Supervisor Start r-______s_VC_rl(E_XC_P~) ______~v/ Block - Deblock I/O etc _ 1 I

Figure 19. Actual Program Flow That Starts on Input/Output

Data Management 35 Table 1. Access Method Summary r------T------T------"r------;..------T------T------, I Organization I Sequential IPartitioned I Indexed Sequential I Direct I Telecommunications I t------t------T------t------t------T------t------t------T------~ I I I I I QISAMI I I I I I I I I I t------T------~ I I I I I Access Method I QSAM I BSAM I BPAM I LOAD I SCAN I BISAM I BDAM I QTAM I BTAM I t------t------t------+------t------t------t------t------t------t------~ I Primary Macro- I GET, PUT I READ I READ, WRITE I PUT I SETL, GET, I READ I READ I GET I READ I I Instructions IPUTX I WRITE I FIND, STOW I I PUT X I WRITE I WRITE IPUT I WRITE I I I I I I I I I I I I t------t------t------t------t------t------t------t------t------t------~ I Synchronization I Automatic I CHECK I CHECK I I I I I I I lof program with I I I I I I I I I I I input/output I I I I Automatic I Automatic I WAIT I WAIT I Automatic I WAIT I I device I I I I I I I I I I t------t------t------t------l------t------t------t------t------t------f IRecord type ILogical F,V I Block IBlock (Part I I I I IMessage, IBlock U I I transmitted I Block U IF,V,U lof a member) 1 Logical F,VILogical F,VILogical F,VIBlock F,V,UISegment, I I I I I IF, V, U II I I lor Block U I I t------t------t------t------t------t------t------t------t------t------f I Buffer creation I BUILD I BUILD I BUILD I BUILD I BUILD I BUILD I BUILD I BUFFER I BUILD I I and IGETPOOL IGETPOOL IGETPOOL IGETPOOL IGETPOOL IGETPOOL I GET POOL I IGETPOOL I I construction I Automatic I Automatic I Automatic I Automatic I Automatic I Automatic I Automatic I I Automatic I t------t------t------t------... ------+------t------... ------t------t------f I I Automatic: IGETBUF IGETBUF I Automatic: "I Automatic: IGETBUF IGETBUF 1Automatic; IGETBUF I I Buffer I Simple IFREEBUF IFREEBUF I Simple I Simple IFREEBUF IFREEBUF 1Chained IFREEBUF I I Technique I Exchange I I I I I Dynamic I Dynamic I Segment I Dynamic I I I I I I I IFREEDBUF IFREEDBUF I IFREEDBUF I t------t------t------t------t------t------t------t------t------t------f I Transmi ttal modes I Move I I I Move I Move I I I Move I I I (work area/buffer) ILocate I I 1Locate 1Locate I I I I I IL ______.1.I Substi______tute .1. I ______.1.I ______LI ______.1.I ______.1.I ______.1.I ______.1.I ______.1.I ______JI

Data Management 37 SECTION 4: PROGRAM DESIGN AND PREPARATION

Operating System/360 provides a number general, the first load module used in of facilities to the programmer for his the performance of any task, may inter­ assistance in planning and coding a connect with other load modules named p:t'o<,fram. This section describes the during the time the task is performed. var10US techniques that the programmer may Modules are placed wherever storage is use in constructing his program, and spe­ available, relocated, (i.e., initial­ cial features he may request in his coding ized to execute from a chosen location) by means of assembler language macro­ and interconnected dynamically. Over­ instructions. (Some of 'the features are lay of entire load modules may take also available to use:rs of compiler place, and individual load modules may languages.) Also described is the flow of sometimes be shared between different control at the time these macro­ tasks in a multitask operating environ­ instructions are executed. ment. The same sequence of instructions, in the appropriate one of its three forms of PROGRAM SEGMENTATION source, object, or load module, can be used with little or no change at any of the specified times as a subprogram of a larger Techniques for designing large programs sequence of instructions. as smaller, more easily managed subprograms have been used for many years. There are many advantages in doing this. For instance: large programming jobs can be PROGRAM STRUCTURES assigned to several diffe:rent programmers; common subroutines can he reused; program testing and maintenance a:re simplified; and When a new task is created, the control each subprogram can be written in ,the program is given the name of the first load source language that is most appropriate. module to be executed. The named load Operating System/360 adds a new dimension module may (but needn't) be loaded into to the flexibility availal?le in program main storage in one operation; and it may design. Now subprograms may be combined at (but needn't) be interconnected with other four distinct times during the cycle from load modules in the course of the task's program statement to complete job performance. Depending on the programmer's execution: choice, the code executed on behalf of a task -- in this context, a program can • Compilation or Assembly Time. Sub;r:ou­ be categorized as one (or a combination) of tines and separately written sohrce the following program structures: decks may be combined as the input to a single compilation or assembly. 1. Simple Structure. A single load • Linkage Editing Time. Separately com­ module contains all of the user code piled object modules and load modules required for task performance and is can be included as the input to a loaded into main storage as an entity. single linkage editor run, to produce a It is immaterial whether the load single composite load module for execu­ module may itself have been derived tion. If overlay techniques are used, from other load modules as a result of the entire load module need not be the linkage editor run, or whether contained in available main storage. other load modules may be employed as • Job Entry Time. Load modules that a result of requests for supervisor correspond to phases of a multiphase services. procedure can be specified in EXEC 2. Planned Overlay Structure. In this statements as individual job steps. case, the required code is processed Interconnection and interstep dependen­ by the linkage editor into a single cies are handled by the job scheduler. load module, just as with programs By segmenting a procedure in this way, having simple structures. The only the greatest economy is obtained in the difference is that all sections of the allocation of space on direct-access load module are not loaded at the same devices. Only the space required for time. Instead, segments of the pro­ one step of the procedure need be gram are identified which need not be assigned at one time. in main storage at the same time. The • Task Performance Time. The load module same area of main storage is used and named in an EXEC statement, or in reused by different program segments.

Program Design and Preparation 39 3. Dynamic Serial Structure. More than The same load module may be associated one load module is called upon during with a number of different program names, the course of program execution. All each of which can correspond to a different linkages follow standard linkage con­ entry point. At linkage editing time, a ventions, with the control program primary program name and up to five aliases acting as an intermediary in setting may be specified. All names and the cor­ up subprogram entry and return. Pro­ responding entry points are contained in gram execution is serial, which is the the directory of the library in which the same as in types 1. and 2. load module is stored. In addition, a load 4. Dynamic Parallel Structure. More than module can dynamically specify additional one load module is called upon during names and entry points. These are not the course of program execution, and retained when the space used by the load the supervisor is an intermediary just module is released. as in type 3. In this case, however, the execution of two or more subpro­ In the example, when SIMPLE completes grams is allowed to proceed in paral­ its execution, it notifies the supervisor lel. To accomplish this, each asyn­ by the system macro-instruction RETURN. At chronously operating subprogram is the same time, it places in a standard established as a task and follows register a return code, by which it reports normal task rules. using conventions established by the user -- how it was completed: -normally,­ Most programmers preparing programs to -type X condition encountered-, -type Y run under Operating System/360 will not be condition encountered,n and so on. The concerned with all of the variations possi­ supervisor, recognizing that SIMPLE is the ble in program segmentation and program only load module required by the task, will flow. The operating system is designed to then terminate the task. handle programs that use few or many of the variations, either in a single-task or a SIMPLE is written so that it could also multi task environment. The following para­ be used as a subprogram of a larger graphs discuss more fully the program program, either one formed by the linkage design approaches available to the program­ editor with SIMPLE as an input, or in a mer. dynamic structure. It begins with a SAVE macro-instruction that expands to an instruction sequence that saves designated registers. The RETURN macro-instruction, in addition to setting the return code register, restores the saved registers. If SIMPLE STRUCTURES there had been a higher level program, control would then have been passed back to it. Figure 20 ,illustrates a simple program structure. A task has been attached with SIMPLE itself may be a composite of the specification that the first load several load modules that have been com­ module to be executed is SIMPLE. The bined into a single load module by the supervisor finds SIMPLE, allocates space linkage editor, as shown in Figure 21. for it, and then loads the entire load This does not change the fact that SIMPLE module prior to execution. The name SIMPLE is a program with a simple structure (since designates not only the entire set of code it is, at execution time, a single load contained in the load module, but also the module, all of which is in main storage) • particular entry point to be used.

SIMPLE User's Program Area

--t--... SAVE SUBPROG SAVE SIMPLE

---.... SIMPLE SAVE

CALL SU'PROG /

_-----+-RETURN RETURN +--1- RETURN

Figure 20. Execution of a Load Module Within a Task Figure 21. Subprogram Within a Program

40 In the figure, two subprograms are 1. Completion of a timing interval. shown, the first calling upon the second 2. Program error interruptions. named SUBPROG. By definition the calling 3. Unusual end of task. subprogram is at a higher control level 4. End of subtask. than the called sUbprogram. In this exam­ ple, the supervisor is not involved in the Completion of a timing interval by use subroutine linkage. The reference between of the STIMER macro-instruction, the proc­ CALL SUBPROG and the address SUBPROG is essing time used by anyone task (which may resolved as part of the linkage editor be significantly less than total elapsed process. The RETURN in SUBPROG restores time) may be measured. For example, the the registers and branches to the higher programmer may request notification after control level. The supervisor is not one second of task time. such an interval called. Internal linkages of this sort are may be set up just prior to entering a more efficient in terms of execution speed possibly endless loop in a program under than are linkages where the supervisor is test. As a parameter of the macro­ involved. instruction, the programmer specifies the entry point in the current load module to Within the logical flow of a simple­ be entered after the specified time structured load module, other load modules expires. Thus, if the program overstays may actually be called upon indirectly as its alloted time in the loop, control is supervisor services. This can take place passed to a routine that can take indirectly as a result of a request for corrective "action. If an exit is made from supervisory service, or in a slightly dif­ the loop before the time interval expires, ferent way, as with the input/output and the TTIMER macro-instruction may be used to buffer control routines described in Sec­ cancel the interruption request. A further tion 3. In the latter case, the OPEN discussion of the interval timer functions function incorporates additional load appears later in this section. modules as if they were logically part of the same simple logical flow of the single Program error exits are requested by the load module. Linkage to such added load set program interrupt exit (SPIE) macro­ modules is made via the data control block. instruction. The programmer may specify The routines are thus used directly, with­ the types of program interruptions his out any supervisor ac·tion, except when a subroutine will handle, and the types the hardware input/output operation is actually supervisor is to handle. The programmer required. most likely will want to handle conditions such as overflow and underflow from Note that the sequences of code, lines arithmetic operations, and let the supervi­ and arrows in this and other figures in sor take normal action for the others, such this section denote logical flow, not as execution of a privileged instruction actual flow. That is, hardware interrup­ and violation of storage protection. tions may cause an actual flow quite dif­ ferent from the flow that the programmer An abnormal end of task exit is set up plans. Actual flow, described later in by the specify task abnormal exit (STAE) "Task Management,· Sect:ion 6, is not a macro-instruction. This exit is taken if matter of concern to the programmer when he the task is abnormally terminated internal­ designs his program. ly or externally. An internal termination is one resulting from the execution of the abnormal end of task (ABEND) macro­ Deferred Exits instruction. This may be issued by the user's program after the determination is made that an uncorrectable error has Figure 21 showed how a. subroutine may be occurred. An external termination is one entered at a predictable point in the initiated by the supervisor program, for logical flow of a load module. There are example, in the event of storage protection some situations where the exit point may violation or the expiration of the speci­ not be known in advance, but depends on an fied time for the job step. interruption whose time of occurrence is unpredictable. Such subroutines may nev­ End of subtask. In multitask ertheless be included by the linkage editor operations, the completion of any subtask in a load module. Included also must be can cause an entry into a specified point system macro-instructions that the program­ in the program of the higher level task. mer uses to describe the conditions for entry into the subroutines, as well as An example of a deferred exit is shown their entry points. in Figure 22. In this case, a subroutine named FIXUP is to be entered in case of Four conditions may be specified to floating-point overflow. The SPIE macro­ achieve a deferred exit from the main instruction specifies the exit condition, logical flow: namely, floating-point overflow. At the

Program Design and Preparation 41 User's Program Area Supervisor Area

SIMPLE Interruption ENTRY SAVE Handler SPIE •••

FP

RETURN Interruption RETURN Handler

Figure 22. Deferred Exit to Subroutine

floating-point instruction ftFP,· an ,gram and tables (inserted by the linkage overflow occurs, causing a program inter­ editor) needed to control the overlay exe­ ruption. The supervisor handles the inter­ cution. The root segment remains in main ruption as specified by SPIE, routing con­ storage at all times during program execu­ trol to FIXUP. tion. Program segments Band C occupy the same ,area of main storage, but at different PLANNED OVERLAY STRUCTURES 'times during the course of program execu­ ,tion. Such segments overlay each other, ;and are called exclusive segments. Some tasks may require programs that are too large to be placed in main storage all at one time. In these cases, the simple program approach described above is not adequate, and the programmer should consid­ er designing the program using a planned j Entry Point ~ overlay structure. Programs that can be logically divided into major sections are A well suited for planned overlay execution. A planned overlay structure is a single load module, created by the linkage editor program in response to overlay control statements. Unlike simple structures, how­ ever, it is not loaded into main storage all at once. The logical segments of a planned over­ Figure 23. Overlay Tree Structure lay program are loaded into main storage as required, each occupying an area which may at some time be used by a different During the execution of an overlay pro­ segment. The relationship of program seg­ gram, overlaid segments are destroyed rath­ ments must be planned in advance by the er than being saved on secondary storage programmer. The type of flow can be illus­ and then restored. When a previously over­ trated best by the tree structure shown in laid segment is needed again, a fresh copy Figure 23. :is loaded. For this reason, any data area used for communication by two or more Each branch (A, B, and C) of the tree exclusive segments must be included as part structure represents a segment. The verti­ of a higher segment that remains in storage cal length of each branch represents the 'with either of the exclusive segments. amount of main storage used by the segment. Two segments that may be in main storage The root segment (A in Figure 23) con­ at the same time, such as A and B, or A and tains the entry point of the overlay pro- C in the example, are called inclusive

42 segments, and are in the same path. A path impossible. For applications of this gen­ consists of a given segment, the root eral nature, the operating system provides segment, and all interm,ediate segments, as a means for calling subprograms represented in the tree structure. dynamically, during the performance of a task. This capability is possible because: Upward calls (toward ·the root segments)· are always to segments already in main • Program retrieval by name is a normal storage. Such calls a:re always direct, supervisor service. just as if they were contained in a simple • Main storage space is allocated dynami­ load module. Since this type of control cally by the supervisor. flow is most efficient, ·the designer of the • The task concept treats programs as overlay structure should attempt to capi­ resources. talize on it. • Standard subroutine linkage conventions permit any load module to be executed Downward calls are always indirect, but as a subroutine. will only require the assistance of the overlay supervisor (a part of the control Four different forms of dynamic program program) if the entry points referred to construction are provided by the operating had not been used since the segment was system. They are referred to here by their loaded. If the called segment is already system macro-instructions, even though the in storage, no segment loading is required. same linkages may be provided by a compiler. The four forms of dynamic lin­ The flow of control between exclusive kage are: LINK, XCTL (transfer control) , segments, and downward calls to segments LOAD, and ATTACH. not in main storage are also indirect. 'l~hey always require the assistance of the The first three, which provide sequen­ overlay supervisor, which loads a fresh tial program execution, are discussed copy of the required segment before com­ below. The fourth provides parallel pleting the branch. (asynchronous) program execution and 1S described in "Dynamic Parallel Structures." Many requirements to load segments will impair the efficiency of program execution. Two additional features are available to m1n1mize this loss of efficiency. The Link Macro-Instruction first is a structure variation in which two or more different paths can be in storage at the same time. Each different path LINK is used to pass control from one occupies a different storage area; each load module to another in much the same way such storage area is called a region. One as CALL is used to pass control to a region might contain the main program and subprogram within a single load module. Of the other might have a number of subrou­ the two load modules involved, the first is tines used by several different paths in at a higher control level than the second. the first region. The second feature, The operation of LINK is illustrated in useful in multitask opera.tions, allows seg­ Figure 24. Three different load modules ment loading to proceed in parallel with are shown: their names are "DYNAMIC", PIA," other processing, so tha,t program load time and "B." Each linkage involves supervisor may be overlapped. This feature is con­ action. trolled by the segmen1t load (SEGLD) and segment wait (SEGWT) system macro­ instructions. The program DYNAMIC is the only one of the three named at the time the task was created. It could, for example, have been named in the EXEC statement of a job step. DYNAMIC SERIAL STRUCTURES The supervisor finds DYNAMIC, allocates space, and fetches it just as with a simple program structure. DYNAMIC is the highest For many applications, a simple program level load module used for the task. Exe­ structure is inadequate, even in a planned cution of DYNAMIC proceeds until the macro­ overlay form. For example, a large number instruction "LINK API is reached. One of of subroutines may be called on, but their the machine instructions generated by LINK selection and sequence of execution depend A is a supervisor call (SVC); the on examination of each data record or subprogram name "An is a parameter in the transaction to be processed. The large linkage. The supervisor proceeds to find, number of subroutines makes it impractical allocate space for, and fetch subprogram A. to have all of them in main storage at The linkage to A is effected, and program once. Furthermore, the effectively random execution takes place serially. Subprogram sequence of use makes a planned overlay A is at a lower control level than DYNAMIC. operation uneconomical, difficult, or All RETURN macro-instructions cause control

Program Design and Preparation 43 to be passed to the load module at the next programs may be nested, using three levels higher control level. Hence, a RETURN from 'of control. The only limit on the number A, via the supervisor, will go to DYNAMIC 'of control levels is the availability of at the instruction following LINK A, and main storage. the storage area used by A may be made available for reuse. Later, when LINK B is In this example, program B is used encountered, the same procedure is followed twice, once at the third control level and as with A. If no other storage is availa­ once at the second level. If B is still in ble, subprogram A may be overlaid by B. main storage and navailable" when called (Since DYNAMIC is to be returned to, that 'for the second time, the same copy of B is, since it is at a higher level of will be used rather than a new copy (which control than either A or B, it is not 'would require additional loading) • subject to overlay by either of those programs) • When DYNAMIC's RETURN is reached, the supervisor recognizes that there is no higher level of control, and Transfer Control (XCTL) Macro-Instruction causes the task to be terminated. XCTL is used to pass the logical flow of control dynamically to load modules corresponding to successive phases of a serial program. Its operation is similar to that of LINK in these ways: DYNAMIC A • The flow of control passes SAVE sequentially; that is, the two load SAVE modules involved do not operate concur- rently. • Standard linkage conventions are LlNKA observed, and all parameters are passed * RETURN explicitly. • Acting as the intermediary, the super- visor finds the program, allocates space, and fetches it. LlNKB B Operation of XCTL is different from that SAVE of LINK in several important respects: * • The program receiving control is con­ sidered to be at the same control level RETURN RETURN as that transferring control. • The transferring program is considered * Supervisory Action to have been completed, and its storage Figure 24. The LINK Operation area may be made available for reuse, even by the program receiving control. All parameters used by subprograms A or • Work or storage areas in the transfer­ B are explicitly passed as part of a ring program may not be used by the standard linkage procedure. This is neces­ program receiving control, since they sary because the load modules A, B, and may have been overlaid. DYNAMIC have been processed by the linkage • XCTL is used instead of RETURN. Conse­ editor independently; no external symbol quently, any needed register and indi­ resolution has taken place between them. cator restoration must be done at this time. The LINK procedure is speeded up consid­ erably if a copy of the program is An illustration of the XCTL relationship "available" in main storage when the LINK is shown in Figure 26. is issued. A program may already be in main storage because it was used earlier, DYNAMIC, the highest, or first control or because it was fetched in anticipation level program, links to subprogram A. A in of the current need with a LOAD macro­ turn transfers control to B. A is consid­ instruction. A copy of a program that has ered to be completed, and is replaced by B already been used is "available" for reuse at the second control level. B may overlay under certain constraints, discussed in A if there is not enough storage space for nprogram Design Facilities." both. Although work areas in DYNAMIC could be passed to A, and A could pass the same A LINK macro-instruction may be imbedded work area to B, A cannot pass work areas to within a linked program, so that nesting B contained in A. When B, at the second takes place. Figure 25 illustrates how level, issues its RETURN, control is passed

44 to the next higher level of control LOAD, however, specifies to the control (DYNAMIC). When DYNAMIC issUes its RETURN, program that the named load module is to be the supervisor recognizes that there is no fetched and then retained in storage until higher level of control, and the task is either a DELETE macro-instruction is terminated. issued, or the task is complete. LOAD itself does not cause control to be passed to B; it merely causes B to be loaded. LOAD Macro-Instruction

The LOAD macro-instruction was designed Figure 27 (b) shows how LOAD may be primarily for those situations in which used. Here the programmer is assured that tasks must make frequent dynamic use of the the same copy of B can be used each time same load module; and the load module has LINK B is executed, with no unnecessary the characteristics alluded to earlier program fetches. which make it available for reuse. A typical situation is shown in Figure 27 (a), in which load module B is required Figure 27 (c) shows a more efficient use several times during the execution of of LOAD, which takes advantage of the fact DYNAMIC. Since LINK alone is used to that LOAD returns B's entry point address indicate the need for B, the main storage to DYNAMIC. This allows direct linkages, occupied by B may be released after each using BRANCH-type instructions, and avoids execution of B. This may require repeated any supervisor intervention other than in fetches of B at each successive LINK. the, execution of LOAD and DELETE.

DYNAMIC A

SAVE .. SAVE SAVE * * LlNKA LINKS * * RETURN LINKS RETURN

* S .. RETURN * .... SAVE

RETURN * Supervisory Action

Figure 25. Nested Subprograms

DYNAMIC A

---r---. SAVE SAVE SAVE * * LINK A XCTL S RETURN

-----+-- RETURN

* Supervisory Action Figure 26. Use of XCTL Macro-Instruction

Program Design and Preparation 45 DYNAMIC DYNAMIC DYNAMIC LINK macro-instruction may be used within a planned overlay program. The usual consid­ SAVE SAVE SAVE erations apply regarding the possible over­ lay that can take place when XCTL is used, LlNKB LOAD B in which the load module releasing control LOAD B BRANCH B is subject to overlay. LlNKB LlNKB LlNKB BRANCH B

LlNKB LlNKB BRANCH B DELETE B DELETE B RETURN DYNAMIC PARALLEL STRUCTURES (a) RETURN RETURN (b) (c) The ATTACH macro-instruction creates a new task that can proceed in parallel with Figure 27. Uses of LOAD Macro-Instructions other tasks, according to the resources it needs and the condition of other tasks in the system. In many ways, the ATTACH function is similar to LIN~. The main difference is that LINK is a request for serial execution, where ATTACH is for par­ allel execution. Since ATTACH creates a task that can have resources allocated to it, the execution of ATTACH is more costly Planned Overlay versus Dynamic Structures in supervisor time than is LINK. In some circumstances the use of ATTACH within a problem program can be extremely helpful; The control program facilities for in others, it is unnecessarily wasteful. planned overlay structures and dynamic The following four examples will serve to fetching of load modules are both designed clarify this point, and illustrate the to meet the need for executing programs program flow that takes place when ATTACH larger than the storage areas available. is used. In all four examples, two load They each have their advantages. Planned modules are involved, A and B. During the overlay structures can be more efficient in execution of A, the need for execution of B terms of execution speeds, because the is detected at point (D); at (R) the linkage editor procedure permits direct completion of B is required. references by one segment to values whose locations are identified by external sym­ Example 1 (Figure 28). Detection and bols in another segment. There is no need requirement for completion occur together. to collect such values in a consolidated LINK should be used, since there is no parameter list, as required for supervisor­ chance for parallel execution. assisted linkages. Furthermore, when using a planned overlay, supervisory assistance is needed to locate a single load module in the library. When using a dynamic structure, many load modules need to be located in order to execute an equivalent A program. Also, a planned overlay optimizes Indicates Program Execution the use of main storage.

These advantages tend to diminish as (D) (R) LlNKB I I user's problems get more and more complex, I _rr------..., I I II I I particularly when the logical selection of I I I I I I subprograms depends on the data being proc­ II I I essed. In this situation, the use of I I II I I dynamically constructed programs is usually I I I I a better solution than planned overlay programs. Furthermore, load modules fetched dynamically may be reused by other tasks; segments fetched using the planned overlay structure cannot be reused. Although both approaches are solutions to u- the same problem, there is no prohibition against using combinations of the two. A load module, linked to dynamically, may Figure 28. Immediate Requirement for Sub- itself operate in the overlay mode. The program

46 Example 2 (Figure 29). Detection occurs Example 4 (Figure 31). Detection again before requirement for completion. Fur­ occurs before requirement for completion; thermore, an appreciable delay in the exe­ in this case there are no significant cution of A is expectE~d before B is delays expected in either A or B. LINK required to be completed. B consists should be used, at any convenient point entirely of calculations with no inherent between (~ and ~). No advantage would be delays. A should attach B with a lower gained by using ATTACH. priority than itself. Otherwise, B would be executed in its entirety before A could regain control, and there would be no parallel execution.

A A (Olr=l

(D) ATTACH B B (R l LINKS ----L-III I ~ ~=Iu..--I I WAIT 1/0 I I I I I I LJ Figure 31. No Delays Expected ( 1/ 0 Completed) The general rule is simply that ATTACH (Rll:j ( B Already Completed) should be used only when· a significant amount of overlap between the two ta~iks can be achieved. Figure 29. Delays Expected in Higher Level Further discussion of the role of the Subprograms ATTACH macro-instruction, the use of prior­ ities, and the system's control of t~sks is described in Section 6, -Task Management." Example 3 (Figure 30). Detection occurs before requirement, as in Example 2. In this case, A expects no inherent delays, but B does. A should ATTACH B, giving B PROGRAM DESIGN FACILITIES higher priority. Execution of A proceeds during the delays in B. Before coding, the programmer should be familiar with the techniques involved in producing reusable programs and the special facilities that he may request. The fol­ lowing paragraphs describe these facilities A and some recommended techniques in using them.

(D) q B I I REUSABILITY I I ..~ WAITI/O U I I I I I I All load modules in the library are ~ placed in one of three categories, as ~I I U(t~Pletodl specified by the programmer at the time of I linkage editing. The three categories are: not reusable, serially reusable, and reen­ (R) ~ W~IT B ~ ( B Already Completed) terable. Not reusable. Programs in this category Figure 30. Delays Expec·ted in Subprogram are fetched directly from the library when

program Design and Preparation 47 each is requested for use. These programs provided reenterable programs.) A load alter themselves during execution, and will module of this category can be executed not execute correctly if entered again. correctly even though the protection key in the program status word during task exe­ Serially reusable. A load module of cution is different from the supervisor this type is designed to be self­ storage key. This is possible because the initializing, so that any portion modified protection key comparison must be satisfied in the course of execution is restored only when the contents of the addressed before it is reused. The same copy of the storage area are to be altered. The load module may, therefore, be used contents of storage areas containing reen­ repeatedly during performance of a task. terable programs are not altered in any way In addition, a serially reusable load during execution. module may be shared between different tasks, provided that both tasks were creat­ If a reenterable load module is not ed from the same job step. A further fetched from the link library, but rather condition for use of the load module by from a private library or the job library, more than one task is that it not be in use it is made available only to tasks origi­ by one task at the time it is called for by nating from the same job step. another. If it is, a new copy will be fet.ched. If the programmer wants to avoid the automatic fetching of a second copy of the module in these circumstances, he may do so by use of the enqueue (ENQ) and DESIGN OF REENTERABLE PROGRAMS dequeue (DEQ) macro-instructions. These enable several tasks to place themselves in a queue, waiting for the load module to A reenterable program is designed to use become available. The operation of these the general purpose and floating point macro-instruction is explained in Section 6 registers for addressability and variables under "Event Synchronization." where practical, and to use temporary stor­ age areas that nbelongn to the task, and Reenterable. Such a program is designed are protected with the task's storage pro­ so that it does not in any way modify tection key. Temporary or working storage itself during execution. It is areas of this sort can be provided to the "read-only-. Reenterable load modules reenterable program by the calling program, fetched from the system's link library which uses a linkage parameter as a pointer (defined fUrther in Section 5, nJob to the area. Temporary storage areas can Management") are loaded in storage areas also be obtained dynamically by the reen­ protected with the same storage key that is terable program itself, using the GETMAIN used for the supervisor program. Since macro-instruction. This macro-instruction only the control program operates with a is a request to the supervisor to allocate matching PSW protection key, such programs additional main storage to the task, and to are protected against accidental modifica­ point out the location of the area to the tion from any other user programs. Since a requesting program. Note that the storage reenterable load module is never modified area obtained is assigned to the task, and during its execution, it can be loaded not to the program that requested the once, and used freely by any task in the space. The space may be subsequently system at any time. Specifically, it can returned to the supervisor's control by a be used concurrently by two or more tasks FREEMAIN macro-instruction, or by task com­ in multitask operations. One task may use pletion. it, and before the module execution is completed, an interruption may give control If a reenterable program is interrupted to a second task which in turn may reenter for any reason, the register contents and the module. This in no way interferes with program status word (PS~ are saved by the the first task resuming its execution of supervisor in an area associated with the the module at a later time. interrupted task, and restored later when program execution is to continue for that In a multitask environment, simultaneous task. No matter what use is then made of use of a load module is considered to be the reenterable module, the interrupted normal operation. Such use is an important task can resume its use of the module at a factor in minimizing main storage space later time. The supervisor merely keeps requirements and program reloading time. the task's working storage area intact, and Many of the control program routines are when required, restores the contents of the written in reenterable form, so that they saved registers and the program status can be shared between tasks, and reused word. The reenterable load module is not within a single task. (The data storage affected, and is unaware of which task is and retrieval routines that are requested using it at any instant. Each task will during execution of the OPEN macro­ have its own temporary storage area for use instruction are examples of supervisor- by the reenterable module.

48 Shared use of a reenterable program is tions, restart may be initiated by macro­ illustrated in Figure 32. In this example, instructions or operator command. the shared program is READER, and the tasks (READ 1 and READ 2) are part of the job When the restart is executed, control is scheduler function, simultaneously reading normally given to the standard restart two input job streams. location, which is the instruction immediately following the CHKPT macro­ instruction. The programmer can specify his own restart location when additional action is required to make the program restartable. The checkpoint/restart facility does not automatically copy any data sets. The programmer should locate checkpoints at Task those points in his program where restarts I READ 1 are easiest. Buffer and Task - Work Area for Task READ 2 READER (Program) READ 1 SAVE TIMER -- -- v GETMAIN':::: -- The interval timer is optional on some -- models of System/360, standard on others. RETURN Buffer and It is used by the operating system for Work Area control program functions, and may also be for Task used by user-written programs by means of READ 2 three different supervisor macro­ * Supervisory Action instructions. Figure 32. A Reenterable program that The control program makes use of the Requests Its Own Temporary timer in two ways: to ensure that the Storage maximum time for the job step, specified in the EXEC statement, is not exceeded; and to make job step time available for accounting purposes. CHECKPOINT AND RESTART A user-written program can use the interval timer feature through three dif­ Checkpoint is a facility of the control ferent macro-instructions. The first program that can be used (with the CHKPT facility provides access to a simulated macro-instruction) to permit temporary real-time clock maintained by the supervi­ removal of a job, or to minimize lost time sor. The clock (or pseudo-clock, as it is due to machine failure or external error. sometimes calle~ is set by the console When the CHKPT macro-ins1:ruction is execut­ operator after he loads and prepares the ed, the control program saves all the main operating system to process the storage areas and control information need­ installation's work flow (initializes the ed to restart from the checkpoint. system), and is updated periodically as long as the system is not in the stopped After execution of CHKPT, control is state. The clock can provide both time of returned to the user's program. processing day and calendar date. The TIME macro­ continues as if the checkpoint function had instruction is used to query the supervisor not been performed. The checkpoint output at any time during program execution; the may be printed by a debugging facility response is time and date. called the test translator as a debugging aid. The second facility is the ability to Restart is the procedure used to restore request that the supervisor communicate and run a previously checkpointed job step. with a problem program after a stated At restart, the control program retrieves period of time. The set timer (STIMER) the checkpoint control information, ensures macro-instruction is used for this purpose. that volumes are correctly mounted, and Intervals requested are either real time repositions tapes. All programs and data (actual elapsed time) or task time. Task are restored to the locations occupied at time is accrued only while a task is using checkpoint time, and the job step the central processing unit. It does not continues. Depending on the exact condi- include time in a wait condition.

Program Design and Preparation 49 Using STlMER, the programmer may request control of program execution time, and that the task be placed in a wait condition post-execution editing to give programmers until a real-time interval is completed. a wide range of test capabilities. The He may also request that the task be primary control over test translator opera­ allowed to continue but that at the end of tion is by means of a series of system either a real-time or task time interval, macro-instructions that are assembled and control be given to the sUbroutine linkage edited with the program being test­ designated in the STIMER macro-instruction. ed. In some cases, the programmer may want to find out how much time remains in a The general procedure is to produce requested but incomplete interval, or to object modules without mixing test instruc­ reset a previous interval. These functions tions with user's program instructions. are provided by the third facility, the All test instructions are placed in a test timer (TTIMER) macro-instruction. separate control section. The advantage of this approach is that the test instructions can be deleted after correct program opera­ Some of the possible applications for tion is achieved, or they can Qe changed these facilities are: without requiring reassembly of the parts of the program being tested. (Deletion and • Time and date -stamping- of messages, replacement of control sections is a normal data sets, and printouts. The telecom­ function of the linkage editor.) In addi­ munications package (QT~ uses the tion to saving time, the risk of introduc­ timer in this way. ing new errors by manipulating the original • Restarting a task after a predetermined source module for reassembly is minimized. time. Telecommunications line polling One obvious way of doing this is for the can be done on a periodic basis, rather programmer to place his test instructions than continuously, during low traffic 'in one source module and his program hours. instructions in another, and assemble them • Program execution analysiS and program separately. debugging. Phases of a long program can be timed individually under a var­ When preparing a program, the programmer iety of conditions. In program debug­ will often find it convenient to mix pro­ ging, the timer can be used to limit gram and test instructions in the source the amount of time spent in executing module. The assembler will separate them each section of a program, thus allow­ for him and produce an object module con­ ing a single test run to continue in taining the test instructions as a separate spite of loops or other time-consuming control section. If, subsequently, a dif­ action that might occur unexpectedly. ferent set of test instructions is required, they can be assembled indepen­ dently of the user's program instructions, and combined by the linkage editor with the DEBUGGING FACILITIES previous assembly, where they will replace ,the earlier version of the test instruc­ tions. The test instruction control sec­ Even though the cost of program debug­ tion is generated as nonexecutable data, ging may be significant, the cost of an and controls the test translator during undetected program error can be far execution of the program. The assembler greater. The goal of the operating system also produces a symbol table that is later testing facilities is to minimize the time used to prepare the test data output in the and cost of program testing. The primary proper format. emphasis is placed on source language debugging facilities provided by the oper­ The load module to be tested is prepared ating system languages and compilers. Com­ by the linkage editor from its components piler source language debugging statements (object modules or other load modules) • and facilities are described in the indivi­ The TEST option is specified for the lin­ dual language publications. The debugging kage editor run in which the test control facilities provided for users of the assem­ section appears as input. The TEST option bler language are explained in the follow­ specification is, furthermore, placed with ing paragraphs. Uhe load module on the library. When a program to be tested executes the TEST OPEN macrO-instruction, supervisor ASSEMBLER LANGUAGE PROGRAM DEBUGGING: call instructions are inserted by the test TEST TRANSLATOR translator at locations where testing is to be performed. As a result, the supervisor routes control to the routine that performs The test translator combines a series of the requested test service. No special source language macro-instructions, some -test" register is used. The supervisor

50 call linkage does not affect the contents TEST OUTPUT of any register, and test operation places no limitations on the use of registers by the programmer. After the test function is Test data produced during the execution performed, control is returned to the orig­ of a load module is placed on external inal program. Although part of the user's storage for later editing. The test output code is displaced with the inserted super­ editor routine is executed after the actual visor calls, the test translator ensures test run. The formats indicated in the that the logical flow in the user's program symbol table produced by the assembler are is unaffected by the displacement. The used, unless test macro-instructions have inserted supervisor calls can be removed by specified an overriding format. the TEST CLOSE macro-instruction. TEST OPEN and TEST CLOSE can be issued any number of times during the execution of a The time used for processing test output load module. is minimized, since: Two kinds of test stat.ements are provid­ ed, action and control. Action statements • Limits stated by the installation or permit the user to display program values, programmer on the quantity of test changed values, register contents, status output and the number of test ma~ro­ words, system tables, program maps, and instructions encountered prevent comments. In addition, program execution runaway test execution. may be monitored to record the detection of • Test output may be designated, at the changes in program fl()w (branch instruc­ programmer's option, according to any tions, subroutine calls, supervisor of eight priority categories. These requests, or referrals t() program areas) • categories allow selective editing and output of test results. The control statements allow the pro­ • Test output editing is separate from grammer to route control to specified test test program execution. Output may be requests, depending on arithmetic or logi­ saved by the programmer until the time cal relationships between program values, when editing and printing are conven­ flags, and special test counters. They ient. also allow him to modify the contents of the load module. In this fashion, when an error is discovered, the program is allowed The test translator is described in to continue testing and seek additional greater detail in the publication IBM Oper­ errors. ating System/360: Control Program Services.

Program Design and preparation 51 SECTION 5: JOB MANAGEMENT

Job management fUnctions of the control identification, an operation field, and an program include handling system job flow operand field for statement parameters. and all operator communications. All work The format for operands resembles that used to be done by the operating system is for macro-instructions. Because the exact described in a standardized format and fed format of control statements is given in into the system via one or more input the publication IBM Operating System/360: units. Job descriptions are in the form of Job Control Language, no attempt will be control statements, whose functions are made here to give complete statements in described in this chapter, and whose examples. Only the portions needed to detailed formats are given in the publica­ illustrate each point are shown. tion IBM Operating System/360: Job Control Language. The input unit (or units) used The control statements required to spec­ to read control statements is normally ify a job are: designated by operator command. The flow of control statements optionally combined • The JOB Statement. This statement with data, coming from anyone input unit, gives the job a name. The programmer is called an input job stream. The system may optionally state job accounting may have many concurrently active input job information, his own name, and other streams. information applicable to all steps of the job. Each JOB statement marks the The job flow is handled by a group of beginning of a job, and at the same programs, collectively termed the job time marks the end of the preceding scheduler. Operator communication func­ job. An example of a JOB statement is: tions are handled by a program called the //PAYROLL JOB master scheduler. A wide variety of job • The Execute (EXEC) Statement. This management functions are available, from statement is used to name the first which the user can select those most load module to be used to perform one appropriate for his applications and work­ step of the job. It may also be used load. Details of master scheduler func­ to name cataloged procedures. If a job tions are described in the publication IBM consists of more than one job step, an Operating System/360: Operating Considera­ EXEC statement is used to signify the tions. start of each step and the end of the preceding step. This statement need be named only if it is referred to by some other control statement. The EXEC CONTROL STATEMENT CAPABILITIES statement is used to state conditions that ~pply within the job step; for example; maximum execution time for all Control statements are designed to allow of the load modules used in the job the programmer and the operator to describe step. Each job step results in the clearly and concisely each job to be per­ execution of at least one task. An formed by the system. In addition, control example of an EXEC statement is: statements allow many job accounting, // EXEC PGM=SUMPAIRS input/output device allocation, and work • The Data Definition eDD) Statement. scheduling functions to be performed by the Several such statements may follow the system rather than by the operator. A job EXEC statement; each is used to define is considered to be any unit of work that a data set used or created during can be run independently of other units. execution of a job step. The DD state­ The time required for its execution may be ment provides the symbolic link between anywhere from a few seconds to many hours. the reference compiled into a program and the actual name and location of the Each job is described by a series of data set to be used in this execution control statements written by a programmer of the program. The program reference, and introduced into the system in the input part of the data control block macro­ job stream. Control statements are iden­ instruction (DCB), is a symbolic tified by the symbols // in the first two -ddname,- which is identical to the positions of each 80-byte logical record. name field of a DD statement. One of Since control statements may be continued the operands of the DD statement from one record to the next, there is no (DSNAME= ••• ) names the actual data set fixed limit on their length. Their format to be used. An example of a DD is similar to that used in the assembler statement is: language , with a name field for statement //DDNAMEl DD DSNAME=COLOR.CRIMSON '\

52 Assume that control statements are to be Job Priority written for a jobtha1t uses only a single program (load module) named SUMPAIRS. This program uses the symbolic names IN1 and IN2 If the system has an input work queu~, for its input data sets, and OUT for its the priority determines the sequence 1n single output data set. The actual input which queued jobs will be selected for data sets are named LIB. ADDENDS and initiation as tasks. The priority is then LIB. AUGENDS; the output data set is to be applied to tasks and, in multitask opera­ cataloged under the name LIB. SUMS. The tions, is used to resolve contention programmer chooses to name this job SIMPLE. between tasks for system resources. The The following control s'tatements are used: priority is also applied to a task's print or punch output, and determines the sequence of output writer operations where //SIMPLE JOB there is a backlog. // EXEC PGM=SUMPAIRS //IN1 DD DSNAME=LIB.ADDENDS Prior to the selection of a job from the //IN2 DD DSNAME=LIB.AUGENDS input work queue, its priority can be //OUT DD DSNAME=LIB.SUMS changed by operator command.

Coding within each statement is free form; i.e., fields are recognized by the Dependencies presence of one or more blanks or by other designated separators, rather than by the columns in which they are placed. The //, A programmer may request that the return however, as well as characters that indi­ code set in the return code register at the cate that a statement is continued on a completion of the job step be tested. The succeeding card, are column dependent. The action to be taken as a result of the code three DD statements in the above example value is stated in a condition parameter could be in any sequence. that is optional for each JOB, EXEC, and DD statement. If the stated condition is met, then the job will be terminated, an entire Not shown in the example is that jobs step skipped, or a DD statement ignored. may contain many steps, in which case the This facility can be used to terminate EXEC statement for each succeeding step is automatically a compile-link-execute placed immediately behind the last state­ sequence if errors found by the compiler ment or the data of the preceding step. are such that execution of the following Also, jobs may use many control parameters steps could not produce useful results. It not shown in the example. The choice of can also be used to select one of several parameters is based on the control program data sets for use as test data, depending options selected by the user, and on the on the outcome of previous steps. It is job execution conditions that the program­ further used to execute a job step contain­ mer wishes to state. In the discussion ing a user diagnostic program when a that follows, the parameters, options, and preceding job step is terminated with other execution conditions are introduced under than a specified return code. the following categories:

• Scheduling controls Maximum Execution Time • Program source selection • Data set identification and disposition • Input/output device allocation A maximum execution time can be speci­ • Direct-access storage space allocation fied for each job step. This allows the • Cataloged procedures programmer to guard against endless looping. If a maximum time limit is not stated by the programmer in the EXEC state­ ment, an installation-specified standard maximum time limit is used.

SCHEDULING CONTROLS Non-Setup Jobs Job scheduling deals with functions con­ cerning if, when, and how long jobs are to Jobs that can be executed without having be run. These and other uses of the job any special input/output setups can be control language are discussed in the fol­ designated as "non-setup" in the JOB con­ lowing paragraphs. trol statement. A compilation using resi-

Job Management 53 dent direct-access storage for work areas case for programs that are still being and the input job stream for source state­ tested, and not yet available in the link ments is a typical non-setup job. In some library. A procedure is provided to state, of the job schedulers, non-setup jobs are in one or more DD statements placed immedi­ used as fillers to make use of time other­ ately after the JOB statement, the iden­ wise spent waiting for operator action. tification of the preferred libraries. The ordered set of preferred libraries is called the job library.

Job Log In calling for a program, the programmer may specify the data control block of any library he wishes to be used. If he makes A log of all jobs can be maintained by no such specification, the job library is the job scheduler. Information from the searched. If the program is not found in JOB and EXEC statements is used for iden­ the job library, the link library will be tification; interval timer facilities pro­ searched. vide a measure of the time used by a job step; additional information can be placed on the log by an installation-written accounting routine, an operator command from the console, or a problem program mATA SET IDENTIFICATION AND DISPOSITION using a write-to-log (WTL) macro­ instruction. The log data set can be printed at specified times, or upon The DD statement identifies each data operator command. It will be printed auto­ set to be used in a job step. One of the matically when the log area is full. most important functions of this statement is to complete the symbolic chain through which a program retrieves or stores data. This chain of indirect symbolic references PROGRAM SOURCE SELECTION gives the user flexibility by allowing him to define characteristics such as buffer sizes and techniques, blocking factors, and Link library is the term used to refer device identification at job entry time, to a particular partitioned data set con­ rather than in his program. It also pro­ taining load modules. In the absence of vides a way for a single program to be contrary specifications, load modules used, independently and Simultaneously, by referred to in EXEC statements, as well as two or more different tasks. Without sym­ in the ATTACH, LINK, XCTL, and LOAD macro­ bolic references, it would be difficult or instructions, are retrieved from this impossible for the same utility program, library. for example, to be in shared use, printing two completely different data sets from two In some jobs, a programmer may want to tapes simultaneously. have programs taken from different parti­ tioned data sets that he names, rather than The chain of symbolic references is from the link library. This might be the illustrated in Figure 33.

Compiled with object module Created with data set

DCB Data Set Label

dcbname ddname dsname

GET DD

Compiled with object module Control statement as interpreted at job time

Figure 33. Chain of Symbolic References

54 The first reference is the GET dcbname, Concatenated Data Sets where data input is requested. The second is in the DCB statement of the program, where the ddname is referenced. The third When an application uses a sequence of is the DO statement, \t1here the ddname is two or more data sets as input, the control related to the data set name to be used statements permit the programmer to conca­ during the current execution of the tenate (logically connect) the data sets program. The paragraphs that follow out­ for the duration of the job step. For line in brief some of thE~ ways of identify­ example, five data sets, one produced on ing and controlling data sets by parameters each day of a week, might be used as input in the DO statement. to a single sort.

Each data set is described by a separate DD statement, but only the first DD state­ SYSIN and the DO * Statement ment is named; it is implied that each member of the group shares this common ddname. Each data set is used automat­ Original input data (e.g., keypunched ically, in the same sequence as the DD cards) may be presented to the system in an statements, whenever the ddname is used. input job stream, together with the control statements. This minimi:~es operator setups of input/output devices. such data immedi­ ately follows a DO asterisk (DO *) state­ ment. An example of this statement is: //SYSIN DD * Generation Data Groups (data) (data) The programmer can identify data sets An internal unique data set name is gener­ belonging to generation data groups, in ated by the job scheduler for this data, which the names are identical except for but the data set is no·t cataloged. The generation number. Data sets of this type generated name is used only for the dura­ of group are deSignated by either relative tion of the job. notation, or by the full name including generation number. Depending on the configuration, input presented in this way is available to the user's program either directly from the card reader (or other input job stream devic~ or from a direct-access device onto which the job scheduler places the data prior to job execution. Dummy Data Sets In the preceding example, convention was followed in assigning SYSIN as the ddname. A general purpose program may require The actual ddname chosen is immaterial, so that one of its input requirements, or a long as the name in the input job stream regularly scheduled report, be ignored. matches the name used in the program. Also, during early phases of a program Furthermore, the selection of a ddname -­ debugging, it may be desirable to test only specifically, SYSIN -- in no way constrains program flow, rather than full processing the program to receive its input from the of data from data sets. These techniques input job stream. The actual source of are possible with sequential data organiza­ data is not specified until the SYSIN DD tions by use of the DUMMY parameter of a DD statement is entered in the input job statement. Data sets so identified are not stream. assigned to input/output units, the OPEN procedure is simplified, and any attempt That statement may specify a different within the program to store in or retrieve data source. For example, if the program­ from the dummy data set results in an mer wants to use a previously transcribed end-of-data condition on input and is and cataloged dat.a set named treated as a -no operation- on output. HAROLD.TESTPROG, the following statement could be used instead of the DD asterisk For example, in the first run of a tape statement: file maintenance program, the master file may not yet exist. A dummy master file //SYSIN DD DSNAME=HAROLD.TESTPROG could be specified as input; the transac­ tion file by itself becomes the first No change in his program is necessary. actual master file.

Job Management 55 Data Set Disposition data sets that were already in existence are retained. For each data set used, the programmer has a variety of options for the action to be taken by the system at the end of the INPUT/OUTPUT DEVICE ALLOCATION ~ob step. He may specify that a data set 1S to be treated as system output and printed or punched, using the output writer Allocation of input/output devices is feature of the job scheduler; or cataloged done by the job scheduler before job step in the library; retained but not cataloged; initiation, according to a number of dif­ deleted at the completion of the job step; ferent considerations. One of these is the or treated as a temporary data set. A allocation requests included in each DD temporary data set is handled as if it were statement; others are the devices available cataloged during the remainder of the job's and the system generation parameters. In execution, but is automatically deleted at general, it is not necessary to specify the end of the job. A temporary data set allocation of specific devices. The job is, in effect, passed to succeeding steps. scheduler will make reasonable assignments. This type of data set is often used for There are applications, however, where the temporary storage of a compiler's output performance of a job depends very much on that serves as the input to the linkage the device types and channels used for editor in a later job step. certain data sets. To handle this, the system accepts allocation requests and requirements in a variety of forms. Even The programmer may. also designate ;so, the programmer gains flexibility and volumes that are to rema1n mounted through­ -improved overall performance if he states out an entire job; he may also designate his requests in a general way, rather than whether or not the system is allowed to use being specific. a direct-access volume for storage of other data sets. These latter features ensure Individual input/output devices and that a volume intended for repeated use arbitrary groups of input/output devices over a span of several job steps is not can be given permanent symbolic names for dismounted and remounted unnecessarily, and allocation purposes. The symbolic name that volumes are not used for data sets :requested in the DD statement should be the that have not been specifically designated least restrictive one appropriate to the to reside there. situation. For example, the group of input/output devices in Figure 34 illus­ If no disposition instructions are given trates two IBM 2311 Disk Storage Drives and in the DD statement, a normal procedure is eight tape drives (four of the tapes are followed. Data sets created during a job IBM 2400 Tape Drives, Model 1, and four are step are deleted at the end of the step; IBM 2400 Tape Drives, Model 2) •

Selector Tape Channel Control 1

Direct Access Control

Selector Tape Channel Control 2

Figure 34. Typical Input/Output Devices

56 Table 2. Names of Installation Devices r------T------·---T------T------~------, I I 2311 Disk I 2311 Disk I Channell tapes I Channel 2 Tapes I I I I ~------~------+------T------i I Name I Storage D:rive I Storage Drive I Mod 1 I Mod 2 I Mod 1 I Mod 2 I I I I r-----r-----+_----T----+----T-----+----T-----i I I #1 1 #2 1 11 1 #2 1.1 1'2 1 11 1 12 1.1 1 #2 I ~------+------.----+------+.----+-----+-----+---+_---+-----+----+-----i I SEQUEN 1 x 1 x 1 x 1 x 1 x 1x I x 1 x I x I x 1 1 TAPE 1 I 1 x 1 x I x 1x 1 x 1 x I x I x 1 1 DIRECT 1 x 1 xliii 1 1 1 1 1 ~------+------+------+----+-----+-----+----+----+-----+----+-----i I CH 1 TAPEX I I I x I x I x I x I I I I I 1 CH2TAPEX I 1 I 1 I I 1 x I x I x I x I ~------+------,---+------+----+-----+-----+----+_---+-----+----+-----i I CH 1 MOD 2 I I I I I x I x I I I I 1 I CH2MOD2 1 1 I 1 1 I 1 I 1 x 1 x 1 1 MOD2TAPE 1 1 1 I 1 x I x 1 I 1 x I x I ~------+------+------+.----+-----+_----+----+----+-----+----+-----i 1 CH 1 TAPE 1 1 1 1 x 1 I 1 1 1 1 1 1 1 CH1TAPE3 1 1 1 1 I x I 1 I 1 1 I

1L______CH2TAPE 1 ~ 1 ______~1 ______~ 1 ____~ 1 _____ ~I _____ ~I ____~ I ___x ~I _____~ 1 ____ ~I _____ JI

Table 3. Specifications That Achieve Input/OUtput Overlap r------T------T------T------T------, I I I I I I 1 I Case 1 I Case 2 I Case 3 I Case 4 I ~------+------+------+------+------i IData Set 1 I CH1TAPE1 1 CH1MOD2 I CH1TAPEX I TAPE I ~------+------+_------+------+------i 1L ______Data Set 2 ~1 ______CH2TAPE1 ~1 ______CH2MOD2 ~1 ______CH2TAPEX ~1 ______CHAN=SEP JI

Table 2 illustrates some names that same volume. This would be desirable with might be used, and the units included under data sets on direct-access storage where each name. their use is related, and the programmer wants to minimize disk pack mounting and Specific allocation could be requested demounting. This would also be desirable ~Y us~ng the name CH1TAPE3, but the system for two data sets that are created serially 1S g1ven more flexibility if a less res­ which the programmer wants on the same tape trictive name such as CH1TAPEX or MOD2TAPE reel. is used instead. The use of restrictive requests may result in a job being held up For large multivolume data sets on mag­ if the specific un~t is not available. netic tape, where reels must be dismounted and mounted during a job step, spare or To obtain input/output overlap between alternating drives can be requested to two data sets on tape, any of the combina­ minimize operator setting up time, if extra tions of statements in Table 3 could be tape drives are available. This is done by used in order of increasing generality. requesting that two tape drives be assigned to a single data set. In the case of Case 4 is the least restrictive of the output data sets, mounting a ·scratch" reel cases, and illustrates the way to request on one or more drives allows a drive to be channel separation between two data sets, assigned dynamically to anyone of several i.e., a different channel for each of the output data sets, whichever reaches the end data sets. An extension of channel separa­ of volume first. A ·pool· designation is tion is the facility for channel affinity. used for such cases. If data 'sets A and B are to be assigned separate channels, then an affinity of data If an allocation request states the name set C for A means that C and B should be of a nonexistent device, or a device given different channels. It does not declared by the operator to be unavailable, necessarily mean that A and C share the the associated job will be terminated. same channel. Requests for affinity or separation will only be followed if there are enough Volume affinity may be requested .between input/output devices in the system. If two data sets that are t:o be placed on the there are not enough, as when a tape drive

Job Management 57 has been removed for maintenance, the sys­ or cylinders will not always be physically tem ignores the affinity and separation contiguous. Physically contiguous space requests, and runs the job using other will be allocated, if requested. units. A series of DD statements may be used to request a split cylinder. This feature allocates space that is to be shared among Deferred Mounting of Tapes each of the data sets involved. Each data set represented by one of the DD statements is given a specified percentage of the Normal operation of the job schedulers tracks on each of the allocated cylinders. requires that the correct volumes be mount­ The split-cylinder technique allows concur­ ed on all input/output devices used by a rent use of two or more data sets on the job step before the step is initiated. same volume without excessive access arm This ensures that work will not be started, movement. partially completed, and then forced to wait for operator action. Half-completed tasks, in a multitasking operation, tie up the system facilities and prevent other CATALOGED PROCEDURES tasks from proceeding. In some cases, however, this precaution may be unnecessary or even undesirable. Some applications, by Frequently used control statement their design, allow sufficient mounting sequences may be prepared once and then time during execution of an early phase to cataloged in the system library. These ensure that data sets needed on tape during control statement sequences, called catal­ a later phase, will be mounted in time. oged procedures, can be reused upon demand. Other applications use a single unit, sequentially, for more than one data set. Typical sequences of job steps and out­ In such cases, the programmer may want to put requirements that might be predefined use the deferred mounting option, where a are: job step is allowed to proceed without first having all data sets in place. Compile - Linkage edit - Execute - Print Edit input data - Sort - Update master file - Print exceptions. DIRECT-ACCESS STORAGE SPACE ALLOCATION Control statement sequences that are to be cataloged are presented in the input work stream in the usual way. A JOB statement The DD statement for data sets to be parameter indicates that the sequence is to written out on direct-access storage con­ be cataloged rather than executed. The tains requests for the needed space. Nor­ sequence may contain one or many job steps. mally the amount of space to be initially Once cataloged, a procedure is called from allocated is specified, as well as the the library by an EXEC statement that names increments of space to be allocated auto­ the procedure to be executed, rather than matically as needed. A request may be for naming a program. The entire cataloged space on a -private- volume, which means procedure is then substituted in place of that no subsequent request for space will the EXEC statement that named it. be allocated from that volume unless the volume is specifically designated. This Temporary changes can be made to cata­ allows direct-access volumes to be reserved loged procedures, for the current job only, for the exclusive use of, for instance, a by statements in the input job stream whose programmer or an organizational department. names match those of cataloged procedure Alternatively, the request may be non­ statements. Input job stream statements specific, which means that the request will override cataloged statements, but do not be filled from available space on any change what is cataloged. volume other than previously designated private volumes. Space may be requested in terms of JOB SCHEDULER AND MASTER SCHEDULER tracks or cylinders; or it may be requested FUNCTIONS in terms of blocks (i.e., physical records) • In the latter case, the system will compute the number of tracks or Job management contains four major fUnc­ cylinders required. The program, in this tional areas. Each area includes a number instance, is independent of the charac­ of selectable options. The four functional teristics of the direct-access unit that is areas are: used. To make most efficient use of avail­ able space, the logically contiguous tracks • Job scheduler: reader/interpreter

58 • Job scheduler: initia'tor/terminator devices are allocated, that direct-access • Job scheduler: output writer storage space is allocated as required, and • Master scheduler that the operator has mounted any necessary tape and direct access volumes. It finally requests that the supervisor give control to the program named in the job step. JOB SCHEDULER At job step completion, the terminator of the job scheduler is responsible for Reader/Interpreter removing the work description from control program tables, freeing input/output devi­ ces, and disposing of data sets according Each reader/interpreter of a job schedu­ to instructions in the DD statements. ler is responsible for reading one input job stream, scanning the input data to As part of the input/output device allo­ identify control statements, interpreting cation function, the initiator/terminator and analyzing the control statements, and is responsible for issuing operator messa­ preparing the necessary control tables that ges calling for volume mounting, and ensur­ describe each. job to the system. For ing that the mounted volumes actually match systems with an input work queue, the allocation requests in the control state­ reader/interpreter ensures that the control ments. The following paragraphs present information is placed in the queue in the three features that are optionally priority sequence, and that the data fol­ supplied to help minimize system time loss lowing a DD * statement is stored separate­ due to operator setup. lyon a direct-access device as a temporary data set. • projected Mount. The operator is given volume mounting messages a number of Multiple reader/interpreter tasks may be job steps in advance of that being functioning at the same time, each one initiated. Operator setup time can be transcribing control statements and data to overlapped with the execution of the direct-access storage concurrently with previous job step. other task operations. All use the same • Automatic Volume Recognition. With input work queue. Since the subprograms of this feature, the operator may premount the reader/interpreters are reenterable, labeled nine-track tape reels on any the same copy may be used by all concur­ available unit; the job scheduler will rently performing reader/interpreter tasks. record in a table the identification of each volume and the unit used. When a Some systems have the ability to do particular tape reel is needed for job remote stacked job processing, in which job step set-up, the table will be control information is sUbmitted from searched. If the needed reel is found remote on-line terminals. A to be already mounted, the usual proce­ reader/interpreter task is attached to han­ dUre of issuing a mounting message will dle the job control statements forwarded be bypassed. This feature is particu­ through the queued telecommunications larly advantageous in production access method. The control information is installations where work schedules usu­ placed in the input work queue and handled ally are set in advance and follow a in the same manner as locally submitted repeated pattern. In this situation, jobs. Output data sets from remote jobs the operator usually knows in advance are handled by an output writer task as which tape reels are to be used and the described later, except that the system sequence in which they will be also provides for routing the output data required. Automatic volume recognition to specified terminals. This is described is also desirable with those configu­ in detail in the publication IBM Operating rations which perform jobs in the same System/360: Telecommunications. sequence in which they appear in the input job stream. • Non-Setup Padding. Jobs not requiring any operator setup action can be iden­ Initiator/Terminator tified in the JOB statement. When any job step requiring setup is delayed because operator action is not The initiator of the job scheduler is complete, the initiator/terminator can responsible for selecting jobs to be exe­ scan the input work queue, find the cuted and performing necessary preparatory highest priority non-setup job, and work. The selection is made directly from immediately initiate its first step. an input job stream, or from an input work On completion of that step, the queue, depending on the configuration. For initiator/terminator checks to see if each step of a selected job, the initiator operator action is complete. If so, ensures that all necessary input/output the job step requiring setup is ini-

Job Management 59 tiated; if not, the next step of the Figure 35 illustrates the selection of non-setup job is initiated and run and three jobs from the input work queue and the procedure is repeated. the initiation of one step from each as a task. The allocation method used by the multijob initiator ensures that each job A more advanced version of the selected will have input/output devices initiator/terminator is optional for larger allocated to it before any jobs selected systems where it is practical to have more later are assigned their devices. than one job from the input work queue under way at one time. This capability is Multijob initiation may be used to called multijob initiation. When the sys­ advantage to initiate jobs in an applica­ tem is generated, the user specifies the tion where a series of "batch-type" jobs maximum number of different jobs that the are to run simultaneously with an indepen­ initiator is to have under way simultane­ dent job requiring input from remote termi­ ously. nals. Typically, such telecommunications jobs have frequent periods of inactiVity Each selected job is run sequentially due either to periods of low traffic or to (one step at a time) just as with single delays for direct-access seeks. During job initiators. However, additional jobs such delays, locally available jobs can be are selected from the queue and initiated executed. (Because multijob initiation is as long as: a more generalized way to optimize device allocation, the non-setup padding facility • The number of jobs specified by the may not be combined with it.) user is not exceeded. • Enough input/output devices are avail­ able to satisfy allocation requests. • Enough main storage is available for OUtput Writers all current requirements and for the initiator program itself. • Jobs are in the input work queue ready During program execution, output data for execution. sets with a "system output" disposition may • The initiator has not been detached by be stored on a direct-access storage device the operator. at high speed. Later, an output writer of

Job Selection High Job Priority

Job

Job Job 1 Job 2 Job 3

I Job Input Job > Stream Job

Job

Low Priority Input Work Queue

Job 1 Job 2 Job 3 Step A Step A Step A

Figure 35. Multijob Initiation

60 the job scheduler can transcribe the data (4) ABC $DEFGH JKL---Z to a system output unit, normally a printer (5) (A) $BC DEFGHJ KLM---Z or punch. Whenever this is done, control information regarding the output data sets Line (1) illustrates jobs A through Z in is stored in an output work queue. An the input job stream (perhaps a card output data set can be retained indefinite­ reader) before any jobs have been entered ly and still be prociessed by an output in the input work queue. writer. Each system output device in oper­ ation is controlled by an output writer Line (2) shows job A in the input work task; each device can be started or stopped queue. The jobs that follow are still independently by the operator. being read in. As soon as job A is entered in the queue, execution begins. There is Groups of output devices can be logical­ no need to wait for jobs B through Z to ly grouped together as a class to handle \:nter the work queue. work of similar nature. For example, a single printer might be designated as a ; Line (3) shows the situation when A has class to handle all high-priority, low­ completed execution with its output volume printed output, and two printers referred to on the output queue. By this might be designated fo:r all high-volume time, jobs B through G have been entered in printing. the input queue. Since A's output is ready to be printed or punched, the output writer The DD statement allows output data sets begins. There is no wait for the output to be directed to a class of devices, and that will be produced by the jobs that allows the specification of a form number follow. Shown also on this line is a or card electro number code. This number high-priority job (represented by the dol­ is given to the operator before printing or lar sign). It is still in the input stream punching starts so that 'the forms in the (card reader) and has not yet"been recog­ output unit can be prope:rly set up. nized by the system. Output data destined for an output Line (4) shows the situation when ($) writer mayor may not be referred to by the has entered the input queue. Jobs A ddname ·SYSOUT.- However, SYSOUT must be through C have been completed; job A's specified on the DD statement as the dispo­ output is still being printed. Job ($) is sition of the data set. It is this speci­ the next job selected by the job scheduler fication that places i::t reference to the because of its priority, even though it data on the output work queue. The queue entered the input work queue later than is maintained in priori,ty sequence, allow­ jobs D through H. ing the output writers to select data sets on a priority basis. Line (~ shows the situation at the completion of job ($). By now the output In systems with input and output work of job A has been completed. The output of queues on direct-access devices, the output job ($) will be the ~ext set of data to be writer is the final linllt in a chain of printed by the output writer, because of control routines designed to ensure fast its priority, even though jobs Band C turn-around time. Turn-around time, in entered the input work queue first. this case, is considered to be the time from entry of the work statement in the computer until a usable output is obtained. Fast turn-around is achieved largely MASTER SCHEDULER because of two factors: data at two inter­ mediate stages of the work flow is accessi­ ble as soon as it is prepared, without any All systems have a master scheduler requirement for hatching; and at each such whose functions are to handle messages from stage, priorities are used to place impor­ the system to the operator, replies from tant work ahead of less important work that the operator, and commands frOm the opera­ may have been previously prepared. The two tor to the system. intermediate stages are: when the job has just been entered in the input work queue , Messages to the operator are initiated and when the job is completed with referen­ by use of the write-to-operator ~TO) or ces to output data in the output work write-to-operator-with-reply (WTOR) macro­ queue. instructions. The WTO macro-instruction is used to supply information to the operator Output Work Input Work Input Job (or programmer) ; WTOR is normally used to Queue Queue Stream request information from the operator.

(1) ABC---Z The operator can issue various commands: (2) A BCD---Z (3) A BCDEFG H$J---Z • Job action commands cause a change in

Job Management 61 the status of a job. For example, • Information entries allow him to pro­ cancelling or suspending a job, or vide the system with current date and modifying its priority. time, to enter information in the sys­ • System action commands cause changes in tem log, and to reply to system or the actions taken by the three job program requests for information (as a scheduler functions. These commands consequence of the WTOR may inform the system of a new device macro-instruction) • to be used in the input job stream, or of a device that is no longer available for allocation. Operator commands normally are entered into • Information requests allow him to the system from a device such as a console inquire about the status of the system typewriter, but can also be placed as or of certain jobs. separate statements in an input job stream.

62 SECTION 6: TASK MANAGEMENT

-All work submitted for processing must module. It is discussed further be formalized as a task (or part of a task) below.) before it will be performed. A program is 3. Loads the program into main storage, treated by the Operating System as data relocating it as part of the process. until the time that it is named as an This function is performed by program element of a task. This is true regardless fetch. of the particular control program features that are selected. Three loading attributes may be named in a linkage editor run. For convenience, all There are, however, significant differ­ three are discussed below, although the ences in the features available. Although third option, scatter loading, is never the requirement that all work be performed available for single-task operations: under task control has no exception, the manner of controlling 1tasks is subject to 1. If block loading is specified, the considerable variation. The most Signifi­ entire load module is placed in a cant choice among the options available is contiguous main storage area. the choice between single-task and multi­ 2. If overlay loading is specified, suf­ task control. ficient contiguous main storage is reserved to contain the longest path No more than one task can exist in the in the planned overlay program. How­ single-task environment. On the other ever, only the root segment is ini­ hand, several tasks may coexist in the tially fetched. multi task environment and compete for 3. If scatter-loading is specified, the available resources on a priority basis. control program loads the entire load module, but not necessarily in con­ Since both environments have to do with tiguous main storage locations. This task control, a program that is written for has no effect on program execution. the single-task environment and follows The scatter-loading capability allows normal systems conventions will work equal­ load modules to be split according to ly well in the latter environment. control section boundaries. Even with the scatter-loading attribute, a load module will be block-loaded in the following instances: SINGLE-TASK OPERATIONS • The control program does not have scatter-loading capability. In a single-task environment, the job • There is a single main storage scheduler operates as a 1:ask which uses a area large enough to contain the task control block that entered the system entire load module. when the system was initialized. Each job In no case will a single control step is executed as part of this task. section be split. The task so defined is the only task Once the load module (or root segment, that will exist in the system and so can in the case of overlay) is available in have all available resources. Its program main storage, control is passed to the can have a Simple, oVE~rlay, or dynamic entry point associated with the module serial structure - one 0]: more load modules name. Logical flow of control thereafter may be required. is as explained in "Program Design and Preparation." If the load module fetched The control program must first fetch the is the first subprogram of a serial dynamic load module named in the EXEC statement. program, then the subsequent load modules To do so it: required are fetched in the same way as the first, with one exception: if the needed 1. Finds the program, using the program module is reusable and a copy is aI-ready in name. main storage, that copy will be used for 2. Allocates main storage space according the new requirement. to the program size and loading attri­ butes stated in the library directory Control program routines are handled in entry for the load module. (The load­ much the sam~ way as user routines. ing attribute is specified by the programmer as input to the linkage Some of the control program routines are editor run that produces the load resident in main storage at all times. The

Section 6: Task Management 63 first-level interruption handlers are exam­ the user's programs. As a consequence, ples. Other control program functions are 'Control will pass back and forth between called into main storage upon demand; these the user program and the control program at are termed transient control program rou­ all interruptions. This actual flow of tines. An example is the routine associat­ .control is something that is entirely tran­ ed with the OPEN macro-instruction. When a 'sparent to the user's program; that is, the control program transient routine has com­ . jprogram is unaware of the actions taken.· pleted its function, it remains in storage until the storage space is required for some other use. User's Program Area Supervisor Area If a transient routine is in storage, and is called, the control program will use SIMPLE it directly without going through the find­ SAVE allocate-fetch process, since such transient routines are reenterable. When a task is completed (normally or abnor~lly), control is returned to the superv1sor. The supervisor, recognizing the end condition, reports back to the job RETURN scheduler that the job step is complete.

Figure 36. Actual Flow of Control ACTUAL FLOW OF CONTROL

The single-task control program provides MULTITASK OPERATION for normal interruption handling, and hence provides for overlapped operation between a task and other asynchronous operations sup­ All task management functions described ported by the hardware, such as for single-task operations apply equally input/output and interval timer operations. well for multitask operations. Each job The programmer is not concerned with the step is executed as a task. The manner in actual flow of control as a result of which this takes place, which has been interruption handling, other than as a way touched on in its various aspects in to better understand the environment in preceding sections, is illustrated in Fig­ which his program will be executed. ure 37. Named load modules are either reused (if they are in storage and This actual flow of control is illus­ reusable) or new copies are fetched. trated in Figure 36. Control passes to the : Interruptions are transparent to the user supervisor by any interruption allowed by programs. As a result, programs following the hardware design, and is returned by the system conventions that are written for a load program status word (LPS~ single-task environment work equally well instruction. in multiple-task environments. However, considerably more is required of task man­ Interruptions may be caused by a super­ agement when many tasks compete in request­ visor call instruction in the user's pro­ ing system facilities. The manner in which gram. Such instructions are requests for these requests are handled is described in some form of supervisory service, such as the following paragraphs. starting an input/output operation, which usually requires the execution of one or The goal of the control program is to more privileged instructions. No matter effectively isolate each job step from the what source language is originally used, others, and at the same time allow tasks to the only way of obtaining such services share system facilities where it is advan- while the task is being performed is by use ·tageous to do so. of supervisor calls. Whether or not individual programs use All other interruptions take place unex­ 'multitask facilities, such as certain pectedly as far as the user's program is macro-instructions which create new tasks concerned. Although program and machine or which synchronize multiple tasks, the interruptions may be caused by the execu­ : installation can benefit in a number of tion of an instruction in the user's pro­ . ways from having a multitaskcontrol pro­ gram, the programmer cannot normally pre­ gram. One of these benefits is concurrent dict when such an interruption will occur. 'operation of input readers and output writ­ Input/output and external interruptions are :ers which improves turn-around time for all entirely asynchronous with the execution of 'jobs, and allows special handling of high

64 r--' --f I L _ +___ T~k___ l I I I Program I I SIMPLE I I (Load I r-----~~~------, I Module) I I I : //STEPl EXEC PGM=SIMPLE L ______..J I //DDNAMEl DD DSNAME=AL: I I //DDNAME2 DD DSNAME= B I Data Sets I //DDNAME3 DD DSNAME=C I 1.~~J L ______--~ ------12. =-~ J 3.[~J

Figure 37. Job Step-Task Relationship

priority jobs. Another is that multijob • The operator performing the initial initiation by the job scheduler is made program loading operation, or using possible, which allows two or more jobs to commands that start components of the be under way at the same time. job scheduler. • The EXEC job control statement defining A more direct benefit of multitask oper­ a job step, which in turn becomes a ation is simplified program design. Indi­ task to be executed. vidual programs (or subprograms of complex • The ATTACH macro-instruction within a programs) need not be as carefully planned user's program calling for creation of to balance processing time with a subtask. (Like a subprogram, a sub­ input/output time to gain efficient opera­ task generally notifies the higher­ tion. An individual program may be rather level task that created it of its inefficient if run alone, but in a multi­ completion.) task operation its waiting time can be used effectively to process other tasks. This The mechanism used in all of these is particularly important in programs which situations except initial program loading spend a relatively high proportion of time is the ATTACH macro-instruction. The only in seeking records in direct-access difference is whether the ATTACH is issued storage; for example, inventory programs in by the control program or by a user-written which transaction or inquiry records are program. (There are one or two other received by the computer directly from special cases in which the control program remote terminals. The inventory may be, may issue the ATTACH as an indirect result for example, of parts a'vailable, savings of a service request, but these cases are deposits balances, or airline seats availa­ of less importance in program design. They ble. Since a rapid response (updating are in the QTAM access method and the SEGLD master files or replying to the remote macro-instruction.) terminal) is required, mas·ter files must be on direct-access devices. Each incoming Figure 38 shows the most elementary message must be processed by a program situation that could exist after initial which in turn depends on direct-access program loading, and before any input storage retrieval. In sllch applications, readers have been started by the operator. each message can be processed by a separate This assumes that the user has chosen to task, many messages can be processed con­ have all input readers started and stopped currently, and the seeks can be effectively under operator command. The master schedu­ overlapped. ler task exists in the system at all times. Figure 39 shows the situation after the operator has started one input reader, the TASK CREATION -- ATTACH initiator, and one output writer, and after the first job step has been initiated. F'our of the five tasks are performing job Tasks are created as a result of three management functions. The dotted lines different actions. These are: show subtask relationships.

Section 6: Task Management 65 The control program, in controlling the Control Program Tasks Processing Program Tasks sharing of facilities between tasks, does not differentiate between control program :tasks and processing program tasks as such. TCB It exercises control on the basis of task priority and storage protection key, and : allocates system resources among all tasks Master (None) Scheduler . according to the general rules described in the following paragraphs.

RESOURCE ALLOCATION Figure 38. Situation Immediately After Initial Program Loading Many system resources are demanded by competing tasks. Even in a single-task control program, some resource allocation Figure 40 shows the situation that is necessary. In a multitask control pro­ exists after three jobs have been initiated gram, many system facilities are treated as to run simultaneously. The task created by resources subject to control and job 1 , step 1 (A) is shown with two allocation. subtasks that it has attached (B1 and B2). One of these subtasks has attached its own In situations where there are conflict­ subtask (C). ing demands, the control program resolves

Control Program Tasks Process i ng Program Tasks ------TCB TCB

Master Reader Writer Initiator Scheduler

Figure 39. Situation With Reader, Writer, Initiator, and One Job Step

User Program Tasks Control Program Tasks TCB TCB TCB

Job 1 Job 2 Step 1 Job 3 Step 1 A Step 1

TCB

Job 1 Step 1 B2

Job 1 Step 1 C

Figure 40. Situation After Initiating Three Concurrent Jobs

66 the conflicts, allocates resources, and of the WAIT macro-instruction, or implicit­ gets work accomplished. ly as a condition of system macro­ instructions. A typical implied wait is that included in the GET macro-instruction. GET requests that the next sequential input record be made available to the program. If the next record is already in a buffer Tasks As Users of Resources area of main storage, the record is supplied immediately, and the control pro­ gram is not involved; no WAIT takes place. Resources are assigned to tasks. As a If, however, the record is not yet in main result, the control program can keep track storage , a WAIT is issued automatically, of all allocations, and ensure that resour­ and the task is delayed until the record is ces are freed, when appropriate, upon task read and can be supplied. completion. Releasing resources, especial­ ly upon abnormal end-of-task conditions, is essential for nonstop system operation. Figure 41 shows four tasks in sequence by priority. Task A is waiting for two Some of the system's resources may be events, tasks Band C are waiting for one allocated immediately, but in other cases, each, and task D is not waiting. In this a task may be forced to wait until the illustration, D is the only one ready; current user of the resource frees it. In therefore, it is the active task using the cases where several tasks are waiting 'for central processing unit. Each time an the same resource, queueing takes place. awaited event takes place, the completion (The queue is made up of control blocks is "posted" in a designated communication that directly or indirectly point back to area, called an event control block (ECB). the requesting tasks.) When the resource The WAIT, POST, and event control block becomes available, it is given to the relationship is discussed in more detail ranking member of the queue, whose rank was under "Event Synchronization." determined by task priority, sequence of entry into the queue, the specific reque$t, or some combination. The wait condition applies to tasks in the task queue, and does not mean that the Each system resource is controlled by a central processing unit itself has been different part of the control program, placed in a hardware waiting state. Howev­ these parts being collectively termed er, all the tasks in the system must be in resource managers. Figure 41 illustrates a wait condition before the supervisor the logical relationship that exists places the central processing unit in a between tasks in the system and the wait condition. resource managers that manage queues. The queue concerned with the central One action is common to the management processing unit is composed of task control of all resources -- when use of a resource blocks, and is called the task queue. The is completed, that fact is signalled by an central processing unit time "manager" is a interruption. The interruption causes con­ part of the supervisor called the task trol to be seized from the currently active dispatcher. When the taf3k dispatcher is task, and routed to the appropriate given control, it issuef3 the load program resource manager. The resource manager may status word (LPSW) instru(~ion that passes now reallocate the resource and place a control to the task of highest priority waiting task in the ready state if all of ready to use the central processing unit. its requirements are met. In the example (Figure 41), task A becomes ready after The task queue consists of all task both of its resource requests are control blocks 1n the system, ordered by completed. At that time it displaces D as priority. Each task control block is con­ the active task, and continues from the sidered to be in either the ready or wait instruction following the WAIT. When no condition. A "ready task" can make immedi­ higher priority tasks are ready, D resumes ate use of central processing unit; a execution where it had been interrupted "waiting task" cannot. If a task is wait­ unaware that its operation had not been ing, it means that some ev~nt must be continuous. completed before the task will again be ready to use the control processing unit, Resource queue elements are created only for example, the completion of an by active tasks. Similarly, tas~ control input/output operation. blocks representing subtasks are created only by active tasks as a result of the Tasks are placed in the wait condition ATTACH macro-instruction. Tasks can wait whenever they cannot proceed further. The for the completion of subtasks, just as need to wait is stated explicitly by means they wait for completion of other events.

Section 6: Task Management 67 Task Queues

D C B A Manager of Queued Tasks: PR = 3 PR = 4 PR = 10 PR = 12 CPU Time

W(I) W(I) W (2)

Queued Resource Requests: C A Manager of Resource Alpha

Queued Resource Requests: B A Manager of Resource Beta

Figure 41. Resource Queues

Passing Resources to Subtasks EVENT SYNCHRONIZATION

When subtasks are attached within a job WAIT and POST Macro-Instructions step, they share some of the system re­ sources assigned to the attaching task. The resources that are passed or shared, Event synchronization is the delaying of are: task execution until some specified event occurs. The synchronization has two aspects: • Storage protection keys. • Main storage areas. • Serially reusable programs, if not • The requirement for synchronization is already in use. stated explicitly by the WAIT macro­ • Reenterable programs. instruction, or is implied by use of • Data sets, and the devices on which certain other macro-instructions. they reside .. • After the event has occurred, notice to the requesting task is given so it can proceed past the WAIT point. Data sets to be used for a job step are initially presented to the job scheduler by DD statements. When the job scheduler The notification required is performed creates a task for the job step, all such by the POST macro-instruction. When the data sets are available to all load modules event is known to the control program (for operating under the task. They may OPEN example, the completion of a read and CLOSE, store and retrieve, with no operation), the control program issues the restriction other than heeding data set POST. If the event is known only to the boundaries. user's program, the user's program must issue it. When a task attaches a subtask, it may pass the location of any data control block to the subtask. USing this, the subtask As an example, the function of both has equal access to the data set. When a tasks A and B in Figure 42 is to compute job step is terminated, all data sets are some value, display it, and then proceed; automatically closed. However, when a sub­ the display of task A must precede that of task that has been given the location of an B. Task A displays first, then issues the open data control block is closed, no such POST; task B waits for A, then displays its automatic closing of data sets takes place. result.

68 The programmer is responsible for clear­ ing event control blocks before each use. It is imperative that the event to which an (Calculate) (Calculate) event control block pertains has occurred DISPLAY WAIT POST DISPLAY before it is reused. 9-----, Programmers intending to make use of the Figure 42. Intertask Synchronization. event synchronization facilities will find the following example helpful. A READ macro-instruction within program SYNCH is followed by a wait for the comple­ tion of the input event. Figure 43 shows A task may make several different the situation immediately after the READ. requests and then wait for any number of The event control block required for the them. For example, a task may specify by operation is located in a main storage area READ, WRITE, and ATTACH macro-instructions belonging to the task. Its address, that three asynchronous functions are to be nECBA n, was specified in the READ (1). The performed. However, as soon as two of them appropriate resource manager, the have been completed, it is to be placed in input/output supervisor, has queued the the ready condition. When each of these READ request and has placed the address requests is made initially to the control ECBA in the queue element (2). program, the location of a one-word event control block (ECB) is also stated. The event control. block provides the basic communication between the task issuing both the original requests and the subsequent wait, and the posting agency (in this case, the control program). When the WAIT macro­ Input/Output instruction is issued, the parameters TCBA SYNCH supply the addresses of the event control Supervisor blocks corresponding to the requested ser­ vices. Also supplied is a wait count that specifies how many of the services (events) READ·· ·ECBA· .. are required before the task is ready to continue. . When an event occurs, the following ECBA takes place: ECBA .....1 _____--' • A ncomplete flag" in the appropriate event control block is set by the POST macro-instruction. Figure 43. Situation After READ • A wait count test is made to see if the number of complete flags satisfies the Figure 44 shows the situation at the wait condition, and hence if the task time the WAIT macro-instruction is is ready. executed. In this example, the READ opera­ • A "post coden specified in the POST tion has not yet been concluded. The WAIT macro-instruction is also placed in the macro-instruction's parameters point to the event control block.. The post code event control block location, and state gives additional information regarding that only one event is needed to satisfy the manner in which the completion the WAIT. The supervisor, as a result of occurred. the WAIT macro-instruction, performs these actions: After the task has again been. given control, the programmer can determine what • ~laces the task control block address, events did occur, and in what manner. He nTCBA n, in the event control block (1), does this (with instructions following the and sets a single bit indicator (the WAIT macro-instruction) by testing each "wait bit·) in the event control block event control block. to 1, meaning that a task is waiting for the event to take place • Many requests for services may result in • Sets a 1 in the wait count indicator in waits that are of no concern to the pro­ the task control block to show the grammer -- for example, GETMAIN, GET, and number of events being awaited (2). PUT. In these cases, event control blocks • Flags the task control block as being and wait specifications al~e handled entire­ in the wait condition; therefore, its ly by the supervisor or by accessing rou­ task is no longer eligible to use the tines. central processing unit.

Section 6: Task Management 69 • Passes control to the next ranking is tested to see if a task is waiting. ready task on the queue. In this case, it is, so the task control block wait count is decremented by 1 (2). • The post code specified in the POST macro-instruction replaces the address of TCBA in the event control block • (Waiting) • The wait count in the task control block is now 0, so the task is placed TCBA SYNCH in the ready condition, eligible to compete on a priority basis for central Input/Output processing unit time. As soon as there READ, ,ECBA, • , Supervisor are no higher priority ready tasks, execution continues.

WAIT I, ECBA In the preceding example, the program reached the WAIT macro-instruction before Queue Element the requested input/output operation was completed. If the input/output operation had been completed first, the complete bit and post code would have been set, and the EJ program would have proceeded without any supervisor call interruption.

Figure 44. Situation After Execution of Enqueue (ENQ) and Dequeue (DEQ) WAIT Macro-Instructions

Figure 45 shows the situation at the The form of event synchronization des­ time the input/output operation is complet­ cribed, which employs the wait and post ed, when the input/output supervisor per­ functions, is used in the management of forms the POST function. The following resources by the supervisor. When a task then takes place: requests a system resource, a control block associated with the task is placed on the • The event control block is located from appropriate resource queue; the task may the address ECBA in the queue element have to wait until the resource is availa­ in the input/output supervisor queue ble. When it is available, the supervisor (1), and another bit, "the complete notifies the task by posting. bit," of the event control block is set to 1. Another form of event synchronization is • The wait bit in the event control block possible, which allows "cooperating" tasks

SYNCH I nterrupti on

READ'" ECBA ....

WAIT I, ECBA Queue Element

ECBA

'0 ,] 3: Q) 0.. 5 u

Figure 45. Situation at Completion of Input/Output Operation

70 to share certain resources defined by the later requests), and control is returned to user in much the same way. The resources the task. that can be controlled in this way are called n serially reusablE!.· When the task has finished with the facility, it must make it available to any other tasks that may be waiting for it. The idea of serial reusability (brought The dequeue (DEQ) macro-instruction is pro­ out in the discussion of serially reusable vided for this purpose. It causes the programs), may be applied to a large varie­ task's queue element to be removed, and the ty of facilities. Thei.r common charac­ first of any pending queue elements to be teristic is that each may be used by all activated; the busy indicator is set tasks that are associated with the same job appropriately and the next pending request step, but only one task may use them at one is satisfied by posting the appropriate time. For example, the facility may be a waiting task. table that has an entry with the value of 100. One task is to increment the value by 10, a second by 20. If the two tasks have concurrent access to the table, the first TASK PRIORITIES task may store 110, and t,he second task may store 120. The correct end value should, however, be 130. In a multitask operation, competing requests for service or resources must be If the programmer wants to control resolved. For example: two or more job access to such a facility, he may create a requests (i.e., sets of job control state­ queue of all tasks requiring access, and ments not yet acted upon) are available on limit access to one task at a time. Speci­ the input work queue; two or more requests fically, in the case of serially reusable for use of a channel and control unit to programs, he may want to queue tasks gain access to an input/output device requiring such a program, instead of allow­ appear on the corresponding resource queue; ing the control program to fetch copies of two or more tasks in the ready state appear it if the one in main storage is in use. on the task queue, etc. In all of these situations the control program must decide Queueing capabilities are available in what is to be done first. In some cases, the form of the two :macro-instructions choices are made by considering hardware enqueue (ENQ) and dequeue (DEQ). When optimization, for example, servicing ENQueue is used, a task will wait if the requests for access to a disk in a fashion facility is in use; when DEQueue is used that minimizes disk seeking time. In most (after the task comple·tes its use of the cases, however, the system relies upon a facility), it will notify the first waiting priority number provided by the user. task so that the facili·ty can again be used. The user can best decide the priority criteria. He may combine in his selection The enqueue macro-instruction (ENQ) pro­ such factors as the identification of the vides the means by which concurrently oper­ job requestor, response time requirements ating tasks can be preven'ted from interfer­ in teleprocessing applications, the amount ing with each other while using common of time already allocated to a task, or the data, or competing for a :Eacili ty that can length of the time that a job has been in not be shared. The natu:t'e of the facility the system without being processed. is known only to the tasks that require it, and is of no concern 1to the operating The result of such considerations is a system. All that the operating system priority number ranging from 0 to 14 in needs is a queue control block that is order of increasing importance. provided by the programmer. When specified, ENQ causes a request to be Initial priorities are specified on job placed in a queue associated with the queue statements and affect the sequence in which control block. A check is then made to see jobs are selected for execution. The oper­ if the nbusy indicatorn in the queue con­ ator is free to modify such priorities up trol block is on. If it is on, the to the time that the job is actually serially reusable facility cannot yet be selected. used, and the task issuing the ENQ is placed in the wait condition until its turn Further changes to priorities may be comes. made dynamically by the change priority (CHAP) macro-instruction, which allows a If the busy indicator is not on, the program to modify the priority of either task issuing the enqueue is free to use the the active task or of any of its subtasks. facility and will proceed to do so. Its Controls are available to prevent unauthor­ queue element becomes first in the queue, ized modification. The controls operate in the busy indicator is turned on (to block the following way.

Section 6: Task Management 71 When the job scheduler initiates a job It is expected that most installations step, the current priority of the job will use only three levels of priority for (which may have been set by the operator) batch-processing jobs in the normal input is used to establish a dispatching priority job stream. Normal work will automatically and a limit priority. The dispatching be assigned a median priority (as selected priority is used by the resource managers, at system generation time). A higher num­ where applicable, to resolve contention for ber will be used for urgent jobs, and a a resource. The limit priority, on the lower one for -fillers· or deferred work. other hand, serves only to control dynamic priority assignments.

Each task is free (by use of CHAP) to TASK TERMINATION change its dispatching priority to any point in the range between zero and its limit. Furthermore, when a task attaches a Normally, programs signal completion of subtask, it is free to set the subtask's their execution by either RETURN or by dispatching and limit priorities at any XCTL, as described earlier. In the case of point in the range between zero and the limit of the attacher. However, the subtask's dispatching priority ~ be high­ er than that of the attacher (although not higher than its own limit). For example, RETURN, one of the general registers if task A, with limit and dispatching (called the return code regi'Ster) is used priorities both equal to 10, wants to to transmit a return code back to the attach subtask B with a higher relative caller. If the program at the highest dispatching priority than itself, it may control level within the task executes a proceed as follows: RETURN, the supervisor treats it as an automatic end-of-task signal. The return 1. Task A uses CHAP to lower its own code at task termination may be inspected dispatching priority to 7. by the attaching task. In particular, it 2. Task A attaches B with limit and is used by the job scheduler to evaluate dispatching priorities both equal to the condition parameters in job control 8. statements. Lastly, a task may change the dispatch­ ing priority of any of its subtasks, so long as it does not exceed the higher level In addition to the normal RETURN proce­ task's limit. Care should be exercised, dure above, any program operating on behalf for if the new dispatching priority is of a task can execute an abnormal end higher than the subtask's limit priority, (ABEND) macro-instruction to discontinue the subtask's limit will be changed accord­ task execution. Two cases may exist, ingly. For example, suppose A has a limit depending on whether or not the terminating priority of 10, and attaches a subtask B task has created a subtask which is still with a limit priority equal to 8. A CHAP active. The situation with no subtask is macro-instruction may be issued under task illustrated in Figure 46. At (1) task A is A which specifies that B's dispatching attached by the job scheduler. At (2) an priority should be 9. Since 9 is less than unusual condition is recognized, and ABEND A's limit, the request is valid. Since 9 is executed. The supervisor immediately is greater than B's limit, the limit prior­ takes any special termination action ity of B will be changed to 9 as well as requested by the ABEND macro-instruction, the dispatching priority. such as causing a dump, and passing a completion code (a parameter of ABEND) to Task priorities are used as criteria for the attaching task to be recorded with key temporary suspension of low priority tasks, control areas in the supervisor. All re­ called roll-out, in case sufficient main sources of the task are released, except storage space is not available. This is the task control block itself, and the described further under -Main Storage Allo­ event control block of the attaching task cation. • which is posted. At (3) the initiator/terminator proceeds with any ter­ Job priorities (the original priorities mination procedure necessary, such as dis­ when tasks are initiated) are also used by position of data sets and release of the job scheduler's output writers to esta­ input/output resources. It then issues a blish the sequence of output printing, DETACH macro-instruction, which is a punching, and similar functions specified request to the supervisor to eliminate the in the job control statements. task control block from the system.

72 Task for Job Scheduler Task termination is considered to be Initiator/T erminator TCB normal only when all subtasks are complete, A and have been detached. Abnormal subtask termination is possible, however, without. SAVE causing termination of the attaching task. ATTACH A ECB ABEND WAIT 1, ECB Asynchronously entered or deferred sub­ routines were discussed in Section 4, "program Design and Preparation." One of DETACH A --1---* the causes for a deferred entry is an RETURN abnormal end of task. Figure 48 illus­ trates how a deferred entry is triggered in • Dump B by an abnormal end in A. The conditions • Release Task A's are similar to those of the preceding Resources example, except that task B has earlier • POST ECB executed a specify task abnormal exit * Supervisory Actnon (STAE) macro-instruction, identifying a subroutine TERM to be executed in the event Figure 46. Abnormal Termination of a Task of any abnormal termination.

At (1), task A is attached by the initiator/terminator. At (2) during the If a task encountering an unusual condi­ execution of A, subtask B is created. At tion had created a subtask, and the subtask (3) during the execution of B, the STAE had not yet finished normally, the supervi­ macro-instruction is encountered, which sor action would be slightly different. places a flag in the task control block for This situation is illustrated in Figure 47. B, indicating that subroutine TERM is to be At (1) in the execution of task A, subtask entered, to perform some post-mortem B is created, but not completed. At (2) an action, in the event that B terminates unusual condition in A results in the abnormally. At (4), during the execution execution of an ABEND macro-instruction. of A and before the normal termination of The supervisor, prior to performing the B, an ABEND is executed. The supervisor termination actions discussed in the recognizes the flag in task control block B preceding example, causes an ABEND and (5), and at the point (6) passes control to DETACH for task B, thereby eliminating all TERM. The post-mortem routine continues to traces of B from the system, including Bls completion, then returns to the supervisor task control block. Then termination at (7). The supervisor terminates both B action is taken for A. At (3), the and A, as in the previous example, and initiator/terminator executes DETACH A, posts completion of A so that the causing TCB A to be deleted. initiator/terminator can execute a DETACH.

A TCB Initiator/ Terminator

ATTACH A ATTACH B ECB Supervisor WAIT ECB ABEND--+---< 2 * ABEND B DETACH B Terminate A DETACH A o POST ECB * Delete TCB A

* Supervisory Action L...-___-I

Figure 47. Abnormal Termination of a Subtask

Section 6: Task Management 73 Initiator/ TCB Terminator

ATTACH B

ABEND ----t----t Suspend processing in A and B; give control to TERM routine in B

STAE (TERM) Prepare Exit in .------+------TCBB TERM

RETURN ----+--( Terminate B DETACH B Terminate A * Supervisory Action POST ECB

Figure 48. Deferred Exit at Abnormal End of Task

MAIN STORAGE ALLOCATION areas, the locations of which are sup­ plied by the supervisor to the problem program. The GETPOOL macro-instruction One of the important functions of the is used in conjunction with the supervisor is the control and allocation of system's data management facilities. ma1n storage space. This is done dynami­ cally, when it is demanded by a task or the control program itself. The basic alloca­ Procedures are also supplied for dynamic tion procedures, which apply in both single release of main storage areas. The areas and multitask environments, are discussed may be released automatically when the task in the following paragraphs. This is fol­ is completed. They may also be released lowed by a discussion of the procedures for during execution, either implicitly or multi task operation. explicitly. Implicit release may take place when a program is no longer in use, The only part of storage that is stati­ as signaled by RETURN, XCTL, or DELETE. cally allocated is that used by the control Explicit release is requested by the FREEM­ program on a resident basis. The size of AIN or FREEPOOL macro-instructions. this area is set at the time of system generation, and the control program nucleus Explicit allocation by GETMAIN can be fills it at the time of initial program for fixed or variable areas, and can be loading. All other main storage areas are conditional or unconditional: allocated dynamically, that is, on request. The basic request mechanisms have both been • Fixed area. The amount of storage mentioned previously. They are: requested is explicitly given. • Variable area. A m1n1mum acceptable • Implicit. An implicit request is gen­ amount of storage is specified, as well erated internally within the control as a larger amount preferred. If the program, because of some other control larger amount is not available, the program service. An example of the supervisor will respond to the request implicit request is LINK, in which the with the largest available block not supervisor finds a program, allocates less than the stated minimum. space, and fetches it. • Conditional. Space is requested if • Explicit. The GETMAIN or GETPOOL available, but the program can proceed macro-instructions may be used in any without it. user program. These are requests for • Unconditional. The task cannot proceed assignment of additional main storage without the requested space.

74 'MAIN STORAGE ALLOCATION IN A MULTITASK fically within the boundaries of a single ENVIRONMENT job step. When the initiator/terminator creates a task from a job step, it gives the task a protection key· that it shares Since main storage is shared in a multi­ with its subtasks. The protection key is task environment, several factors should be placed in the program status word when any considered when reserving space. To allow task from the job step is in control of the for effective use of space, the programmer central processing unit. should generally not, during assembly or compilation, reserve lar~Je blocks of main Storage areas allocated by the supervi­ storage that are infrequently' used. Such sor conform to the 2K- byte boundaries of blocks should be obtained and released the protection feature, on the basis of dynamically. Work areas for reenterable subpools. Each job step in the system is programs must be obtained dynamically ~r automatically assigned two logically dif­ passed by the higher level program as ferent subpools, each consisting of one or previously described) • more storage blocks. The first of these , pools is used to store non-reusable and On the other hand, since 'each dynamic serially- reusable programs from any request takes some supervisor time to make source, and reenterable programs from sour­ and account for the allocation, requests ces other than the link library. This pool for dynamic allocation and release of stor­ is considered to be unnumbered. The second age should generally not be repeatedly made pool, numbered 00, is used for any task for very small areas. work areas obtained by the supervisor, and for filling unnumbered GETMAIN or GETPOOL A number of additional storage consider­ requests. Optionally, requests may supply ations are: specific numbers, in which case numbered subpools are established. Established sub~ • Storage protection between different pools may be added to, deleted from, or tasks. entirely released. • Storage protection boundaries. • Need to pass or share storage areas The programmer, in requesting main stor­ between related tasks. age areas, normally will not be concerned • , potential for noncontiguous main stor­ about the effect of the 2K-byte block size. age areas, and the possible use of Each request is filled by the supervisor scatter loading. from any available space within the set· of • Task priorities, and the potential need 2K-byte blocks assigned to the subpool, and to clear storage areas so a high prior­ additional blocks are assigned only if a ity task can proceed. large enough space does not exist. Requests for space may be made in the form These considerations form the basis for of a list of independent requirements, so the storage allocation methods used by the that noncontiguous main storage areas can multitask supervisor. be used to fill space requests. This method is used, for example, when fetching a load module with a scatter-load attribute. ' STORAGE PROTECTION AND PROTECTION BOUNDARIES

PASSING AND SHARING OF MAIN STORAGE AREAS System/360 protects blocks of 2048 (2K) bytes of main storage. E:a.ch block can be given "a storage key in the range of 0 to When the h'ighest level task of a job 15. The operating system's supervisor step (i.e., the task attached by the job areas are assigned key 01 the remaining scheduler) is terminated, all storage pools keys are assigned to tasks created by the are released for reassignment. However, job scheduler. All of t.he tasks created when a task attaches a subtask, and makes from the same job step are given the same available to it storage areas (possibly key. containing data that is being passed as part of the linkag~, the release of those Storage protection is a vital element in storage areas after the subtask has ,been multi task operations. Undebugged programs terminated may not be desired. The higher may be tested at the same time production level task may still want them. work is being run. Production programs can contain undetected errors that are not To provide for this alternative, pro­ exposed until some peculiar combination of grams may call for the creation of subpools conditions is presented. The storage pro­ numbered 01 or greater. Each such subpool tection feature contains the effects of may be made available to a subtask at the such conditions as much as possible, speci- time it is attached by passing or by

Section 6: Task Management 75 sharing. If a subpool created by a task is control program in the following way. passed to a subtask, termination of the First, the control program attempts to free subtask will result in release of the main storage space occupied by a program subpool. If the subpool is shared, termi­ that is in storage, but is neither in use nation of the subtask will not result in nor reserved by a task. Failing that, a the release of the subpool. In both cases, decision can be made to temporarily suspend tasks that "receive" subpools (by passing the execution of one or more tasks, and or sharing) may add to them, delete from remove information associated with them them, or even release them, in the same way from main storage by writing it on an area as the originating task. of a direct-access device or on a magnetic tape. It is written in a format suitable A subtask that "receives" a subpool may for fast storage and retrieval. These in turn pass it or share it with its operations of storage and retrieval of task subtasks. Whenever a subpool is passed, information brought about by competing the higher level task surrenders all claims demands for main storage space are termed to it. Indeed, if the task then requests "roll-out" and "roll-in." additional storage blocks for the subpool, a new subpool identified by the same sub­ pool number would be formed. Whenever a The decision to rollout a task or group subpool is shared, the higher level task of tasks is made primarily on the basis of retains a claim to the subpool. All tasks task priority. A main storage demand by a with claims to a subpool must be terminated high priority task will cause as many lower before the subpool is automatically priority tasks to be rolled out as is released. necessary to satisfy the demand. If the lowest priority task in the system requires A task may share a subpool with any additional space to continue, it is placed number of subtasks that it attaches~ but it in a wait state pending main storage may not share and pass the same subpool, or availability. pass the same sub pool more than once. When roll-out takes place, it is on a Subpool 00 refers to the same set of job step basis, that is, all tasks operat­ storage blocks for all tasks in a job step~ ing under a single job step are rolled out it therefore need not be passed or shared, as a group. Roll-in takes place automat­ nor is it released until the job step is ically, as soon as the original space is complete. available again. The rolled-out group is brought back into storage exactly as it was at roll-out time, and continues execution from where it left off. All input/output TASK PRIORITIES AND ROLL-OUT operations under way at the time of the roll-out are completed before the roll-out takes place, so that no data is lost. In multijob systems, the situation can During the time a task is rolled-out, its arise where two or more job steps are being input/output units are not altered, so that executed, and one of them makes an uncondi­ repositioning information need not be tional request for additional main storage saved. A rolled-out task is not completely space, either directly or indirectly, but removed from the system, since its task no space is available for allocation. This control block remains in a wait status, situation is handled automatically by the awaiting roll-in.

76 APPENDIX: SYSTEM CONVENTIONS

The material in this and other publica­ • System Components. These are arbitrary tions related tOo Operating System/360 des­ groupings used for convenience in cribes the facilities offered by the ordering and distributing programs sup­ system. System conventions relate to the plied by IBM. System component names use of those facilities. These will begin with some letter in the conventions: range of "A" through "I." Letters "J" through "Z" will not be used by IBM, • Provide standardized methods, particu­ and are therefore available to users. larly for communication between rou­ • Object Modules. Each object module tines within tasks and between tasks. provided by IBM, if named, will have • Safeguard the user from using system the same three initial letters as the facilities in a way that would require system component of which it is a part. revision of his programs if the instal­ • Load Modules. A load module (output lation changes its computing or operat­ from the linkage editor) will have a ing system configuration. They also primary (program) name, and up to five help minimize effects of IBM changes or additional aliases, each of which is extensions of funct,ion to either the associated with the name of an entry computing or the operating system. point for the load module. Each load module is stored as a member of a Operating System/360 does not insist partitioned data set, on a direct­ that the system conventions be followed, access storage unit. Load module names although in some cases it may call the must be unique within each partitioned attention of the user t,Q a violation of a data set. Load module names need not convention. It is recognized that in some be the same as the names of the object instances a deliberate violation of a con­ modules used to create them. vention is justifiable. • Control Sections and External Symbols. Within a load module there will be one The co:qventions, descr'ibed in the fol­ or more control sections that had been lowing paragraphs, have to do with: names, defined as part of an object module. subprogram linkages, programs that can be IBM-written control sections and shared, communication between tasks, wait external references between control loops, operator messages, control section sections will use the same initial size, source language debugging, character three letters as that used in the sets, volume labels, and direct-access object module name. storage addresses. • Data Sets. Every data set used by the operating system will be named at the time of use. The name will be declared explicitly in most cases, but in some instances may be generated internally. Reference from the program is to a data definition name in a DD control state­ The standard format for names is one to ment, which in turn specifies the eight bytes, starting with an alphabetic actual data set name to be used. character, without embedded blanks. No special characters are allowed within a name. Some variation to this general rule is allowed, according to the use that will be made of the name. For example, COBOL Each data set name is made up of a language allows for names written according simple name which may be preceded by one or to different rules than those stated. more qualifiers, as was described in "Data Management." Simple names that are quali­ Names may be applied to many different fied need not be unique. Qualified names items within the operating system. Some of data sets that are cataloged, or that are of concern only to programmers, but are on the same volume must be unique. others are used by parts of the operating system and are of wider interest. Names need not be unique within the entire oper­ ating system. They must be unique, however, in the area in which they are All DD statement names used by the used. It is important to understand these control program or IBM-supplied language contexts to avoid duplications that could translator will start with the initial cause errors. letters SYS.

Appendix: System Conventions 77 SUBPROGRAM LINKAGE OPERATOR MESSAGES

A standard procedure for subprogram lin­ A standard format and rules are provided kage has been designed to give the greatest for messages to and from the console opera­ possible flexibility of use consistent with tor. All IBM-supplied system components efficient program execution. For greatest that produce operator messages will tag flexibility of interconnection, all load each message with a code that will identify modules in the system should use the stand­ the component. It is recommended that user ard linkage convention for intermodule lin­ programs follow a similar identification kage. Each load module should start with procedure. the SAVE macro and should terminate with the RETURN or XCTL macro, or their equival­ ents. CONTROL SECTION SIZE Subroutine linkage conventions are dis­ cussed in the publication, IBM Operating System/3 60: Control Program Services'. Where practical to do so, the user should divide programs into control sec­ tions that are 4096 bytes, or slightly less. The reasons are: • Addresses will be within the range PROGRAM SHARING covered by the displacement part of instructions using a single loading of a single base register. Sharable programs are either reenterable • The control program can scatter load or serially reusable. Where possible, sub­ when appropriate. programs should be written and designated • The supervisor can allocate main stor­ as one of these types. The advantage to be age space efficiently. Programs that gained increases as the number of uses of are at or under some multiple of 2048 the program increases. bytes are most efficient, and those just over are least efficient. When considering control section size, the user may consider the effect of program maintenance and modification, which can INTERTASK COMMUNICATION cause programs to change in size.

Definite rules are stated for the ATTACH macro-instruction, telling what parameters CHARAC~ER SET CONSIDERATIONS can be passed, and how. Techniques exist, however, which a programmer could use to bypass the supervisor's control and esta­ System/360 permits ,relatively free asso­ blish direct task-to-task intercommunica­ ciation between the internal bit structure tion. It is strongly recommended that only of a byte and the graphic symbol represent­ the standard methods be used, because a ed. The TRANSLATE instruction simplifies nonstandard approach can cause system side any translations that may be needed. Even effects that may be hard to find and to so, there are considerations that may correct, particularly if there is any affect program design. Some of these are: change in the supervisor due to new equip­ • The number of characters in the set of ment, addition of selectable modules, or each printer in the system, which is program updating. generally device dependent. • The use of dual graphics for a single bit configuration. System/360 coding separates the graphics of the former -A" and "H- character sets used with USE OF WAIT the 1403 and other IBM printers. It is recommended that dual usage in instal­ lations be eliminated. The programmer should use the WAIT • The trend toward standardization of macro-instruction in cases where event syn­ codes under the auspices of the Ameri­ chronization is needed, rather than pro­ can Standards Association and the gramming a wait loop as has been common International Standards Organization. practice. Wait loops waste central proc­ Widespread use of a standard code essing unit time, and prevent the supervi­ structure might be reason for an sor from allocating resources efficiently. installation to change internal codes.

18 It is strongly recommended that user VOLUME LABELS programs be written so that they do not depend on specific relations between bit configurations and graphic symbols in cases where there is a possibility of character The operating system provides a standard code change. Dependencies will be needed label procedure for all magnetic tape in some cases, in spite of oareful program reels, disk packs, and data cells. With design. such cases shoul.d be related to a tapes, however, there may be compatibility table, if possible, in a way that would considerations, and users may choose to allow table replacement t.o handle any code incorporate their own nonstandard tape­ change. In any event, it. is recommended label handling procedures, or not to check that any character code-dependent sections tape labels. Details on system standards of coding be clearly identified in all in this area are described in IBM Operatinq program documentation to help identify System/360: Data Manaqement. places where reprogramming might be needed.

SOURCE LANGUAGE DEBUGGING AND MAINTENANCE .TRACK ADDRESS INDEPENDENCE Good programming practice requires that source language programs be maintained in an up-to-date condition at all times. Operating System/360 is designed to assist Space on direct-access storage units is the user to keep source programs current allocated dynamically on a track or and avoid the temptation to "patch" at the cylinder basis. To make the best use of object program level. The general approach available space, access methods have provi­ to program debugging is in.sertion of debug­ sions to allocate physically separated ging statements using the same language and tracks; and, for purposes of data access, compiler facilities as the program being to convert relative track addresses (that tested. Changes for test purposes, and for relate to the boundary of the data set) to correction of errors, are made by recompil­ actual track addresses. Therefore, for ing only the object module in which the purposes of space allocation, as well as change is needed. The new or revised programming ease, programs should generally object module is then recombined with other be written to use relative track addresses modules using the linkage editor, to pro­ and remain independent of the actual duce and store a load module for test. addresses.

Appendix: System Conventions 79 GLOSSARY

access method: Any of the data management , maintained by data management. techniques available to the user for trans­ 2. To include the volume identification of ferring data between main storage and an a data set in the catalog. input/output device. address constant: A value, or an expres­ cataloged data set: A data set that is sion representing a value, used in the represented in an index or hierarchy of calculation of storage addresses. indexes which provide the means for locat­ ing it. alias: An alternate name that may be used to refer to a member of a partitioned data cataloged procedure: A set of job control set1 an alternate entry point at which statements that has been placed in a catal­ execution of a program can begin. oged data set and can be retrieved by naming it in an execute (EXEC) statement. allocate: To grant a resource to, or reserve it for, a job or task. checkpoint: 1. A point at which information about the asynchronous: Without regular time rela­ status of a job step can be recorded so tionship1 hence, as applied to program that the job step can be restarted. execution, unexpected or unpredictable with 2. To record such information. respect to instruction sequence. concatenated data set: A collection of attach (task): To create a task control logically connected data sets. block and present it to the supervisor. control block: A storage area through attribute: A characteristic1 e.g., attri­ Which a particular type of information butes of data include record length, record required for control of the operating sys­ format, data set name, associated device tem is communicated among its parts. type and volume identification, use, crea­ tion date, etc. control dictionary: The external symbol dictionary and relocation dictionary, col­ auxiliary storage: Data storage other than lectively, of an object or load module. main storage. control program: A collective or general basic access method: Any access method in term for all routines in the operating which each input/output statement causes a system that contribute to the management of corresponding machine input/output opera­ resources, implement the data organization tion to occur. (The primary macro­ or communications conventions of the oper­ instructions used are READ and WRITE.) ating system, or contain privileged opera­ tions. : (See stacked job processing. ) control section: The smallest separately relocatable unit of a program1 that portion block (records): of text specified by the programmer to be 1. To group records for the purpose of an entity, all elements of which are to be conserving storage space or increasing the loaded into contiguous main storage loca­ efficiency of access or processing. tions. 2. A physical record so constituted, or a portion of a telecommunications message control volume: A volume that contains one defined to be a unit of data transmission. or more indexes of the catalog. block loading: The form of fetch that data control block: A control block brings the control sections of a load through which the information required by module into contiguous positions of main access routines to store and retrieve data storage. is communicated to them. buffer (program input/output): A portion data definition name (ddname): A name of main storage into which data is read, or appearing in the data control block of a from which it is written. program which corresponds to the name field of a data definition statement. catalog: 1. The collection of all data set indexes data definition (DO) statement: A job

80 control statement that describes a data set task; typically, the completion of an asyn­ associated with a particular job step. chronous operation, such as input/output. event control block (ECB): A control block data manaqement: A general term that col­ used to represent the status of an e~ent. lectively describes those functions of the control program that pro-vide access to data exchange buffering: A technique using data sets, enforce data storage conventions, and chaining for eliminating the need to move regulate the use of input/output devices. data ln main storage, in which control of buffer segments and user program work areas data organization: A term that refers to is passed between data management and the anyone of the data management conventions user program according to the requirements for the arrangement of a data set. for work areas, input buffers, and output buffers, on the basis of their data set: The major uni"t of data storage availability. and retrieval in the operating system, consisting of a collection of data in one exclusive segments: Segments in the same of several prescribed arrangements and des­ region of an overlay program, neither of cribed by control information that the which is in the path of the other. They system has access to. cannot be in main storage simultaneously. data set control block (DSCB) A data set execute (EXEC) statement: A job control label for a data set in direct-access statement that designates a job step by storage. identifying the load module to be fetched and executed. data set label (DSL): A collection of information that describes the attributes extent: The physical locations on of a data set, and that is normally stored input/output devices occupied by or res­ with the data set; a general term for data erved for a particular data set. set control blocks and tape data set labels. external reference: A reference to a sym­ bol defined in another module. deferred entry: An entry into a subroutine that occurs as a result of a deferred exit external symbol: A control section name, from the program that passed control to it. entry point name, or external reference; a symbol contained in the external symbol deferred exit: The passing of control to a dictionary. subroutine at a time determined by an asynchronous event rather than at a predic­ external symbol dictionary (ESD): Control table time. information associated with an object or load module which identifies the external device independence: The ability to symbols in the module. request input/output operations without regard to the characteristics of the fetch (program): input/output devices. 1. To obtain requested load modules and load them into main storage, relocating direct access: Retrieval or storage of them as necessary. data by a reference to its location on a 2. A control routine that accomplishes 1. volume, rather than rela1:.ive to the pre­ viously retrieved or stored data. F format: A data set record format in which the logical records are the same dispatching priority: A number assigned to length. tasks, and used to determine precedence for use of the central processing unit in a generation data group: A collection of multi task situation. successive, historically related data sets. dump (main storage) : inclusive segments: Overlay segments in 1. To copy the contents of all or part of the same region that can be in main storage main storage onto an output device, so that simultaneously. it can be examined. 2. The data resulting from 1. index (data management) 3. A routine that will accomplish 1. 1. A table in the catalog structure used to locate data sets. entry point: Any location in a program to 2. A table used to locate the records of which control can be passed by another an indexed sequential data set. program. initial program loading (IPU: As applied event: An occurrence 01: significance to a to the operating system, the initialization

Glossary 81 procedure which loads the nucleus and it. A job step consists of the external begins normal operations. specifications for work that is to be done as a task or set of tasks. Hence,- also initiator/terminator: The job scheduler used to denote the set of all tasks which function that selects jobs and job steps to have their origin in a job step specifi­ be executed, allocates input/output devices cation. for them, places them under task control, and at completion of the job, supplies control information for writing job output language translator: A general term for on a system output unit. any assembler, compiler, or other routine :that accepts statements in one language and input job stream: A sequence of job con­ produces equivalent statements in another trol statements entering the system, which language. may also include input data. ·library: input work queue: A queue of summary 1. In general, a collection of objects information of job control statements main­ (e.g. , data sets, volumes, card decks) tained by the job scheduler, from which it ,associated with a particular use, and the selects the jobs and job steps to be :location of which is identified in a direc­ processed. :tory of some type. In this context, see job library, link library, system library. installation: A general term for a parti­ 2. Any partitioned data set. cular computing system, in the context of the overall function it serves. and the limit priority: A priority specification individuals who manage· it, operate it, associated with every task in a multitask apply it to problems, service·it, and use operation, representing the highest dis­ the results it produces. patching priority that the task may assign to itself or to any of its subtasks. job: An externally specified unit of work for the computing system from the stand­ link library: A generally accessible par­ point of installation accounting and oper­ ·titioned data set which, unless otherwise ating system control. A job consists of :specified, is used in fetching load modules one or more job steps. referred to in execute (EXEC) statements :and in ATTACH, LINK, LOAD, and transfer job control statement: Anyone of the control (XCTL) macro-instructions. control statements in the input job stream that identifies a job or defines its linkage: The means by which communication requirements. is effected between two routines or modules. job library: A concatenation of user­ identified partitioned data sets used as linkage editor: A program that produces a the primary source of load modules for a load module by transforming object modules given job. into a format that is acceptable to fetch, combining separately produced object job management: A general term that modules and previously processed load collectively describes the functions of the modules into a single load module, resolv­ job scheduler and master scheduler. 'ing symbolic cross references among them, ·replacing, deleting, and adding control iob scheduler: The control program fUnc­ sections automatically on request, and pro­ tion that controls input job streams and viding overlay facilities for modules system output, obtains input/output re­ requesting them. sources for jobs and job steps, attaches tasks corresponding to job steps, and oth­ :load: To fetch, i.e., to read a load erwise regulates the use of the computing :module into main storage preparatory to system by jobs. (See reader/interpreter, executing it. initiator/terminator, output writer.) :load module: The output of the linkage job (JOB) statement: The control statement editor; a program in a format suitable for in the input job stream that identifies the ;loading into main storage for execution. beginning of a series of job control state­ ments for single job. :locate mode: A transmittal mode in which ldata is pOinted to rather than moved. job step: A unit of work for the computing system from the standpoint of the user, 'logical record: A record from the stand- presented to the control program by job pOint of its content, function, and use control statements as a request for execu­ rather than its physical attributes; i.e., tion of an explicitly identified program one that is defined in terms of the infor­ and a description of resources required by mation it contains.

82 macro-instruction: A general term used to executable, form and an associated control collectively describe a macro-instruction dictionary. statement, the corresponding macro­ instruction definition, the resulting operator command: A statement to the con­ assembler language st,atements, and the trol program, issued via a console device, machine language instructions and other which causes the control program to provide data produced from the assembler language requested information, alter normal opera­ statements; loosely, anyone of these rep­ tions, initiate new operations, or termi­ resentations of a machine language instruc­ nate existing operations. tion sequence. output work queue: A queue of control information describing system output data main storage: All addressable storage from sets, which specifies to an output writer which instructions can be executed or from the location and dispoSition of system whioh data can be loaded directly into output. registers. output writer: A job scheduler function master scheduler: The control program that transcribes specified output data sets function that responds to operator onto a system output unit, independently of commands, initiates actions requested the program that produced such data sets. thereby, and ret urns r~:!!quested or required information; thus, the overriding medium overlay: To place a load module or a for controlling the use of the computing segment of a load module into main storage system. locations occupied by another load module or segment. module (programming): The input to, or output from, a singlE~ execution of an overlay (load) module: A load module that assembler, compiler, or linkage editor; a has been divided into overlay segments, and source, object, or load module; hence, a has been provided by linkage editor with program unit that is discreet and identifi­ information that enables overlay supervisor able with respect to compiling, combining to implement the desired loading of seg­ with other units, and loading. ments when requested. move mode: A transmittal mode in which overlay segment: (See segment.) data is moved between the buffer and the user's work area. overlay supervisor: A control routine that initiates and controls fetching of overlay multijob operation: A 'term that describes segments on the basis of information concurrent execution of job steps from two recorded in the overlay module by linkage or more jobs. editor. multiprogramming: A general term that parallel processing: Concurrent execution expresses use of the computing system to of one or more programs. fulfill two or more different requirements concurrently. path: A series of segments which, as represented in an overlay tree, form the multitask operation: Multiprogramming; shortest distance in a region between a called multitask operation to express par­ given segment and the root segment. allel processing not only of many programs, but also of a single reenterable program ....p~h~y...;s;;.;i=-c=-a;;;;.l~~r..;:e:;..;;c;..;o:;..;;r=-d;::;..;;..: A record from the st'and­ used by many tasks. point of the manner or form in which it is stored, retrieved, and moved; i.e., one ~ A set of one or more characters that that is defined in terms of physical quali­ identifies a statement, data set, module, ties. etc., and that is usually associated with the location of that which it identifies. polling: A technique by which each of the terminals sharing a communications line is nucleus: That portion of the control pro­ periodically interrogated to determine if gram that must always be present in main it reqUires servicing. storage. Also, the main storage area used by the nucleus and other transient control To note the occurrence of an event. program routines. priority scheduling system: A form of job object module: The 01lltput of a single scheduler which uses input and output work execution of an assembler or compiler, queues to improve system performance. which constitutes input to linkage editor. An object module consists of one or more private library (of a job step): Any control sections in relocatable, though not parti tioned (lata set which is neither the

Glossary 83 link library nor any part of the job relocation: The modification of address library. constants required to compensate for a change of origin of a module or control section. problem program: Any of the class of routines that perform processing of the type for which a computing system is ~elocation dictionary: That part of an intended, and including routines that solve Object or load module which identifies all problems, monitor and control industrial relocatable address constants in the processes, sort and merge records, perform ~odule. computations, process transactions against stored records, etc. resource: Any facility of the computing processing program: A general term for any system or operating system required by a program that is not a control program. job or task and including main storage, ~nput/output devices, the central process­ protection key: An indicator associated ~ng unit, data sets, and control and proc­ with a task which appears in the program essing programs. status word whenever the task is in control, and which must match the storage resource manager: A general term for any keys of all storage blocks which it is to control program function responsible for use. the allocation of a resource. qualified name: A data set name that is restart: To reestablish the status of a composed of multiple names separated by job using the information recorded at a periods (e.g., TREE.FRUIT.APPLE) • checkpoint. qualifier: All component names in a quali­ return code: A value that is by system fied name other than the rightmost (which convention placed in a designated register is called the simple name) • :(the "return code register") at tl1e comple­ tion of a program. The value of the code, queue control block (QCB): A control block which is established by user-convention, that is used to regulate the sequential use ~ay be used to influence the execution of of ,a programmer-defined facility among succeeding programs or, in the case of an requesting tasks. abnormal end of task, it may simply be printed for programmer analySis. queued access method: Any access method that automatically synchronizes the trans­ return code register: A register identifi­ fer of data between the program using the ed by system convention in which a user­ access method and input/output devices, specified condition code is placed, at the thereby eliminating delays for input/output pompletion of a program. operations. (The primary macro­ instructions used are GET and PUT.) reusable: The attribute of a routine that the same copy of the routine can be used by reader/interpreter: A job scheduler two or more tasks. (See reenterable, function that services an input job stream. serially reusable.) ready condition: The condition of a task roll in: To reinstate a task or a set of that it is in contention for the central tasks that had been rolled out. processing unit, all other requirements for its activation having been satisfied. rollout: To record on an auxiliary stor­ :age device the contents of main storage real time (interval timer): Actual time. tocations associated with a task so as to :free main storage for allocation to a task record: A general term for any unit of ,of higher priority, and to do so at the data that is distinct from all others when !discretion of the control program rather considered in a particular context. than the task that is rolled out. reenterable: The attribute of a load :root segment: That segment of an overlay module that allows the same copy of the program that remains in main storage at all load module to be used concurrently by two 'times during the execution of the overlay or more tasks. program; the first segment in an overlay 'program. region: A contiguous area of main storage within which segments can be loaded inde­ scatter loading: The form of fetch that pendently of paths in other regions. Only may place the control sections of a load one path within a region can be in main module into non-contiguous positions of storage at one time. main storage.

84 scheduler: (See master scheduler and job storage block: A contiguous area of main scheduler.) storage consisting of 2048 bytes to which a storage key can be assigned. secondary storage: Auxiliary storage. storage key: An indicator associated with a storage block or blocks, which requires seek: To position the access mechanism of that tasks have a matching protection key a direct-access device at a specified loca­ to use the blocks. tion. substitute mode: A transmittal mode used segment: with exchange buffering in which segments 1. The smallest functional unit (one or are pointed to and exchanged with user work more control sections) that can be loaded areas. as one logical entity during execution of an overlay program. subtask: A task that is created by another 2. As applied to telecommunications, a task by means of the ATTACH macro­ portion of a message that can be contained instruction. in a buffer of specified size. supervisor: As applied to Operating sequential scheduling system: A form of System/360, a routine or routines executed the job scheduler which recognizes one job in response to a requirement for altering step at a time in the sequence in which or interrupting the flow of operations each job appears in the input job stream. through the central processing unit, or for performance of input/output operations, serially reusable: The attribute of a and, therefore, the medium through which routine that when in main storage the same the use of resources is coordinated and the copy of the routine can be used by another flow of operations through the central task after the current use has been con­ processing unit is maintained; hence, a cluded. control routine that is executed in supervisor state. service program: Any of the class of standard routines that assist in the use of synchronous: Occurring concurrently, and a computing system and in the successful with a regular or predictable time rela­ execution of problem programs, without con­ tionship. tributing directly to control of the system or production of results, and including SYSIN: A name conventionally used as the utilities, simulators, 1:.est and debugging data definition name of a data set in the routines, etc. input job stream. short block: A block of F format data SYSOUT: An indicator used in data defini­ which contains fewer logical records than tion statements to signify that a data set are standard for a block. is to be written on a system output unit. simple buffering: A technique for con­ system input unit: A device specified as a trolling buffers in such a way that the source of an input job stream. buffers are assigned to a single data control block and remain so assigned until system library: The collection of all the data control block is closed. cataloged data sets at an installation. simple name: The righ1:most component of a system macro-instruction: A pre-defined qualified name (e.g., APPLE is the simple macro-instruction that provides access to name in TREE.FRUIT.APPL~ • operating system facilities. source module: A series of statements in system output unit: An output device the symbolic language of an assembler or shared by all jobs, onto which specified compiler, which constitutes the entire output data is transcribed. input to a single execution of the assem­ bler or compiler. system residence volume: The volume on which the nucleus of the operating system stacked job processing: A technique that and the highest level index of the catalog permits multiple job definitions to be are located. grouped (stacke~ for presentation to the system, which automatically recognizes the ~ A unit of work for the central jobs, one after the other. More advanced processing unit from the standpoint of the systems allow job definitions to be added control program; therefore, the basic mul­ to the group (stack) at any time and from tiprogramming unit under the control pro­ any source, and also hOllor priorities. gram.

Glossary 85 task control block (TCB): The consolida­ efficiency~ the rate at which work can be tion of control information related to a handled by a computing system. task. transmittal mode: The method by which the contents of an input buffer are made avai­ task dispatcher: The control program func­ lable to the program, and the method by tion that selects from the task queue the w~ich a program makes records available for task that is to have control of the central output. processing unit, and gives control to the task. turn-around time: The elapsed time between submission of a job to a computing center task manaqement: A general term that col­ and the return of results. lectively describes those functions of the control program that regulate the use by U format: A data set format in which tasks of the central processing unit and ~locks are of unspecified or otherwise other resources (except for input/output u;nknown length. devices) • user: Anyone who requires the services of task queue: A queue of all the task a computing system. control blocks present in the system at any one time. V: format: A data set format in which logical records are of varying length and telecommunications: A general term include a length indicator; and in which V expressing data transmission between a com­ format logical records may be blocked, with puting system and remotely located devices ~ach block containing a block length indi­ via a unit that performs the necessary qator. format conversion and controls the rate of transmission. volume: All that portion of a single unit of storage media which is accessible to a teleprocessinq: A term associated with IBM ~ingle read/write mechanism. telecommunications equipment and systems. volume table of contents WTOC): A table test translator: A facility that allows associated with a direct-access volume, various debugging procedures to be speci­ Which describes each data set on the fied in assembler language programs. volume. text: The control sections of an object or wait condition: As applied to tasks, the load module, collectively. condition of a task that it is dependent on an event or events in order to enter the throughput: A measure of system i;eady condition.

86 Abnormal end of task (ABEND) macro- transmittal modes 30 instruction 41,73 BUFFER macro-instruction 30 Abnormal end of task exit 41 Buffer pools 30 Access language categories 12 Buffering Access method chained segment 31 definition 80 exchange 31 description 12,26 facilities 30 direct 27 simple 31 indexed sequential 26 specification of 15 parti tioned 26 BUILD macro-instruction 30 sequential 26 summary (Table 1) 37 CALL macro-instruction 41,43 telecommunications 27 Catalog Action statements 51 definition 80 Address constant 14,80 editing 25 Affinity 57 indexes 11,24 Alias names 40,80 search procedure 24 Allocation 18,66,80 structure 11 Assembler language program debugging (test Cataloged data set 11,80 translator) 50 Cataloged procedures 16,58,80 ATTACH macro-instruction Cataloging 11,23,80 definition 80 Chained segment buffering 31 dynamic parallel structures 46 Change priority (CHAP) macro-instruction subtask creation 67 71,72 task creation 18,65 Channel affinity 57 Attribute Channel separation 57 data 80 Character set conventions 78 loading 63 CHECK macro-instruction Automatic volume recognition (AVR) 16,59 use in BPAM 26 Auxiliary storage use in BSAM 26 definition 80 Checkpoint 49,80 locating data on 10 Checkpoint (CHKPT) macro-instruction 49 CLOSE functions 22,34 Basic access method 12,30,80 CLOSE macro-instruction 22 Basic direct access method (BDAM) 27 Combining Subprograms 13,39 Basic indexed sequential access method Concatenated data sets 55,80 (BISAM) 26 Connected or concatenated data sets 55,80 Basic partitioned access method (BPAM) 26 Control block 18,22,80 Basic sequential access method (BSAM) 26 Control dictionary 80 Basic telecommunications access method Control program 8,80 (BTAM) 29 Control section BDAM (basic direct access method) 27 definition 14,80 BISAM (basic indexed sequential access naming conventions 77 method) 26 size conventions 78 Block Control statement data 29 capabilities 52 definition 80 data definition (DO) 15,52,80 formats 29 execute (EXEC) 15,52,81 telecommunications 29 job (JOB) 15,52,82 Block loading 63,80 test translator 50 Blocking Control volume 24,80 facilities 29 specification of 15 Data BPAM (basic partitioned access method) 26 access methods 25 BSAM (basic sequential access access routines 34 method) 26 control block 30,33,80 BTAM (basic telecommunications access identifying and locating 10 method) 29 organizing 11 Buffer storing and retrieving 11,23 assignment techniques 30 Data access methods definition 80 basic direct 27 pools 30 basic indexed sequential 26 Index 87 basic partitioned 26 Device control 11 basic sequential 26 Device independence 12,81 basic telecommunications 29 Direct-access 81 definition 12,80 Direct-access storage queued indexed sequential 26 creation of data set in 22 queued sequential 26 space allocation 58 queued telecommunications 27 track address independence 79 summary (Table 1) 37 Direct access volume 10 Data accessing operation 35 identification and the VTOC 22 Data access routines 34 initialization of 22 Data control block Direct calls 43 definition 30,80 Directory 26 fill-in 34 Dispatching priority 72,81 initialization 33 Downward calls 43 Data definition name (ddname) 52,80 DSCB (data set control block) 22,81 Data definition (DD) statement 15,52,80 DSL (data set label) 22,81 Data key 26,27 Dummy data sets 55 Data management pynamic parallel program structures 46 definition 81 Dynamic serial program structures 43 detailed description 22 facilities provided 10,11 End of block (EOB) 29 general description 10 End of message (EOM) 29 Data organization 11,81 Enqueue (ENQ) macro-instruction 48,70,71 Data set Event access methods 12,25,80 definition 81 cataloged 11,23,24,80 posting 66 connected or concatenated 55,80 synchronization 68 control block 22,81 system action at occurance of 69 creation 23 Event control block (ECB) 67,69,81 definition 10,22,81 Event synchronization 68,69 deletion 56 :Exchange buffering dummy 55 definition 31,81 editing of 25 substitute mode 32 extent 22,81 Exclusive segments 42,81 header label (tape) 23 EXCP macro-instuction 12,35 identification and disposition 54 ,Execute channel program (EXCP) macro­ identification and extent control 22 instruction 12,35 inclusion in input stream 16 Execute (EXEC) statement 15,52,81 label 22,81 Explicit release of main storage space 74 name 10,23,77 Explicit request for main storage space 74 partitioned 11 ; Explicit wait 68 password protection of 10,25 ,Extent 22,81 security protection of 10 External symbols sequence number 23 definition 81 sharing by subtasks 27 naming conventions 77 temporary 56 External termination (of a taSk) 41 trailer label (tape) 23 updating of 25 'Fetch procedure 63,81 use by concurrent tasks 27 ,FIND macro-instruction 26 Data set control block (DSCB) 22,81 Fixed-length (F-format) blocks 29,81 Data set label (DSL) 22,81 ;FREEBUF macro-instruction 30 DCB 'FREEDBUF macro-instruction 30 data control block 30,33,80 ; FREEMAIN macro-instruction 48,74 macro-instruction 34 FREEPOOL macro-instruction 74 dcbname 55 ddname 52,80 GDG (generation data group) 24,55,81 DD * statement 55 Generation and version number 24 Debugging facilities 50 i Generation data group (GDG) 24,55,81 Deferred exit GET macro-instruction at abnormal end of task 73 implied wait 67 definition 81 locate mode 31,32 to subroutine 41 move mode 31 Deferred mounting 58 scan mode 26 DELETE macro-instruction 45 use in exchange buffering 33 Dependencies 53 use in QISAM 26 Dequeue (DEQ) macro-instruction 48,70,71 use in QSAM 26 DeSign of reenterable programs 48 use in QTAM 27,28 DETACH macro-instruction 72,73 use in queued access language 12,31

88 GETBUF macro-instruction 30 LINK macro-instruction 43 GETMAIN macro-instruction 48,14 Linkage editor 14,82 GETPOOL macro-instruction 30,74 LOAD macro-instruction 45 GET/PUT language 12 Load mode 21 Load module Identifying and locating data 10 definition 14,82 Implicit release of main storage space 74 execution within a task 40 Implicit request for main storage space 74 fetching from library 63 Implicit wait 67 naming conventions 11 Inclusive segments 42,8'1 simple structure 42 Indexed sequential use by concurrent tasks 48 access method 26 Loading attributes 63 organization 11 Locate mode Indexes definition 31,82 catalog 11,23 simple buffering 32 cylinder 26 Logical records definition 81 definition 82 editing 25 in data blocks 29 track 26 use by concurrent tasks 26 Indirect calls 43 Initial program load (IPL) 65,81 Initiator 16 Magnetic tape volumes 22 Initiator/terminator 17~59,82 Main storage Input job stream 15,61,82 block loading into 63,80 Input/output device definition 83 allocation 16,56 explicit release of 74 control 11 explicit request for 74 names 56,51 implicit release of 74 pools 51 implicit request for 74 Input/output overlap 57~58,64 overlaying 42,43 Input/output supervisor 35 passing and sharing of 75 Input work queue 17,60,B2 scatter loading into 63,84 Internal termination (of a task) 41 subpools 75 Interval timer .41,49 Main storage allocation 74 IPL (initial program load) 65,81 Master password 25 Master scheduler 16,52 job 15,52,82 definition 83 Job account log 11 functions 61 Job accounting 11 in multi task operation 65 Job control language 15 Members 11,26 Job (JOB) statement 15, ~)2, 82 Message Job library 48,54,82 operator 16 Job log 54 remote 11,29 Job management Model data set label 25 detailed description 52 Move mode general description '15 definition 31,83 options 11 simple buffering 31 Job priority 16,53 Multijob initiation 18,60 Job scheduler 16,53 Multijob operation 60,16,83 description 82 Multiprogramming 18,83 functions 59 Multitask operation 64 Job step 15,82 advantages of 19 definition 83 Labels job priority in 18 data set 22 main storage allocation 74 data set header 23 data set trailer 23 Names non-standard tape 23 alias 40,80 standard 23 conventions 17 volume 10,19 data set 10,22 Language translators qualified 23,84 definition 8,82 simple 23,85 input to 14 Nested subprograms 45 output from 14 Non-reusable 41 Library 11,84 Non-setup jobs 11,53 Library management 24 Non-setup padding 11,59 Limit priority 12,82 Non-standard tape labels 23 Link library 48,54,82 NOTE macro-instruction 13 Index 89 Object module not reusable 47 definition 13,83 reenterable 48,84 naming conventions 77 reusable 48,84 OPEN functions 22,33 serially reusable 48,85 in simple structured programs 41 Program design and preparation preparing CCW lists 35 detailed description 39 OPEN macro-instruction 22 general description 13 open functions 33 Program error exits 41 protection flag test 25 Program segmentation 39 Operating system Program segments 42,43 benefits to the programmer 8 Program source selection 54 description 2,8 Program structures 39 elements 8 dynamic parallel 46 Operator commands 15,62,83 dynamic serial 43 Operator communications 15 planned overlay 42 Operator messages simple 40 conventions 78 Projected mount 59 in priority scheduling system 17 Protection key 48,84 in sequential scheduling system 16 PUT macro-instruction Organizing data 11 load mode 26 Output work queue 17,61,83 locate mode 31 Output writers 17,60,83 move mode 31 Overlay 14,63,83 use in exchange buffering 32 Overlay module 83 use in QISAM 26 Overlay segment 42,85 use in QSAM 26 Overlay structured program 42 use in QTAM 27,28 Overlay supervisor 43,83 use in queued access language 12,31 Overlay tree structure 42 use in simple buffering 32 PUTX macro-instruction Partitioned use in QISAM 26 access method 26 use in simple buffering 32 organization 11 Partitioned data set (PDS) QISAM (queued indexed sequential access definition 11 method) 26 directory 26 QSAM (queued sequential access method) 26 member 11 QTAM (queued telecommunications access Passed subpools 75 method) 27 Passing and sharing Qualified name 10,23,84 of data sets 27 Qualifier 11,84 of main storage areas (subpools) 75 Queue control block (QCB) 84 Passwords 25 Queued access methods 12,31,84 Path 43,83 Queued indexed sequential access method PDS (partitioned data set) 26 (QISAM) 26 Planned overlay structures Queued sequential access method (QSAM) 26 description 39,42 Queued telecommunications access method versus dynamic structures 46 (QTAM) 27 POINT macro-instruction 13 Polling 29,83 Read only 48 POST macro-instruction 68 READ macro-instruction Priorities use in basic access language 12,30 changes to 71 use in BDAM 27 dispatching 72,81 use in BISAM 26 limit 72,82 use in BPAM 26 roll-out 72,76 use in BSAM 26 Priority scheduling system 17,83 use in BTAM 29 Private library 48,83 READ/WRITE language 12 Private volume 58 Reader/interpreter 16,59,84 Processing programs 8,84 Ready condition 19,67,84 Program Real time 49,84 and SUbprogram 13 Reenterable programs completion of 72 definition 84 contrasted with task 18 design of 48 conventions for sharing 78 shared use of 49 debugging facilities 50 Region 43,84 deferred exit from 41 Relocation 39,84 design facilities 47 RELSE macro-instruction 12 error exits from 41 Remote stacked-job processing 18,59 interruption handling of 41 Remote terminals 11,18

90 Resource allocati on,; 18,67 Subprogram Resource managers 167,84 at different levels of control 13 Resources at same and different levels of controlling access to 71 control 14 definition 84 combining 13 passing to subtasks 68 definition 13 serially-reusable 71 delays expected in execution of 47 use by tasks 18,67 immediate requirement for 46 Restart 49,84 linkage conventions 78 RETURN macro-instruction nesting 45 in dynamic structured programs 44 no delay expected in 47 in simple structured programs 40 within a program 40 task termination 72 Subroutines 41 Reusability 48,84 Substitute mode Roll-in 76,84 definition 31,85 Roll-out 72,76,84 exchange buffering 32 Root segment 42,63,84 Subtask abnormal termination of 73 SAVE macro-instruction 40 changing priority of 72 Scan mode 27 creation 65 Scatter loading 63,84 definition 85 Scheduling controls 53 end of 41 Secondary storage 42,85 sharing resources 68 Segment sharing subpools 75 definition 85 Supervisor 16,85 overlay 42 Supervisor call (Svq 43 program 41,42 SYSIN 55,85 telecommunications 2~J SYSOUT 61,85 Segment load (SEGLD) macro-instruction 43 System conventions 77 Segment wait (SEGWT) macro-instruction 43 System library 85 Separation 57 System output data 17,60 Sequential System output writers 17,60,83 access method 26 System residence volume 24,85 organization 11 Sequential scheduling system 16,85 Task control block (TCB) 18,67,86 Serially reusable Task dispatcher 67,86 programs 48,85 Task management resources 71 definition 86 Service programs 8,85 detailed description 63 Set lower limits (SETL) macro­ general description 18 instruction 27 Task queue 18,67,68,86 Set program interrupt exit (SPIE) macro- Task time 49 instruction 41 Tasks Set timer (STIMER) macro-·instruction 41,49 active 18,67 Shared subpools 75 attaching a subtask 67 Simple buffering changing priority of 72 definition 31,85 communication conventions 78 locate mode 32 concurrent use of data set 27 move mode 32 concurrent use of reenterable load Simple name 23,85 module 48 Simple program structures 39,40 creation (ATTACH) 18,39,46,65 Single-task operations 63,64 definition 18,85 Source language debugging' conventions 79 dispatching of 19 Source module 13,85 passing information between 76 Specify task abnormal exit (STAE) macro­ preventing interference between 27 instruction 41 priorities 18,71,72,76 SPIE (set program interrupt exit) macro­ queueing of 18,67 instruction 41 ready condition 18,67,84 Split cylinder 58 representation of 18 STAE (specify task abnormal exit) macro- roll-out and roll-in of 76 instruction 41 switching control among 19 Standard label 23 synchronization between 69 STIMER (set timer) macro-instruction 41,50 termination of 41,45 Storage key 48,85 use of resources 18 Storage protection 48 waitcondition 18,67,86 Storing and retrieving data 11 TCB (task control bloc~ 18,67,86 STOW macro-instruction 26 Telecommunications Subpools 75 access method 27,29 Index 91 definition 86 editing 25 organization 11 examples of 10 Telecommunications jobs 18,60,65 labels 10,79 Teleprocessing 71,86 magnetic tape 22 Temporary data set 56 mounting 15,16,17 TEST CLOSE macro-instruction 51 private 58 TEST OPEN macro-instruction 50 system residence 24,85 TEST option (test translator) 50 table of contents 10,22,86 TEST output 51 Volume table of contents (VTOC) 10,22,86 Test timer (TTlMER) macro- instruction 41,50 Wait condition 18,67,86 Test translator 50,51,86 WAIT macro-instruction Throughput 86 conventions for 78 TI~~ macro-instruction 49 explicit or implicit statement of 67 Timer 41,49 use.in BDAM 27 Track index 26 use in BISAM 26 Transfer control (XCTL) macro-instruction use in BTAM 29 44,72 use in event synchronization 68 Transient control program routines 64 WRITE macro-instrUction Transmittal modes 31,86 use in basic access language 12,30 Tree structure 42 use in BDAM 27 TRUNC macro-instruction 12 use in BISAM 26 TTlMER (test timer) macro- use in BPAM 26 instruction 41,50 use in BSAM 26 Turnaround time use in BTAM 29 definition 86 Write-to-Iog (WT~ macro-instruction 54 in multitask operation 18,64 Write-to-operator (WTO) macro­ with output writers 60 instruction 61 Write-to-operator with reply (WTOR) macro­ Unlabeled tapes 23 instruction 61 Unspecified-length (U-format) WTL (write to log) macro­ blocks 29,86 instruction 54 Upward calls 43 WTO (write to operator) macro­ instruction 61 Variable-length (V-format) blocks 29,86 WTOR (write to operator with reply) Volume macro-instruction 61 control 24 definition 10,86 XCTL (transfer control) macro­ direct access 10,22 instruction 44,72

92 READER'S COMMENTS

IBM Operating System/360 Ti tle: Concepts and Facilities Form: C28-6535-0

Is the material: Yes No Easy to Read? Well organized? Complete? Well illustrated? Accurate? Suitable for its intended audience?

How did you use this publication? As Otheran introduction ______to the subject __ ___ For additional knowledge fold

Please check the items that describe your position: _ Customer personnel _Operator _ Sales Representative _ IBM personnel _ Programmer _ Systems Engineer _ Manager _Customer Engineer _Trainee _ Systems Analyst _ Instructor Other______

Please check specific criticism(s), give page number(s) ,and explain below: _ Clarification on page (s) _ Addition on page (s) _ Deletion on page (s) _ Error on page (s)

Explanation:

fold

Name ______

Address ______

FOI.D ON TWO LINES, STAPLE AND MAIL No Postage Necessary if Mailed in U.S.A. staple staple

fold fold ------~------Ir------l FIRST CLASS I I PERMIT NO. 81 I I I I I IL ______POUGHKEEPSIE, N. Y. JI

Ir------l BUSINESS REPLY MAIL I IL ______NO POSTAGE STAMP NECESSARY IF M~ILED ~ ______IN U. S. A. JI 111111 ~z 111111 H ~

1\1111 ~ POSTAGE NILL BE PAID BY z IBM CORPORATION 111111 ~ ~ P. O. BOX 390 0 POUGHKEEPSIE, N. Y. 12602 111111 u 111111 111111 111111 ATTN: PROGRAMMIN~ SYSTEMS PUBLICATIONS DEPT. 058 111111 111111 111111 fold fold

4/65:20~-~L·

staple staple C28-6535-0

o N co I 0'1 U1 LV U1 I o

International Business Machines Corporation Data Processing Division 112 East Post Road, White Plains, N. Y. 10601