Digital PDFs
Documents
Guest
Register
Log In
AA-3341C-TC
May 1977
113 pages
Original
3.9MB
view
download
Document:
PDP-11 SORT Reference Manual
Order Number:
AA-3341C-TC
Revision:
000
Pages:
113
Original Filename:
OCR Text
PDP-11 SORT Reference Manual Order No. AA-3341C-TC May 1977 This document discusses the features and uses of the PDP-11 SORT utility. Installation procedures for the operating systems listed below are included. This document and the software to which it pertains are for use with RMS-11-formatted tiles only. PDP-11 SORT Reference Manual Order No. AA-3341C-TC SUPERSESSION/UPDATE INFORMATION: This document supersedes the document of the same name, Order No. DEC-11-USTMA-B-D, published July 1975 for the operating systems listed below only. OPERATING SYSTEM AND VERSION: RSX-11 M V03 and V3.1 RSTS/E V06B IAS V02 SOFTWARE VERSION: SORT-11 V02 To order additional copies of this document, contact the Software Distribution Center, Digital Equipment Corporation, Maynard, Massachusetts 01754 digital equipment corporation · maynard. massachusetts First Printing, October 1974 Revised: July 1975 May 1977 The information in this document is subject to change without notice and should not be construed as a commitment by Digital Equipment Corporation. Digital Equipment Corporation assumes no responsibility for any errors that may appear in this document. The software described in this document is furnished under a license and may be used or copied only in accordance with the terms of such license. Digital Equipment Corporation assumes no responsibility for the use or reliability of its software on equipment that is not supplied by DIGITAL. Copyright © 1974, 1975, 1977 by Digital Equipment Corporation The postage prepaid REl\DER'S COMMENTS form on the last page of this document requests the user's critical evaluation to assist us in preparing future documentation. The following are trademarks of Digital Equipment Corporation: DIGITAL DEC PDP DEC US UNIBUS COMPUTER LABS CO MT EX DDT DEC COMM DECsystem-10 DECtape DIBOL EDUSYSTEM FLIP CHIP FOCAL INDAC LAB-8 DECsystem-20 MASSBUS OMNIBUS OS/8 PHA RSTS RSX TYPESET-8 TYPESET-10 TYPESET-11 CONTENTS Page vii PREFACE CHAPTFR CHAPTER CHAPTER 1 OVERVIEW 1-1 1.1 1.1.1 1.1. 2 1. 2 1.3 1. 3 .1 1. 3. 2 1. 3. 3 1. 3. 4 1. 3. 5 1-1 1-2 1-4 1-7 1-8 1-8 1-9 1-9 1-10 2 INTRODUCTION Data Files Command String and Specification File HOW SORT OPERATES SORT PROCESSING OPTIONS Record Sort (SORTR) Tage Sort (SORTT) Address Routing Sort (SORTA) Index Sort (SORTI) Graphic Representation of SORTA and SORTI output THE SORT COMMAND STRING 2.1 2.2 2.2.1 2.2.2 2.3 2.3.1 INTRODUCTION HOW TO RUN SORT Running SORT in Interactive Mode Running SORT in RSTS/E Batch Mode THE COMMAND STRING FORMAT File Specifications 2-1 2-1 2-1 2-2 2-2 2-3 3 CONTROLLING SORT OPTIONS 3-1 3.1 SWITCHES 3 .1.1 ALLOCATION (/AL:n) 3 .1. 2 BLOCKSIZE (/BL:n) 3 .1. 3 BUCKETSIZE (/BU:n) 3 .1. 4 CONTIGUOUS (/CO) 3 .1. 5 DEVICE (/DE:x) FILES (/FI:n) 3 .1. 6 3 .1. 7 FORMAT (/FO:x:n) 3 .1. 8 INDEXED SEQUENTIAL (/IN:X) KEY (/KE:abm.n) 3 .1. 9 3.1.10 PROCESS (/PR:x) RELATIVE (/RE) 3.1.11 SEQUENTIAL (/SE) 3 .1.12 SIZE (/SI:n) 3.1.13 3.2 THE SPECIFICATION FILE 3.2.1 Header Specification 3.2.1.1 Notes and Comments on Header Specification Entries ALTSEQ Format and Notes 3.2.1.2 3.2.2 Record Type Specification 3.2.2.1 Notes and Comments on Record Type Specifications 3.2.3 Field Specifications Notes and Comments on Field Specification 3.2.3.1 Entries iii 1-10 2-1 3-1 3-1 3-1 3-1 3-3 3-3 3-3 3-3 3-3 3-4 3-5 3-5 3-5 3-5 3-5 3-9 3-10 3-10 3-11 3-13 3-14 3-16 CONTENTS (Cont.) Page CHAPTER CHAPTER 3.2.4 3.3 Using a Specification File SORT SPECIFICATION SUMMARY 3-17 3-19 4 ERROR CONDITIONS 4-1 4.1 4.2 4.3 4.4 4.5 4.5.1 4.5.2 4.6 4.7 ERRORS IN SORT: GENERAL COMMENTS COMMAND DECODER ERRORS SPECIFICATION FILE ERRORS I/O ERRORS CONTROL PROGRAM ERRORS Pre-Sort Errors Merge Errors OTHER ERRORS RMS ERROR CODES 4-1 4-1 4-3 4-5 4-6 4-6 4-6 4-6 4-7 5 INTERNAL OPERATION 5-1 5.1 FILES 5 .1.1 User and Scratch File Name Conventions 5.1. 2 LUN Assignments 5.1. 3 File Maintenance 5 .1. 4 File Allocation 5.1. 5 Scratch File Structure 5.1. 6 Scratch Files Use 5.2 ORGANIZATION OF SORT SORTS ERRORS 5.3 5.4 USING THE SORTS SUBROUTINE PACKAGE 5.4.1 Conventions and Standards RSORT - Initializing the Sort 5.4.1.l 5.4.1.2 RELES - Passing Input Records to the Sort 5.4.1.3 MERGE - Merging the Scratch Files 5.4.1.4 RETRN - Requesting an Output Record ENDS - Ending the Sort 5.4.1.5 Setting up the Keys 5.4.2 5.4.3 Calculating the Size of the Work Area 5.4.4 Typical Calling Sequences 5.4.5 Linking SORTS Subroutines with Your Program 5-1 5-1 5-1 5-2 5-2 5-3 5-3 5-4 5-4 5-5 5-6 5-6 5-7 5-8 5-8 5-9 5-9 5-10 5-10 5-10 APPENDIX A CHARACTER SETS USED BY SORT A-1 APPENDIX B P:RINTABLE CHARACTERS B-1 APPENDIX c SORT PROGRAM EXAMPLES C-1 APPENDIX D INTERNAL OPERATIONS D-1 PROCESS DESCRIPTION THE SORT WORK AREA PERFORMANCE PARAMETERS D-1 D-1 D-4 SORT INSTALLATION E-1 GENERAL COMMENTS SORT KIT CONTENTS Building the SORT Task for RSX-llM or IAS Building the SORT Task for RSTS/E CHANGING THE SORT TASK IMAGE SIZE E-1 E-1 E-2 E-2 E-3 D.l D.2 D.3 APPENDIX E E.l E.2 E.2.1 E.2.2 E.3 iv CONTENTS (Cont.) Page APPENDIX F F-1 RMS I/O STATUS CODES Glossary-1 GLOSSARY INDEX Index-1 FIGURES FIGURE 1-1 3-1 3-2 3-3 C-1 C-2 C-3 C-4 c-5a C-5b D-1 Sample Record Types Specification File Format SORT Specification Form SORT Specification Entries Sales List Overtime Analysis Employee List Bonus Analysis Stock Order List, Page 1 Stock Order List, Page 2 SORT Work Area Allocation 1-3 3-6 3-8 3-18 C-2 C-3 c-4 C-5 C-6 C-7 D-3 TABLES TABLE 1-1 1-2 1-3 2-1 3-1 3-2 3-3 3-4 4-1 4-2 4-3 A-1 A-2 B-1 B-2 D-1 F-1 Selecting the Sorting Process and Devices that Best Suit the Processing Environment Sorted Output File Sorting Process Options Device Specification Codes Switch Summary Header Specifications Record Type Specifications Field Specifications RMS Status Codes for RSX-llM RMS File Attribute Mismatch Status Codes Other Commonly Occurring Status Codes The ASCII Character Set with Corresponding EBCDIC Codes The Subset of the EBCDIC Character Set used by SORT when EBCDIC Sorting is Requested Printable Characters Grouped by Equal Digits Printable Characters Grouped by Equal Zones User-Accessible SORT Parameters RMS Error Status Codes v 1-3 1-4 1-9 2-4 3-2 3-19 3-20 3-22 4-7 4-7 4-8 A-2 A-3 B-2 B-3 D-5 F-1 PREFACE This reference manual describes the features and operation of the SORT utility program. Chapter 1 describes the SORT program, its operation and environment. Chapter 2 is an operator's guide for running SORT. Chapter 3 is a reference for those who write the instructions for the SORT program. Chapter 4 describes error conditions, and Chapter 5 contains more detailed information about the SORT program for special applications. Appendices A and B contain tables of ASCII and EBCDIC, and zone/digit card punch codes respectively. Appendix C contains several examples of SORT programs. Appendix D discusses internal SORT operations, mainly for the benefit of experienced programmers. Appendix E Appendix F contains SORT installation information for all systems. contains RMS-returned status codes. A glossary is included to define terminology used in this manual. vii CHAPTER 1 OVERVIEW 1.1 INTRODUCTION The SORT utility program allows you to read any input file, to sort the contents, and to write out the sorted data onto an output file. The sorting sequence is determined by control fields, also known as key fields, within the data itself. If you do not wish to sort your data base, you can still use SORT to extract key information, sort that information, and store the sorted information on a permanent file. You can later use that file to access your data base in the order of the key information on the sorted file. The contents of the sorted file may be entire records, key fields, or record indices relative to the position of each record within the file (the first record on the data base is record 1, the second, 2, etc.). SORT provides four sorting techniques: • Record Sort (SORTR) produces a reordered file by using the entire contents of each record as the record key. A record sort can be used on any acceptable input device and can process any valid RMS (Record Management Services) format. • Tag Sort (SORTT) produces a reordered file by sorting only the record keys. SORT then randomly reaccesses the input file to create a resequenced output file according to those record keys. The tag sort method conserves temporary storage, but can only accept input files residing on disk. • Address Routing Sort (SORTA) produces an address file without reordering the input file. The address file, sorted by record keys, can later be used as an index file* to read the data base in the desired sequence. Any number of address files may be created for the same data base. A customer master file, for instance, may be referenced by customer-number index or sales-territory index for different reports. SORTA is the fastest of the four sorting methods. • Index Sort (SORT!) produces an index file* containing the key field of each data record and a pointer to its location in the input file. The index file can be used for sequential or direct accessing from a random file. The SORT utility program may be controlled by a command string and an optional specification file. There is a simple format for each. If your SORT application does not require that records be restructured or that only a subset of the input file be sorted, then you need only a command string to control SORT. * Not indexed by RMS-11. 1-1 OVERVIEW SORT can handle any RMS-valid file organization. Different file organizations are distinguished by the ordering of the records they contain and the way they handle the retrieval process. The order of the records in a sequential file is determined by the order in which the records are read from the file. The first record in the file is the first record read out, regardless of whether the records are written to the file in some sorted order or not. A relative file consists of record areas that are identified by relative record numbers. The first record area in the file is record number 1, the second is 2, etc., much the same as an apartment house where the first apartment is 1, and so forth. But, as in an apartment house, if you want the record that is in the twelfth record area, for instance, you must ask for record number 12, even though there may not be records in areas 1 through 11. Relative files can reside only on disk. An indexed file contains prologue information, one or more indices, and the data records themselves. To retrieve information, you ask for the proper record by primary or alternate key. The system looks up the key in the appropriate index and retrieves the record using the record pointer associated with the key. Indexed files can reside only on disk. Table 1-1 shows the devices that you may use to supply data Data may be stored in binary, ASCII, or EBCDIC form. 1.1.1 to SORT. Data Files SORT may accept a file from any one available in the system configuration: 1. Disk unit 2. Magtape unit 3. Card reader 4. Paper tape reader 5. Terminal of the peripheral devices A record is usually divided into several logical areas called data fields. The data in each field may or may not be relevant to SORT. Each field may be interpreted as a record identifier, key data, or general data related to the logical content of the record and not relevant to the sorting process. SORT uses record identifiers to distinguish the various types of records in a file. SORT uses the key fields in each record to reorder an input file. Any other data field in a record may be retained in the output file or ignored by SORT. Figure 1-1 shows three different types of input records, each with a different format. The record identifiers are the letters in position 1: S means Sales record, 0 means Order record, and R means Restock record. In this case, the keys chosen for sorting the Sales record types are the "item number code" in positions 2 to 7, and the "number of items sold" in positions 8 to 13. The "total amount of sale" is an example of a data field not relevant to the sorting process. 1-2 OVERVIEW Table 1-1 Selecting the Sorting Process and Devices that Best Suit the Processing Environment ---i ------ -·-·- Work File Output File I np ut F il e Sorting Technique ·-- - - - --- ···- ·-- Disk (3-8 files) SORTR Dis k Disk (Record Sort) Mag ta pe Magtape 1 Pap er Tape Paper Tape Car ds Printer Console Con so le - - · -t - · - - Disk (3-8 files) SORTT Dis k Disk (Tag Sort) Mag ta pe Magtape 1 Printer Console Paper Tape - -----------' -- Disk (3-8 files) Disk SORTA Dis k (Address Routing Sort) Mag ta pe SORT I Dis k +---- Disk (3-8 files) Disk Mag ta pe (Index Sort) L-------·--··---- '---·~---· ~-··-· ----· -----~-·--· -·~·- --~~~ 1 Provided records are at least 18 bytes long. be in ANSI format. Magtape must RECORD IDENTIFIER SALES RECORD ORDER RECORD DESCRIPTION OF ITEM ITEM NO. CODE PRICE OF ITEM NUMBER OF ITEMS ORDERED PURCHASE ORDER NO. RESTOCK RECORD ITEM NO. CODE UN IT CODE COST PER UNIT MINIMUM STOCK QUANTITY PRESENT AMT. OF STOCK REORDER NUMBER 11-1520 Figure 1-1 Sample Record Types 1-3 OVERVIEW If you request a sort in ascending order on the sales records illustrated above, the sort is based on the item number code first and then on the number of each item sold within that item number. In order of decreasing significance, the keys are: 1. Item number 2. Number of items sold The output file contains all sales records in the order illustrated in Table 1-2. Please note that data fields other than those you use for keys, salesperson's code for instance, may be in any order. Table 1-2 Sorted Output File Major Key: Item Number Minor Key: Quantity Lowest item no. Lowest quantity Next higher quantity Lowest item no. Highest quantity Next higher item no. Lowest quantity Next higher quantity Next higher item no. Highest quantity Highest item no. Lowest quantity Next higher quantity Highest item no. Highest quantity .. ----·----·--·--·--- ·-······-------· 1.1.2 Command String and Specification File You can direct the SORT program by entering command string has three functions: 1. To reference devices in the current sort 1-4 system a command for each string. The file the in OVERVIEW 2. To specify switches that define file parameters used sorting process 3. To reference a specification switches to control the sort file or to in specify the other Several command string switches define the sorting process parameters. One switch describes record formats and the maximum record size. Another delimits the internal work files. Others provide detailed file information to RMS. Normally, you direct the sort with a specification file. Two additional switches may be used instead of a specification file to control a sort. One switch specifies the sorting process option; the other identifies the key fields. The use of these switches is limited to sorting an input file of uniform format: 1. The key fields must reside in record of the iriput file. the same 2. The file must contain only the records to be included in the sort. The figure below illustrates a general sort that would only require a command string and switches. l l l c l D l location in every l SORT USING COMMAND STRING AND SWITCHES The specification file is the supplement to the command string, which provides the basis for controlling and directing the sorting process. The specification file gives you a variety They are listed below: 1. of controlling Record Selection l l l l D c l B RECORD SELECTION 1-5 B D features. OVERVIEW You can include or omit any records from the sorting process. The output file will contain only the records that you specify. 2. Alternate Collating Sequence ":m::H•m• l ~: l c l B A l l B c D A - - + e-o.o-.a .._. f- t....J I- f- I- I-' --ALTERNATE COLLATING SEQUENCE 11-1523 If necessary, you can specify an alternate collating sequence. The normal sequence is that implied in ASCII code. One alternate choice is EBCDIC values. The other is an individual alternate collating sequence (ALTSEQ) . An ALTSEQ can be used to change the ASCII values of the normal sequence. It applies to all the alphanumeric key data in the records, but only during the actual sorting process. The output record remains unchanged. 3. Forced Keys l l ~: 102 l 351 242 -.-...3nn-/nn--... l l 242 102 351 333 I- II-' f- t....J I-' ___.. -··-· FORCED KEY 11-1524 An ALTSEQ applies to all positions of the key. Forced keys allow you to specify an alternate sequence for particular positions within the key. You can specify an alternate sequence by substituting a lower-valued character, such as the slash (/) in the example above. Since the slash comes before O, the 300-series records in the example are brought to the front of the file. Notice that the records so treated are in sequence and in front of the rest of the sorted file. The net effect is that of two sorted files, one behind the other. 1-6 OVERVIEW 4. Input Format Variation I . ., l l l J N 141 Abbby A bbby l A oaoz N 207 N 207 N 141 t- INPUT FORMAT VARIATION If the input file contains records with several different formats, you can identify those records by type so that they may be properly handled. In the example above, A and N are record identifiers. 5. Output Format Variation l l l B mn 19 D UV 23 l C SI 17 l l UV D 23 SIC 17 mn B 19 xy A 11 A 'Y 11 I-' t- IfOUTPUT FORMAT VARIATION You can change the format of the data file during the sort, but you cannot change the contents of any given data item. 1.2 HOW SORT OPERATES The SORT program consists of two basic parts: a control program and a subroutine package called SORTS. The control program directs the overall processing. SORTS serves as a collection of subroutines that the control program uses during its processing. You can write your own control program to take advantage of the separate SORTS subroutines. (See Section 5.4.) There are three phases of operation in the SORT control program.* In the first phase, SORT reads the command string, decodes, and stores * Each phase of operation corresponds program structure. 1-7 to an overlay in the SORT OVERVIEW the switch values and the specification file, if present. Any errors in the command string or specification file are reported at this point. The second phase begins the pre-sort operation. The control program is called to open and read the input file and establish the keys. Then the SORTS subroutine begins the initial sorting process. At this point, the amount of available internal storage space becomes important to the efficiency of the sort. If that space is not sufficient to hold all the records, SORT builds strings of sorted records and transfers them to scratch files on bulk storage devices. In order to merge these files and complete the sort, space for at least three scratch files must be available. The SORT program normally provides for a maximum of eight scratch files. Either a switch in the command string or the amount of available internal work space can reduce the number of scratch files used. The merge phase rebuilds the intermediate scratch files into a merged file. Another subroutine reads the records in the proper sequence. The records are then written into the output file. If there are no scratch files to merge because main memory was sufficient to hold all the records, the sorted records are written directly into the output file. After the last record is written, the control program cleans up the scratch files and returns to the first phase; SORT is then ready to accept another job. 1.3 SORT PROCESSING OPTIONS There are four SORT processes: Record Sort, Tag Sort, Address Routing Sort, and Index Sort. You can specify the SORT process in the specification file or with a switch in the command string. The default process is the Record Sort. Each process has its particular input requirements, processing methods, and resultant output files. In general, Record Sort performs a relatively slow sort. Tag Sort produces the same kind of output as Record Sort. Tag Sort performs a faster sort if the key size is much smaller than the total record size. The Address Routing and Index Sorts are high-speed sorts that produce compact output. See Table 1-3. 1.3.1 Record Sort (SORTR) The Record Sort (SORTR) outputs all specified record data in a sorted sequence. Each record is kept intact throughout the entire sorting process. Since it moves the whole record, SORTR is relatively slow and may require considerable main memory or external storage work space for large files. NOTE Records can be FIXED, STREAM ASCII, or VARIABLE length in any valid RMS (Record Management Services) format. The size of the records on a fixed length format file is determined when the file is created. The first word of a variable length format record contains the size of the record in bytes. This first word is used by the file system and is transparent to SORT. 1-8 OVERVIEW Table 1-3 Sorting Process Options .-----------·-- Type of SORT Type of File --- Record Size and Format Device Speed •-.----- -- ----- - - - - - - - - - - - - - - SORTR (Record Sort) Input and Output Any SORTT (Tag Sort) Input Any Any appropriate device including: disk, rnagtape 1 card reader, console "·--· - --·· -------------t-- - ---------- -------- ---··---·---- - Disk ----------- Output Any Input Any Slowest Any appropriate device (including rnagtape 1 ) Slow for large files, large keys ~--··----- SORTA (ADDROUT Sort) Disk or rnagtape 1 Output Fixed, six bytes Input Any -Disk ~----- SORT! (Index Sort) -+-----------·--+--------------1 1 Disk or rnagtape Fast ----------------! Output Fixed, 6byte pointer + original key 1 Magtape labels are ANSI standard. tape labels. 1.3.2 Fastest - - - - - - - - - - · - - - - - - -1 Disk DOS is not supported for rnag- Tag Sort (SORTT) The Tag Sort (SORTT) produces the same kind of output file as SORTR, but it only handles record pointers and key fields. Since SORTT moves a smaller amount of data than SORTR, SORTT usually performs a faster sort than SORTR. The input file must be randomly re-accessed to create the entire output file, which may be a lengthy process for large files. 1.3.3 Address Routing Sort (SORTA) SORTA produces address routing files, which consist of relative record pointers, beginning at 1, in binary words. These files can be used as a special index file to access randomly the data in the original file. It is possible to maintain only one data file, but several different index files as needed. Like SORTT, SORTA uses the minimum amount of data necessary in the sorting process. Once the input phase is completed, the input file is not read again. The output data is in a restricted mode. This means that SORTA is the fastest sorting method in the sort package. Do not transfer an ADDROUT index file to a device that cannot handle binary data, such as a printer. 1-9 OVERVIEW 1.3.4 Index Sort (SORT!) SORTI produces an index file (not indexed by RMS-11) consisting of relative record pointers, as in SORTA, and index keys. This makes it slightly slower than SORTA. During processing SORT! handles only the relative record pointers and two forms of the key fields. One form is used for sorting and the other is left as it was in the original data. NOTE The SORT! output file contains two extra records at the beginning of the file: first record - output record count +2 second record - input record count Each of these additional records contains a key consisting of ASCII nulls. (See Table 1-3.) If the key size is odd, the key portion of the output record padded with a null byte. 1.3.5 will be Graphic Rep.resentation of SORTA and SORT! Output The ADDress ROUTing Sort (SORTA) produces an output file consisting of record indices. Each record index occupies one 6-byte record in the output file. Here is an example of SORTA output: Let us assume that we are sorting a file consisting of six records with SORTA. If the sequence of record indices corresponding to the sorted records is 5,1,6,3,4,2 then the output from SORTA can be represented as follows: 1-10 OVERVIEW BLOCK NUMBER HIGH LOW (2 bytes (2 bytes 16 bits) 16 bits) RECORD NUMBER -- BYTE-I N-BLOCK (2 by tes 16 b its) - ~-- 0 0 0 1 6 2 1 0 0 0 0 0 1 0 0 0 0 0 0 2 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2 3 6 4 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 4 2 5 0 0 0 0 0 1 0 0 0 0 u0 0 0 0 1 3 2 6 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2 6 ---- -------- Index Sort (SORT!) produces an output file consisting of record indices plus keys in original form. Each record in the output file consists of a 6-byte record index plus the key in original form. Following is an example of SORT! output. Assume that you are sorting a file consisting of six records with SORT!, and you are using a key size of four characters (bytes). Note that SORT! writes two additional records at the beginning of the output file: the first is the output record count plus 2; the second is the input record count. The sequence of record indices corresponding to the sorted record, is 5,1,6,3,4,2. The increased output record count in the first additional record reflects the fact that SORT! added two records to the file. Here is part of block 1: ~- RECORD NUMBER BLOCK NUMBER LOW HIGH ( 2 bytes ( 2 bytes 16 bits) 16 bits) ---------- """---.------ - BYTE-IN-BLOCK (2 bytes 16 bits) -1-" ··--·-- ---·---- "" ---- KEY IN ORIGINAL FORM 1--" ---- ---·-·-~ 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 6 2 B. A D. c 4 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 B. A D. c 5 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2 3 6 B. A D. c 6 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 4 2 B. A D. c 7 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 3 2 B. A D. c 8 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2 6 B. A D. c NOTE ABCD represents the sorting keys in original format. The record count in the first record is an octal 10 (decimal 8) • 1-11 CHAPTER 2 THE SORT COMMAND STRING 2.1 INTRODUCTION You initiate the SORT utility program by executing a SORT command string. This chapter describes the command string format for RSTS/E and RSX-llM users. The IAS command string is described in the IAS User's Guide. 2.2 2.2.1 HOW TO RUN SORT Running SORT in Interactive Mode To invoke SORT use one of the prompt: following commands after the system SRT RUN [1,2] SORT RUN$SORT SORT then prints SRT> to indicate that it is ready to accept a command string. You must specify one input file and one output file. A second input file, if you give one, is the specification file. One level of indirect command files is command string is shown below: permitted. An example SORT SRT>OUTPUT=INPUT/FO:VAR:lOO,SPEC This command string directs SORT to sort the file INPUT.DAT on the system device and place the sorted file OUTPUT.DAT on the system device. The specification file SPEC.SRT on the system device is used to define the sorting parameters. The switch /FO:VAR:lOO is described in Section 3.1.7. After you enter the SORT command string, SORT begins its processing. If there are errors in the command string or specification file, they are immediately reported on the console. At the end of a successful run, SORT prints the following message: SRT M:ELAPSED REAL TIME: hh:mm:ss SRT -- M:TOTAL RECORDS SORTED: nn This message tells you the real or wall clock time necessary perform the sort and the number of records in the output file. 2-1 to THE SORT COMMAND STRING When the sort is done, SORT again prompts with SRT>. At this point you can either enter another command string or terminate execution with AZ (CTRL/Z) (or Ac - RSTS/E only). 2.2.2 Running SORT in RSTS/E Batch Mode To run SORT in RSTS/E batch mode, precede your command string with the following: $RUN $SORT $DATA The command strinq is the same as section. 2.3 that described in the preceding THE COMMAND STRING FORMAT The SORT program requires a command string to direct each job. The command string names the input and output files and the devices on which they reside. Command string switches define the input and output file parameters. The specification file or additional command string switches control the sort. The use of the switches and the specification file is explained in Sections 3.1 through 3.3. A command string has one of the following forms: output-files-list=input-files-list @command-file Both output-files--list and input-files-list are strings consisting of file specifications separated by commas. Each file specification selects a file to be used as an output or input file by the system program. In particular, the SORT output-files-list consists of one file specification; and the SORT input-files-list consists of one or two file specifications. The second input file is optional, and is described in Section 3.2 as the specification file. A file specification may have one or more switches associated with it. A switch is an indicator used to select program options. Switches for SORT have the following form: /name:value The switch name is a string of characters of which two are significant. only the initial The second form of command string specifies an indirect command file. Each line on the file is used as a command string (as if you had typed it at the terminal) before any command strings following the file specification are accepted. The command string syntax is described more completely in the Programmer's Reference Manual for your system or, for RSTS/E users, the RSTS/E User's Guide. 2--2 THE SORT COMMAND STRING 2.3.l File Specifications A file specification has the following form: dev: [uic]filenam.typ;ver/swl:vl: ..• :vn/sw2:vl ... where: dev: 2-character alphabetic legal device code optional 1- or 2-digit unit number. default is SY, the system disk. and The [uic] project-programmer number specifying the directory. The UIC is optional, but, if used, must be a valid User Identification Code. filename any 1- to 6-character (RSTS/E only) or 1- to 9-character alphanumeric string that specifies a file name. .typ 1- to 3-character file type. System programs default the file type to an appropriate standard type. So, the typical user will not need to specify the file type. ;ver version number of the file (for RSX-llM and IAS users only -- omit for RSTS/E). This can normally be omitted because the system defaults to the highest existing version number on input and to the highest existing version number plus 1 on output. File types default as shown below: File Default Type Input DAT Output DAT Specification s~ Command CMD File specifications are discussed in detail in the Programmer's Reference Manual or, for RSTS/E users, the RSTS/E User's Guide. 2-3 THE SORT COMMAND STRING Table 2-1 Device Specification Codes Dev: Device* SY: System disk, default device DKn: Disk, cartridge unit n; n=O is the default condition TI: User terminal CR: Card reader LP: Line printer TTO: Operator console DB: RPJ04/RPJ06 disk DP: RP11/RP03 disk DM: RK06 disk MM: Magnetic tape MT: Magnetic tape * See your System User's Guide for specific device types. 2-4 CHAPTER 3 CONTROLLING SORT OPTIONS 3.1 SWITCHES SORT switches describe the input and output files and allow you to change SORT defaults, such as the number of scratch files used. RMS requirements have made it necessary to completely revise the SORT switches. These changes have been reflected in the switches described here. All numeric switch values are decimal, not octal. All switches are valid for both input and output files and on all systems unless otherwise noted. Table 3-1 summarizes the switches and other pertinent information for your convenience. 3.1.1 ALLOCATION (/AL:n) The ALLOCATION switch is valid for the output file only. You can use this switch to specify the initial space allocation for the output file. Legal values range from 0 to 65,535. If you do not use this switch, the output file allocation defaults to the input file size for the record and tag sort processes. For index and address routing sort processes, the default size is based on the number of records sorted. See Section 5.1.4 for details. 3.1.2 BLOCKSIZE (/BL:n) The BLOCKSIZE switch is valid for magtape files only and is used to specify the nonstandard magtape blocksize. If this switch is not used, the blocksize defaults to the standard 512-byte block. 3.1.3 BUCKETSIZE (/BU:n) The BUCKETSIZE switch specifies the RMS bucket size (the number of 512-byte blocks per bucket}. Please note that the size of the block is the standard 512 bytes even if the BLOCKSIZE switch is used. The default value of this switch depends on the organization of the input file. If the input and output files are of the same organization, the default for the output file is the input file value. If the input files differ in organization or the default is required for the input file, the default value is 1. 3-1 CONTROLLING SORT OPTIONS Table 3-1 Switch Summary Switch Name Code Default Value Validity ALLOCATION /AL:n See Section 3.1.1 Output BLOCKSIZE /BL:n 512 bytes Both (magtape) BUCKETSIZE /BU:n Input file or 1 Output CONTIGUOUS /CO Non-contiguous Output DEVICE /DE:x Build value Input FILES /FI:n Build value or 5 Both FORMAT /FO:x:n (See footnote) Both INDEXED SEQUENTIAL /IN:x (See footnote) Input KEY /KE:abm.n C, N, first position of field, length of field Input PROCESS /PR:x R (record sort) Input RELATIVE /RE (see footnote) Output SEQUENTIAL /SE (See footnote) Output SIZE /SI:n RSTS clustersize or RSX-llM retrieval window size (see Section 3.1.13) Output --····--··-·----- -·-·---------·· --···-------···---·---····----··- --- - - - - - - - - - ---- * The default for input files is the type of time. file present at OPEN The default for output files is SEQUENTIAL. For SORTR and SORTT, the output record format will default to the characteristics of the input file unless you use STREAM ASCII input record format. STREAM ASCII will produce a VARIABLE output record format. For SORTI and SORTA, the output record format will be FIXED. Default record sizes are six bytes for SORTA, six bytes plus the size of the index for SORTI, and the size of the input record for SORTR and SORTT. 3-2 CONTROLLING SORT OPTIONS 3.1.4 CONTIGUOUS (/CO) The CONTIGUOUS switch is valid for output files only. It specifies that the output file will be contiguously allocated. This means that each successive block assigned to a file will be physically located between its logical predecessor and its logical successor with no filler or extraneous material separating the blocks. The default is non-contiguous. 3.1.5 DEVICE (/DE:x) The DEVICE switch lets you specify which device you want to be associated with the scratch files. This switch overrides any device specification from task build options. The parameter x is any valid 1- to 4-character device name with the colon that normally follows that name omitted (e.g. DB3). See Section 5.1.6 for details. 3.1.6 FILES (/FI:n) The FILES switch specifies the maximum number of intermediate scratch files. Legal values are from 3 to 8. If you patched the location FILES at task build time, the default value now is the one you specified then. If you did not use a patch, the default is 5. 3.1.7 FORMAT (/FO:x:n) The FORMAT switch specifies the record format (x) and the maximum record size (n) in a file. The record format x may take the following values: FIXED, STREAM, VARIABLE, or UNKNOWN Record format values may be truncated to the first letter. The maximum record size n is the exact record size in bytes for FIXED length records. For the other formats, n is the size in bytes of the largest record present. The record size is required only on input. This switch must be present in input files even if the format is UNKNOWN. The default of the record format (x) is VARIABLE. The record format on output can be used to override the input record format. For the default of n, see the footnote of Table 3-1. 3.1.8 INDEXED SEQUENTIAL (/IN:X) The INDEXED SEQUENTIAL switch specifies the INDEXED SEQUENTIAL file organization. For default values, see the footnote of Table 3-1. X specifies the number of keys (no default). This switch is valid on input only. 3-3 CONTROLLING SORT OPTIONS KEY (/KE:abm.n) 3.1.9 The KEY switch is the most important switch in the SORT parameters. It tells SORT wh.ich fields are to control the sequence of the output file. You can specify more than one key field (up to 10) if you separate each description from the next with a colon. Here is an example of two key fields: /KE: BN 1. 6: C 8. 2 The field description sequence in the which breaks down as follows: a basic format above is abm.n Specifies the way in which the data is to be handled. If it is omitted, the default value is C as described below. If you have not used SORT before, refer to Appendix B and become acquainted with the concepts of zones and digits. Here are the legal values for the data handling parameters and their interpretations: B 2's complement binary C Alphanumeric D 1. If the characters are alphabetic, numeric with the sign superimposed over the units digit, or contain slashes (/), use the value of the digits group (see Table B-1). Here are two examples and their values: A2CD5 2. b = (+) 12345 A/47J = (-) 11471 If the characters represent a standard FORTRAN IV number, such as 12, -35, 42.98, or -0.76E+3, convert the number to binary for storage or evaluation F 2- or 4-word floating point binary I Same as D, but with the sign leading and separate, so that the first byte of the field is a + or - J Same as I but with the sign trailing and separate K Same as D but with the sign leading and overpunched (54321, for instance, if positive, would come out as 5432A. The negative of 54321 would be 5432J.) P Packed decimal format z ASCII zone (see Table B-2) Defines the general sort order. The default is N (ascending order) N Ascending order O Opposite, or descending, order m Is a decimal number giving the first byte of the key field. Number from the first byte of the record which is byte 1. This item must be present. n Is a decimal number giving the length of the key field in bytes. This item must be present. 3-4 CONTROLLING SORT OPTIONS 3.1.10 PROCESS (/PR:x) The PROCESS switch specifies the Legal values are: R T A I - 3.1.11 of sorting process to use. switch, for output only, specifies RELATIVE For defaults, see the footnote of Table 3-1. file RECORD (the default) TAG ADDRESS ROUTING INDEX RELATIVE (/RE) The RELATIVE organization. 3.1.12 type SEQUENTIAL (/SE) The SEQUENTIAL switch, for output only, specifies SEQUENTIAL organization. For defaults, see the footnote of Table 3-1. 3.1.13 file SIZE (/SI:n) The SIZE switch specifies the file cluster size (RSTS) or the size of the retrieval window (RSX-llM). The ranges and defaults for this switch will be determined by your operating system. Check with your system manager for this information and record the ranges and default below: SYSTEM: 3.2 ~~~~~~~ RANGE: ~~~~ DEFAULT: ~~~~- THE SPECIFICATION FILE The specification file offers a variety of controls for the sorting process. These controls are entered in a format consisting of up to three types of records or lines in the specification file; a fourth type may be used if nonstandard collation is required. Figure 3-1 shows, in card form, two possible arrangements of the specification file whose elements are explained below. 3-5 CONTROLLING SORT OPTIONS .--------------·-------------------------··--~------- DATA FIELD ····~---· FIELD --- """'""o" - ·-RECORD TYPE SPECIFICATION FIELD ECIFICATIONS DATA FIELD RECORD TYPE / -----------·-,I FIELD SPECIFICATIONS ALTSEQ I I HEADER / ALT-;E;- - - - - - - - 1 HEADER I RECORD TYPE SPECIFICATION t--ALTERNATE COLLATING SEQUENCE RECORDS L-ALTERNATE COLLATING SEQUENCE RECORDS _J J HEADER CARD HEADER CARD With Record Type Specifications Figure 3-1 1. FIELD SPECI Fl CATIONS Without Record Type Specifications Specification File Format The Header The first record in a specification file must be the The header tells the SORT program: 2. Header. • the kind of sorting process to be used, • the key field and output record size, • whether an alternate collating sequence is and • whether the key fields are to be stripped from output. There is only one Header for each job. to be used, the ALTSEQ Records If you use an alternate collating sequence, ALTSEQ records follow the header. ALTSEQ records allow you to change the order in which a character or characters is sorted. You can use these records to: 3-6 CONTROLLING SORT OPTIONS 3. 1. Move certain records to the front or back of a file 2. Group them in one place within the file 3. Change the order in which records appear in a sequence within the file given Record Type Specifications If you do not use an alternate collating sequence, the next type of record or line in the specification file is record type specifications. They control record selection and allow SORT to work with variable record formats. If all records have an identical format (or the format is not important) and all are to be included in the output file, the record type specification may be omitted. 4. Field Specifications If record type specifications appear, each is followed by any applicable field specifications. If not, the field specifications follow the header (behind any ALTSEQs). The two kinds of field specifications are key field specifications and data field specifications. Key field specifications define and locate each key. They are listed in order of decreasing significance. Data field specifications define and locate all the data fields to be written to the output file. The data will appear in the same order in the output file as the data field specifications. Key field specifications appear first in the specification file and are followed by any data field specifications. Data fields are not specified for SORTA or SORTI because the output file contains only pointers and possibly some restricted-format key data. The format of each type of specification record is fixed. The SORT specification form, based on card columns, is shown in Figure 3-2. The following entries are common to all three types of specification file lines. Column Entry Notes 1-2 Page number Required only when different types of records are to be described. A separate page, numbered in ascending sequence, should be used for each record type and its corresponding Field Specifications. Only the first page has a header specification. 3-5 Line number Depicting line sequence. If column 5 is blank, 0 is assumed. Thus a digit entry in this column can be used to identify later line insertions. 6 Specification Type H, I, O, or F as shown below 40, etc. Comments Ignored by SORT processing 3-7 CONTROLLING SORT OPTIONS rn 1 SORT SPECIFICATIONS Page HEADER SPECIFICATION 2 Program ldent1f1cation ffYfTTI Programmer SORTR,T Mode of Processinl) 0 SOR TR SOR TT SORTA SORTI Line ! ~ Total Length of Key Fields & RECORD TYPE SPECIFICATION .......----- -.-----Factor 1 0 ;c u . 1 - - - - - - - I Lme g §~ ~ :; Ci ~ ~ N ~ ~ u Field Location ~-~~~---------- ,_ Factor 2 EQ 1-.._.------------ ~~ f- ------~---- Constant - 1-- --:- - GE LT -_ - -, Field Location - j -------.-- -----------·----·---·--·--· - - - -, Comments I FIELD SPECIFICATION - - - - - - - - - - - - - - - --------------------· -------------------- Forced .. -- J s 0 7 6 ~::_ ~ 0 ;;: Field Location ~ : 6 g I-----, H1---F-ro-m~-To--~H j 1 FiekJ Name Comments I I a 9 10 11 •-~- 1!}~ -~s ~+1~~-\~~ 21 ~~ ~J 2\.~~-.~~ ~-! _:_s ;iq rn 11 J? 3-~- -~~~ .~s 1_ri_ -~1 ~~ :? 4~ 41 42 43 44 45 46 47 48 49 so~-\~ s.1 _:_~ ~-~ s.& ~~~-~~ ~.3.- ~!,2..~. ~s 66 67 68 69 10 11 12 13 14 F f--1 0 8 F f-+ f-· 0 9 f- -· l- - ., 1 0 1 1 f-+-1 2 f- 1 3 1 4 Figure 3-2 SORT Specification Form NOTE Whole lines of comments may also be included in the file; these are denoted by an asterisk (*) in column 7. The comment lines may appear anywhere in the specification file and serve to document the file in its printed listings. They do not affect SORT operations. In the following material, criteria apply: unless otherwise stated, the following • Numeric data is decimal, not octal. • Either leading zeroes or leading right-justified entries. • All field position definition records begin at column 1. 3-8 blanks are acceptable in CONTROLLING SORT OPTIONS Header Specification 3.2.1 See Section 3.2.1.1 for notes and comments: Columns Explanation and Legal Entries 1 - Page and line numbers: described in Section 3.2 5 Header record identification 6 Legal value: H 7 - 12 Type of SORT (must be left-justified) Legal values: SORTR or blanks - Record SORT SORTT - Tag SORT SORTA - ADDROUT SORT SORT! - Index SORT 13-17 Total of all key field sizes Legal values: 1 - 16383 N.B.: must be equal to the total size in bytes of the largest record key on the file and right-justified 18 Normal sort order sequence Legal values: A or blank - ascending D - descending 19 26 25 (not used) Alternate collating sequence Legal values: blank - standard ASCII sequence E - EBCDIC sequence X - user-modified ASCII sequence 27 (not used) 28 Output option for SORTR and SORTT ONLY Legal values: X - key fields created by SORT will be stripped from the output record blank - no action 29-32 Output record length for SORTR and SORTT ONLY Legal values: decimal number equal to the number of bytes in the largest output record 3-9 CONTROLLING SORT OPTIONS Columns Explanation and. Lega~_ En_tries 33-39 {not used by SORT - may be used for comments) 3.2.1.1 Notes and Comments on Header Specification Entries Notes and Comments Column of Entry Affected 18 This field may be qualified by N or O entered in column 7 of the field specification (q.v.) 26 This field identifies the sort order for fields identified as alphanumeric {C in column 8 of the field specification). If X is entered here, the header must immediately be followed by ALTSEQ cards. See Section 3.2.1.2 for ALTSEQ card format. Standard ASCII is assumed for forced key field specifications and this field cannot be used to amend that assumption. SORT does not perform file transliteration. Files that are not already in standard ASCII characters must be transliterated before the sort. The EBCDIC characters sequence. option specifies ASCII sorted into EBCDIC 28 If a blank appears here, the key fields may be treated as data fields and moved to the output record as any other data field would be, whether relocated within the output record with respect to the input record or not. 29 - 32 To determine this number, add the sizes of all the data fields in the field specifications {plus the sizes of the key fields if column 28 is blank) for the largest record in the file. If neither SORTT nor SORTR is to be run at this time, then an entry in this field is not needed. 3.2.1.2 ALTSEQ Format and Notes Column Notes 1 - 6 ALTSEQ - mandatory entry 7 - {not used) 8 3-10 CONTROLLING SORT OPTIONS Columns 9 - 80 3.2.2 Notes Replacement character groups {12), of 6 positions each; each group contains the octal representations of two ASCII characters: the character being sorted out of sequence, and the character that corresponds to its new position in the sorting sequence. For example, the correct entry to replace an ASCII space with an ASCII zero (0) would be 040060; 040 for the space and 060 for the zero. The result of this would be to sort spaces into the same relative position in the sequence as Os. Notice that preexisting Os are not affected by this entry, but they may be affected by another entry on the same or another ALTSEQ card under the same header. Record Type Specification See Section 3.2.2.1 for notes and comments. Columns Explanation and Legal Entries 1 - Page and line numbers. See Section 3.2 for description 6 5 Inclusion or Omission character Legal values: I - Include the records described in this line in the sort O - omit the records described in this line from the sort 7 Continuation character {allows for cases in which several conditions define a single record type) Legal values: A - logical AND 0 - logical INCLUSIVE OR 8 Field mode {defines the processing to be applied to the data field defined} Legal values: B C D F I J - KP Z - binary alphanumeric numeric binary floating point in 2 to 4 words numeric with leading and separate sign numeric with trailing and separate sign numeric with sign leading and overpunched in first byte packed decimal zone, see Table B-2, Appendix B 3-11 CONTROLLING SORT OPTIONS Columns Explanation and Legal Entries 9 - 12 Factor 1 (position of the base comparison factor is in the first byte; the first byte in the record is byte 1) Legal values: a decimal number - location of the first byte blanks - specifies a single byte field 13 - 16 Factor 1 endpoint Legal values: a decimal number - location of last or only byte in the field 17 - 18 Relationship of Factor 1 to Factor 2 Legal values: EQ NE LT GT LE GE - 19 equal not equal less than (i.e. Fl LT F2) greater than less than or equal to greater than or equal to Comparison factor format (indicates whether Factor 2 is a field or a constant) Legal values: F - identifies a field C - identifies a constant 20 - 39 Factor 2 (This takes two different formats depending on whether Factor 2 is a field or a constant.) If Factor 2 is a field: 20 - 23 location of first byte - a decimal number or blanks as for Factor 1. 24 - location of the last or only byte - a decimal number as for Factor 1. 27 28 - 39 (not used) If Factor 2 is a constant: 20 - 39 40 - 80 the value of the constant (not used - available for comments) 3-12 CONTROLLING SORT OPTIONS 3.2.2.1 Notes and Comments on Record Type Specifications Columns Explanation {general) If all the records in the input file are to be included in the sorted output file and they all have the same format or you are using the entire record as the key, then no record type specification is necessary. If all the records have the same format and some are to be omitted, then only one record type specification is needed. If several different formats of records are to be sorted, then there must be a record type specification for each. Each record type specification used should be followed by its appropriate field specifications. 6 If this column contains an I and there are no further entries in this line, all records not previously described are to be included in the sort input. Records that are not described in Include lines will be ignored. Because SORT processes Include and Omit lines sequentially, you should be very careful to get your lines in the right order, particularly if any records are described on more than one line. The last Record Specification line before a Field Specification must be an Include line. If you describe the records to be processed by omitting the unwanted records from the file, then you can use a line with an I in column 6 and no further entries in the line as the final record specification. 7 Multiple AND and OR lines are permissible, but the series will be processed strictly in sequence, each line ANDed or ORed to the accumulated Boolean expression in turn: If A is False and B and C are True, the expression A OR {B AND C) is True logically, but in order to get the correct results from SORT, arrange it this way: B AND C OR A SORT will react: {B AND C) OR A, which gives value. the required True On the other hand, A OR B AND C gives a True value in both the SORT and non-computerized logic as it stands. 3-13 CONTROLLING SORT OPTIONS Columns Explanation 8 C - alphanumeric information limited to 256 bytes D - numeric value, maxi mum size 8 bytes after conversion to binary. If the number is presented in standard ASCII Fortran IV format, as for a decimal number with or point, without decimal floating point exponent, or sign at the beginning, the SORT will convert the number to binary. But the maximum size is still 8 bytes. F - maximum size 8 bytes - two or four word floating binary representation before conversion z - ASCII zone, maximum size 1 byte see Table B-2 in Appendix B 9 - 16 Factor 1 - Sort identifies records by comparing the value of one or more fields in a record with constants or other fields in the record. These other fields or constants are referred to as Factor 2. 17 - 18 defines the Factor 1 - Factor 2 relationship 20 - 39 Factor 2 - See notes under Factor 1 above. If Factor 2 is a field, it must be the same length as Factor 1. If a constant, after conversion to the corresponding internal format, be the same length as Factor 1 and be in the same mode (see Field Mode, position 8). 3.2.3 Field Specifications There are normally a set of field specifications following each record type specification in the specification file set. (For one exception, see paragraph 3.2.2.1, general notes.) If there are no record type specifications, any appropriate field specifications follow the header. Field specifications have two main jobs: • to describe the output file format • to determine, for each record type, the sort is to be based. keys on which the List the key field specifications first, in order of decreasing significance. Then, if the sorting process is SORTR or SORTT, add data field specifications to put out any portions of the original input record. List the Key and Data field specification lines in the specification file in the same order as the required output record format. The SORT creates the output record according to the order, size, and contents of the key and data specification lines. Place an X in column 28 of the Header to strip unwanted key fields from the output record. If the key field is specified twice, as a key field and as a data field, the key field ·can remain in the output record where the data field specification puts it, even if the key fields are stripped. See Section 3.2.3.l for further commentary. 3-14 CONTROLLING SORT OPTIONS Columns Explanations and Legal Entries 1 - Page and line numbers - see Section 3.2 5 6 F - specifies a field specification 7 Field type - specifies keys and their sort sequences and data fields Legal values: N - key field, normal sort sequence (see position 18 of Header) O - key field opposite sequence F - key field, special treatment required (see positions 17 - 19) D - data field (if used, then column 8 should be C) 8 Field type - should be C if column 7 is D - these options are the same as those for column 8 of the record type specifications (q.v.). 9 - 12 Field location - location of first byte of multi-byte field Legal values: a decimal number - location of first byte of field blanks - specifies one-byte field 13 - 16 Field location - last or only byte Legal values: a decimal number - location of last or only byte in the field 17 - 19 Forced key fields 17 Trigger character - identifies the character needed to trigger the force: Legal values: blank - the force always occurs any other character - the force occurs only if this character is found 18 Replacement character Legal values: any legal character 3-15 CONTROLLING SORT OPTIONS Columns Explanati~n 19 and Legal Entries Continuation character Legal values: blank - this is a new forced key any other character - this key is continued from the previous line 20 - 80 3.2.3.1 {not used - available for comments} Notes and Comments on Field Specification Entries Columns Explanation 7 Enter key fields first in order of decreasing significance. 17 - 19 Use this field to change the content of a I-character key field, thereby changing the sorting sequence. The original data will still appear on the output record, since only the key will be changed. To specify a forced key, put F in column 7 of the field specification and the nature of the force in columns 17 - 19. Since the force is based on characters, there must be a C in column 8. A force does not apply to any other keys or fields than the one stated. To help you understand how these forced key fields affect the here is a description of how the SORT handles these fields: SORT, When column 7 contains an F, SORT sets up a one-byte field in its key area and sets its value to either 377{octal} for ascending or 0 for descending sequence. Note that the alternative collating sequence does not apply to forced key characters. If column 17 is not blank, SORT compares its contents to the content of the field defined in columns 13 - l~. If an equal condition occurs, SORT moves the character to the reserved key byte previously described. By using more than one Field Specification, you can force more than one character out of normal sequence, such as sorting the entire alphabet out ahead of numerics. But beware: 1. Unless the displaced character is itself displaced to another position in the sorting sequence, it will appear with the character displacing it in the order in which the two characters were found in the input file. Thus, if A displaces ! and a series appears in the input file as {A, B, !, A, !, !, A, C, D}, the sorted output wi l 1 be {A, ! , A, ! , ! , A, B, C , D} , so ... 2. When in doubt, force the displaced character elsewhere, particularly when it is known to appear in the input file and is not omitted elsewhere in the SORT specification file. 3-16 CONTROLLING SORT OPTIONS If, on the other hand, column 17 contains a blank, no comparison is performed and the value of column 18 always replaces the initial value in the reserved key byte. This has the following results: 1. When associated with conditional keys in preceding lines, records not satisfying the prescribed conditions can be grouped into any position in the output file, not necessarily the end of the file. 2. When this specification stands alone, it becomes an unconditional force of all records in the group. This form can be useful when the group is already identified by a record type specification. It has no effect on the entire file if applied to the entire file. If column 19 of the field specification is blank or the preceding line does not specify a force key, SORT only reserves a new key byte. The same byte is modified in all other cases. This makes it possible to combine several conditions within the same key, such as arranging an output file in the order 4, 2, 3, 1, rather than 1, 2, 3, 4 or 4, 3, 2, 1. However, SORT still expects the field location to be defined in columns 13 - 16, even if each continuation line covers the same field. NOTE SORT rejects forced for SORT!. 3.2.4 key specifications Using a Specification File The sample input file contains records in the format shown in Figure 1-1. The file may contain null records such that there may be a record identifier and no other data in the record. SORTR is entered in columns 7 through 11 of the Header. The header specification also indicates that the key is to be sorted in ascending sequence and that an alternate collating sequence is to be used. The ALTSEQ line following the header tells SORT to interpret all nulls as spaces. The null records are omitted from the sorting process with an Omit line in the record type specification. The Include lines direct SORT to process only the RESTOCK records where the present amount of stock is less than the stock quantity allowed. ORDER Records, SALES Records, and RESTOCK records where the present amount of stock is greater than the stock quantity allowed are ignored. The field specification shows that the selected records will be sorted on the reorder number. Since this is a SORTR, the Item Number Code, Unit Code, and Cost per Unit data fields, in positions 2-14, transfer to the output records. The output records will have the reorder number in positions 1-6, and the Item Number Code, Unit Code, and Cost per Unit in positions 7-19. Note that the total length of the key fields and the output record length in the header specification are calculated from the field sizes indicated in the field specification. 3-17 CONTROLLING SORT OPTIONS 110•00•0 ~ ~ ~ ~~~~::~~.~~Is~~ E Q U I PM E NT 1 SORT SPECIFICATIONS 2 75 76 77 78 79 80 i~~;~1:a1ion lslTIKlo§k I Page~ Date _ _ __ HEADER SPECIFICATION Programmer ------~ RECORD TYPE SPECIFICATION ~ "- Factor 1 g g~ ~ ~~ 5 0 6 7 8 g~ t:. --:" ___ ~onstant LT From LE To .,M ~ Locatio~ Frori To I F 1elcJ 1 75;•&!<1, sj; .·~ 3 f-~ 0 Record Name 1 Comments I I ,~ v[e~~ •it•Yµ:i°CY •trl f ''''' + -Hf--_,- -+-· 1+1 4 1---1 -1-j 0 5 0 -----·---t_ ____ I' • ."••!'>I. - - - · --· 11 1s.__~20 212_! -~2+-~26r~~ 2:!~!2_2 33 34 JS 36 37 3~ 39 40 41 4243 44 45~~ 47'~~~h51 52 53 54 55 56 57 58 59 60 6162 63 64 &s 66 67 ~a 69 1~ 11 n 13 74 9 IO 11 12 13 14 15 l6 111 1J> 2 f--+~ 0 ~u Factor 2 Field Location 1 H 0 f- EQ 6 ~-~~~·-----·-·-·-··· I fl I FIELD SPECIFICATION - ---·,.------,' ----------·------------· -----, ---·------ ..--------------------------Forced .._ ~~ Field Location ~ From ~ ~ ~ 2 0 ·--~----1~0~- n_ ~ - ~ lt ~- ? u 5 6 7 8 To 9 10 II 12 13 14 15 16 17 I! 19 2~ 21 ~~ 2! 14 25 Fri~1 F~c \ o 8 0 F$ ~ 0 7 l- f-1 9 NOT USED ~-----, Field Name 8 Comments I I 26 27 28 ~? ~~~ ?~2· Jl J4 ~-~ 3~ J7 38 39 40 41 42 43 44 45 46 47 ~- 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 ~ ~C.t!l4S~ I~~ ~ I Pi~Xo~~i(,~~~IMN ~u~~vDI I~ ~K~ 1 0 I 1---1 1 2 1--- 1- -~+H t t-· -t--+- - f-j--1- t - t- 1 3 t-- 1 4 Figure 3-3 SORT Specification Entries 3-18 1---+- tt- - f-+-+- -1--+- +-- ---- t-+-- CONTROLLING SORT OPTIONS 3.3 SORT SPECIFICATIONS SUMMARY Table 3-2 Header Specifications Column Entry Explanation 1 - - - - - - - !------------------------- t----- ---------~ 6 H Header Specification 7-12 SORTR SORTT SORTA SORT I Record Sort Tag Sort ADDROUT Sort Index Sort 13-17 1 - 16383 Decimal number specifies total length of all key fields listed in Field Specifications (must be the maximum for SORTR) 18 A or blank Processing sequence: Ascending or Descending D 26 Blank E x 28 29-32 ASCII collating sequence EBCDIC collating sequence ASCII with modification listed in following lines Blank (SORTR, T only) The key fields will reside at the beginning of each output record x The key fields will be stripped from the beginning of the output records Decimal Number (SORTR, T only) This entry specifies the number of bytes of all key and data fields listed in the Field Specifications (must be maximum for SORTR) 3-19 CONTROLLING SORT OPTIONS Table 3-3 Record Type Specifications Entry Column 6 7 8 Explanation I The records described in this record specification will be included in the sorting process. If there are no entries in the following columns, all records not yet described will be included 0 The records described in this record specification will be omitted from the sorting process A The condition identified by this record specification is a logical AND with the condition from the previous line 0 The condition identified by this record specification is a logical OR with the condition from the previous line c Character - the field in columns 9-16 (Factor 1) is alphameric z Zone - use the zone value for the entry D Digit - use the digit value or convert the FORTRAN IV number to binary I Same as D but with sign leading and separate, i.e., the first byte of the field is a + or a - J Same as D but with sign trailing and separate, i.e., the last byte of the field is + or - K Same as D but with sign leading overpunch, i.e., sign is superimposed upon first byte of the field p Packed - the field contains packed decimal data B Binary - the field contains 2's complement binary data F Floating - treat the field as a 2- or 4-word floating binary representation (Continued on next page) 3-20 CONTROLLING SORT OPTIONS Table 3-3 (Cont.) Record Type Specifications Explanation Entry Column - - - - - - - - - --- - - - - - - - - - - - i Decimal Number Locati on of the first byte of the field (Facto r 1) Blanks Single byte field 13-16 Decimal Number Locati on of last byte of field or location o f single byte field 17-18 EQ NE LT GT LE Factor 1 must equal Factor 2 Factor 1 must not equal Factor 2 Factor 1 must be less than Factor 2 Factor 1 must be greater than Factor 2 Factor 1 must be less than or equal to Factor 2 Factor 1 must be greater than or equal to Fae tor 2 The f allowing entry describes a field to be co mpared with the field specified in col um ns 9 through 16 9-12 GE 19 F c The f allowing entry describes a constant to be compared with the field specified in co lumns 9 through 16 Decimal Number Locat'ion of the first byte of the field (Fact or 2) compared with Factor 1 Blanks Facto r 2 is a single byte field 24-27 Decimal Number Posit'ion of last byte of Factor 2 field or lo cation of single-byte field 20-39 Character String The c onstant compared with Factor 1 entry must agree with mode and length of Facto r 1 20-23 3-21 CONTROLLING SORT OPTIONS ·rable 3-4 Field Specifications ··- .....- -..- .. Entry Column - -----·-··-···--- --- ··-------·------ -----~ Explanation 6 F Field Specification 7 N Normal - key field sequenced as indicated in column 18 of header 0 Opposite - key field sequenced opposite to column 18 of header F Forced - single byte key field with special sequence D Data field c Character - alphanumeric key or data field z Zone - D Digit - use digit value or convert to binary for FORTRAN IV numbers I Same as D but with sign leading and separate, i.e., the first byte of the field is a + or a - J Same as D but with sign trailing and separate, i.e., the last byte of the field is + or a - K Same as D but with sign leading overpunch, i.e., sign is superimposed upon first byte of the field p Packed - the key field is in packed decimal B Binary - the key field is in 2's complement binary notation F Floating - the key field is in 2- or 4word floating binary representation 9-12 Decimal Number Location of first byte of field 18 Replacement Character The character which will be substituted when the force condition {if any) is met 19 Continuation Character {any character other than blank) This specification line covers the same forced key field as the preceding line{s) Blank This line designates a new forced key 8 zone value ________. ---·---·-----·-·---- ............. 3-22 CHAPTER 4 ERROR CONDITIONS 4.1 ERRORS IN SORT: GENERAL COMMENTS There are three main categories of errors that SORT can detect: • Command decoder errors • Specification file errors • I/O errors SORT errors are reported at the terminal only and are not recoverable. The format of a SORT error is as follows: SRT -- control-phase:?message [-RMS-status-code] where: control-phase is the SORT phase in control at the time error occurred. Legal values are: the c - command decoder M - merge p - presort 4.2 message is a one-line happened. RMS-status-code is a decimal status code returned by RMS for additional information on file errors only. If RMS is not impacted by the SORT error, this status code does not appear. Status codes likely to be seen are listed with their meanings in Section 4.7. brief explanation of what COMMAND DECODER ERRORS If your error message has a control-phase of C, you have made a command decoder error. The command decoder error messages and their probable causes are listed below: 1. SORT COMMAND ERROR a. Too many input files (more than two, including specification file) or output files (more than one) b. General syntax error 4-1 ERROR CONDITIONS 2. c. Too many switches d. Erroneous switches on the specification file e. An undefined switch IMPROPER SWITCH: /FI a. Less than three or greater than eight scratch files. b. Invalid terminator NOTE Valid terminators are period, comma, slash, equal sign and <CR>. "INVALID TERMINATOR" means that some other character was used as a terminator or that SORT expected to find a terminator where none existed. 3. 4. IMPROPER SWITCH: /KE a. Invalid letter or value b. Start location or size is 0 c. No period (.) between start location and size d. Illegal size for data mode e. Invalid terminator (See NOTE above) TOO MANY KEYS Buffer space overflowed NOTE SORT reserves a buffer area for storage of a table based on the input specifications in order to control the processing of each record. This space should be ample for all situations to make this error unlikely. If you need more space, see Appendix D. 5. NO KEYS SPECIFIED There are no key switches in the command specification file has been declared. 6. string and no KEY AFTER LAST BYTE OF RECORD The end of an input record key field goes record size (switch or specification). 4-2 past the stated ERROR CONDITIONS 7. NO /FO SWITCH You omitted the /FORMAT switch on the input file. 8. IMPROPER SWITCH: /FO You have not specified a valid format type. 9. IMPROPER SWITCH: /PR You specified an invalid sort process. 4.3 SPECIFICATION FILE ERRORS In general, the detection of an error in the results in an appropriate message followed by: Specification • a printout of the entire record, or • a printout of the record up to the point where the detected. 1. INVALID CHARACTER 2. error a. Column 6 is not H,I,O,F and record is not ALTSEQ. b. Process is not SORTR, SORTT, SORTA, SORTI, or blank. c. Collating sequence is not blank, E, or X. d. Data type is not B, C, D, F, I, J, K, P, Z. e. Key type is not D, F, N, 0. f. Logical entry is not A, O, blank, or File was * ILLEGAL FIELD a. A numeric field in specification decimal digits or blanks. b. No key size is given in Header specification. c. No output size is given in Header Specification of SORT is SORTR or SORTT. d. ALTSEQ is misspelled. e. ALTSEQ entries do not represent 7-bit octal values. f. Last location is less than first location in record field identification. g. Size is invalid for data mode. 4-3 contains other if than type ERROR CONDITIONS 3. 4. h. Sizes of Factors 1 and 2 in Record Specification match. i. Compare relation is undefined. j. Forced field is other position. 6. C or more than one a. Constant given in Factor 2 is greater than 20 characters. b. Mode of constant does not agree with mode of Factor. c. Invalid characters appear in constant if the constant is numeric). d. Sign is omitted from binary or packed constant. (e.g., non-digits NO HEADER First record of specification. specification file is not an H INCORRECT SEQUENCE a. Numeric record sequence is lower than sequence previously encountered. b. No valid data specification appears when keys are stripped from output. c. Record specification after should be last). d. Key specifications appear after data specifications. "include-all" to be ("include-all" NO ALTSEQ a. 7. type not ILLEGAL CONSTANT a. 5. than do Specification for alternate collation entered in column 26 but no ALTSEQ Specifications follow. Header TOO MANY SPECIFICATIONS a. Number of specifications for a particular type of have overflowed the buffer space. 4-4 record ERROR CONDITIONS NOTE SORT reserves a buffer space for storage of a table based on the input specifications and used to control the processing of each record type. This space should be ample for all situations to make the error unlikely other than in very exceptional circumstances. 8. LAST RECORD SPEC NOT "I" a. 9. Last record specification in file was OMIT. ILLEGAL KEY a. A forced field specification was SORT (SORT!). included in an Index 10. NO KEYS SPECIFIED a. 4.4 No key specification appeared before data in a specification file set. specifications I/O ERRORS Once the sort is under way the only normal errors that can due to I/O failure, as indicated below: 1. are xxxx is OPEN (IN/OUT) FAILURE ON filename.ext xxxx The file could not be opened by RMS. the appropriate RMS error code. 2. occur The parameter INPUT/OUTPUT ERROR ON filename.ext xxxx RMS generated an error while reading or writing this The parameter xxxx is the appropriate RMS error code. 3. BAD RECORD SIZE ON filename.ext RMS tried to read a record on this file that is the size specified in the /FO switch. 4. file. larger than NO ROOM IN filename.ext a. The storage capacity of the device while writing the output file. has been exhausted b. There are no more clusters (RSTS/E only). size you specified 4-5 of the ERROR CONDITIONS 5. 6. INAPPROPRIATE FILE ORGANIZATION a. /IN switch was not specified. b. You tried to access an indexed file and was not linked in. support TEMP FILE ERROR xxxx a. 4.5 RMS-llK An I/O error occurred on a scratch file. error code. xxxx is the RMS CONTROL PROGRAM ERRORS Pre-Sort Errors 4.5.1 1. 2. NO DATA IN INPUT FILE filename.ext a. There are no records in the input file. b. The file is not an RMS file. INVALID KEY FIELD DATA filename.ext a. An inappropriate byte has been found in a field described as D, I, J, K or Z mode. Merge Errors 4.5.2 1. # OF OUTPUT RECORDS DOES NOT MATCH # INPUT a. The number of records released to the sort does not equal the number returned. NOTE This is a warning message only. The output file contains as many records as specified in the end-of-sort message. 4.6 OTHER ERRORS Occasionally, errors may occur due to the rejection of data passed to the SORTS subroutine package (see Chapter 5). They are reported as: SORT ERROR -- CODE nn where nn is the code number returned by a SORTS subroutine in paragraph 5.3). 4-6 (described ERROR CONDITIONS 4.7 RMS ERROR CODES A complete listing of RMS status codes can be found in Appendix G. The status codes that appear in this section represent errors that you will be most likely to encounter. The status codes in Table 4-1 occur only under RSX-llM, and are due to file primitive failure. Check to see if your file is readable and in the correct format. If these status codes recur, please send an SPR to DIGITAL. Table 4-1 RMS Status Codes for RSX-llM Code Brief Explanation -160 Read error on file header attributes -176 Write error on file header attributes -400 Deaccess error during $CLOSE -520 Device positioning error -560 Files-11 ACP Enter function failure -624 File extension failure -1088 File could not be marked for deletion -1456 Files-11 ACP Remove -1520 Error while reading prologue -1776 File write error -1792 Error while writing prologue funct~on failure The status codes listed in Table 4-2 may occur under any operating system. They appear because the file attributes you gave did not match those of the existing file. Table 4-2 RMS File Attribute Mismatch Status Codes r-------...--------------------------------------. Code Brief Explanation -192 Bucketsize exceeds maximum -480 Dynamic memory exhausted -976 Key size equals 0 or is too large (indexed file) or is not 4 (relative file) -1168 Not enough room to open an indexed file ____ ___________________________ _ ,__ __._ 4-7 ERROR CONDITIONS Status code -864 occurs during subroutine usage only. It indicates that you did not initialize RMS before control passed to SORT. Table 4-3 gives other status codes that commonly occur. Table 4-3 Other Commonly Occurring Status Codes Code Brief Explanation -112 Variable length records on ANSI-labelled magtape are not ANSI D format -336 CLOSE function failed (RSTS/E only) -432 RMS tried to access a deleted record -448 Syntax error, no such device, or device inappropriate for operation -464 Syntax error in directory name -496 Directory not found -512 Device not ready -672 RMS attempted to create an already existing file -704 File locked by another user - access denied -736 File not found -752 Syntax error in file name -768 Invalid file options (also occurs if you try to extend a contiguous file) -784 Device full - cannot create or extend file -880 Illegal operation - see Appendix G for examples -896 Illegal record in sequential file or invalid count field -1008 Magtape is not ANSI-labelled -1024 Logical channel busy -1040 Invalid logical channel number -1120 Maximum record size equals O during $CREATE -1152 Not at end of file -1200 Open function failed (RSTS/E only) (Continued on next page) 4-8 ERROR CONDITIONS Table 4-3 (Cont.} Other Commonly Occurring Status Codes Code Brief Explanation -1408 Invalid record address -1424 Invalid or illegal record format -1440 Target bucket locked by another task or stream -1536 Invalid record in indexed file - file may be damaged -1568 Record size error during $PUT or $UPDATE -1744 Syntax error in file version number (not a RSTS/E occurrence) -1784 Device is write-locked See Appendix F for a more complete explanation of each status code. 4-9 CHAPTER 5 INTERNAL OPERATION 5.1 FILES User and Scratch File Name Conventions 5.1.1 Input, output, and specification files may have any name acceptable to the operating system. SORT generates its scratch files by using the temporary file creation mechanisms of the operating system under which it is running. Scratch files are automatically deleted from your file directory by the operating system when SORT is no longer running. LUN Assignments 5.1.2 The following are the default Logical Unit Number assignments as reflected in the task build command file SRTxxx.CMD (xxx is system dependent - see Section F.2): - -"""·~-~-~- LUN Device Use Internal Name --- --- 1 TI: Command Input File - 2 TI: Message Input File SORT: MSGLUN 3 SY: Input File SORT:INLUN 4 SY: Output File SORT:OUTLUN 5 SY: Specification File SORT:XLUN 6 SY: First Scratch File SORTS: $RFIRL 7-13 SY: Other Scratch File - To change the internal correspondence between LUN and the following statement in the command file: GBLPAT=x:y:z where: x:y z is the internal name, such as SORT:MSGLUN. is the new LUN in octal. 5-1 usage, include INTERNAL OPERATION To change the devices to LON correspondence, statement in the command file: change the following ASG=x:y where: x y is the device name. is the LUN in decimal File Maintenance 5.1.3 At the end of a successful run, SORT stores the new output file on the device you specified. The new output file may then be used as immediate input to some other program. The input and specification files are unchanged. File Allocation 5.1.4 To optimize your sort for speed, SORT tries to allocate in advance the output file and each scratch file at maximum size. SORT does this by making an educated guess about the space needed. Under the tag and record sorting processes, SORT allocates as much space to the output file as to the input file. Under the index and address routing processes, SORT calculates a size for the output file by multiplying the size of the output record by the number of records sorted. Each scratch file is arbitrarily given 50 percent more space than the input file, no matter what process is used. Usually, this pre-allocation process causes no problems. But you should be aware of the instances in which problems due to over-allocation do arise and what you can do about them. Your pre-allocation size may be too large if you are using the tag or record sorting process and one or more of the following conditions are true: 1. You are sorting from an indexed file. 2. You are using OMIT lines in the specification file. 3. You are using the reformatting option file. 4. You are using a smaller record size in the output in the input file. in the specification file than Some wasting of space in the output file can usually be tolerated, but on a crowded disk you may be notified of insufficient space when there really was enough to hold your file. Try cutting down on the amount of space by making a conservative estimate of what you need and including that estimate in the /AL switch on the output file side of the command string. You may perhaps be more concerned about the situation in which you get the following error message when you try to sort a large file: P:?TEMP FILE ERROR -784 INTERNAL OPERATION This means that there is no more room for the allocation of scratch files. Here, too, there may be space wasted due to over-allocation. Read Section D, especially Section D.3, again carefully, and remember that there is a tradeoff in this situation between size and speed. Try cutting down the size of the scratch file to one third that of the input file. If the error persists, trim the size again. If this does not work, then the disk may be too full to handle the sort. Scratch File Structure 5.1.5 The scratch files consist of one or more sequenced strings of records, followed by an end-of-file flag word. Each string consists of zero or more records, in order by key, followed by an end-of-string flag word. The number of strings on each file varies from time to time as the sort progresses, until, at the end of the merge phase, there is one string on each file. If there is not enough data in the input file to produce at least one string on each scratch file, the unused files will contain only an end-of-file flag word. The format of the records stored in these files is as follows: Word 1 Size of the data portion in bytes. The maximum acceptable to SORT is 16K (up to 37777 octal). Thus, bits 14 and 15 are always O. Words 2 through n After possible conversion to a form more suitable for logical comparison, the key fields are stored in reverse. Words n+l* through m The data portion for record sort (SORTR) is the record as read from the input file; for SORTT and SORTA, it is a 2-word relative record pointer. This pointer is joined by the key fields in their original form during a SORT!. Two unique records also appear in the scratch files as markers. is one word only containing all 0 bits except as below: e Bit 15 1 indicates end-of-string flag e Bit 14 1 indicates end-of-file flag Each Scratch Files Use 5.1.6 The scratch files switch, FILES (see Section 3.1.5), is only effective when operating under special conditions. For each scratch file potentially to be used, a certain amount of core is required to establish internal control blocks. This necessarily makes the sort take longer by: 1. Restricting the space available for record storage during the sort, and 2. Forcing the usage of scratch files even for small input files * For SORTR and SORTT controlled by specification file, word n+l is used to hold an internal control pointer, and the data starts at n+2. 5-3 INTERNAL OPERATION By specifying a smaller number of scratch files than the default, you may be able to release sufficient space to do the whole sort in core and thereby speed up the sort of a small file. The default number is allocated if the FILES switch is unspecified. This default is defined at task building time via "GBLPAT=SORT:FILES:X" (3< X <10 octal}. The SORTS routines use an unbroken ascending series of LUNs starting at the value in internal location $RFIRL and continuing for the number of files specified in the internal location FILES (the default is 5). Depending upon the sorting process and/or the sorting specifications, each scratch file could require half again as much disk storage as the original input file. Take this into consideration when assigning the scratch file LUNs to disk devices. Also, the executive's files system functions most efficiently if few blocks are occupied and there is minimal space fragmentation of the disk space. Use private disks if you can. This will speed up the sort, especially if you put all your scratch files on private disk space and the input and output files on public disks. If you have more than one disk, scatter the LUNs among them so that no two successive LUNs are on the same disk. Use the fastest disks for scratch files. 5.2 ORGANIZATION OF SORT As noted in Section 1.2, the SORT program goes through three phases. Each phase is actually set up as an overlay with a resident control program to handle the overlays in the correct sequence. Here are the names and functions of the SORT modules: 5.3 1. RSORT initializes the system, then serves error processor for the remaining modules. 2. SORTC decodes the Command String and Specification File. This routine is the first section to be called by RSORT. After SORTC finishes, it is overlaid by SORTP. 3. SORTP handles the pre-sort phase based upon data transmitted by SORTC and is associated with appropriate subroutines from SORTS. It is replaced by SORTM when the pre-sort is done. 4. SORTM controls the main sort and output. It for a new sort when it has finished its task. 5. SORTS is a collection of subroutines sorting. that as the resident recalls actually SORTC do the SORTS ERRORS Whenever SORTS detects an error, it returns an octal non-zero code in the location specified by <Location of Error Code> in the most recent call. In addition, for I/O errors, Rl contains the address of file control block for the file in error. The status supplied by RMS is set into the error status word of that file control block. (See Appendix G for error code values.} 5-4 INTERNAL OPERATION The error codes (octal) and their meanings are listed below: Error Code 5.4 Meaning 00 No errors 01 Device input error 02 Device output error 03 OPEN(IN) failure 04 OPEN(OUT) failure 05 Size of current record is greater than maximum size 06 Not enough work area 07 RETRN was called after it had exited with a negative error code (end of sort) 10 SORT routine called out of order (The order of the calls should be RSORT, RELES, MERGE, RETRN, ENDS). 11 Sort already in progress {To do a second sort, must be called to clean up the first sort). 12 Key size is not positive, SORTS detected a negative key size in its calling parameter 13 Record size not positive 14 Key address is not even (the keys must start even address because SORT uses word moves). 15 Record address is not even 16 Scratch records will be too large (the size of the keys plus the size of the largest record must be less than 37776 octal). 17 Too few scratch files are given scratch files must be specified). (a minimum of 3 20 Too many scratch files are given (a scratch files may be specified). maximum of 10 21 End-of-string record was expected where none was 22 Unexpected end-of-file 23 SORT found a record larger than expected 24 Record length is SORTI. not detected standard for SORTT, ENDS zero or at an SORTA, USING THE SORTS SUBROUTINE PACKAGE You can associate the SORTS subroutine package with your own control program to perform a particular type of sort, provided that the control program meets the necessary interface requirements. 5-5 INTERNAL OPERATION Conventions and Standards 5.4.1 All of the entry points in the SORTS subroutines are entered coding: MOV #TAG,R5 JSR PC,X TAG: .BYTE .WORD N,O ARGUMENT-! .WORD ARGUMENT-N via the where: PC X N is Register 7, is an entry label, is the number of arguments. All of the sort subroutines require arguments which are word-bound (16-bit word addresses}. This is because the routines use word oriented instructions, rather than byte oriented instructions, for speed advantages. A detailed description of the calling procedure for each routine follows. In all calling procedures, !ERROR is the starting address of a user-generated error processor to be used if the call aborts. 5.4.1.1 RSORT - Initializing the Sort MOV JSR TAG: .BYTE .WORD .WORD .WORD .WORD .WORD .WORD .WORD -----0 .WORD .WORD .WORD .WORD #TAG,R5 PC,RSORT 7(11.) ,0;7 (OPTIONALLY 11) ARGUMENTS TO RSORT <ADDRESS OF ERROR CODE> <ADDRESS OF NUMBER OF BYTES IN ALL KEYS> <ADDRESS OF NUMBER OF BYTES IN LARGEST RECORD> <LOCATION OF MOST MAJOR KEY WORD> <FIRST LOCATION IN WORK AREA> <ADDRESS OF SIZE OF WORK AREA IN BYTES> <ADDRESS OF NUMBER OF SCRATCH FILES> P T I 0 N A L L Y ----<ADDRESS OF NUMBER OF BUFFERS PER FILE> <ADDRESS OF CLUSTERSIZE FOR RSTS/RETRIEVAL POINTER FOR RSX> <ADDRESS OF PRIMARY ALLOCATION FOR SCRATCH FILES> <ADDRESS OF FIRST SCRATCH FILE LUN> For FORTRAN, the call is as follows: CALL RSORT (IERROR,KEYSIZ,MAXREC,KEYADR,IWRKLO,IWKSIZ,IFILES [,BIGBUG,SCRCLF,PRIALQ,FIRLUN]} 5-6 INTERNAL OPERATION where: KEYSIZ is the decimal byte count of the total key size. KEYSIZ must be even (incremented by 1 if not) and positive (error 12 if not). MAX REC is the decimal size in bytes of the largest record in the input file. MAXREC must be even (incremented by 1 if not) and positive (error 13 i f not). The sum of KEYSIZ and MAXREC cannot exceed 16,383 (error 16 if greater). KEYADR is the address of the most significant word in the major key. KEYADR must be a word-bound address (error 14 if not). See Section 5.4.2 for details. IWRKLO is the address of WORKLO, the first word in the SORT work area. IWRKLO must be word-bound (incremented by 1 if not). See Appendix D, especially Figure D-la. IWKSIZ is the size (decimal). I FILES is the number of scratch files to be allocated. !FILES must be greater than 2 and less than 11 (errors 17 and 20 respectively if not) . BIGBUF is the number of 512-byte buffers to be allocated for each scratch file and the number of contiguous blocks read or written during each scratch file read or write. The default is 1. For details see Appendix D. SCRCLV is the RSTS/E clustersize or the RSX-llM number of retrieval pointers. The default is 0. For details see Appendix D. PRIALQ is the decimal number of blocks to be allocated to each scratch file at open time. For details see Appendix D. FIRLUN is the first Logical Unit Number to be used by the scratch files. The SORTS subroutines use the set of LUNs running consecutively from FIRLUN to (FIRLUN + !FILES - 1) in octal representation. The default is 5. of the work area in bytes FORTRAN users should remember to designate BIGBUF, SCRCLV, PRIALQ, and FIRLUN as INTEGERS. 5.4.1.2 RELES - Passing Input Records to the Sort MOV JSR TAG: .BYTE .WORD .WORD .WORD #TAG,RS PC,RELES 3,0 ;3 ARGUMENTS TO RELES <ADDRESS OF ERROR CODE> <ADDRESS OF THE SIZE OF THE RECORD, IN BYTES> <LOCATION OF THE FIRST WORD OF THE RECORD~ 5-7 INTERNAL OPERATION For FORTRAN, the call is as follows: CALL RELES(IERROR,IRECSZ,RECADR) where: IRECSZ is the decimal byte count of the size of the record to be released. IRECSZ must be positive and less than or equal to MAXREC (error 5 if not) (See Section 5.4.1.1). RECADR is the address word-bound). 5.4.1.3 of the record (error 15 if not MERGE - Merging the Scratch Files This is called after all input has been read. MOV JSR TAG: .BYTE .WORD #TAG,R5 PC,MERGE 1,0 ;l ARGUMENT TO MERGE <ADDRESS OF ERROR CODE> For FORTRAN the call is: CALL MERGE(IERROR) 5.4.1.4 RETRN - Requesting an Output Record MOV JSR #TAG,R5 PC,RETRN TAG: .BYTE 3(4),0; 3 (OPTIONALLY 4) ARGUMENTS TO RETURN .WORD <ADDRESS OF ERROR CODE> .WORD <ADDRESS OF WORD TO CONTAIN RECORD SIZE> .WORD <LOCATION OF FIRST WORD OF THE RECORD> ---------- OPTIONALLY ---------.WORD <ADDRESS OF WORD TO CONTAIN LOCATION OF RECORD> For FORTRAN, the call is as follows: CALL RETRN(IERROR,IRECSZ,RECADR[,LOCREC]) where: IRECSZ is the decimal byte count of the size of record. RECADR is the address of buffer to receive record (error 15 if not word-bound). LOCREC if RECADR is O, RETRN places the address of the record in the location rather than actually moving the record. 5-8 the returned INTERNAL OPERATION 5.4.1.5 ENDS - Ending the Sort MOV JSR TAG,R5 PC,ENDS TAG: .BYTE 1,0 ;l ARGUMENT TO ENDS .WORD <ADDRESS OF ERROR CODE> For FORTRAN the call is: CALL ENDS(IERROR) 5.4.2 Setting up the Keys Before calling RELES, you must first set up the key area, usually outside the record itself. This area must be contiguous and an even number of bytes long. Round up if odd. If you are using byte data, the bytes within each word of the key must be reversed in order before the key is stored. If your key is an odd number of bytes, a padding byte of Os must be added to your key before the bytes of the final word are reversed. Thus, a key that looks like this in the record: first word A c B J looks like this when it is stored: first word B second word A I ("paddi~g" byte) I c If you are using word data, you must move the data word by word into the key area, starting at the highest key location and working downward. The address passed to RSORT in the fourth parameter is the address of the most major WORD. SORT always does word compares, starting at the word in the highest memory location, and, if necessary, working down to the least significant byte in the lowest memory location. The address to be used for KEYADR can be figured as follows: assume KEYSTR is the first word of the key area which is KEYSIZ bytes long. Then KEYADR = KEYSTR+KEYSIZ-2. NOTE The comparison is logical, so all 16 bits of a word are significant. There is no implied sign. The control program must therefore organize the key data passed to SORTS in a form that ensures the correct sequence, even if the original data may be algebraic. 5-9 INTERNAL OPERATION Calculating the Size of the Work Area 5.4.3 The size of the work calculated as follows. IWKSIZ =!FILES area, IWKSIZ, must be a certain minimum * (512. * BIGBUF + (100 + MAXREC + KEYSIZ + 10.)} If you supply space below this minimum, SORTS will keep decreasing the number of files until either the above equation is satisfied or the number of files drops below 3, which will then cause RSORT to return with error code 17. Any extra core will be used to expand the in-core sort area. general, the more space supplied, the faster the sort. Thus, in Typical Calling Sequences 5.4.4 To sort the file IN.TXT to produce the file OUT.TXT: 1. Open IN. TXT. 2. Call RSORT to initialize the sort. 3. Read the next logical record from IN.TXT. go to Step 6. 4. Set up the keys from the new record. 5. Cail RELES to give the record to the sort, then loop back Step 3. 6. Close IN.TXT. 7. Call MERGE to collate the data. 8. Open OUT.TXT. 9. Call RETRN to get the records, go to Step 11. 10. Write the record onto the output file; 11. Close OUT.TXT. 12. Call ENDS to clean up the sort scratch files. next sorted If no record. more If no data, to more loop to Step 9. NOTE The routine RETRN indicates "no more records" by returning a negative value in the error code. 5.4.5 Linking SORTS Subroutines with Your Program The actual sorting subroutines are contained in SORTS.OBJ and SIORMS.OBJ. You can link these to your own calling program using Task Builder. For example, if your program name was PROG: TKB PROG=PROG,SORTS,SIORMS[, [l,l]RMSLIB/LB] INTRODUCTION TO THE APPENDICES Appendix A lists the ASCII character set and a subset of the EBCDIC code. Table A-1 lists the ASCII code values in ascending octal sequence with the corresponding EBCDIC values. You will find this useful for comparing values when requesting a modified ASCII sorting sequence, or when defining forced key fields. Table A-2 lists the EBCDIC subset used when you request an EBCDIC sorting sequence. The EBCDIC values are in ascending order with the corresponding ASCII values. Appendix B contains two tables to help you to determine the digit and zone values of printable characters. For example, the characters B,K, and S have an equal absolute digit value of 2~ however, the "eleven" punch denotes a negative value. The digit values of J through R are negative (-) 1 through 9. Appendix C gives examples of SORT applications. Appendix D discusses SORT internal operations. for the benefit of the advanced user and successful SORT use. Appendix E guides your installation of SORT. Appendix F lists RMS status codes. This is information is not essential for APPENDIX A CHARACTER SETS USED BY SORT Table A-1: The ASCII Character Set with Corresponding Codes Table A-2: The Subset of the EBCDIC Character Set SORT When EBCDIC Sorting is Requested A-1 EBCDIC Used by CHARACTER SETS USED BY SORT Table A-1 The ASCII Character Set with Corresponding EBCDIC Codes __ .,_·-···--··-·-- Character ASCII Code ---·-·------·-· EBCDIC Code NUL SOH STX ETX EOT ENQ ACK BEL 000 001 002 003 004 005 006 007 000 001 002 003 067 055 056 057 BS HT LF SI 010 Oll 012 013 014 015 016 017 026 005 045 013 014 015 016 017 OLE DCl DC2 DC3 DC4 NAK SYN ETB 020 021 022 023 024 025 026 027 020 021 022 023 074 075 062 046 CAN EM SUB ESC FS GS RS 030 031 032 033 034 035 036 037 030 031 077 047 034 035 036 037 04 0 041 042 043 044 045 046 047 100 ll 7 177 173 133 154 120 175 I 050 051 052 053 054 055 056 057 115 135 134 ll6 153 140 ll3 141 0 1 2 3 4 5 6 7 060 061 062 063 064 065 066 067 360 361 362 363 364 365 366 367 8 9 070 071 072 073 074 075 076 077 370 371 172 136 114 176 156 157 . ··- _...,_ --~~---- VT FF CR so us SPC # $ % & * + > ? -··-·-····-···-~--~ EBCDIC Code -------- 1 - - - - - - - - - jr------ ______, @ 100 174 301 A 101 302 B 102 303 103 c 304 104 D 305 105 E 106 306 F 307 G 107 Character -··· H I J K L M N 0 p Q R s T u v w x y z [ \ l a b c d e f g h i j k 1 m n 0 p q r s t u v w x y z DEL -~·-·--~-~-~--~~~~- A-2 ASCII Code llO lll ll2 ll3 ll4 ll5 116 ll 7 310 3ll 321 322 323 3 24 325 326 120 121 122 123 124 125 126 127 327 330 331 342 343 344 345 346 130 131 132 133 134 135 136 137 347 350 351 ll2 340 132 137 155 14 0 141 142 143 144 145 146 147 171 201 202 203 204 205 206 207 150 151 152 153 154 155 156 157 210 211 221 222 223 224 225 226 160 161 162 163 164 165 166 167 227 230 231 242 243 244 245 246 170 171 172 173 174 175 176 177 247 250 251 3 00 152 320 241 007 CHARACTER SETS USED BY SORT Table A-2 The Subset of the EBCDIC Character Set used by SORT when EBCDIC Sorting is Requested 1 Character EBCDIC Code ASCII Code Character ·----- NUL SOH STX ETX HT DEL ·--1~- 203 204 205 206 207 210 2ll 221 143 144 145 146 147 150 151 152 p q r 222 223 224 225 226 227 230 231 153 154 155 156 157 160 161 162 s t u v w x y 241 242 24 3 244 245 246 247 250 176 163 164 165 166 167 170 171 251 300 301 302 3 03 3 04 305 306 17 2 173 101 102 103 104 105 106 307 310 3ll 320 3 21 322 323 324 107 llO lll 175 ll2 ll3 ll4 ll5 325 3 26 3 27 330 331 340 34 2 343 344 345 ll6 ll7 120 121 122 134 123 124 125 126 346 347 350 351 360 361 127 130 131 132 060 061 362 363 364 365 366 367 370 371 062 063 064 065 066 067 070 071 000 001 002 003 Oll 177 013 014 c d e f g h i 015 016 017 020 021 022 023 026 015 016 017 020 021 022 023 010 k LF ETB 030 031 034 035 036 037 045 046 030 031 034 035 036 037 012 027 ESC ENQ ACK BEL SYN EQT DC4 NAK 047 055 056 057 062 067 074 075 033 005 006 007 026 004 024 025 SUB SPC 077 100 ll2 ll3 ll4 ll5 ll6 ll7 032 040 133 056 074 050 053 041 120 132 133 134 135 136 137 140 141 152 046 135 044 052 051 073 136 055 057 174 153 154 155 156 157 171 054 045 137 076 077 140 172 173 174 175 176 177 201 202 072 043 100 047 075 042 141 142 FF CR so SI OLE DCl DC2 DC3 BS CAN EM FS GS RS us [ < ( + ! & l $ *) ; t or - I , % or > ? : # @ I = II a b A ASCII Code - 000 001 002 003 005 007 013 014 VT EBCDIC Code j 1 m n 0 z A B c D E F G H I J K L M N 0 p Q R \ s T u v w x y z 0 1 2 3 4 5 6 7 8 9 1 This table shows only those EBCDIC characters for which there are ASCII equivalents. It therefore illustrates the collating sequence SORT applies when the Header Specification contains E in column 26. A-3 APPENDIX B PRINTABLE CHARACTERS Table B-1: Printable Characters Grouped by Equal Digits Table B-2: Printable Characters Grouped by Equal Zones B-1 PRINTABLE CHARACTERS Table B-1 Printable Characters Grouped by Equal Digits Group .,.___-----+· 0 Character blank 3 DEC 029 Card Code 5 E 12-5 12 N 11-5 11 v 0-5 5 5 F 12-6 No punches 0 A 12-1 J 11-1 0 11-6 I 0-1 w 0-6 1 6 6 1 r--·----- . ···-······-+······ Character 0 !-------·-· .. ---·--+-- . -·····-----··----------·--· ---------- ·------- 2 Group ..... ····-·-··- ----------------·-······---+ ·-----·-···----·-· & 1 DEC 029 Card Code B - -1-- 6 --·· ········--······---- ------+------------+--·-·-------- ------~ 12-2 7 12-7 11-7 K 11-2 s 0-2 x 0-7 2 2 7 7 H 12-8 ·- '·-···-········------ c --------------+-------- - - -------------------+------~ 12-3 8 L 11-3 Q 11-8 T 0-3 y 0-8 3 3 8 8 I 12-9 R 11-9 0-9 -----~ 4 G p ------------··-·----+------------- -----··+------ D 12- 4 M 11-4 u 0-4 z 4 4 9 .. 9 __________,______________-"-----····-··-·-- B-2 ·-- 9 ···-·-------'----------- PRINTABLE CHARACTERS Table B-2 Printable Characters Grouped by Equal Zones ---- ---- -___,..,........----- --- .. - --·-------·- Group Character DEC 029 Card Code Group & 12 ( + '"-~ 1------ -----~ --------- - - - - - - · - 0 0 12-5-8 % 0-4-8 12-6-8 ' 0-3-8 12-3-8 I 0-1 < 12-4-8 > 0-6-8 1 12-7-8 ? 0-7-8 A 12-1 s 0-2 B 12-2 T 0-3 c 12-3 0-4 D 12-4 u v E 12-5 w 0-6 F 12-6 x 0-7 G 12-7 y 0-8 H 12-8 z 0-9 I 12-9 .' 11 . 1 2 DEC 029 Card Code Character ?- 0 , _,, .. - 0-5 --- ···· t--------·· 3 -----r--- Blank No punches 11-2-8 II 7-8 $ 11-3-8 # 3-8 ) 11-5-8 ' 5-8 * 11-4-8 : 2-8 ; 11-6-8 = 6-8 J 11-1 @ 4-8 K 11-2 1 1 L 11-3 2 2 M 11-4 3 3 N 11-5 4 4 0 11-6 5 5 p 11-7 6 6 Q 11-8 7 7 R 11-9 8 8 9 9 --·- -- B-3 APPENDIX C SORT PROGRAM EXAMPLES EXAMPLE 1: SALES LIST Input Record Positions 1-5 6-39 52-59 60-65 66-70 71-77 78-80 Customer Number (CUSTNO) Customer Name (CUSTNM) Date Item Number (ITEMNO) Item Quantity (ITEMQY) Price Blanks This Record Sort is primarily intended to produce reformatted records. The structure of the input file is indicated above. The input file contains only one record type, therefore no Record Type Specifications are needed. The keys for the sort are CUSTNO, ITEMNO, and ITEMQY, with the last key sorted in descending sequence. The output file will have records ordered from lowest to highest customer number, with the lowest to highest item number records within each customer number category, and the highest to lowest item quantity in each item number category. The order of the data field specifications reformat the output record. Note the use of the blank in columns 78 and 79; the data will be set off in field columns. c-1 SORT PROGRAM EXAMPLES 1 2 SORT SPECIFICATIONS Page~ HEADER SPECIFICATION Programmer - - - - - - - - - 75 76 77 78 79 80 ~:~;~f~otion lsl"li.IEkil I --····--·------·····-·····-··········-··-·-····----------------------SORTR,T Mode of Processing 0 SOR TR SOR TT SORTA SORT! Line 8. ~ ~ Total Length of Key Fields ~ Output Record Length NOT USED j Comments (Program Identification) Forced Lme 0 LL LL~~ !!. z 0 Field Location 6 I-----, NOT USED ~ ~ ~ 1-----.,.-----1~ ~u From To ~ Field Name Comments I I ~~.i....4-4-+-'~''~'~'-"+'~'-"-~'~'~16~17.+-~i-+:'c...'.:.:_21:~2 2_~ !.~ ~ -~~ ~!...~~ 29 30 31 32 3l 34 J5 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 5J 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 12 73 74 c1'1srr lol 1 "' +··· I·· .. , _:!ljjelr11 C'([o t- -1-l 1.1-1·~ Tl~'f cul's'rto1lni +··· I t-t - -f- -+· I· t-+l-~ ..... - f . j.. ·l·· I·· ··- I- ~--~ +····-t-1 2 Page~ FIELD SPECIFICATION .+ t· t- - 75 78 77 78 79 80 ~;:~;~f~otion 1~11\l)..,l«fal I Forced I-----, NOT USED Field Name Comments I I ~~O· ~.! ~~ ?.3 ~~ ~-~-·--~~.. ~7 __28 29 30 JI 12 ll J4 J~ J6 37 38 JIJ 40 41 42 43 44 45 46 ~7 48 49 50 51 52 SJ 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 t+ I- i··•· -· I-• +·· - ~ --1 + - t-t-+-+· I-+- +· ··t· ~ .... I ·- - 1 3 1 4 Figure C-1 EXAMPLE 2: Sales List OVERTIME ANALYSIS Input Record Positions 1-3 4-8 9-39 40-43 50-53 80 Department Number (DEPTNO) Employee Number (EMPNUM) Employee Name (EMPNAM) Standard Number of Working Hours (STDHRS) Total Number of Hours Worked (HOURS) Plant Identification Code This Record Sort produces a record of employees by department number in the main plant (M) who incurred overtime. The Record Type Specification shows the use of both an Include and an Omit line; with a field and a constant Factor 2 comparison. C-2 SORT PROGRAM EXAMPLES "D"DD"D ~ ~ ~ ~~~~~S~A~~~<;!~ E Q u I p M E N T , SORT SPECIFICATIONS 2 Page~ Dete _ _ _ __ HEADER SPECIFICATION 75 76 77 78 79 80 ~:~;~f~ation lo&ll=\INl~li.I Programmer RECORD TYPE SPECIFICATION Factor 1 0 Line 0 EQ ~ ~--------1 NE ::: .e a: GT ~ ~~ 5 I- ~U 6 7 8 Field Location ~~ From LE To Factor 2 1-r-----------------1 f--- - ~ - Constant I- Flel;Lo;;i.; From To 51¢ !ile>tLJ~lr1 !416 r- - - - I 9 10 II 12 13 14 15 16 17 18 '.9 20 21 22 23 24 25 26 21'2s ~ 1 jq tl>I ~2-t-P=I jcj ~---1 J Comments I 2~ 30r2-l ~?~~6 37 38 39 40 41 42 43 44 45 46 47,48 49 50 51 52 53 54 55 56 57 ~. SJM!M3_,6_4 65 66 67 68 69 70 711:,1.?~ ~- -1-++-i Ito v ~1~ 111 .i~Ji + t..jo c.~T j.tjojNlcn Aji:jtl jt+-J3 !S'jszsJeJ&ic "1 1 -t--i o 3 -1 Record Name +- t--t--1 -f--14- - t---+-t-1- f--t--1 +- ri e xc!c::.J£!!> ~IT"AN~ A~ P L. A t<~I o(NJi..)Y ~ t- t· 0 4 ro 5 r- ·-·- t- o 6 rt- - FIELD SPECIFICATION Forced Line t----, Field Name s Comments I I a 9 10 11 12 ll 14 15 16 11 1s 19 20 21 22 23 24 2s 26 21-~~ .. ~~o 2_1 !~~~JS 36 11 JS 39 40 41 42 43 44 45 46 47 48 49 so s1 s2 sJ 54 ss ss s1 sa 59_60 61 62 63 64 65 66 67 68 6!,~ ~-1~ 6 1 F NP'I ~1 ._:i.1a FPIJ>I 0 i- / F ~1»1 ~ 0 - FtJ>lq i--1- 1 F~P>I 1 5¢ I !3j · ~ e P Ii n o 5!~ ~lo(vRF>J jlt ]8j q 3q 40 l~~ t __ IE!tnl".~Jv fl>j ~I~' f( AMJ - 1--1 _ _ __ 1---i t--+-i - -- -+ 1 2 i--1 3 r--- I- 1 4 Figure C-2 EXAMPLE 3: Overtime Analysis EMPLOYEE LIST This Tag Sort illustrates the use of forced key field specifications. The sort is based on the plant identification code in column 80 of the input records. In order to sort them in the order M, W, P, the M in column 80 is forced to a 1, the W is forced to a 2, and the P is forced to a 3. The output record entry is unchanged. C-3 SORT PROGRAM EXAMPLES 11n•nn•nEQU PM ENT ~ ~ ~ ~~~~~s~.~~uls~':! I 1 SORT SPECIFICATIONS 2 75 78 77 78 79 80 Page~ Date _ _ _ __ HEADER SPECIFICATION ~:~;~,~ation lc::lmlP l1-ls !fl Programmer - - - - - - SORTR,T Mode of Processing a Line SOR TR SOR TT SORTA SORTI ! < Total ~ Length of Kev Fields Output NOT USED Comments Record l (Program Identification) Length RECORD TYPE SPECIFICATION 0 Line Factor 1 EQ ~ lLI------~ '; ~ a~ o c ? u.~ § 0 . --···-··-····-..-·---·· Factor 2 ---·---·~- 1-r---------------1 . . . . . . . . .:··7· .. l1 ~~ GE Field Location From To LT LE ~ i---------t- - - - - Constant-------- - I Field Location From To j I- - I - - - Record Name I ff· Comments I I 6 37 a 1 l-+-1 I a 2 a 3 1---+- o 4 1-+-+-io 5 l-+--1-0 6 ~ ~al.,· . ··~··~ . ,.i................................. ·~n·_._[j_ vrr-1 I iY . ·- -- -- - _.. -- .L....J_,___ L....J________ -- -- -· FIELD SPECIFICATION r--"T""'"lr-r-.-------~-..,.-------------- Forced ----, NOT USED Field Name Comments I -·· I·" I I- I -1-·· +-· t:\l~~ ~Ii t>~lt' r.i(;, Aj"-Jh Y _ w~p~~ ~Ecpa~ oµ~~~tli _ .. 1 2 ~-+- 1 3 l-+- 1- 1--1 · :+ f- 1--1-+-· 1 4 Figure C-3 EXAMPLE 4: Employee List BONUS ANALYSIS This Index Sort illustrates the use of multiple Include and Omit lines. The first category of Omit lines excludes all main plant industrial employees' records that do not show bonus eligibility; the second set of Omit lines excludes any employees' records from any other plant that do not show bonus eligibility. The line with an I in column 6 and no other entries includes all other records; i.e., the records of industrial staff employees from the main plant and all employees from any other plant who are eligible for a bonus. C-4 SORT PROGRAM EXAMPLES 1 SORT SPECIFICATIONS 2 75 76 77 78 79 80 Page~ Date _ _ __ HEADER SPECIFICATION i:~;~f~ation !iJO '"'Ill{ IA Id 0 Line SOR TR SOR TT SORTA SORTI 8. ~ ~ Total ~ Length of Key Fields NOT USED f RECORD TYPE SPECIFICATION .---.-.-~~----~~--------------~---------------- ~ "- Line :o~: g~c !:!~iii 8u l 4 s 6 ~2 oA~j ~IAl<::i ~14 ~ 1~A~I ~ 0 6 1--- NE ~~ LT LE ~ -- C o n s t a n t - - - f- - - - - I Field Location j From To I ------ I- - - - - 1 Record Name Comments I I 9 20 2122 23 24 2s 26 21'2s 29 JO JI J2 JJ 34 35 36 11 JS 39 40 41 42 43 44 45 46 47148 49 so 51 s2 53 54 ss 56 57 sa 59 60 61 62 63 s~ejQjcN 5j~~~~ 7~ Nle;c 1 j~~ I~~ I~~ b~ -1 t--+--'-oc.Apj:tjo[M_ i=-1 l"'f:t\.tj_.Z f'LAlll[i1 53~y~ riov~s 6\~69 71!~!~ 73r~ r H - ~usl• ~xq~~~ ~jrA~~~I~ o_ _ ~lc.iftl"ll _ _ _ El6.['4 - :t!N\i>Ju~Jtj~:rjA '- ~ji"iAjf1Fj ~!Mla..j~ I 1r ~~ -- Factor 2 g~ Field Location From To iq o EQ a 9 10 11 12 13 14 15 16 1118 1 ~- 0 lq : :1 Factor 1 IEJY51,_ t.--1 i...lqc~llj.J:.jojrl -_ Ho1J~s - A~jov~ 601~~s ~l~1l~ o~\~V FIELD SPECIFICATION ------·- -------- ~~~~~----~-~------------~------------------ - ......., Forced .._ ~ ~ Line 8_2~ ~ S 6 ! ~ From 7 8 Fit~ 0 8 1--1 0 9 Fr{[c F MIC 1 0 1_F_ g~~ - o 7 1---1--- ~ Field Location rllD 1Jo"" To u ~---......., NOTUSED ~ ~ E c Comments II Field Name ~ 8 8 J I --,- -,--,--~ -- -- .,4 9 IO 11121314151617181920212223242S 26 2128293031323334 3536J7J839 14041424344454647484950Sl525354555657 5859606162636465666768697011727374 I~~ - ~~I~!~~ ~l~ ;lq lit --1 -- -r- ---- I cAT"&-<:r'/ sj¢ . 1-Joc.AiTIN ft _ 1 e-le11'1I ~vl1t1 I f-- 1 1 .. I-+-, 2 ·-- 1--1 3 1--- t--1-i - -+- 1 4 Bonus Analysis Figure C-4 EXAMPLE 5: 1-2 3-10 50-55 70-75 STOCK ORDER LIST Warehouse Identification Code Stock Number Quantity of Items Required to be in Stock Quantity of Items in Stock This is an ADDROUT Sort intended to produce a file of stock numbers by warehouse. Those records whose stock quantity level is lower than the accepted level are listed first in each warehouse category. A priority number (1 for under-stocked items; 2 for items of sufficient quantity) is forced into position 3 of the output record. The output file records will be in the following order: Warehouse 1 Stock Numbers of Items whose qua~tity is low Stock Numbers acceptable Warehouse 2 of Items whose quantity is Stock Numbers of Items whose quantity is low Stock Numbers acceptable C-5 of Items whose quantity is SORT PROGRAM EXAMPLES etc. Warehouse 3 1 SORT SPECIFICATIONS 75 76 77 78 79 80 2 Page~ Program Identification lsfT~~ ~Y HEADER SPECIFICATION Programmer ~----- .----.-..------....----.-.------........T""""1r---·---.--·-----------··-·-~ Mode of Processing 0 ;;c SORTA SOR TT SORTA SORT/ Line Total Length of Key Fields SORTR,T -iii ax l NOT USED £~ ~ Comments Output 8 b ~ ~:~;;~ - z 9' 6 ;j' • • 10 II 12 13" 15 16 17" "20,, 22",.,, ,. ,, ,, ,. ,r !Program Identification) !: ;;f.~r~~IYhl.5EirI'Liriri.iirII 6. 65 66 67 68 69 70" 72 73,. RECORD TYPE SPECIFICATION ---------- -- ----------- ------- --------- I- - Comments -------···-·------------- ----------------------- Factor 1 0 EO g~~ Lone r I!. ~ fl . ? ~ s~c~--- l 4 5 6 8 7 From 8 9 To Factor 2 ~~ f- - Constant - - - _______........ I - -:- - GE LT LE ~ - - I Field Locat1?~ __J From To - - - I Record Name I I Jt QoA•~J*Y [~S~ ~~·, ~Ari[:•1 ~~£V~~~ ~ I 10~ 14 IS~ 1718~__!20 :1'122r~24 2!1 16 2Jl<'_819 JO 3_:1 ~2 JJ 34 35 36 37 38 l! ~i:,.~-~~ 45 46 ~714_8_ 49 50 51 52 53 5! 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 ~ ~ 7~ r~~ 5~1 J]J ,,~ 11 FIELD SPECIFICATION ----------------------- - -·r----··-··1 -· Forced f-----, NOT USED Field N"me 0 Comments I 7 0 8 0 9 ft 0 . l---+-+- f-- 1-+--+- -+- - 1- 1 2 1 3 -+- Figure C-Sa Stock Order List, Page 1 C-6 SORT PROGRAM EXAMPLES 1 Page HEADER SPECIFICATION 2 [[J Mode of Processing SORTA SOATT SORTA SOATI Lme Total Length of Key Fields Factor 1 EQ 0 ~ u . 1 - - - - - - - - I NE ~ u- ~ ojN_u~ ~ _ _ g~ Field Location LT From LE To Factor 2 1-------------------1 t ~ __ =~ons1ant Field Location ~ From To ---- __ _..,. .....__ _ _ _ _ I Comments I j I Record Name I r··~~l~···::····:.i:;;t:If ··.J~'"I11fill·r·· . ·~:. . . . , . . . . . . . . . . . u~· :~~·· ~ .. .. FIELD SPECIFICATION "- ~~ ! ~~ ~ u Field Location ~ From 0: f-----r---li To QEd I-----, F1ekl Name 8 8 Comments I I 9 10 111213141516171819202122232425 :>6 2728i.'93031323334 3536313839404147434445464748495051525354!>55657 5859606162636465666768697071727374 0 7 0 8 0 9 1 t F 1"'1 F~ 32 I If f 1 2 Figure C-5b Stock Order List, Page 2 C-7 APPENDIX D INTERNAL OPERATIONS D.l PROCESS DESCRIPTION The material in this Appendix is included for the benefit of the more experienced programmer. This information is not necessary for the successful use of SORT by the less experienced user. The SORTS subroutines, which make up the bulk of the SORT program, consist of two phases: a sorting and distribution phase and a merge phase. During the sorting and distribution phase, the RELES subroutine accepts records from the input file and places them in an internal sort area called the sort tree. Each time the tree is filled, RELES distributes intermediate strings or runs of sorted records to the scratch files. The average length of these runs depends on the size of the record and its key. Also, the more nearly sorted the input file is, the longer the runs are. Because the algorithm of the SORT package is replacement selection, the average length of a run is twice the number of records that fit into the sort area. At the end of the input file, the RELES routine finishes the sorting and distribution phase and RSORT calls the merge phase. The merge phase consists of two subphases: an intermediate merge, the MERGE subroutine, and a final merge, the RETRN subroutine. The MERGE subroutine reads the series of runs from the scratch files, merges them into smaller numbers of longer runs and writes them out to the scratch files until there is only one run per scratch file. The RETRN subroutine then merges the runs together to create a single stream of records to be returned to you one at a time. D.2 THE SORT WORK AREA The entire work area of SORT is in the psect AAAAAA. Psect AAAAAA has an initial length of O, which you can expand by using the EXTSCT command in the task build command file. The size of this psect controls the ultimate task image size. In general, the larger the AAAAAA psect is, the faster SORT runs. SORT calculates the size of the work area by subtracting the address of the global location WA from that of the global location BOTTOM. These two global symbols mark the upper and the lower limits, respectively, of the SORT work area. The SORT work area is used for several purposes, which are illustrated in Figure D-1. Figure D-la shows the layout of the work area at the end of the command decoding phase. RMS uses space near the lower end of the work area for file control blocks and SORT uses space near the upper end for internal key information. The upper area is initially D-1 INTERNAL OPERATIONS set up to hold 10 keys. Its size is stored in the global location KYAREA in the segment SORTCX. To change the size of the key area, enter the following command in the task build command file: GBLPAT=SORTCX:KYAREA:x where: x is the number of keys times 30 and is expressed in octal. The pointers WORKHI and WORKLO contain the addresses of the upper and lower limits, respectively, of the remaining work area space and are maintained throughout the sorting process. Figure D-lb shows the physical layout of the SORT work area before RSORT begins. An additional area from the low end of the available work area space is turned over to RMS for internal control blocks. SORTS also sets up the input file buffer. Note the changed positions of WORKHI and WORKLO. The positions have changed because the values of the addresses in these two locations have changed to reflect the new boundaries of available work area space. If the input file is designated as sequential, SORT uses the RMS large disk blocking feature. Large disk blocking, also called big blocking, means that if you have enough core, you can call several blocks of your input file off the disk at once, instead of just one block at a time. Big blocking can be applied to all the files you use in your sort and, if you can use it, speeds up the sorting process by cutting down the number of times you have to do a disk seek. The SORT control program initializes the sorting process as follows: work area for the actual 1. RSORT divides the available work area core space into quarters. One quarter, rounded down to the nearest 512-byte block, is used as an input block buffer. 2. The number of blocks in the input block buffer is passed as a parameter to RSORT to control its scratch file blocking factor. To override the scratch file blocking factor, specify an explicit blocking factor with the BUCKETSIZE switch on the input side. 3. The amount of space remaining in the work area after the space for the input block buffer is deducted is passed to RSORT as a parameter. If the big blocking factor is 0, then half of the space left after the input block buffer is deducted is allocated for scratch file buffer space. If the big blocking factor is not O, then that many 512-byte blocks are allocated for scratch file buffer space. (The big blocking factor is an octal number.) In either case, the leftover space is used to store the sort tree and the record areas. You can change the big blocking factor on the scratch files by using this command at task build time: GBLPAT=SORTS:$RBGBF:x where: x is the big blocking factor in octal. D-2 INTERNAL OPERATIONS BOTTOM-r-------,----RMS INTERNAL CONTROL BLOCKS WORKLo-----------1 SCRATCH FILE BUFFER FILE 1 BUFFER FILE 2 BUFFER SORT TREE FILE 3 BUFFER FILE 4 BUFFER WORKHI - - - - - - - - - · - ; INPUT FILE BUFFER FILE 5 BUFFER WORKHI - - - - - - - - - - i KEY AREA WA---..L------J~---- a. AFTER COMMAND DECODING b. BEFORE THE SORT Figure D-1 c. DURING THE SORT d. AFTER MERGE SORT Work Area Allocation The first record in the input file is read and the actual sorting process begins. SORTS handles the actual sorting and distribution of the input records. The physical core layout for the SORT work area resembles Figure D-lc. At the end of the record distribution process, the input file buffer is no longer needed, so SORTS releases it. If the output file does not need more than two blocks of buffer space - that includes all sequential files and any relative files with bucketsizes less than three - the input buffer space is added back to the work area and WORKHI is adjusted accordingly. At the start of the merge phase, SORTS divides the available work area space into as many buffers as there are scratch files specified. Figure D-ld shows the default - five buffers. One of the buffers is larger than the rest and the raiio between its size and the size of a small buffer is: ~:l where: n is the number of scratch files. You can see that the more scratch files you specify, the larger the discrepancy in sizes between the large buffer and one of the small ones. After the intermediate merge subphase and before the final merge, SORTS turns over the large buffer to RMS for use on the output file. Big blocking is enabled for sequential files, and the final merge takes place. D-3 INTERNAL OPERATIONS D.3 PERFORMANCE PARAMETERS Two main concepts you must consider efficiency of SORT are: when you try to increase • Determining the most efficient size of the work area • Dividing the work area size among competing needs The advantages of giving more space to the input and at the expense of the sort tree are: • Larger blocking factor • Lower disk access and seek time output the buffers, But a smaller sort tree results in: • More intermediate runs • A longer merge phase run The default proportions for the input and output buffers and the tree are 25, 25, and 50 percent, respectively. sort During the merge phase, RETRN uses almost all of the work area space for scratch file buffers. By assigning a large number of scratch files, you reduce the number of merge runs and general record shuffling. But if you lack the core space necessary for a large, fast-running sort, more scratch files can be a handicap. More scratch files in a small space means smaller files can be a handicap. More scratch files in a small space means smaller I/O buffers per file and therefore greater disk access and seek times. Table D-1 shows you how to change seven factors that affect the speed and efficiency of SORT. The Result column reflects the effect of an increase in the factor being on the run time of the sort. Plus (+) means a faster sort; minus, a slower one; zero, no effect. The Change column shows the variables that you should change to affect the factor being considered. The Time and Place column legends translate as follows: • TKB - make the change to the Task task build time. • RSORT - make the change to the RSORT parameter list. • IFS - make the change to the input file switch on the command file at task build time. D-4 Builder command file at INTERNAL OPERATIONS Table D-1 User-Accessible SORT Parameters .. 1 Result Time and Place EXTCST=AAAAAA:n IWKSIZ + + TKB RS ORT Input Buffer Size /BU:n + IFS Scratch File Buffer Size GBLPAT=SORTS:$RBGBF:n BIGBUF + + TKB RS ORT Key Area Size GBLPAT=SORTCX:KYAREA:n - TKB Number of Scratch Files GBLPAT=SORT:FILES:n 01 TKB Scratch File Clustersize GBLPAT=SORTS:$RSCLV:n SCRLV /SI:n + + + TKB RS ORT IFS Contiguous Scratch Files GBLPAT=SORTS:$RSCTG:l /CO + + TKB IFS Scratch File Preallocation GBPAT=SORTS:$RPALQ PRIALQ /AL:n + + + TKB RS ORT IFS SORT Parameter Variable to Change Work Area Size Detrimental if you lack sufficient core to run a large, fast sort. NOTE The /AL, /CO, and /SI switches apply only to the temporary scratch files when used on the input side. This usage is intended only for programmers who are completely familiar with the effects of these switches. D-5 APPENDIX E SORT INSTALLATION E.l GENERAL COMMENTS SORT is an independent task that can be run under control of RSTS/E (V06B-02), RSX-llM (V3.0), or IAS (V2.0). SORT is neither shareable nor reentrant, so multiple calls to SORT create multiple copies of SORT in core storage. E.2 SORT KIT CONTENTS The SORT kit contains individual command files for you to use to build SORT on your operating system. These files are: • For full RMS-llK (including indexed) support SRTRIM.CMD - RSTS/E with RMSll Runtime System SRTEIM.CMD - RSTS/E with RSX Runtime System SRTMIM.CMD - RSX-llM and IAS • For sequential and relative only RMS-11 support SRTRRM.CMD - RSTS/E with RMSll Runtime System SRTERM.CMD - RSTS/E with RSX Runtime System SRTMRM.CMD - RSX-11 M and IAS When you build SORT you must use one of these files, depending which operating system and what kind of RMS-11 support you have. on The Task Builder command file contains a number of parameters that can be changed and options that can be included by the system manager to tune SORT to your installation's needs. These parameters control the size of the in-core work area (the scratch pad) which controls the task size, and the default logical unit and device assignments for the files SORT uses. Chapter 5 and Appendix D contain a full treatment of these parameters and other options. You can change the command file after it has been taken from the distribution medium and before the task build is started. To change just the task image size, see Section F.3. As supplied by DIGITAL, the command file builds the largest possible task (28K words on RSTS/E, 32K words on RSX or IAS) on account number [l,2], the library account, under the name SORT.TSK. The program uses five scratch files as the default and finds and puts all files on the public disk structure. E-1 SORT INSTALLATION E.2.1 Building the SORT Task for RSX-llM or IAS RSX-llM users can build and install SORT by using this procedure: 1. Use FILEX or PIP to transfer SORT from the distribution medium to a privileged account on public disk space: >FLX SY:/RS=MMO: [1,2]*.*/DO 2. At this point make any changes to the file: 3. Build the task: >TKB @SRTMIM 4. Builder command (for full RMS-llK support on RSX-llM or IAS) Install the task image: >INS [l,2]SORT 5. Task (the default task name is •.. SRT) Erase the files if no longer neededi >PIP @SRTERS 6. Invoke SORT: >SRT SRT> E.2.2 (SORT is now ready) Building the SORT Task for RSTS/E NOTE The following procedures for installing SORT-11 apply only to RSTS/E V6C and earlier versions. For instructions on SORT-11 installation, refer to the RSTS/E System Generation Manual. RSTS/E users can build and install SORT by using this procedure: 1. Use PIP to transfer the file from the distribution medium a privileged account on public disk space: to PIP *.*/CO=MMO:[l,2]*.* READY 2. At this point make any changes to the file. 3. Build the task: RUN $TKB.TSK TKB> @SRTRIM TKB>// READY Task Builder (full RMS-11 support) E-2 command SORT INSTALLATION 4. Make the task image executable by all users: PIP $SORT.TSK<l04>/RE READY 5. Add the "SRT" CCL command: RUN $UTILTY UTILTY V06B-03 RSTS V06B-02 TS/l #CCL SRT-=$SORT.TSK;O rz READY 6. Spool off and save the build map: QUE SORT.MAP/DE READY 7. Erase the files if no longer needed: PIP @SRTERS READY E.3 CHANGING THE SORT TASK IMAGE SIZE The total size of the installed task image is controlled by the size of the psect AAAAAA, the scratch pad work area. To make the task smaller, cut down the size of the psect as follows: 1. Use an editor to access the proper command file. 2. Find the line "EXTCST=AAAAAA:XXXXXX". 3. Copy the number represented by XXXXXX here. A. 4. Determine the desired task size reduction in 4K word increments (e.g. 12KW = 3) B. 5. Multiply the number on line B by 20000(8). C. 6. Subtract line C from A using octal arithmetic. D. 7. Replace XXXXXX in the command file with the value on line D. 8. Continue with the build. E-3 APPENDIX F RMS I/0 STATUS CODES This appendix describes I/O status codes that can be returned to program by RMS. your For some error conditions, RMS uses the RMS-status-code field of the SORT error message to communicate additional information. Table F-1 lists the RMS status codes and what they mean. Table F-1 RMS Error Status Codes Decimal Value Description -16 Operation aborted: out-of-stack save area or structures corrupted. -32 Files-11 ACP could not access the file. -48 File activity precludes action (e.g., attempting to close file with outstanding asynchronous record operation). -64 Bad area identification number (AID} field in allocation XAB (i.e., out of sequence}. -80 Illegal value in alignment allocation XAB. -96 (or Value in allocation quantity (ALQ} field in FAB allocation XAB} exceeds maximum or, during an explicit $EXTEND operation, equals O. -112 Records in a file on ANSI-labeled magnetic tape are variable length but not in ANSI D format. -128 Illegal value in allocation XAB. -144 Invalid operation at AST level: attempting to issue a synchronous operation from an asynchronous record operation completion routine. -160 Read error on file header attributes. -176 Write error on file header attributes. boundary allocation type options in-core (ALN} (AOP} field field data a of in (Continued on next page} F-1 RMS I/0 STATUS CODES Table F-1 (Cont.) RMS Error Status Codes -- Decimal Value ---···---··---------------· Description -192 Bucket size (BKS) field maximum. in FAB contains -208 Bucket size (BKZ) field in exceeding maximum. -224 Block length (BLN) field in a FAB or RAB is incorrect. -232 Beginning of file detected on $SPACE operation tape file. -240 Private buffer pool address not a double word boundary. -256 Private buffer pool size not a multiple of 4. -272 Internal error detected in RMS-11; contact a Software Specialist. no -288 Cannot connect RAB (i.e., only one permitted for sequential files). record -304 $UPDATE attempting to change a key field that does not the change attribute. have -320 Index file bucket check-byte mismatch. The bucket has corrupted. No recovery possible for the bucket. been -336 Close function failed (RSTS/E operating system only). -352 Invalid COD field in XAB or this XAB type is illegal for the organization or operation. -368 Files-11 ACP could not create file. -384 No current record: operation not immediately preceded by successful $GET or $FIND. -400 Files-11 ACP deaccess error during $CLOSE. -416 Invalid area number in DAN field of key definition XAB. -432 Record accessed by RFA access mode has been deleted. -448 1. 2. 3. allocation value XAB exceeding contains to recovery value magnetic possible; access stream Syntax error in device name. No such device. Inappropriate device for operation (e.g., attempting create an indexed file on magnetic tape). -464 Syntax error in directory name. -480 Dynamic memory exhausted: insufficient space pool or private buffer pool. space in a to central (Continued on next page) F-2 RMS I/0 STATUS CODES Table F-1 (Cont.) RMS Error Status Codes Description Decimal Value -496 Directory not found. -512 Device not ready. -520 Device positioning error. -544 Duplicate key detected, duplicates allowed attribute not set for one or more key fields. -560 Files-11 ACP enter function failed. -576 Environment error; -592 End of file. -608 Expanded string area in NAM block too short. -616 File expiration date not reached. -624 File extend failure. -640 Not a valid FAB: -656 1. 2. 3. operation not selected in ORG$ macro. BID field does not contain FB$BID. Record operation attempted was not declared in FAC field of FAB at open time. Invalid contents in FAC field. FB$PUT not present in FAC for $CREATE operation. -672 File already exists (attempted $CREATE operation). -680 Invalid file ID. -688 Invalid combination of values in FLG field of key definition XAB (e.g., no duplicates and keys can change). -704 File locked by another user -- your program cannot access the file because its sharing specification cannot be met. -720 Files-11 ACP Find function failed. -736 File not found. -752 Syntax error in file name. -768 Invalid file options. -784 Device full: -800 Invalid area number in IAN field of key definition XAB. -816 Index not initialized (this code can only occur in field when STS contains ER$RNF). cannot create or extend file. the STV (Continued on next page) F-3 RMS I/O STATUS CODES Table F-1 (Cont.) RMS Error Status Codes Description Decimal Value -832 Invalid IFI field in FAB. -848 Maximum number (254) of key definition or allocation XABs exceeded or multiple summary, protection, or date XABs present during operation. -864 $INIT or $INITIF macro call never issued. -880 Illegal operation; 1. 2. 3. 4. examples include: Attempting a $TRUNCATE operation to a non-sequential file. Attempting an $ERASE or $EXTEND operation to a magnetic tape file. Issuing a block mode operation (e.g., $READ or $WRITE) to a stream not connected for block operations. Issuing a record operation (e.g., $GET, $PUT) to a stream connected for block mode operations. Illegal record count field. -912 Invalid internal stream identifier (ISI) field in RAB (field may have been altered by user) or $CONNECT never issued for stream. -928 Key buffer address (KBF) field equals 0. -944 Record identifier (i.e., the 4-byte location addressed by KBF) for random operation to relative file is 0 or negative. -960 Invalid key of reference (KRF) in RAB: 1. 2. encountered in sequential invalid -896 file: As input to random $GET or $FIND operation, or As input to $CONNECT or $REWIND (in this case, ER$KRF is returned for the first record operation following the $CONNECT or $REWIND) • -976 Key size equals 0 or too large (indexed file) or to 4 (relative file). not equal -992 Invalid area number in LAN field of key definition XAB. -1008 Magnetic tape is not ANSI labeled. -1024 Logical channel busy. -1040 Invalid value in logical channel number (LCH) field of FAB. -1048 Attempt to extend an area containing an unused extent. -1056 Invalid value in LOC field of allocation XAB. (Continued on next page) F-4 RMS I/O STATUS CODES Table F-1 (Cont.) RMS Error Status Codes Description Decimal Value -1072 In-core data structures (e.g., I/O buffers) corrupted (this code can only occur in the STV field when STS contains ER$ABO). -1088 Files-11 ACP could not mark file for deletion. -1104 1. 2. -1120 Maximum record number field contains a negative value during $CREATE of relative file. Record identifier (pointed to by KBF) for random operation to relative file exceeds maximum record number specified when file created. Maximum record size (MRS) field contains operation and: 1. 2. 0 during $CREATE Record Format is fixed, or File organization is relative. -1136 Odd address in Name Block address $OPEN, $CREATE, or $ERASE. -1152 Not at end-of-file: attempting a $PUT operation sequential file when stream is not positioned to EOF. -1168 Cannot allocate internal index descriptor: insufficient room in space pool while attempting to open an indexed file. -1184 No primary key definition indexed file. -1200 Open function failed (RSTS/E operating system only). -1216 XABs in chain not in correct order: 1. 2. XAB (NAM) present field during Allocation or key definition XABs not in densely ascending) order. XAB of another type intervenes in key allocation XAB sub-chain. in FAB on to a $CREATE of ascending (or definition or -1232 Invalid value in file organization (ORG) field of FAB. -1248 Error in file prologue: reconstructed. -1264 Key position (POS) field in key definition value exceeding maximum record size. -1280 File header contains bad date and time information (retrieved by RMS-11 because a date and time XAB is present during a $OPEN or $DISPLAY operation); file may be corrupted. file is corrupted XAB and must be contains a (Continued on next page) F-5 RMS I/O STATUS CODES Table F-1 (Cont.) RMS Error Status Codes ..--------~---------------- ..... •••············ ·······-·--·--·, ~-,.·----·--·-··--·----------_.., ··----···-·· Description Decimal Value f - - - - - - - - - t - - - - - · · · · · ·····- -1296 Privilege violation: operating system. -1312 Not a valid RAB: BID field does not contain RB$BID. to Section A.3 of this Appendix. -1328 1. 2. -1344 1. 2. access to the file denied by the Ref er Illegal values in record access mode (RAC) field of RAB. Illogical value in RAC field (e.g., RB$KEY with a sequential file). Illegal values in record attributes (RAT) field of during $CREATE. Illogical combination of attributes (e.g., FB$CR FB$FTN) in RAC field during $CREATE. Record address (RBF) field in RAB contains (block mode access only). -1376 File read error. -1392 Record already exists: during a $PUT operation in random mode to a relative file, an existing record found in the target record position. -1408 Invalid RFA in RFA field of RAB during RFA access. -1424 1. 2. odd and -1360 Invalid record format in $CREATE. Specified record format organization. an FAB address RFM field of FAB during is illegal for file -1440 Target bucket locked by another task or the same program. another -1456 Files-11 ACP Remove function failed. -1472 Record identified by KBF/KSZ fields of RAB for random $GET or $FIND operation does not exist in relative or indexed file (for indexed files only, STV may contain ER$IDX). Record may never have been written or may have been deleted. -1488 $FREE operation issued but no bucket was locked by stream. -1504 Record options (ROP) field contains illogical combination of values. -1520 Error while reading prologue. -1536 Invalid PRV record encountered in indexed file; corrupted. -1552 Record stream active, i.e., in asynchronous environment, attempting to issue a record operation to a stream that has a request outstanding. illegal stream values in or file may be --------·--·------------····--·--- (Continued on next page) F-6 RMS I/O STATUS CODES Table F-1 (Cont.) RMS Error Status Codes Description Decimal Value I------+----------------------- -1568 Record size specified in RSZ of RAB during $PUT is invalid: 1. 2. 3. 4. $UPDATE RSZ equals O. RSZ exceeds maximum record size (MRS) specified when file created. RSZ not equal to size of Current Record for $UPDATE operation to a sequential file on disk. RSZ does not equal MRS (for fixed format records). -1584 Record too big for your buffer: RMS-11 could not move entire record retrieved by $GET operation to work area (UBF/USZ). Note that this error does not destroy the current context of the stream. Rather, the stream's context is updated as if the operation had been completely successful. -1600 During $PUT operation, key of record to be written is not equal to or greater than key of previous record (and RAC field contains RB$SEQ) • -1616 Illogical value in SHR field of FAB (e.g., FB$WRI for sequential file). specified -1632 Invalid SIZ field in key definition XAB during (e.g., specified size exceeds maximum record size). $CREATE -1648 During asynchronous record operation, RMS-11 has found that the stack is too big to be saved (this code can only occur in the STV field when STS contains ER$ABO). -1664 System directive error. -1680 Index tree error: -1696 Syntax error in file type (e.g., more than three specified). -1712 Invalid address in UBF field of RAB: 1. 2. indexed file is corrupted. characters UBF contains O, or UBF not word aligned (for block mode access only). -1728 Invalid USZ field in RAB (i.e., USZ contains 0). -1744 Syntax error in file version number. -1760 Invalid VOL field in allocation contain 0). -1776 File write error. -1784 Device is write locked. -1792 Error while writing prologue. -1808 XAB field in FAB (or NXT address . ______,____________________ .__ or ~~--- field XAB in (i.e., XAB) VOL does not contains an odd ··--- - - - - - - - - - - - - - · - - - - - - - - - - - - F-7 GLOSSARY Alphanumeric Characters - the entire set of 128 ASCII characters. ASCII Character Set - the set of 128 seven-bit American Standard for Information Interchange characters (see Appendix A). Code Byte - the smallest addressable unit of information; eight bits. Each ASCII character usually resides in a single byte. Collating Sequence - the order into which characters are sorted upon numeric values assigned to each. based Device - any of the peripherals referenced by the operating system. Digit - in EBCDIC representation, the numeric value of the four bits of a byte. low-order EBCDIC - an alternate character set used widely in the computing industry (see Table A-2 for comparison with ASCII characters). Field - a logically distinguishable area within a record in which data is located. File - a collection of related records treated as a unit. Floating-Point Binary - a method for storing numeric data, the exponent occupies the first byte and the mantissa resides in the next three or seven bytes. Used in FORTRAN IV representation. Format - the arrangement of any record or file; fields reside in a record. the order in which Key, Key Field - the sorting key is the data element chosen from a record to control the sort. For example, if a list of names is sorted alphabetically, the keys would be each successive letter in the name field. Key, Major - the most important field in the total key. If you were sorting a list by name, department and salary, name would be the major key. Key, Minor - the least significant field in the example above, salary is the minor key. total key. In the Line - In this document, a line generally refers to a line in the SORT specifications form or a record on the specification file. Packed Decimal - method for compact storage of numeric data; two digits are stored in each 8-bit byte and the sign resides in the last byte of the low-order digit. RMS - Record Management Services Glossary-! Record - the unit of information in a file; treated as a unit a group of related fields System Device - the device on which the Executive resides. Word - two bytes or sixteen bits of data Work File - a collection of sorted records created processing cycle and released after the sort is finished during the Zone - the top three punches of a character as represented on a card or the numeric value of the upper four bits of a byte punch Glossary-2 INDEX /AL, /BL, /BU, /CO, /DE, /FI, /FO, /IN, /KE, /PR, /RE, /SE, /SI, 3-1 3-1 3-1 3-3 3-3 3-3 3-3 3-3 3-4 3-4 3-4 3-4 3-4 Block, 512-byte, 3-1 Blocking, big, D-2 Blocks per bucket, 3-1 Blocksize switch, 3-1 Boolean expression, 3-13 Bucket, blocks per, 3-1 Bucket size, 3-1 Bucketsize switch, 3-1 Buffer size ratio, scratch file, D-3 Byte, null, 1-10 padding, 5-9 $SORT, $RUN, 2-1 RUN, 2-2 Access from a random file, direct, 1-1 sequential, 1-1 Address routing sort, 1-1, 1-8, 1-9, 1-10, 3-4 Allocation, file, 5-2 Allocation switch, 3-1 Allocation, figure, SORT work area, D-3 Alternate collating sequence, 1-6' 3-6' 3-7 Alternate key, 1-2 ALTSEQ, 1-6, 3-7 ALTSEQ format and notes, 3-10 ALTSEQ records, 3-6 ANSI format, 1-3 Ascending order, 1-4 ASCII, 1-10 ASCII character set, table, A-2 ASCII data, 1-2 ASCII zone, 3-4 Assignments table, LUN, 5-1 Available internal storage space, 1-8 Batch mode, running SORT in RSTS/E, 2-2 Binary data, 1-2, 1-9 Calling sequence, SORT subroutine, 5-10 Card reader, 1-2 Cards, 1-3 Changing SORT defaults, 3-1 Changing sort order within a sequence, 3-7 Character set, table, ASCII, A-2 EBCDIC, A-3 Characters, equal digits, printable, table, B-2 Characters, equal zones, printable, table, B-3 Cluster size, file, 3-5 Code, device, 2-3 user identification, 2-3 Codes, RMS error, 4-7 RMS error status, F-1 SORT error, 5-5 Codes, table, device specification, 2-4 Collating sequence, alternate, 1-6, 3-6, 3-7 normal, 1-6 Collation, nonstandard, 3-5 Command decoder errors, 4-1 Command file, indirect, 2-2 Command string, 1-1, 1-4, 2-2 errors, 1-8 format, 2-1, 2-2 lndex-1 INDEX (CONT . ) Conunand string (Cont.), functions, 1-4 SORT, 2-1 switches, 2-2 Conunents, 3-8 Conditional keys, 3-17 Conditions, error, 4-1 Configuration, system, 1-2 Console, 1-3 Contiguous switch, 3-3 Control fields, 1-1 Control program, 1-7 errors, 4-6 Control-phase, 4-1 Controlling SORT, 1-1 Controlling SORT options, 3-1 Controls, sorting process, 3-5 Conventions, file naming, 5-1 Data, ASCII, 1-2 binary, 1-2, 1-9 EBCDIC, 1-2 entry, size switch defaults, 3-5 field, 1-2 defining, 3-7 locating, 3-7 specifications, 3-7 handling, 3-4 irrelevant to SORT, 1-2 key, 1-2 output, 1-9 relevant, 1-2 restricted-format key, 3-7 Data base, 1-1 Decoder errors, conunand, 4-1 Defaults, changing SORT, 3-1 file, footnote, 3-2 file types, 2-3 sort process, 1-8 switch, table, 3-2 Defining a data field, 3-7 Defining a key, 3-7 Description, SORT process, D-1 Description sequence, field, 3-4 Device, code, 2-3 file, input and output, 2-2 Device (Cont.), peripheral, 1-2 specification codes, table, 2-4 switch, 3-3 types, table, 2-4 Different record formats, 1-7 Digits, printable characters, equal, B-2 Direct access from a random file, 1-1 Directing SORT, 1-5 Discussion, specification file example, 3-17 Disk, 1-2 scratch files on, 1-8 wasted space on, 5-2 Distribution process, record, D-3 EBCDIC, character set, table, A-3 data, 1-2 ENDS, 5-9 Entry, conunon, of specification lines, 3-7 field specification, 3-15 forced key specification, 3-17 header specification, 3-9 notes, 3-10 points, SORTS subroutines, 5-6 record type specification, 3-17 SORT specification, figure, 3-18 Error, codes, RMS, 4-7 RMS status, F-1 SORT, 5-5 conunand decoder, 4-1 conunand string, 1-8 control program, 4-6 I/O, 4-1, 4-5 merge, 4-6 messages, 4-1 other, 4-6, 4-8 presort, 4-6 RSX-llM file primitive, 4-7 RSX-llM attribute mismatch, 4-7 SORT~ 4-1 Index-2 INDEX (CONT • ) Error (Cont.), specification file, 1-8, 4-1, 4-3 subroutine, 4-8 Example, SORT, C-1 SORTR, 3-17 specification file discussion, 3-17 Expression, Boolean, 3-13 Factor, big blocking, D-2 Field, control, 1-1 data, 1-2 defining a data, 3-7 description sequence, 3-4 first byte, key, 3-4 interpretation, 1-2 locating a data, 3-7 key, 1-1, 1-5, 1-10, 3-4 length, key, 3-4 location, key, 1-5 specification, 3-7, 3-14 data, 3-7 entries, 3-15 key, 3-7 notes, 3-16 stripping key, 3-14 table, 3-22 File, allocation, 5-2 buffer size ratio, scratch, D-3 cluster size, 3-5 defaults, footnote, 3-2 devices, input and output, 2-2 errors, specification, 1-8, 4-1, 4-3 example, discussion, specification, 3-17 index, 1-1 indexed, 1-2 indirect command, 2-2 information, RMS, 1-5 input, 1-1, 1-9, 2-2, 3-17, 5-1 input and output, 3-1 internal work, 1-5 merging scratch, 1-8 moving records within a, 3-7 name, 2-3 naming conventions, 5-1 File (Cont.), needed, number of scratch, 1-8 on disk, scratch, 1-8 opening the input, 1-8 optional specification, 1-1 organization, input, 3-1 RMS-valid, 1-2 output, 1-8, 1-10, 1-11, 2-1, 2-2' 3-7' 5-1 parameters, 1-5 input and output, 2-2 primitive errors, RSX-llM, 4-7 random, direct access, 1-1 relative, 1-2 scratch, 5-1 sequential, 1-2 sequential access from a random, 1-1 sorted, 2-1 specification, 1-5, 1-8, 2-2, 2-3, 3-5, 3-14, 3-17, 4-3, 5-1 structure, scratch, 5-3 switch, 3-3 type, 2-3 types, default, 2-3 uniform format input, 1-5 usage, scratch, 5-3 First byte, key field, 3-4 FIXED format, 3-3 FIXED records, 1-8 Forced key specification entries, 3-17 Forced keys, 1-6 Form, figure, 3-8 SORT specification, 3-7 Format, ALTSEQ, and notes, 3-10 ANSI, 1-3 command string, 2-1, 2-2 FIXED, 3-3 output, 1-7 packed decimal, 3-4 record, 1-5 different, 1-7 STREAM, 3-3 switch, 3-3 uniform input file, 1-5 UNKNOWN, 3- 3 VARIABLE, 3-3 variable record, 3-7 variation, input, 1-7 FORTRAN IV number, 3-4 Functions, command string, 1-4 Index-3 INDEX (CONT.) General data, irrelevant to SORT, 1-2 Handling, data, 3-4 Header specification, 3-6, 3-17 entries, 3-9 notes., 3-10 table, 3-19 High-speed sorting, 1-8 I/O errors, 4-1, 4-5 IAS, 2-1 Identification by type, record, 1-7 Identification code, user, 2-3 Identifier, record, 1-2 Index, file, 1-1 keys, 1-10 record, 1-1, 1-10, 1-11 sort, 1-1, 1-8, 1-10, 1-11, 3-4 Indexed file, 1-2 Indexed sequential switch, 3-3 Indices, record, 1-11 Indirect command file, 2-2 Information, key, 1-1 prologue, 1-2 RMS file, 1-5 storage of sorted, 1-1 Initial sorting process, 1-8 Input and output files, 3-1 devices, 2-2 parameters, 2-2 Input file, 1-1, 1-9, 2-2, 3-17, 5-1 opening the, 1-8 organization, 3-1 uniform format, 1-5 Input format variation, 1-7 Input phase, 1-9 Installation, SORT, E-1 Interactive mode, 2-1 Internal operations, SORT, 5-1, D-1 Internal work files, 1-5 Interpretation, field, 1-2 Invoking SORT, 2-1 Irrelevant to SORT, general data, 1-2 Key, alternate, 1-2 area size, D-2 conditional, 3-17 data, 1-2 restricted-format, 3-7 defining, 3-7 fields, 1-1, 1-5, 1-10, 3-4 first byte, 3-4 length, 3-4 location, 1-5 specifications, 3-7 stripping, 3-14 forced, 1-6 specification entries, 3-17 in original form, record, 1-11 index, 1-10 information, 1-1 locating a, 3-7 primary, 1-2 setup, 5-9 significance, sort, 1-4 switch, 3-4 Labels, magtape, 1-9 Length, key field, 3-4 Line number, 3-7 Lines, common entries of specif ication, 3-7 Locating a data field, 3-7 Locating a key, 3-7 Location, key field, 1-5 Logical Unit Number, 5-1 LON assignments table, 5-1 Magtape, 1-2, 3-1 Magtape labels, 1-9 Management Services, Record, 1-1, 1-8 Maximum record size switch, 1-5 MERGE, 5-8 Merge errors, 4-6 Merge phase, 1-8 Merging scratch files, 1-8 Messages, SORT error, 4-1 Method, sorting, 1-1 Index-4 INDEX (CONT • ) Mismatch errors, RSX-llM, 4-7 Mode, interactive, 2-1 Moving records within a file, 3-7 Output file, 1-8, 1-10, 1-11, 2-1, 2-2, 3-7 devices, 2-2 parameters, 2-2, 3-1, 5-1 Output format variation, 1-7 Output record, 1-11, 3-14 Name, switch, 2-2 Naming conventions, file, 5-1 Nonstandard collation, 3-5 Normal collating sequence, 1-6 Notes, ALTSEQ format and, 3-10 field specification, 3-16 record type specifications, 3-13 Null byte, 1-10 Null records, 3-17 Number, FORTRAN IV, 3-4 line, 3-7 logical unit, 5-1 page, 3-7 project-programmer, 2-3 Number of scratch files needed, 1-8 Package, SORTS subroutine, 1-7, 5-5 Packed decimal format, 3-4 Padding byte, 5-9 Page number, 3-7 Paper tape, 1-2 Parameters, file, 1-5 input and output file, 2-2 SORT, 3-4 SORT performance, D-4 SORT performance, table, D-5 Parts of SORT, 1-7 Performance parameters, SORT, D-4 table, D-5 Peripheral device, 1-2 Phase, input, 1-9 merge, 1-8 SORT, 1-7 Pointer, record, 1-2 relative record, 1-10 Points, SORTS subroutine entry, 5-6 Preallocation problems, 5-2 Presort errors, 4-6 Presort operation, 1-8 Primary key, 1-2 Printable characters, equal digits, table, B-2 Printable characters, equal zones, table, B-3 Printer, 1-3 Problems, preallocation, 5-2 Process, controls, sorting, 3-5 default sort, 1-8 description, SORT, D-1 initial sorting, 1-8 options, 1-5 table, 1-9 record distribution, D-3 SORT, 1-8 sorting, 1-5, 1-9 switch, 3-4 Opening the input file, 1-8 Operations, SORT, 3-8 SORT internal, 5-1, D-1 Optimization, sort, 5-2 Optional specification file, 1-1 Options, controlling SORT, 3-1 sort processing, 1-8 sorting process, 1-5 sorting process, table, 1-9 Order, 1-4 ascending, 1-4 ascending sort, 3-4 descending sort, 3-4 general sort, 3-4 Organization, input file, 3-1 SORT, 5-4 Organization, RMS-valid, file, 1-2 Other errors, 4-6, 4-8 Output data, 1-9 Index-5 INDEX (CONT. ) Processing, options, sort, 1-8 sort, 1-10 Program, control, 1-7 errors, 4-6 Project-programmer number, 2-3 Prologue information, 1-2 Prompt, SORT, 2-2 system, 2-1 Random file, direct access from a, 1-1 sequential access from a, 1-1 Ratio, scratch file buffer size, D-3 Reel time, 2-1 Record Management Services, 1-1, 1-8 Records, ALTSEQ, 3-6 distribution process, D-3 FIXED, 1-8 format, different, 1-7 switch, 1-5 variable, 3-7 identification by type, 1-7 identifier, 1-2 index, 1-1, 1-10, 1-11 keys in original form, 1-11 moving, within a file, 3-7 null, 3-17 output, 1-11, 3-14 pointer, 1-2 selection, 1-5, 3-7 size switch, maximum, 1-5 sort, 1-1, 1-8, 3-4 sorted, 2-1 STREAM ASCII, 1-8 strings of sorted, 1-8 type specifications, 3-7 entries, 3-11 notes, 3-13 table, 3-20 VARIABLE length, 1-8 within a file, moving, 3-7 Relative file, 1-2 Relative record pointers, 1-10 Relative switch, 3-4 RELES, 5-7 Relevant data, 1-2 Restricted-format key data, 3-7 Retrieval window size, 3-5 RETRN, 5-8 RMS, 1-1, 1-8, 3-1, D-2 error codes, 4-7 error status codes, F-1 file information, 1-5 RMS-valid, file organization, 1-2 RSORT, 5-4, 5-6, 5-9 RSTS/E, 2-1, 2-2 version number, omitted for, 2-3 RSX-llM, 2.-1 file primitive errors, 4-7 mismatch errors, 4-7 $RUN $SORT, 2-2 RUN [1,2] SORT, 2-1 Running SORT, 2-1 in RSTS/E batch mode, 2-2 Scratch files, 5-1 buffer size ratio, D-3 merging, 1-8 needed, number of, 1-8 on disk, 1-8 structure, 5-3 usage, 5-3 Selection, record, 1-5, 3-7 Sequence, 1-11 alternate collating, 1-6, 3-6, 3-7 changing sort order within a, 3-7 field description, 3-4 normal collating, 1-6 SORT subroutine calling, 5-10 Sequential, access from a random file, 1-1 file, 1-2 switch, 3-4 Significance, sort key, 1-4 Size, bucket, 3-1 file cluster, 3-5 key area, D-2 retrieval window, 3-5 Size ratio, scratch file buffer, D-3 Size switch, 3-4 maximum record, 1-5 Size switch defaults, data entry, 3-5 $SORT, RUN I 2-1 $RUN I 2-2 Index-6 INDEX (CONT . ) SORT, 1-1, 1-4, 1-8, 2-1, 3-17, 5-1 address routing, 1-1, 1-8 to 1-10 I 3-4 command string, 2-1 controlling, 1-1 defaults, changing, 3-1 directing, 1-5 error codes, 5-5 error messages, 4-1 errors, 4-1 examples, c-1 general data, irrelevant to, 1-2 Index, 1-1 index, 1-8, 1-10, 1-11, 3-4 installation, E-1 internal operations, 5-1, D-1 invoking, 2-1 key significance, 1-4 operations, 3-8 optimization, 5-2 options, controlling, 3-1 order, ascending, 3-4 descending, 3-4 general, 3-4 within a sequence, changing, 3-7 organization, 5-4 parameters, 3-4 performance parameters, D-4 parameters, performance, table, D-5 parts of, 1-7 phases, 1-7 process, 1-8 default, 1-8 description, D-1 processes, 1-8 processing, 1-10 options, 1-8 prompt, 2-2 Record, 1-1 record, 1-8, 3-4 running, 2-1 in RSTS/E batch mode, 2-2 specification, entries, figure, 3-18 form, 3-7 figure, 3-8 subroutine calling sequence, 5-10 switches, 3-1 Tag, 1-1, 1-8, 1-9, 3-4 work area, D-1 allocation, figure, D-3 SORTA, 1-1, 1-9, 1-10 SORTC I 5-4 Sorted records, 2-1 Sorted file, 2-1 Sorted information, storage of, 1-1 Sorted records, strings of, 1-8 SORT!, 1-1, 1-10, 1-11, 3-17 Sorting, high-speed, 1-8 method, 1-1 process, 1-5, 1-9 controls, 3-5 initial, 1-8 options, 1-5 table, 1-9 SORTM, 5-4 SORTP, 5-4 SORTR, 1-1, 1-9, 3-14 example, 3-17 SORTS I 5-4 subroutine entry points, 5-6 subroutine package, 1-7, 5-5 SORTT, 1-1, 1-9, 3-14 Space, available internal storage, 1-8 Space on disk, wasted, 5-2 Specification, device codes, table, 2-4 entries, field, 3-15 notes, 3-16 forced key, 3-17 header, 3-9 notes, header, 3-10 record type, 3-11 SORT, figure, 3-18 field, 3-7, 3-14 file, 1-5, 1-8, 2-2, 2-3, 3-5, 3-14, 3-17, 4-3, 5-1 errors, 1-8, 4-1, 4-3 example, discussion, 3-17 optional, 1-1 switch, 1-5 form, SORT, 3-7 figure, 3-8 header, 3-6, 3-17 key field, 3-7 lines, common entries of, 3-7 record type, 3-7 notes, 3-13 table, field, 3-22 header, 3-19 record type, 3-20 type, 3-7 Index-7 INDEX (CONT.) Type, file, 2-3 record identification by, 1-7 specification, 3-7 Type specifications, record, 3-7 entries, 3-11 notes, 3-13 table, 3-20 Types, default file, 2-3 Types, table, device, 2-4 SRT I 2-1 Status codes, RMS error, F-1 Storage of sorted information, 1-1 Storage space, available internal, 1-8 STREAM ASCII records, 1-8 STREAM format, 3-3 String, command, 1-1, 1-4, 2-2 of sorted records, 1-8 SORT command, 2-1 Stripping key fields, 3-14 Structure, scratch file, 5-3 Subroutine calling sequence, SORT I 5-10 Subroutine entry points, SORTS I 5-6 Subroutine errors, 4-8 Subroutine package, SORTS, 1-7, 5-5 Switch, allocation, 3-1 blocksize, 3-1 bucketsize, 3-1 command string, 2-2 contiguous, 3-3 defaults, table, 3-2 device, 3-3 files, 3-3 format, 3-3 indexed sequential, 3~3 key I 3-4 maximum record size, 1-5 name, 2-2 process, 3-4 record format, 1-5 relative, 3-4 sequential, 3-4 size, 3-4 SORT I 3-1 specification, 1-5 System configuration, 1-2 System prompt, 2-1 UICI 2-3 Uniform format input file, 1-5 Unit Number, Logical, 5-1 UNKNOWN file format, 3-3 Usage, scratch file, 5-3 User identification code, 2-3 Valid terminators, 4-2 Values, switch, 1-8, 3-1 VARIABLE format, 3-3, 3-7 VARIABLE length records, 1-8 Variation, input format, 1-7 output format, 1-7 Version number, omitted for RSTS/E, 2-3 Table, see also Table of Contents EBCDIC character set, A-3 LUN assignments, 5-1 Tag sort, 1-1, 1-8, 1-9, 3-4 Terminal, 1-2 Terminators, valid, 4-2 Time, elapsed, 2-1 real, 2-1 wall clock, 2-1 Wall clock time, 2-1 Wasted space on disk, 5-2 Window size, retrieval, 3-5 Work area, SORT, D-1 Work area allocation, SORT, figure, D-3 Work files, internal, 1-5 WORKHI, D-2 WORKLO, D-2 Zone, ASCII I 3-4 Zones, printable characters, equal, table, B-3 Index-8
Home
Privacy and Data
Site structure and layout ©2025 Majenko Technologies