Digital PDFs
Documents
Guest
Register
Log In
AA-MO63A-TB
June 1982
159 pages
Original
9.3MB
view
download
Document:
AA-M063A-TB SORT-MERGE Users Guide Feb82
Order Number:
AA-MO63A-TB
Revision:
0
Pages:
159
Original Filename:
AA-M063A-TB_SORT-MERGE_Users_Guide_Feb82.pdf
OCR Text
TOPS-10 SORT/MERGE User's Guide AA-M063A-TB February 1982 This document describes user procedures for the SORT/MERGE stand-alone utility program. This document supersedes the SORT/MERGE User's Guide, Order No. AA-0997D-TB, published May 1978. OPERATING SYSTEM: SOFTWARE: TOPS-10 V7.01 SORT/MERGE V04C Software and manuals should be ordered by title and order number. In the United States. send orders to the nearest distribution center. Outside the United States. orders should be directed to the nearest DIGITAL Field Sales Office or representative. Northeast/Mid-Atlantic Region Central Region Western Region Digital Equipment Corporation PO Box CS2008 Nashua, New Hampshire 03061 Telephone:(603)884-6660 Digital Equipment Corporation Digital Equipment Corporation Accessories and Supplies Center Accessories and Supplies Center 1050 East Remington Road 632 Caribbean Drive Schaumburg. Illinois 60195 Sunnyvale. California 94086 Telephone :(312)640-5612 Telephone:( 408) 734-4915 digital equipment corporation. marlboro. massachusetts First Printing .. June 1977 Revised, May 1978 Revised, February 1982 Copyright ,c:, 1977, 1978, 1982, Digital Equipment Corporation. All Rights Reserved. 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 only be used or copied in accordance with the terms of such license. No responsibility is assumed for the use or reliability of software on equipment that is not supplied by DIGITAL or its affiliated companies. The following are trademarks of Digital Equipment Corporation: DEC DECUS DECSYSTEM-20 DECwriter DIBOL EduSystem ~DmDDmD DECnet DECsystem-10 PDT RSTS RSX VMS RT lAS MASSBUS PDP UNIBUS VAX VT The postage-prepaid READER'S COMMENTS form on the last page of this document requests the user's critical evaluation to assist us in preparing future documentation. Contents Preface Chapter 1 Getting Started with SORT/MERGE 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 Chapter 2 Creating a Multifield ASCII Test File . . . . . . . . . . . Determining Record Length, Key Position, and Key Length Sorting a Multifield File. . . . . . . . . . 1-1 1-2 1-3 1.3.1 1.3.2 1.3.3 1.3.4 1-3 Sorting the File on the Name Field. Sorting the File on the Age Field. . Sorting the File on the Grade Field Sorting the File on Two Keys Sorting a Line-Sequenced ASCII File . . . Sorting Files Containing Tabs . . . . . . . Sorting an ASCII File Containing Variable-Length Records Sorting a Multiline ASCII File. . . . . Sorting Uppercase and Lowercase Text. Sorting Nontext Files . . . . . . . . . 1-5 1-5 1-6 1-7 1-8 1-10 1-11 1-12 1-13 How to Use SORT/MERGE 2.1 2.2 2.3 Introduction. . . . . . Running SORT/MERGE Command Formats. . . 2.3.1 2.3.2 2.3.3 2.4 2.5 The SORT/MERGE Command Scanner. Merging Files . . . . . . . . . . . . . Using Command Files. . . . . . . . . Using SORT/MERGE from a COBOL Program. Using SORT/MERGE from a FORTRAN Program 2-1 2-2 2-4 2-5 2-7 2-7 2-8 2-8 III Chapter 3 SORT/MERGE Switches 3.1 3.2 3.3 3.4 3.5 iv Required Switches. 3-2 3.1.1 3.1.2 IRECORD-SIZE Switch IKEY Switch. 3-2 3-2 3.1.2.1 3.1.2.2 3.1.2.3 3.1.2.4 3.1.2.5 3.1.2.6 3-3 3-4 3-5 3-6 3-6 3-8 /KEY Switch Format. Key Starting Position Key Length Key Collating Order Key Data Type. Key Sign Status Recording Mode Switches 3-10 3.2.1 3.2.2 3.2.3 3.2.4 3-10 3-10 3-11 3-11 IASCII Switch. ISIXBIT Switch IEBCDIC Switch. IBINARY Switch. File Switches 3-11 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.3.10 3-11 3-12 3-12 3-12 3-14 3-15 3-15 3-15 3-16 3-16 I AFTER-ADV ANCING Switch. IALIGN Switch IBEFORE-ADV ANCING Switch. IBLOCKED Switch. IFIXED Switch. IFORTRAN Switch. INOCRLF Switch IRANDOM Switch . ISEQUENTIAL Switch. IV ARIABLE Switch Control Switches. 3-16 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.4.10 3.4.11 3-16 3-17 3-17 3-19 3-20 3-21 3-21 3-21 3-22 3-22 3-23 IBUFFER-PAGES Switch ICHECK Switch . ICOLLATE Switch. IERROR-RETURN Switch. IFATAL-ERROR-CODE Switch ILEAVES Switch. IMAX-TEMP-FILES Switch. IPHYSICAL Switch ISTATISTICS Switch. ISUPPRESS-ERROR Switch. ITEMPORARY -AREA .Switch Tape Switches. 3-23 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.5.7 3.5.8 3-23 3-23 3-24 3-24 3-25 3-25 3-26 3-26 I ANSI-ASCII Switch. IDENSITY Switch. IINDUSTRY -COMPATIBLE Switch ILABEL Switch IPARITY Switch. IPOSITION Switch. IREWIND Switch IUNLOAD Switch Chapter 4 File Formats 4.1 Recording Modes. . . . . . . . . 4-1 ASCII Recording Mode .. SIXBIT Recording Mode. EBCDIC Recording Mode BINARY Recording Mode 4-2 4-2 4-2 4-3 4.1.1 4.1.2 4.1.3 4.1.4 4.2 File Formats. . . . . . . . . 4· ·3 Fixed-Length. ASCII. 4-5 4.2.1 COBOL Fixed-Length ASCII. FORTRAN Fixed-Length (Random) ASCII 4 ·5 4-6 Variable-Length ASCII . . . . . . . . . . . . . . 4-8 4.2.1.1 4.2.1.2 4.2.2 4.2.2.1 4.2.2.2 4.3 4-12 COBOL Fixed-Length SIXBIT . 4-13 Variable-Length SIXBIT . . . . . . . 4-14 COBOL Variable-Length SIXBIT 4-15 EBCDIC File Formats. . . . . . . '. . . 4-16 4.4.1 4.5 4.5.1 4.5.2 4.5.3 4.5.4 4.6 COBOL Fixed-Length EBCDIC . COBOL Variable-Length EBCDIC. COBOL Blocked Fixed-Length EBCDIC COBOL Blocked Variable-Length EBCDIC. 4-25 COBOL Binary File Formats. 4-25 COBOL ASCII Mixed-Mode Binary. COBOL SIXBIT Mixed-Mode Binary. COBOL EBCDIC Mixed-Mode Binary 4-25 4-27 4-28 FORTRAN Binary File Formats . . . . . . . . 4-30 4.6.1.1 4.6.1.2 4.6.1.3 4.6.2 4.6.2.1 4.6.2.2 4.6.2.3 4.6.2.4 FORTRAN Random Binary (with LSCWs) FORTRAN Random Binary (without LSCWs). FORTRAN Sequential Binary (with LSCWs) . FORTRAN Sequential Binary (without LSCWs) 4-31 4-33 4-35 4-37 SORT/MERGE Error Messages 5.1 5.2 Chapter 6 4-17 4 -18 4-20 4-21 BINARY File Formats. . . . . . . . 4.6.1 Chapter 5 4--9 4-10 Fixed-Length SIXBIT . . . . . . . . . 4.3.1 4.4 COBOL Variable-Length ASCII . . . . . FORTRAN Variable-Length (Sequential) ASCII Message Format. Error Messages . 5-1 5-1 SORT/MERGE Performance Considerations 6.1 Performance Overview .. 6-1 The Sort Phase . The Merge Phase 6-2 6-3 6.1.1 6.1.2 v 6.2 Performance Considerations . . 6.2.1 6.2.2 6.2.3 Tree Size . . . . . . . Number of I/O Buffers . Number of Merge Passes. 6-9 6-9 6-10 6-11 Appendix A Summary of SORT/MERGE Commands and Switches A.l A.2 A.3 A.4 Commands........... Switches (in Alphabetic Order). Switches (by Function). Switches (by Type) . . . . . . . · A-I · A-2 · A-I0 · A-II Appendix B Collating Sequences and Conversion Tables Glossary Index Figures Key Argument Tree . . . . . . . . . . . . COBOL Fixed-Length ASCII . . . . . . . FORTRAN Fixed-Length (Random) ASCII. COBOL Variable-Length ASCII . . . . . . 4-4 FORTRAN Variable-Length (Sequentiall ASCII. 4-5 COBOL Fixed-Length SIXBIT . . 4-6 COBOL Variable-Length SIXBIT . 4-7 COBOL Fixed-Length EBCDIC . . 4-8 COBOL Variable-Length EBCDIC. 4-9 COBOL Blocked Fixed-Length EBCDIC 4-10 COBOL Blocked Variable-Length EBCDIC 4-11 COBOL Standard Binary and ASCII Mixed-Mode Binary 4-12 COBOL Standard Binary and SIX BIT Mixed-Mode Binary. 4-13 COBOL Standard Binary and EBCDIC Mixed-Mode Binary 4-14 FORTRAN Standard and Mixed-Mode Random Binary with LSCWs 4-15 FORTRAN Standard and Mixed-Mode Random Binary. . . . . . 4-16 FORTRAN Standard/Mixed-Mode Sequential Binary with LSCWs 4-17 FORTRAN Standard and Mixed-Mode Sequential Binary 6-1 Binary Tree . . . . . . . . . . . . . . . . . . . 6-2 The Operation of the SORT/MERGE Binary Tree. . . . . 3-1 4-1 4-2 4-3 3-4 4-6 4-7 4-9 4-11 4-13 4-16 4-17 4-19 4-21 4-24 4-26 4-27 4-29 4-32 4-34 4-36 4-38 6-2 6-4 Tables 3-1 3-2 B-1 B-2 B-3 VI Field Descriptors for COBOL. . . . . . . . . . . . . . . . . . . . · 3-7 Field Descriptors for FORTRAN . . . . . . . . . . . . . . . . . . · 3-8 ASCII and SIXBIT Collating Sequence and Conversion to EBCDIC. · B-2 ASCII to SIXBIT Conversion. . . . . . . . . . . . . · B-4 EBCDIC Collating Sequence and Conversion to ASCII . . . . . . . · B-6 Preface This manual is written for those who want to sort data using the SORT/MERGE utility program. The intended audience is composed of programmers and/or persons having user experience with a computer system. As a user's guide, this manual is a combination of reference and explanatory material that should be sufficient for anyone with a reasonable amount of experience to successfully sort any of the file formats supported by SORT/MERGE. This experience should include some programming experience in a high-level language or simply user experience with a computer system. Specifically, you should be knowledgeable of the various internal representations of data and with the file format of the data you intend to sort. However, if you are a beginning user who has never used a sorting utility, Chapter 1 has been written to help you get started with the SORT/MERGE utility. This chapter is devoted to sorting ASCII text files, and includes some transitional material as a bridge into more complex types of sorts. Where applicable, shaded areas in the examples show changes in the SORT/MERGE command strings. If there is any term used in this manual that you are unfamiliar with, refer to the Glossary at the end of this manual for a definition of the term. The software required to run SORT/MERGE is MACRO version 53A or later and LINK version 4A or later. This manual reflects version 4C of the SORT/MERGE software. vii References are made in this manual to the latest editions of the following documents: • TOPS-10ITOPS-20 COBOL-68 Language Reference Manual • TOPS-10ITOPS-20 COBOL-74 LanguaRe Reference Manual • TOPS-10 Monitor Calls Manual • TOPS-10ITOPS-20 FORTRAN LanRuaRe Manual • TOPS-10 Operating System Conlmands Manual viii Chapter 1 Getting Started with SORT/MERGE This chapter is written for the beginning SORT/MERGE user who has a simple ASCII or line-sequenced ASCII text file to sort. It demonstrates how to create an ASCII file using SOS, how to calculate the position and length of the key field, and how to use SORT/MERGE to sort the file. 1.1 Creating a Multifield ASCII Test File To create and use a practice file, log in and create the sample file below. (The examples use the SOS editor.) The file is a student record file consisting of last name, age, and final grade. It is 17 characters long and has the following format: name field age field grade field - position 1 to 10 positions 14 and 15 position 17 The following illustrates the format of each entry in the file: 100 00 00 00 01 :I. :I. 11 :1.:1.1 .( ?B 90 :1.2 34 ::,:;6/ ,)\.) 12 34 '"' NN NN NN NN NN name field At) age field (":J grade field MR·S1712·81 1-1 The following example illustrates creating the file with SOS. Each field of the record is separated from the other fields by blanks (not tabs). • SOS TEST. I NCREl} Input: TEST.IN 00100 12345678901234567fRU) 00200 SMITH 19 efRU) 00300 JONES 32 Miilll 00400 ABERNATHY 19 B(RET) 00500 BROWN I NG 20 e(RET) 00600 HART 19 AfRU) 00700 WILSON 20 BfRU) 00800 HILL 20 AfRU) 00900 $ rEb *D100(RE] 1 Lines (00100/1) deleted * E S(RE'D [TEST.INJ NOTE Line 00100 is temporarily used as a line of numbers to help format the file. Before the file is saved, the line of formatting numbers is deleted (line 00100). Also, the ES command, in SOS, is used to save the file without line numbers. The saved version of the file looks like this: • T Y PET EST. I Nru SMITH JONES ABERNATHY 13ROWN I NG HART WILSON HILL 19 e 32 A 19 B 20 e 19 A 20 B 20 A 1.2 Determining Record Length, Key Position, and Key Length Now that the file is created, you must determine the following: 1. The record length. 2. Whether the records are fixed-length or variable-length. 3. The starting position and length of the key field. (The key field is that part of the record you want to sort on.) Each line in the sample file is 17 characters long. Because each line is a separate record, the record length is 1 7 characters long also. You do not count line terminators, such as RETURN, as part of the record length. Because each record is exactly 17 characters long, the records are fixed-length. 1-2 Getting Started with SORT/MERGE The starting position and length of the key field depends on which field of the record you wish to sort (name, age, or grade). If you want to sort on the name field, the key starts at position 1 and is 10 characters long: OO~)~OOO~11111111 ·L• ,.) 3· 4 I::· ( ·7 <:' <r' .) 1 ... ) ··r j\ I~· I: .. ~ ,,_ ..J (.) \.>. ( •...• :I·'? '"' ,.) .' NNNNNNNNNN AA G key field MR·S·1713·81 If you desire to sort on the age field, the key starts at character position 14 and is 2 characters long: 00000000011111111 1234::..16?U90 1. :::.~34::.:jb/ NNNNNNNNNN AA G L-J key field MR·S·1714·81 If you wish to sort on the grade field, the key starts at character position 17 and is 1 character long: OOO~OOOO)11111111 12345678901234567 NNNNNNNNNN U key field MR·S-1715-81 1.3 Sorting a Multifield File 1.3.1 Sorting the File on the Name Field Run SORT/MERGE by giving the command R SORT at monitor level: .R SORTiBTI! * NOTE Those areas of the command string that change in the following examples are shaded. When SORT/MERGE responds with the prompt ~*', type the output file specification: *TEST;OUT Getting Started with SORT /MERGE 1-3 Type an equals sign (=): *TEST,OUT= Type the input file specification: *TEST,OUT=TEST,IN Type the /FIXED switch to indicate that you are sorting fixed-length records: *TEST,OUT=TEST,IN/FIXED Type the /RECORD switch and give the record length of 17: *TEST,OUT=TEST,IN/FIXED/RECORD:17 Type the /KEY switch, then type the starting position of the key as 1, a colon (:), and the length of the key as 10: *TEST,OUT=TEST,IN/FIXED/RECORD:17/KEY:I:10 Type a colon and indicate if the file is to be sorted in ASCENDING or DESCENDING order: * TEST, OUT = TEST, IN 1 F I>(ED 1 RECORD: 171 KEY : 1 : 10: ASCEND I NG@ m Type a carriage return and wait for SORT/MERGE to perform the sort. ·When the sort is complete, SORT/MERGE responds with the following display: [SRT){PN Expanding to L1GP] Gorted 7 records 12 KEY COtTIParisons, 1.71 per record I~O record leaves in tTletTIOn' o run s 0:00:00 CPU titTle, IG,L13 MS per record O:OO:L12 elapsed titTle 'fhe sorted file, TEST. OUT appears as: • TY PE TEST, OUTru ABERNATHY BROWN I NG HART HILL JONES SMITH lAlILSON 1-4 19 B 20 C 19 A 20 A 32 A 19 C 20 B Getting Started with SORT /MERGE To sort the file in descending order, enter the following command string to SORT/MERGE: *TEST t OUT=TEST t IN/FI){ED/RECORD: 17 IKEY: 1: 10 :OESC!;NOING@] The sorted file appears as: + TY PE TEST + OUT@] WILSON SMITH JONES HILL HART BROWNING ABERNATHY 20 B 19 C 32 A 20 A 19 A 20 C 19 B 1.3.2 Sorting the File on the Age Field To sort the file on the age field, simple change the /KEY: arguments in the command string to indicate that field, for example, *TEST tOUT = TEST tIN I F I ){EDI RECORD: 17 I K EY ::{:~1:?: ASCEND I NGffil The sorted file appears as: tTY PE TEST t OUTffil SMITH ABERNATHY HART BROWNING WILSON HILL JONES 19 C 19 B 18 A 20 C 20 B 20 A 32 A 1.3.3 Sorting the File on the Grade Field To sort the file on the grade field, simply change the IKEY: arguments in the command string to indicate that field, for example, *TEST + OUT= TEST t I N/F U{ED/RECORD: 17 IKEY: 17Ft: ASCEND I NGffil The sorted file appears as: tTY PE TEST + OUT@] JONES HART HILL ABERNATHY WILSON SMITH BROWNING 32 A 19 A 20 A 19 B 20 B 19 C 20 C Getting Started with SORT /MERGE 1-5 1.3.4 Sorting the File on Two Keys The previous examples demonstrated how to sort the file on anyone of the fields in the record by changing the /KEY: switch arguments. It is often necessary to sort a file on more than one field. For example, you might want to sort your test file by age and also have each of the age groups sorted by grade. To do this, type the following command string to SORT/MERGE: *TEST. OUT =TEST. IN / F 1>(ED / RECORD: 1 7/K EY: ILl: Z :ASCE:NDING # / KEY: 1 7 : 1 : AS C END I N G(Rff) -fREJl NOTE To continue a command string line, you must type a dash (-) followed by a carriage-return/line-feed. SORT/MERGE then prompts you with a pound-sign (# ). You can then continue typing the command string as shown above. The sorted file appears as: . • TYPE TEST.OUT(RET) HART ABERNATHY SMITH HILL WILSON BROWNING JONES 19 19 19 20 20 20 32 A B C A B C A 1.4 Sorting a Line-Sequenced ASCII File In the first example, you saved TEST.IN without line numbers. The internal octal representation of the first record of TEST.IN would appears as: Internal Representation- -Bit35 123 115 r1:1.1 124 :1.:1.0 0 --·8· • M· • I • M'fu- ij..,1i r---- r-- - - Data- .-.- 040 040 -.-040 040 040 c -()- - n l l - M" " M H • . 040 06:1. OJ:!. 0 -.040 -.- 040 .Ii " -':L"- il9" r---- .-.- '-.-- 040 103 015 012 000 .(Ii -c,~ 0 -':::-F- Niif.. r---MR-S-1716-81 1-6 Getting Started with SORT IMERGE If the file is saved with line numbers, an additional six characters are added to each record. These characters are the five ASCII digits of the line number plus the horizontal tab. If TEST.lN has record-sequence numbers, the octal representation of its first record appears as: :1. 060 060 061 ()6() 06() r- ·0· ·0· 1-0:1. ..- Ii ().- A()" r-- - - 0:1.1. I- 12~3 1.1.5 1:1.1 124 () ff1:- ~S· f-."'M. -1"- "y'ii r- - - .. . 110 040 040 040 ()40 r- 0- - li'1T·- • I i -.-II • - r--H - " ()40 ()40 061 r- 0- 040 040 --Ii -.- iIi" C"--jj -11- H • II II 071 ()4() 103 015' 0:1.2 () r.9 u- "H -'1(;" -(~f I . T r- - MR-S-1717-81 NOTE Bit 35 is turned on in a line-sequence word. Thus, the line-sequence sequence word shown above is not the same as a data word containing the ASCII characters ~00100'. The addition of the six characters increases the record length by six and shifts the key starting position six places to the right. To sort a line-sequenced version of TEST.lN on the name field, you must give the following command: *TEST • OUT =TEST. I NI F I )(EiItEC:URtf:'Z31KEY;1(fo: ASCEND I NG(@) Thus, the IRECORD: switch argument and the IKEY: switch argument were increased to include the length of the line sequence number. The sorted file appears as: .TYPE TEST.OUT(@) 00300 ooaoo 00500 00700 00200 00100 OOGOO ABERNATHY BROWNING HART HILL JONES SMITH WILSON 19 B 20 C 19 A 20 A 32 A 19 C 20 B Note that the line-sequence numbers are now out of order. To correct this, you can edit the file (with SOS) and renumber it with the N command. However, as soon as you open the file, SOS generates a warning message for each line that is out of sequence. If you are working with a large file, Getting Started with SORT IMERGE 1-7 you can have a tedious wait (while the warning messages are displayed) before you can renumber the file. For this reason, it is recommended that you sort ASCII files that are not line-sequenced and defer adding linesequence numbers until after the file is sorted. ,r 1.5 Sorting Files Containing Tabs Tab characters are peculiar in that they are never printed or displayed on an output device. Rather, they constitute an instruction to the output device (or the monitor if TTY NO TAB is set) to skip a certain number of spaces before printing the next character. Tab characters can have the following problems for you when using SORTiMERGE: 1. While a single tab character can introduce as many as seven blank spaces into a printed line, those seven "blanks" are not stored internally as a group of ASCII blank characters. (An ASCII blank is represented by octal 040, but a single ASCII tab character is represented by octal all.) If you mistakenly interpret a single tab character to be the number of spaces it produces on the output device, then you are calculating an incorrect record length and an erroneous starting position for the key field. If the tab character falls within the key field, then you are calculating an erroneous length for the key field. 2. Because tab characters are not printed, they are impossible to detect on an ordinary printout or terminal display. 3. Tabs that are used randomly make it impossible to calculate a record length or key field starting position that is accurate for each record in the file. If tabs are used in the key fields of some records, but blanks are used in the key fields of other records, then you are unable to sort the file correctly. For example, the following lines appear identicaL but the first line contains blanks, while the second line contains tabs. 1-8 SMITH 24 C SMITH 24 C Getting Started with SORT IMERGE The octal representation of the first line appears as: 123 115 1:1.1 124 110 r-·S • -'i1.- ilrii -·1''- -'f./.- .-.- 04'0 040 040 ()4() 040 r-.- .f-.-.-.-._Ii . -. .Ii .-.()40 04() 040 r()40 040 -Ii - . - -.- .- • II .. ()40 062 064 -,-040 040 Ii li'lH-41i .. ~: .. -H- 040 :1.03 040 040 040 ----- "C r.-.II II II ll - h 01~,i 012 000 000 O()O r-CR -0::"" NUL -NlJL T~[n,:MR-S-1718-81 The octal representation of the second line appears as: 123 115 1:1.:1. :1.24 :1. :I. 0 r-..-c. "'M ilf· -"l'. IliT II - \.') H- 011 011 ()62 064 O:Ll i=f( ").. --4 -j::f'( -t:~T - 103 ~: o1 ~j 012 000 000 .--·C· - -CR -LJ.:' NUL..- -NUL.. '-- MR-S-1719-81 Although the two records (lines) shown above appear to be identical when printed, their internal octal representation is very different. The record length of the line using blanks is 25, but the record length of the line using tabs is only 11. While the name field occurs in the sanle place in both records, the age field and grade field do not. The solution to the problem of tab characters is to avoid using them altogether or to use them only in a consistent manner. However, sometimes you cannot know whether the file contains tab characters. A solution to this problem is to use the PIP program to convert any tabs that may exist in your file to the correct number of spaces that each tab represents. The following example illustrates the commands you can give to PIP . • R PI pm *NOTAB.FIL=TEST.IN/wm The IW switch causes PIP to convert the tabs in the file to the appropriate number of spaces. Getting Started with SORT IMERGE 1-9 1.6 Sorting an ASCII File Containing Variable-Length Records The previous examples concentrated on files containing fixed-length records. SORT/MERGE can also sort variable-length records, providing you specify a record length that is equal to the length of the largest record in the file. For example, examine the following modified version of TEST.IN: • TYPE TEST. I NID 1234567890123456 19 C SMITH 32 A JONES 19 B ABERNATHY 20 C BROWNING 19 A HART 20 B WILSON 20 A HILL .Note how the record lengths vary from 11 characters to 16 characters. To sort the above file on the name field, type the following command string to SORT/MERGE: nEST. OUT= TEST. I Nll,JAR I ABLE/RECORD: 1 6/KEY: 8: 9: ASCEND I NGID The following notes apply to the sorting of variable-length records: 1. If you specify a record length that is less than the maximum size record in your file, then those records that are longer than the value you specified are truncated on output. 2. Although the /VARIABLE switch is shown in the command string above, you can omit it and still sort the file correctly. This is because the /V ARIABLE switch is the default record-length type. 3. The /KEY switch is specified with the length of the longest field in the record. Thus, for shorter fields, the key field extends beyond the end of the field. This is permissable only if the data type switch is /ALPHANUMERIC. (Data types are discussed in the last section of this chapter.) However, you cannot specify a key field that extends beyond the value given with the /RECORD switch. The sorted file appears as: • TYPE TEST. OUTID 1234567890123456 19 B ABERNATHY 20 C BROWNING 1.9 A HART 20 A HILL 32 A JONES 1.9 C SMITH 20 B WILSON 1-10 Getting Started with SORT /MERGE 1.7 Sorting a Multiline ASCII File It is sometimes desirable to sort an ASCII text file in which each record consists of two or more lines. For example, you may wish to sort a file of records having the following format: SMITH 19 C JONES 32 A Unfortunately, the control characters (carriage return/line feed) that are used to format the text into lines are really ASCII record delimiters. If you attempt to sort such a file, you will find that what you intended as fields of a single record are interpreted as separate records by SORT/MERGE. The results are not what you expected. There are no elegant solutions to this problem. You could avoid using carriage returns until the actual end of your record, but you lose the ability to format the record into separate lines. A better solution is to write a program that preprocesses your file before sorting and postprocesses your file after sorting. In the preprocess phase, the program converts all carriage return/line feeds, except the last one in the record, to some other character pair that does not occur in the file. You sort the file, and then postprocess it with the program to restore the carriage return/line feeds. The best solution is to actually create the record with a program, rather than with a text editor. This allows generating only one carriage return/line feed per record and allows you to sort the records on any of the fields. However, as the solutions to the problem grow more technically acceptable, you lose the ease and informality of generating the file with a text editor. 1.8 Sorting Uppercase and Lowercase Text The ASCII collating sequence (see Appendix B) is structured so that lowercase alphabetic characters have a greater value than their uppercase equivalents. As a result, if fields are composed of both uppercase and lowercase characters and you sort your file according to the ASCII collating sequence, then the file is sorted so that characters ~~A" through '~Z" come before characters "a" through ~~z", but all other characters have their normal position. By using SORT/MERGE's alternate collating sequence facility, you can specify a collating sequence in which uppercase and lowercase alphabetic Getting Started with SORT /MERGE 1-11 characters are equivalent. This allows you to sort uppercase and lowercase characters in normal alphabetic order. First, create a collating sequence file of the form: .505 UPPER.nn(BD) Input: UPPER.TXT 00100 OOO-"@", "A"="a", "5"="b", 00200 " E " : " e", I. F " = " f" , "G" = " 9" , 00300 "J":"j", "K"="f,", "L"="l", OOLIOO "0"="0'" "P"="p", "0":"9'" 00500 "T"="t", "U":"u", "I.J"="!)", 00600 "y"="},,,, "Z"="z"(BIT) 00700 $ "C":"c", "H" = " h" , "M"="!rl", "R"=" r", "1,..1"="1,1", "D"=",j" ,(BIT) "1" = " i " ., (BIT) "N"="n" ,(BIT) "5":"5" ,(BIT) "){"="x" ,(BD) ~ [UPPER.TXTJ When you give a command string, use the /COLLATE switch with the FILE argument and the name of the file containing your alternate collating sequence. For example, the above collating sequence was stored in a file named UPPER.TXT. To use the first command string shown in this chapter for uppercase and lowercase text, specify the following: *TE5T. OUT=TE5T. I N/F I ){ED/RECORD: 17 IKEY: 1 : 10: ASCEND I NG -(BIT) #/COLLATE: FILE: UPPER. nn(BIT) The result of the command string shown above is to sort file TEST.lN according to the collating sequence stored in file UPPER.TXT. The results are written to file TEST.OUT. 1.9 Sorting Nontext Files This section is designed to help you extend your knowledge of more complex types of sorts that SORT/MERGE can perform. If you are only interested in sorting text files, then you do not need to read this section. The following is the first command string shown in this chapter: *TE5T.OUT:TE5T.IN/FIXED/RECORD:17/KEY:1:10:A5CENDING For simplicity, you relied upon the default values for certain specifications that SORT/MERGE requires. The complete, explicit command string appears as: * T EST. 0 UT = T EST. I NI AS C I I IF I:{ E DIRE COR D : 1 7 IKE 'I' : 1 : 1 0 : AS CEND I NG - (BIT) #/ALPHANUMERIC(BD) Two new items appear in the above command string: 1. /ASCII switch 2. /ALPHANUMERIC switch 1-12 Getting Started with SORT /MERGE The /ALPHANUMERIC switch specifies the data type of the key field. The data type specifies how the data is to be interpreted. For example, you read in Section 1.5 that ASCII characters are represented internally by a 3-digit octal number (or a 7-bit binary number). Because a single word of data on TOPS-10 contains 36 bits, a word of data holds five ASCII characters, with one bit unused (7*5 = 35). However, examined out of context, this word of data appears to be simply a 36-bit binary number. For example, consider the following 36-bit binary value: 011000101101010111001100001010000110 This value can be correctly interpreted as any of the following: 1. 26530857606 Fixed point decimal value 2. 395671090000000000000.00 Floating point decimal value 3. 3.9567109E + 20 Scientific notation 4. (159BC' ASCII characters Remember that any file you create is a series of these 36-bit words that are subject to the various interpretations shown above. The interpretation of a given word depends entirely on context. If you have created a text file, then you are only interested in interpreting the data as characters. If you have created a file of fixed-point decimal values, then you interpret the file accordingly. You must specify the appropriate interpretation to SORT/MERGE. If you specify an incorrect interpretation, then the results of the sort, while technically correct, are not the results you expect. ((Data type" is the term used to refer to the interpretation of data; and the data-type switch refers to the /KEY switch which is used to specify the correct interpretation of data to SORT/MERGE. The switches for the simpler data types are: 1. /ALPHANUMERIC Alphabetic and numeric characters 2. /NUMERIC Numeric characters 3. /COMPUTATIONAL Fixed-point decimal numbers 4. /COMP1 Floating-point decimal numbers 5. /COMP3 Packed (4 bits) decimal 6. /PACKED Same as /COMP3 I See Section 3.2 for more information on data types. Getting Started with SORT IMERGE 1-13 The second new switch, /ASCII, specifies the recording mode. The recording modes that SORT/MERGE recognizes are: 1. ASCII 7-bit bytes 2. SIXBIT 6-bit bytes 3. EBCDIC 9-bit bytes 4. BINARY 36-bi t bytes All recording modes have a byte size associated with them. The byte size specifies how many bits are used to represent a single unit of data in that recording mode. For the first three recording modes, a byte is equivalent to a character. (The first three recording modes have character sets associated with them.) Thus, an ASCII character is represented by a group of 7 bits, a SIXBIT character is represented by a group of 6 bits, and an EBCDIC character is represented by a group of 9 bits. (See Appendix B for the ASCII, SIXBIT, and EBCDIC character set.) A unit of data in binary recording mode requires all 36 bits of the word. Except for data produced by a COBOL program, you can assume that any character data you generate is ASCII data. COBOL programs generate SIXBIT data by default, unless you have specified ASCII as the data type. Refer to Section 4.1 for diagrams depicting the recording modes recognized by SORT/MERGE. Also, see Chapter 3 for the discussion of each recording mode switch. There is also a new concept illustrated by the second command string. That is the concept of file format, which is illustrated by the /ASCII /FIXED switch combination. This particular file format is termed ~fixed-length ASCII'. The file format specifies the type of control characters, control words, or header words that are used to format the data into individual records. Because these format words and control characters are not actually part of the data, SORT/MERGE must strip them from the input, before the actual sorting process can begin. (They are restored on output.) If you incorrectly specify the file format to SORT/MERGE, then the format words and control characters are not properly stripped off and are sorted and output as data. The results are quite unpredictable. (See Chapter 4 for a discussion of file formats.) 1-14 Getting Started with SORT /MERGE Chapter 2 How to Use SORT/MERGE This chapter lists the information needed to sort a file and describes general command formats. Other topics, such as merging files and using command files, are also described. If you are a new user of SORT/MERGE, then you should read Chapter 1 before you read this chapter. 2.1 Introduction SORT/MERGE is a system program that arranges the records of one or more files according to a user-specified sequence. You specify the key fields on which the actual comparisons are to be made, and you also specify the collating sequence to be used in ordering the file. The collating sequence can be the normal ASCII, SIXBIT, or EBCDIC collating sequence; or it can be a unique collating sequence which you have constructed for a particular application. Additionally, you can specify that the file be sorted in ascending or descending order. SORT/MERGE performs two processes when sorting a file. 1. The sort phase, where the input files are read and the records are sifted into runs. These runs are output to one or more temporary areas. You can specify up to 26 temporary areas. 2. The merge phase, where the runs are merged into fewer but longer runs. This process of sorting and merging continues until a single run remains; this run becomes the output file. Depending on file size, file order, and available memory, it is possible for the runs to remain in memory. In such a case, temporary areas are not used. 2-1 The time required for a given sort diminishes progressively as more disk units and more memory are available. Although tape units can be used for input and output files, disk units must be used for temporary areas. If the input files are on disk, you must have enough temporary space to hold the input files plus two additional copies of each input file. The minimum memory required is an area large enough to contain the following: 1. Double buffers for a. Each input device b. The output device c. One temporary disk file 2. At least 16 records 3. One record from each temporary file 2.2 Running SORT/MERGE You must know the following information about the input files in order to sort or merge them: 1. Record size 2. Key size and location 3. Key collating order a. Ascending b. Descending 4. Key data type a. Al ph an umeric b. COMPI c. COMP3 d. COMPUTATIONAL e. FORMAT (FORTRAN ASCII floating point) f. 5. Numeric Key sign status a. Algebraic sign used/not used for compares 2-2 How to Use SORT/MERGE 6. Recording mode a. ASCII b. BINARY c. EBCDIC d. SIXBIT 7. File attributes a. Blocked b. Fixed (random) c. Variable (sequential) d. FORTRAN (ASCII or binary) In addition, there are control attributes and tape attributes that you can specify. SORT/MERGE must have all this information in order to correctly sort a file. However, you can rely on default switches and default key attributes, so that you need not specify all of the information required by SORT/MERGE. Although sorting a file can be a simple operation, several factors are often introduced that make it difficult for an uninformed user to sort a file: 1. The existence of control words in the file. The use of control words is interwoven with the concept of file format, and you may not understand one without understanding the other. Chapter 4 contains diagrams of all major file formats supported by SORT/MERGE, code segments from COBOL and FORTRAN programs that generate these formats, and the SORT/MERGE switch or switch combination used to specify these formats. You should study this chapter until you know what switches to use in specifying your file's format to SORT/MERGE. 2. The existence of line-sequence numbers in the file. Chapter 1 describes the problems caused by line-sequence numbers. 3. The existence of tab characters in the file. Chapter 1 describes the problems caused by tab characters in the file. 4. U sing a key data type other than alphanumeric or numeric. Calculating key position and key length for alphanumeric or numeric keys is a relatively straightforward task. (See Chapter 1, if you do not understand how to do this.) However, when using other key data types such as COMPUTATIONAL or FORMAT, calculating key position and length becomes more complex. If you are using a key data type other than ALPHANUMERIC or NUMERIC, be sure to read the description How to Use SORT/MERGE 2-3 of the /KEY switch in Chapter 3. You can also find the file format diagram in Chapter 4 that describes your file, and study the key specifications in the diagram. 5. Sorting character data stored in a binary file. If you specify your file as a standard binary file (lBINARY switch), then you cannot use an alphanumeric or numeric field as a key field. If you specify your file as a mixed-mode binary file (lBINARY/ASCII, /BINARY/SIXBIT, or /BINARY/EBCDIC switches), then you can use an alphanumeric or numeric field as a key field. However, the specification of record length and key starting position changes from words for a binary file to characters for a mixed-mode binary file. See Chapter 4 for a more detailed discussion of standard and mixed-mode binary files. 2.3 Command Formats There are five different functions that can be specified in a command string to SORT/MERGE. The following describes each of these functions and illustrates the general format of the command string that performs the function. 1. SORT - sort the specified files. switches OUTFIL switches = switches INFILI switches, switches INFIL2 switches 2. MERGE - merge the specified files. switches OUTFIL switches = switches INFILI switches, switches INFIL2 switches /MERG E 3. RUN - leave SORT/MERGE command level and run the specified program. /RUN (specified anywhere in the command string - program is started when the sort or merge is complete.) 4. EXIT - exit SORT/MERGE and return to monitor level. /EXIT (specified anywhere in the command string - control returns to monitor level when the sort or merge is complete.) 5. HELP - print the text of the help file. /HELP (lHELP:SWITCHES prints available SORT/MERGE and SCAN switches.) SORT/MERGE uses SCAN, the TOPS-IO command scanner to parse the command string. The effect of a switch in a command string depends on the type of switch and its place in the command string. See Chapter 3 for more details. Certain switches are not usable in FORTRAN-called sorts. These are described in Section 2.3.4. 2-4 How to Use SORT/MERGE File specifications are given in the standard form: filnam.ext Where ~filnam' is a 1- to 6-character filename, and ~ext' is a 1- to 3-character file extension. At least one input file specification and one output file specification must.be given. Multiple file specifications are separated by commas. Note that multiple output file specifications are allowed only if the output device is magnetic tape. You can continue a command string onto a second line by typing a dash. SORT/MERGE prompts the next line with ~#', and you can continue typing the command string. 2.3.1 Merging Files If you have two or more files that have been previously sorted on the same keyes) and have the same file format, the files can be merged into one file with the /MERGE switch. When merging files, you must specify the same information as for a sort, plus the /MERGE switch, for example: OUTFIL = INFIL1,INFIL2/RECORD:70/KEY:40:15:ASCENDING/MERGE If you attempt to merge files that do not have the same file formats and are not already in sorted order on the same key field(s), then you receive unpredictable results. To safeguard against this, you can specify the /CHECK switch. This switch causes SORT/MERGE to check the files and generate an error message if any out-of-sequence records are found. See Chapter 3 for more information on the /CHECK switch. 2.3.2 Using Command Files A command file is an ASCII file with SORT/MERGE commands stored in it. By specifying ~@filespec', you can cause SORT/MERGE to read a command file and execute the commands stored in it. The following illustrates a command file created with SOS. Note that SORT/MERGE accepts the file with or without line-sequence numbers . • 808 FILE.CCLOOl Input: FILE.CCL 00100 80RT1.FIL=IN1.FIL/RECORD:80/KEY:1:10OOl 00200 80RT2.FIL=IN2.FIL/RECORD:80/KEY:l:10OOl 00300 MERGE.FIL=80RT1.FILt80RT2.FIL/RECORD:80/KEY:1:10/MERGEool 00400 I E}-( I TOOl 00500 $ • [FILE.CCLJ The following command causes SORT/MERGE to execute the command file shown above: *@FILE.CCLOOl How to Use SORT/MERGE 2-5 If you do not specify a file extension, SORT/MERGE searches for a file specification of the form: filnam.CCL. 2.4 Using SORT/MERGE from a COBOL Program COBOL users can run SORT/MERGE from a COBOL program by using the COBOL SORT and MERGE statements. Because this statement is part of the COBOL syntax, it is not described here. See the COBOL manual (COBOL-68 and/or COBOL-74 Language Reference Manual) for information on the SORT or MERGE statement. 2.5 Using SORT/MERGE from a FORTRAN Program FORTRAN users can call SORT/MERGE from a FORTRAN program by using a CALL statement, for example: CALL SORT('OUTPUT.FIL = INPUT.FILIRECORD:50IKEY: 1:5') Note that the actual SORT/MERGE command string can be enclosed in single quotation marks, or passed directly as an array containing the text of the command. The following example illustrates a FORTRAN subroutine that accepts a SORT/MERGE command string typed from a time-sharing terminal, writes the string into an array, and passes the entire array to SORT/MERGE. NOTE When you pass an array to SORT/MERGE in a FORTRAN program, the array must end with a null (for example, CMDO(21) equivalence to CMD(20)). 10 1000 2000 DIMENSION CMDO(21) DIMENSION CMD(20) EQUIVALENCE(CMD,CMDO) TYPE 1000 FORMAT (' *'$) ACCEPT 2000,CMD FORMAT (20A5) CALL SORT(CMD) GO TO 10 END If your installation has built a FORTRAN VM SORT program (FSORT), then the CALL SORT statement in the above FORTRAN program executt~3 FSORT. FSORT contains the same features as the stand-alone SORT/MERGE program. 2-6 How to Use SORT/MERGE However, if your installation has not built a FORTRAN VM SORT, then the FORTRAN-called sort is somewhat smaller but does not have access to all the features of stand-alone sorts. The following are the restrictions: 1. All switches must be specified to uniqueness. This means that IRECORD must be specified at least to IREC, since this version of sort does not have the concept of a switch unique in any abbreviation. For example, if you give the following switch from SORT/MERGE command level: I IH:S you receive a display of all the switches that can be specified to SORT/MERGE. Any switch marked with an asterisk (*) is recognized even if only one letter of the switch is typed. For instance, IRECORD can be specified as IR. This version of sort does not have this facility and generates an error message if you do not type enough characters of the switch to make it unique. 2. Switches must always follow file specifications, for example, Iswitchllswitch2 TEST.OUT = Iswitch3/switch4 TEST.IN ... is illegal, while: TEST.OUT/switchllswitch2 = TEST.IN/switch3/switch4 ... is legal. There is no concept of modified switches. 3. Switches cannot be read from the SWITCH.INI file. 4. The following switches are not recognized: ./BLOCKED I • ICOMP3 (or IPACKED) • ICOMPUTATIONAL ./EBCDIC ./SIXBIT • all SCAN switches (except IDENSITY) 5. There is no continuation line feature. If a command string is excessively long, it should be passed directly to a FORTRAN sort. How to Use SORT/MERGE 2-7 There are two SORT/MERGE switches that are of special interest to FORTRAN users: 1. /ERROR: 2. /FATAL: The first switch, /ERROR:, allows you to specify an error-condition GOTO address. If SORT/MERGE encounters an error, control transfers to the specified address in the FORTRAN program that called SORT/MERGE. The second switch, /FATAL:, allows you to save a SORT/MERGE error code in a specified address. See Chapter 3 for more details on these two switches. 2-8 How to Use SORT/MERGE Chapter 3 SORT/MERGE Switches This chapter gives detailed explanations of all SORT/MERGE switches and certain SCAN switches that are useful to you. (For a quick-reference list of SORT/MERGE switches, see Appendix A, SORT/MERGE Functions and Switches.) There are six categories of switches in SORT/MERGE: 1. Required switches 2. Key data type switches 3. Recording-mode switches 4. File switches 5. Control switches 6. Tape switches Each of these switch groups vanes according to the range of its effect, which can be: 1. Global - Affects the entire process. Global switches can be placed anywhere in the command string without changing their effect. 2. Local - Affects only the preceding file specification. Local switches can also be placed in front of file specifications, but they still affect only that file specification. 3-1 3. Position dependent - Depends on its position in the command string. If placed before a file specification, a position dependent switch affects that file and all following files until an equal sign or an end-of-line character is encountered. Thus, the switch is position dependent over the file specifications that follow it. If placed after a file specification, it affects only that file specification. for example. */Switch-A OUT.FILISwitch-B = ISwitch-C FIRST.FIL/Switch-D -~EJI # ISwi tch-E SECOND. FILISwi tch-F/Swi tch-G THIRD. FILISwi tch-HfRET) Switches A and B apply to the output file (OUT.FILL Switch C applies to all input files. Switch D applies only to the first input file (FIRST.FILL Switch E applies to the second and third input files (SECOND.FIL and THIRD.FILL Switch F applies only to the second input file. Switches G and H apply to the third input file. 4. Modified position dependent - Modified position dependent switches work as follows (the IBLOCKED switch is used for example purposes): a. If IBLOCKED is not specified anywhere in the command string, then no files are blocked. b. If IBLOCKED is specified anywhere in the command string, then those files for which no explicit IBLOCKED switch is specified have a blocking factor determined by default. The default blocking factor is taken from the last position dependent IBLOCKED switch in the command string. If there is no position dependent IBLOCKED switch, then the first IBLOCKED switch in the command string is used. Thus, in the following command, OUT.FIL = IN1.FIL.IN2.FIL.IN3.FIL all files are unblocked. In this command. OUT.FIL = IN1.FIL.IN2.FIL.IN3.FILIBLOCKED:3 all files have a blocking factor of 3. In this command, OUT.FIL = IN1.FIL.IN2.FIL'BLOCKED:2!BLOCKED:3 IN3.FIL.IN4.FIL OUT.FIL, INl.FIL, IN3.FIL. and IN4.FIL have blocking factors of 3. IN2.FIL has a blocking factor of 2. NOTE Key data type switches are in a special category and can only be specified after the key switch they are intended to modify. 3-2 SORT/MERGE Switches 3.1 Required Switches Every SORT/MERGE command string must contain the following two switches: /RECORD and /KEY. Both are global and required. These switches are described below. 3.1.1 IRECORD Switch The /RECORD switch specifies the length of the record and has the following format: /RECORD:n For all file formats except standard binary (described with the /BINARY switch), n indicates the number of characters in the record. For a standard binary file, n indicates the number of words in the record. If the file contains any control words (such as SIXBIT and EBCDIC header words or FORTRAN Logical Segment Control Words) or control characters (such as ASCII carriage return/line feed), you should not include thesE: control words in the record length. If you specify a value with the /RECORD switch that is less than the actual size of the records you are sorting, the records are truncated for variable-length records. For fixed-length records, you receive an error message or undefined results. If you are sorting variable-length records, you should specify the length of the largest record in the file. 3.1.2 IKEY Switch The /KEY switch describes the characteristics of the key field, the field on which comparisons are made when the records in a file are sorted. Three characteristics of the key field are: 1. key starting position 2. key length 3. key collating order NOTE Chapter 4 contains diagrams of key fields and key specifications for all major file formats recognized by SORT/MERGE. You should read that chapter after reading this section. SORT/MERGE Switches 3-3 /KEY Switch Format - 3.1.2.1 The /KEY switch has the format: /KEY:n:m I:xl where: n is the position of the first character or word of the key. (If the key begins with the first character or word of the record, then n = 1.) m is the length of the key. x is the key collating order, either ASCENDING or DESCENDING. The key position and key length values must be specified. If you do not specify a collating order, then it defaults to ASCENDING. 3.1.2.2 Key Starting Position - The key starting position indicates where in the record the key field begins. This position is usually specified in characters. However, for COMPU and COMPI data types, there are file formats that require the key starting position to be given in words, rather than characters. The following illustrates when to use characters and when to use words: Data Type Use ALPHA NUMERIC FORMAT COMP3 COMPU Characters Characters Characters Characters Characters (mixed-mode binary) words (standard binary) Characters (mixed-mode binary) words (standard binary) COMPI If the file is a mixed-mode binary file (a binary file containing characters) and is specified to SORT/MERGE as a mixed-mode binary file (for example, /BINARY/ASCII), then the key starting position is always calculated in characters. This is true even for COMPU or COMPI keys. However, if a mixed-mode binary file is specified to SORT/MERGE as being a standard binary file (for example, /BINARY), then the key starting position for COMPU or COMPI keys is specified in words; and the fields containing characters cannot be used as key fields. See Chapter 4 for more details on mixed-mode binary files. If you are using two adjacent key fields such that some key field is preceded by a COMP3 (or PACKED) key field, then use the following formula to calculate the first character position in the second key field. (n + I + 1) +s 2 3-4 SORT/MERGE Switches where: n is the number of decimal digits in the COMP3 field. s is the starting position of the COMP3 field. When using this formula, round a fractional result to the next lower integer. The key length refers to the length of the key field. Key length is specified either in characters or decimal digits, depending on the data type: 3.1.2.3 Key Length - Data Type Use ALPHA NUMERIC FORMAT COMPU COMPI COMP3 Characters Characters Characters Decimal digits Decimal digits Decimal digits Key Collating Order You can specify either ASCENDING or DESCENDING collating order for any file that you wish to sort. If the key data type is ALPHA, then ASCENDING causes SORT/MERGE to sort the file in direct agreement with the character set used in the file (ASCII, SIXBIT, or EBCDIC). DESCENDING causes SORT/MERGE to sort the file in reverse agreement with the character set used. If the key data type is FORMAT, NUMERIC, COMPUTATIONAL, COMPl, or COMP3, then ASCENDING causes SORT/MERGE to sort the file in ascending numeric order. DESCENDING causes SORT/MERGE to sort the file in descending numeric order. 3.1.2.4 3.1.2.5 Key Data Type - Data type refers to the type of data that makes up the key field. All key data type switches modify the key switch that they follow. The data type switch can be one of the following: /ALPHANUMERIC (/ALPHA) indicates that the key field is composed of alphabetic and numenc characters. /NUMERIC indicates that the key field is composed of numeric characters. If the key field contains an algebraic sign (+' or t_', or over-punched trailing sign), and you wish to exclude the sign in the key comparisons, then specify the /UNSIGNED switch also. Otherwise, the sign status defaults to /SIGNED. This data type can be used only for data without a decimal point or with an implied decimal point. The data cannot include the character t.'. SORT/MERGE Switches 3-5 IFORMAT indicates that the key field is in one of four FORTRAN ASCII numeric formats. The IFORMAT switch has the following format: IFORMAT:nPaw.d where ~n' is a scaling factor, 'a' is a FORTRAN format type, 'w' is the width of the key field, and ~d' is the number of decimal places in the number. The ~n' can be a positive or negative number. If the 'nP' is not specified, no scaling is done. If the ~w.d' is not specified, FORTRAN free format is assumed. The ~a' can be one of the following arguments: Argument Format D E F G Double-precision scientific format Scientific format Floating-point format General format NOTE A key having a FORMAT data type always implies that the recording mode is ASCII. ICOMPUTATIONAL (/COMPU) indicates that the key field is a fixed-point binary number. If the number is 10 decimal digits or less, then the key occupies one word of storage. If the number is greater than 10 decimal digits, then the number occupies two words of storage. This data type is signed by default; so if you wish to exclude the sign from the key comparisons, you should also specify the IUNSIGNED switch. ICOMPI indicates that the key field is a floating-point binary number. If the number is 10 decimal digits or less, then the key occupies one word of storage. If the number is greater than 10 decimal digits, then the number occupies two words of storage. This data type is signed by default; so if you wish to exclude the sign from the key comparisons, you should also specify the IUNSIGNED switch. ICOMP3 (or IPACKED) indicates that the key field is an IEBCDIC packed-decimal number. This data type is signed by default; so if you wish to exclude the sign from the key comparisons, you should also specify the IUNSIGNED switch. The following two tables illustrate the various field descriptors for COBOL and FORTRAN prograllls, and give the appropriate SORT/MERGE data type for each program field descriptor: 3-6 SORT/MERGE Switches Table 3-1: Field Descriptors for COBOL COBOL PHRASE SORT/MERGE KEY DATA TYPE PIC A( ) PIC X( ) PIC 9( ) PIC S9( ) PIC 9( )COMPUTATIONAL PIC 9( ) COMP-l PIC 9( ) COMP-3 IALPHA INUMERIC/UNSIGNED INUMERIC/SIGNED ICOMP ICOMPI ICOMP3 IALPHA NOTE Data types INUMERIC, ICOMP, ICOMP1, and ICOMP3 can be further specified as ISIGNED or IUNSIGNED. COBOL COMP items can be single precision (1-10 decimal digits, occupying one word of storage) or double precision (11-18 decimal digits, occupying two words of storage). Table 3-2: Field Descriptors for FORTRAN FORTRAN FORMAT DESCRIPTOR SORT/MERGE KEY DATA TYPE A D E F G H I L 0 R IALPHA IFORMAT:Fw.d IFORMAT:Gw.d IALPHA INUMERIC IALPHA IALPHA IALPHA FORTRAN DATA TYPE SORT/MERGE KEY DATA TYPE INTEGER REAL ICOMPU ICOMPl /FORMAT:Dw.d /FORMAT:Ew.d NOTE Data types INUMERIC, ICOMPU, ICOMP1, and IFORMAT can be further specified as ISIGNED or IUNSIGNED. If the specified length of a COMPU or COMP1 key is 10 decimal digits or less, SORT/MERGE interprets the key as one word long. If the specified length is 11 decimal digits or more, SORT/MERGE interprets the key as two words long. SORT/MERGE Switches 3-7 The key sign status indicates whether or not the algebraic sign of the key field is to be used in making key comparisons. Key fields can incorporate the algebraic sign in the following ways: 3.1.2.6 Key Sign Status - Key Data Type Sign Representation NUMERIC COMPU COMPI COMP3 Characters ~ +' or ~-', or over-punched character Sign bit (bit 0) Sign bit (bit 0) 4-bit trailing sign bit Specifying /SIGNED causes SORT/MERGE to use the algebraic sign in making key comparisons. Specifying /UNSIGNED causes SORT/MERGE to ignore the algebraic sign in making key comparisons. WARNING If you specify the /SIGNED switch, then the method of sign representation used in your key field can affect the calculation of key starting position and length. Note the effect of various ·sign representations on the key field: NUMERIC data type 1. If the key field is written with a COBOL field descriptor of the form: PICTURE S99, then the sign is represented by an overpunch on the last numeric character in the field. For example, -521 would be represented by 52J. This type of sign representation does not use an extra character position to represent the sign, and the key field is not affected. 2. If the key field contains l-123' (where the entire field consists of characters), and you specify the /SIGNED switch, then the sign occupies a character position and is part of the key. As the sign character precedes the key, the key starting position begins with the sign character, not with the first numeric character in the field. Therefore, the key length must include the sign character. FORMAT data type If the key field was written in any FORTRAN scientific notation format, then the sign is represented by the character ~ +' or l_'. For example, in the following data item: -0.51E + 03, the sign (as well as the period and the letter ~E', the exponent's sign, and the exponent) occupy character positions within the key and are considered part of the key. This is true for either /SIGNED or /UNSIGNED sign status. COMPUTATIONAL and COMPI data types The sign is represented by a single bit for these data types, and the key field is not affected by sign status. 3-8 SORT/MERGE Switches COMP3 data type (or PACKED) In EBCDIC packed-decimal notation, the sign is represented by a 4-bit pattern in the last digit position of the field. The length of the sign representation is never added to the key length. The key field is not affected by the sign status. However, the sign representation can affect a key field position following the COMP3 key field. To determine the length of a COMP3 (or PACKED) data type key field in 9-bit bytes, add the length (L) of the field in digits plus two divided by two, truncating any remainder. Thus, a nine digit key field equals a key field length of five bytes. L + 2 / 2 = key length field 9 + 2 / 2 = 5 bytes 3.2 Recording Mode Switches Recording-mode switches designate the coding scheme used in the data files that you are sorting. There are four recording-mode switches in SORT/MERGE, and all are global: 1. /ASCn 2. /EBCDIC 3. /SIXBIT 4. /BINARY The first three switches (fASCn, IEBCDIC. and ISIXBIT) have collating sequences associated with them. and only one of these three switches can be specified in a command string. 3.2.1 / ASCII Switch The /ASCn switch indicates that the file is recorded in ASCn mode. This switch has the following format: /Ascn Characteristics: 1. Defaults to IV ARIABLE, though iFIXED can be specified instead. If IASCn/BINARY is specified. then the default is IFIXED. and /VARIABLE can only be given with lABell/BINARY/FORTRAN. 2. The ICOMP3 (or /PACKED) switch cannot be given with the iKEY switch when the recording-mode is ASCII. SORT/MERGE Switches 3-9 I 3.2.2 ISIXBIT Switch The ISIXBIT switch indicates that the fi Ie h n'corded in SIXBIT mode. This switch has the following format: ISIXBIT Characteristics: I 1. Defaults to IV ARIABLE, although FIXED can be specified. If ISIXBIT/BINARY is specified, FIXED is the default. and VARIABLE can only be specified with /SIXBITBINARY· FORTRAN. 2. The ICOMP3 (or IPACKED) and FORMAT data type switches cannot be specified with the ISIXBIT switch. 3.2.3 IEBCDIC Switch The IEBCDIC switch indicates that thp fi Ie is recorded in EBCDIC mode. This switch has the following format: IEBCDIC Characteristics: 1. Defaults to IFIXED, though VARIABLE can be specified. If IEBCDIC/BINARY is specified. then VARIABLE can only be specified with IEBCDIC/BINARY/FORTRAN. 2. The IFORMAT data type switch cannot be specified with the EBCDIC switch. 3.2.4 IBINARY Switch The IBINARY switch indicates that the file is recorded in binary mode. This switch has the following format: IBINARY Characteristics: I 3-10 1. Defaults to IFIXED. The ,VARIABLE switch is allowed only for IBINARY/FORTRAN. 2. If the ICOMP3 (or IPACKED) switch is specified with the !KEY switch, then the default is IBINARYiEBCDIC. and ASCII or /SIXBIT cannot be specified. 3. If the ICOMPU or ICOMPI switch is specified with the IKEY switch, then the default is IBINARY/SIXBIT. although IASCII or IEBCDIC can be specified to override this and the key size is specified in characters, not words. 4. If the IFORMAT switch is specified with the IKEY switch, then the recording mode is IBINARYiASCII. and neither ISIXBIT nor IEBCDIC can be specified. SORT/MERGE Switches 3.3 File Switches File switches are used to specify various file attributes such as word alignment, blocked files, and file type (fixed or variable). All file switches are global, except the IBLOCKED switch, which is a modified position dependent switch. 3.3.1 I AFTER Switch The IAFTER switch indicates where the output record is written in relation to the carriage-return/line-feed characters. This switch has the following format: IAFTER Characteristics: 1. The IAFTER switch specifies to place the output record after a carriage-return/line-feed. 2. This switch is designed to be compatible with COBOL-74 programs. 3. The IAFTER switch is a local switch. 4. The I AFTER switch is not required for input files. 3.3.2 IALIGN Switch The IALIGN switch indicates that each output record begins on a word boundary. This switch has the following format: IALIGN Characteristics: 1. Your file must be recorded in ASCII mode. 2. This is a global switch, but affects only the output file. 3. This switch increases the rate of data transfer, but produces a somewhat larger output file. 4. Line-sequenced ASCII files must be word aligned and are output in word-aligned format whether the IALIGN switch is specified or not. 3.3.3 IBEFORE Switch The IBEFORE switch indicates where the output record is written in relation to the carriage-return/line-feed characters. This switch has the following format: IBEFORE SORT/MERGE Switches 3-11 Characteristics: 1. The /BEFORE switch places the output record before the carriagereturn/line-feed. 2. This switch is the default to SORT/MERGE. 3. The /BEFORE switch is a local switch. 4. The /BEFORE switch is not required for input files. 3.3.4 IBLOCKED Switch The /BLOCKED switch indicates the blocking factor to be used for blocked files. This is a modified position dependent switch and has the following format: /BLOCKED:n where: n is a decimal number indicating the number of logical records per logical block. Characteristics: On tape, each physical record is separated from the next record by an inter-record-gap (lRG), which is a space containing no data. As each IRG is approximately 95 words long, a large amount of tape storage is wasted if there is an excessive number of IRGs. This occurs if the length of a physical tape record is not appreciably larger than the size of an IRG. The default size of a physical tape record is set by the monitor at 200 (octal) words. You can override the default value with the SET BLOCKSIZE monitor command (see the TOPS-10 Operating System Commands Manual). An alternative to relying on the system parameter for physical tape record size is to specify the /BLOCKED switch to SORT/MERGE. The argument to this switch specifies how many logical records are contained in a physical tape record. The optimal range of physical tape record size is about 500 to 2000 words. By specifying a blocking factor that creates a physical record size that falls within that range, you can substantially improve utilization of tape storage space by reducing the number of IRGs. This is illustrated in the following diagram: Physical Records: 1 (128 words) ,------, I 2 ,----, I I i i I I i I Rl I R2 I'RG L~~~48~~~J-;~--"RG I R71~ I'RG I R9 eEI~_E~EJ R ~ logical record (62 words) Physical Records: (256 words) 1 ~~L~~~'RG t~I_~~]RiI-~~ IIRGL~9E-~~~~~1~ii8 R = logical record (62 words) 3-12 SORT/MERGE Switches MR-S-1698-81 Note that the second file uses half as many IRGs as the first file. NOTE EBCDIC magnetic tapes must be blocked. If no blocking factor is specified for an EBCDIC magnetic tape, a blocking factor of 1 is assumed. Blocking files also causes somewhat faster access to disk. However, as the size of the physical disk record is computed on the basis of disk blocks (128 words), the blocking factor must be chosen carefully; or you can cause an excessive waste of disk storage space. Use the following formula to calculate physical record size: (n + c1) * m + c2 where: n m c1 c2 record length in words blocking factor record control words in a single record block control words in a single block Now compare the calculated value with the closest multiples of 128 (that is, 128, 256, 384, 512, and so on). If the calculated value is slightly less than or exactly equal to a multiple of 128, then the blocking factor makes efficient use of disk storage. If the calculated value does not meet the previous conditions, then you should try increasing or decreasing the blocking factor until the conditions are met. The following example demonstrates the effect that selection of blocking factors has on disk storage utilization: Record Length: 30 Blocking Factor: 5 Record Length: 30 Blocking Factor: 4 Wasted Space 1 Physical Record (1 block) ~---...-.. Disk Block Boundary (128words) 2 Physical Records (2 blocks) ~1-"-~:.L.L.~..L..4f'--Disk Block Boundary (128 words) Wasted Space Wasted Space ~~L..LJ..~"",- Disk Block Boundary (128 words) Physical Record Size: 256 words Wasted Space: 106 words per block ILL.<~~~~.... Disk Block Boundary (128 words) Physical Record Size: 128 words Wasted Space: 8 words per block MR-S-1699-81 3.3.5 IFIXEO Switch The /FIXED switch indicates that the file contains fixed-length records. This switch has the following format: /FIXED SORT/MERGE Switches 3-13 Characteristics: This switch mayor may not be in effect by default. depending on the particular recording-mode switch being used. See the description of the appropriate recording-mode switch to determine when IFIXED is in effect by default. 3.3.6 IFORTRAN Switch The IFORTRAN switch indicates that the file is a FORTRAN file written in either ASCII or binary recording mode. This switch has the following format: IFORTRAN Characteristics: 1. If you specify IFORTRANIASCIL then IALIGN is in effect by default. 2 .. If you specify IFORTRAN/BINARY, then SORT/MERGE checks for Logical Segment Control Words (LSCWs). Refer to Chapter 4 for a description of LSCWs. 3.3.7 INOCRLF Switch The INOCRLF switch (No Carriage Return/Line Feed switch) indicates that both the input and the output files are IFIXED IASCII records containing no carriage control characters. This switch has the following format: INOCRLF Characteristics: 1. The INOCRLF switch is a global switch. 2. Both the input and output files must be fixed length. 3. This switch should be specified when you sort text files that contain no carriage-return/line-feed. Such files may come from a foreign source or you may be sorting the files to go to a foreign source. 3.3.8 IRANDOM Switch The IRANDOM switch indicates that a FORTRAN random file is to be processed by SORT/MERGE. This switch has the following format: IRANDOM Characteristics: This switch has exactly the same effect as the IFIXED switch. The /RANDOM switch is provided for the convenience of FORTRAN users. 3-14 SORT/MERGE Switches 3.3.9 /SEQUENTIAL Switch The /SEQUENTIAL switch indicates that FORTRAN sequential files are to be processed by SORT/MERGE. This switch has the following format: /SEQUENTIAL Characteristics: This switch has exactly the same effect as the /VARIABLE switch. The /SEQUENTIAL switch is provided for the convenience of FORTRAN users. 3.3.10 /VARIABLE Switch The /V ARIABLE switch indicates that the input file variable-length records. This switch has the following format: contains /VARIABLE Characteristics: 1. The /VARIABLE switch mayor may not be in effect by default, depending on the particular recording mode you are using. See the description of the appropriate recording-mode switch to determine when /V ARIABLE is in effect by default. 2. For general processing, variable length records process slower than fixed length records. 3.4 Control Switches The control switches are used to control parameters such as memory size, tree size, and temporary area allocation, and to perform other functions such as checking files to be merged and specifying alternate collating sequences. All control switches are global, except for the /PHYSICAL switch, which is a position dependent switch. 3.4.1 /CHECK Switch The /CHECK switch indicates to check the order of input files during a merge. This switch has the following format: /CHECK Characteristics: 1. The /CHECK switch can be used only if the /MERGE switch has been specified. 2. This switch increases the number of comparisons and causes some increase in run time. However, it protects against erroneously merging unsorted files. SORT/MERGE Switches 3-15 3. If out-of-sequence records are found, then the following error message is generated: ?SRTMRS MERGE RECORD n NOT IN SEQUENCE FOR filename 3.4.2 /COLLATE Switch The ICOLLATE switch indicates the collating sequence to be used when sorting a file. This switch has the following format: ICOLLATE:argument Characteristics: One of the following arguments must be specified with the ICOLLATE switch: 1. ASCII I 2. EBCDIC ~3. FILE :filename 4. LITERAL:/collating sequencel 5. ADDRESS:address The first two arguments (ASCII and EBCDIC) allow you to sort data in one recording mode according to the collating sequence associated with another recording mode. For example, if you have specified IASCII/COLLATE:EBCDIC for a file, then the data is interpreted as ASCII data, but is sorted according to the EBCDIC collating sequence. Similarly, you can specify IEBCDIC/COLLATE:ASCII and sort EBCDIC data according to the ASCII collating sequence. The remaining arguments (FILE:, LITERAL:, and ADDRESS:) allow you to specify your own collating sequence, either as a file or as a literal. The ADDRESS argument is for FORTRAN users in a format of ~n construction, where ~~n" is the number of the calling argument in the calling argument list. (See the ~~addr" description of the IERROR: switch in Section 3.4.4,) It is essential the FORTRAN user supplies a new complete sequence that replaces the existing ASCII, SIXBIT, or EBCDIC sequence for purposes of sorting and collating. The individual items in your collating sequence can be specified as follows: "A","B","C","D","E" = "F","G"-"N",117 = "P",121-"S","T" = 120,125 = 126 There are three functions illustrated in the above example: 1. 3-16 Equivalence - allows you to make particular characters sort as if they were equal to other characters. SORT/MERGE Switches a. ~~E" = ~~F" indicates that ((F" is assigned the same internal value as ~~E". Thus, ~~F" has been moved from its normal position in the collat- ing sequence (whichever sequence you are using) and now has the same position as (~E". "E"s and "F"s are equivalent and are sorted accordingly. b. 117 = ~~P" indicates that '~P" is equal to the character with the octal value 117 (that is, ~(O") in the ASCII sequence. This does not affect the character whose normal internal represen ta tion is 117. c. ~~T" = 120 indicates that the character whose octal value is 120 (that is, (~P") is now equivalent to T in the new collating sequence. d. 125 = 126 indicates that the character whose octal value is 126 (that is, (~V") is equivalent to the character whose octal value is 125 (that is, (~U"L 2. Abbreviation - allows you to specify a range of characters without having to type each one individually. For example, "G"-"N" is an abbreviated form of ~(G",~(H",((I",'(J","K","L","M","N". 3. Completion - SORT/MERGE must have a complete alternate collating sequence before it can correctly sort or merge the data. (The term 'complete alternate collating sequence' means an alternate collating sequence in which every character from the recording mode in effect is specified,) If you do not specify an alternate collating sequence that is complete, then SORT/MERGE completes it by adding the missing characters (in their normal order) to the end of the partial collating sequence you specified. For example, if you specify only the following items for your collating sequence: (which is equal to ~~D"-('F") and the recording mode is ASCII, then the actual collating sequence is made up of the characters you specified, followed by the normal ASCII collating sequence (minus the characters you specified). The complete alternate collating sequence is as follows: To further illustrate the various ways an alternate collating sequence can be defined, note how the following four sequences are equivalent: 4. 101-104,105 = 107,132 SORT/MERGE Switches 3-17 NOTE All data in the collating sequence file or in the literal is ASCII data. If you wish to store your alternate collating sequence in a file, you can create the file using a text editor and save it with or without line sequence numbers. If you specify your alternate collating sequence as a literal, the sequence must be delimited by a character that does not appear in the literal itself, for example: ICOLLATE:/LITERAL:rA","B","C"-"N"1 or ICOLLATE:/LITERAL:M"A","B","C"-"N"M If you specify a complete collating sequence as a literaL then you may not have any character to use as a delimiter. unless you do one of the following: 1. Specify a range of characters, such as "A"-"Z". This frees characters B through Y for use as delimiters. 2. Specify an octal value for some character. For instance, if you specify 057 instead of "I", then you can use the slash character (/) as a delimiter. If the recording mode is SIXBIT, then you can successfully use any lowercase character as a delimiter. 3.4.3 /CORE Switch The ICORE switch indicates the size of SORT/MERGE's low segment. This switch has the following format: ICORE:nK specifies low segment in K (1024 words) ICORE:nP specifies low segment in pages (512 words) Characteristics: SORT/MERGE's default memory-allocation algorithm generally tries to use about half of the available physical memory on the system, up to your job's physical memory limit. If necessary, SORT/MERGE exceeds your job's physical limit (causing the sort to become virtual), but it never exceeds 128K. The ICORE switch allows you to override the defaulting algorithm. See Chapter 6, SORT/MERGE Performance Considerations, for more information on the use of the ICORE switch. 3-18 SORT/MERGE Switches 3.4.4 fERROR Switch The /ERROR switch indicates the absolute address that execution control should transfer to in the event that SORT/MERGE encounters a fatal error. This switch has the following format: /ERROR:addr Characteristics: The ~addr' is an octal integer specifying the absolute address that control should transfer to. This switch was designed for FORTRAN users, who can specify it in one of two ways: CALL SORT('OUTFIL = INFILIswitches/ERROR:3454673') or CALL SORT(,OUTFIL = INFILIswitches/ERROR:'2',$99) In the first example, an absolute octal address is used. In the second example, the expression 'A2' is used to indicate that the argument to the /ERROR switch is the second (A2) calling argument in the calling argument list, the statement label 99 (specified as $99). This allows you to indirectly specify a symbolic address. At compile time, the symbolic address is converted to a relocatable address. Then, at load time, the relocatable address is converted to the absolute address that SORT/MERGE requIres. The /ERROR switch is a global switch. 3.4.5 fEXIT Switch The /EXIT switch indicates that you want to stop execution and exit to TOPS-IO command level. This switch has the following format: /EXIT 3.4.6 fFATAL Switch The /FATAL switch indicates the absolute address in which to store the error code if SORT/MERGE encounters a fatal error. This switch has the following format: /FATAL:addr Characteristics: The ~addr' is an octal integer specifying the absolute address where the error code should be stored. The error code is a ASCII value of the form SRTxxx, where xxx is a 3-letter code for the error type. These codes and their associated error messages and explanations are listed in Chapter 5, Error Messages. SORT/MERGE Switches 3-19 This switch is designed for FORTRAN users who can specify it in one of two ways: CALL SORT('OUTFIL= INFILIswitches/FATAL:347231') or CALL SORT('OUTFIL= INFILIswitches/FATAL:'2',ERRCOD) In the first example, an absolute address is given. In the second example, the expression (A2' indicates that the argument to the /F ATAL switch is the second calling argument in the call string: ERRCOD. This allows you to indirectly specify a symbolic address. At compile time, the symbolic address is converted to a relocatable address. Then, at load time, the relocatable address is converted to the absolute address that SORT/MERGE requires. 3.4.7 ILEAVES Switch The /LEAVES switch indicates the size of the binary tree that SORT/MERGE is to use during the sort phase of a sort. This switch has the following format: /LEAVES:n Characteristics: 1. The argument (n' is a decimal number that indicates how many leaves (or terminal nodes) the binary tree is to have. 2. This switch does not affect the merge phase of a sort and is illegal with the MERGE command. Ordinarily, you would rely on SORT/MERGE's default tree algorithm to define the size of the tree. However, if you are concerned with improving the performance of a particular sort, then you can specify the tree size with the /LEA VES switch. See Chapter 6, SORT/MERGE Performance Considerations, for more information on using the /LEAVES switch. 3.4.8 IMAXTEMP Switch The /MAXTEMP switch indicates the maxinlum number of temporary files that can be used during a sort or merge. This switch has the following format: /MAXTEMP:n Characteristics: 3-20 1. This switch is a global switch. 2. The maximum number (n) of temporary files that you can specify is 26. This is also the default number, if you do not specify the /MAXTEMP switch. SORT/MERGE Switches 3.4.9 IMESSAGE ,Switch The IMESSAGE switch indicates how much of an error warning or informational message you want printed. This switch has the following format: IMESSAGE:argument Characteristics: The possible arguments are: 1. I NOIPREFIX - determines whether or not the message code (for example, SRTxxx) is printed. 2. INO lFIRST - determ.ines whether or not the text portion of the message is printed. The arguments can be combined by specifying them in parenthesis. For example, IMESSAGE:(NOPREFIX,FIRST) prints the text of the message while suppressing the message code. If you specify IMESSAGE:(NOPREFIX,NOFIRST), however, you still get the text portion of the message. 3.4.10 IOPTION Switch The IOPTION switch indicates the lines in SWITCH.INI that you want to reference. This switch has the following format: IOPTION:name Characteristics: 1. The ~name' argument must appear in the SWITCH.INI file In the form of: SORT:name/switchllswitch2/switch3 ... 2. By specifying this switch, you can force SORT/MERGE to read that particular line(s) in SWITCH.INI that 'name' refers to and apply any switches in the line to your sort. 3.4.11 IPHYSICAL Switch The IPHYSICAL switch indicates to suppress logical name assignments in file specifications. The result is that only physical devices are searched for the data file(s). This switch has the following Jormat: IPHYSICAL 3.4.12 IPRIORITY Switch The IPRIORITY switch indicates the disk priority for your SORT/MERGE job. This switch has the following format: IPRIORITY:n SORT/MERGE Switches 3-21 Characteristics: 1. The argument ~~n" can be a numeric value from -3 to 3. A value of + 3 is the highest priority that can be specified; -3 is the lowest priority. Higher priority jobs may process faster depending upon the queue priority. 2. The default setting for the /PRIORITY switch is O. However, the default can be changed with the DISK. monitor call. (See the TOPS-10 Monitor Calls Manual,) 3.4.13 fRUN Switch The IRUN switch indicates that you wish to run a specified program from SORT/MERGE command level. This switch has the following format: /RUN:filespec I/switch(es) I Characteristics: The ~filespec' is the name of the progranl. and '/switch(es)' can be any of the following: 1. IRUNCORE:n - Run the program with a memory allocation of nK (K = 1024 words) or nP (p = 1 page or 512 words). 2. /RUNOFFSET:n - Run the program. starting at the address + n. If this switch is omitted, the default value is O. If the argument 'n' is omitted, the argument defaults to 1. This switch is generally only useful to compilers. Once this switch is used. the argument in effect applies to all subsequent runs, unless /RUNOFFSET is specified again with a new argument. 3. ITMPFIL:nam:~string' - Store the string in TMPCOR file ~nam'. The ~nam' can be no more than three characters long. This switch is useful for passing a command string to a program. 3.4.14 fSUPPRESS Switch The ISUPPRESS switch indicates to suppress various kinds of messages, depending on which argument you specify. This switch has the following format: /SUPPRESS:argument Characteristics: The possible arguments are as follows: 3-22 1. NONE - Suppress no messages. 2. INFORMATION ning with T). SORT/MERGE Switches Suppress all information messages (those begin- 3. WARNING - Suppress all information messages and all warning messages (those beginning with (lk'). 4. FATAL - Suppress all information message, all warning messages, and all fatal error messages (those beginning with (7'). 5. ALL - Suppress all messages, except messages beginning with ($'. (This has the same effect as F AT AL. ) NOTE It is not possible to suppress those messages beginning with ($', since these are operator intervention messages (for exam- ple, to mount the next reel of a multireel tape file). 3.4.15 ITEMP Switch The /TEMP switch indicates that you wish to specify the names of the devices for temporary file storage. This switch has the following format: /TEMP Characteristics: 1. For stand-alone sorts, the number of devices is fixed at 26. 2. For COBOL and FORTRAN-called sorts, the devices you specify depends on the number of 110 channels available to SORT/MERGE. 3. One temporary file is created on each device that you specify. For example, if you specify the following temporary areas: DSKA:/TEMP,DSKC:/TEMP,DSKB:/TEMP The runs are appended to the above areas as follows: DSKA: - /RUN lIRUN 4/RUN 7/ ... RUN n DSKC: - /RUN 2/RUN 5/RUN 8/ ... RUN n + 1 DSKB: - /RUN 3/RUN 6/RUN 9/ ... RUN n + 2 4. If you do not specify this switch, then SORT/MERGE writes its temporary files (up to 26, as needed) on DSK:. 3.5 Tape Switches Tape switches are used to define attributes of the tape read/write process and to control the tape drive itself. 3.5.1 IDENSITY Switch The /DENSITY switch indicates the tape density to be used for reading or writing a magnetic tape. This switch has the following format: /DENSITY:n SORT/MERGE Switches 3-23 Characteristics: 1. The argument (n' is a decimal number indicating the density and can have one of the following values: • 200 • 556 • 800 • 1600 I • 6250 2. The IDENSITY switch is a position dependent switch. 3. The default is installation dependent and can be set with the SET DENSITY command. (See the TOPS-J 0 Operating System Commands Manual.) 3.5.2 IINDUSTRY Switch The IINDUSTRY switch indicates that a magnetic tape is to be read or written in industry-compatible mode. This switch has the following format: IINDUSTRY Characteristics: The IINDUSTRY switch is meaningful only for EBCDIC magnetic tapes. 3.5.3 ILABEL Switch The ILABEL switch indicates the tape label status to SORT/MERGE. This is a modified position dependent switch. This switch has the following format: ILABEL:argument Characteristics: The possible arguments are: 1. ANSI - If a tape label processor is present, ANSI-STANDARD labels are read or written. Otherwise, this is similar to ILABEL:NONSTANDARD. Thus, labels are skipped over on input and omitted on output. 3-24 2. DEC - Currently equivalent to ILABEL:ST ANDARD, but preferred for specification of COBOL-standard labels. 3. IBM - If a tape label processor is present, IBM-STANDARD labels are read or written. Otherwise, this is similar to ILABEL:NONSTANDARD. Thus, labels are skipped over on input and omitted on output. SORT/MERGE Switches 4. NONSTANDARD - The file has nonstandard labels. SORT/MERGE bypasses them on input and omits them on output. These labels are assumed to be the size of one physical record. 5. OMITTED - The file has no labels, and SORT/MERGE does not perform any label checks. 6. STANDARD - The file has COBOL-standard labels. SORT/MERGE reads and writes them on magnetic tape. If you do not specify the /LABEL switch, then SORT/MERGE expects: 1. Standard labels for a file on magnetic tape 2. No labels for a file on any other device NOTE Labels are ignored on disk because disk is a directory device. 3.5.4 /PARITY Switch The /PARITY switch indicates the parity to be used when reading or writing a magnetic tape. This switch has the following format: /P ARITY :argument Characteristics: 1. This switch is a position dependent switch. 2. The possible arguments are: • EVEN • ODD 3. The default is ODD parity. 3.5.5 /POSITION Switch The /POSITION switch indicates that you wish to position the magnetic tape before the file is read or written, but after rewinding (if required J. This switch has the following format: /POSITI ON :argument Characteristics: 1. The argument can be a signed positive or negative number. Positive arguments skip that number of files. Negative arguments backspace that number of files. 2. This switch is ignored for devices other than tape drives. 3. The default is to position at the first file on the tape. SORT/MERGE Switches 3-25 3.5.6 IREWIND Switch The IREWIND switch indicates to rewind the tape before the file is read or written. This switch has the following format: IREWIND Characteristics: 1. This switch is ignored for devices other than tape drives. 2. The IREWIND switch is a local switch. 3.5.7 ISTANDARD Switch The ISTANDARD switch indicates that the data is to be read and written in STANDARD-ASCII mode. This switch has the following format: ISTANDARD Characteristics: 1. This switch is a modified position dependent switch. 2. The ISTANDARD switch is meaningful only for ASCII recording mode. 3.5.8 IUNLOAD Switch The IUNLOAD switch indicates to rewind and unload the tape after the file is read or written. This switch has the following format: IUNLOAD Characteristics: 3-26 1. This switch is ignored for any devices other than tape drives. 2. For multireel files, this switch affects only the disposition of the last tape. All intermediate tapes are UNLOADed regardless of the setting of this switch. 3. The IUNLOAD switch is a local switch. 4. Once the tape is unloaded, the tape cannot be read from or written to unless the operator reloads the tape drive. SORT/MERGE Switches Chapter 4 File Formats SORT/MERGE is capable of reading and writing data in four recording modes and in a variety of file formats. The following sections describe the four recording modes and all major file formats that are recognized by SORT/MERGE. Each file format is described in detail, and the COBOL code segments and/or FORTRAN programs that generate each file format are given. In addition, each code segment or program has a detailed illustration of the records it produces, and a description of the SORT/MERGE command strings needed to sort the record on any of its fields. 4.1 Recording Modes The recording mode specifies the byte size of the data and, except for binary mode, also specifies the character set used. The four recording modes and their respective byte sizes are: RECORDING MODE BYTE SIZE ASCII SIXBIT EBCDIC Binary 7 bits 6 bits 8 bits 36 bits (1 word) The following sections describe the recording modes in more detail. 4-1 4.1.1 ASCII Recording Mode An ASCII word consists of five characters left-justified in the word. Each character is represented by a 7-bit byte: ASCII RECORDING MODE .. . BIT NU M B E R _ 01 1 2 3 41 5 1 6 7 B 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 BINAR Y 0 o 0 01 0 1. o • REPRE SENTATION- .1 • 0 A DATA 0 0 0 0 1 0 0 • 0 0 • 0 B 0 • 0 • 0 0 0 0 • • X C 2 BYTES: 5 = on bit o = off bit X = unused bit • MR-S-030-79 NOTE A variant form of ASCII, line-sequence ASCII, sets bit 35 of the line-sequence word to 1. ASCII recording mode is specified to SORT/MERGE with the /ASCII switch. 4.1.2 SIXBIT Recording Mode SIXBIT is a compressed form of ASCII in which lowercase letters and a few special characters are not used. A SIXBIT word consists of six characters per word, with each character represented by a 6-bit byte: SIXBIT RECORDING MODE BIT N U M B E R - O 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 BINAR Y REPR ESENTATION - - • 0 o 0 o • o • 000 0 0 1 A DATA .. 0 • 0 0 . 0 B 0 • 0 . 0 0 0 0 0 0 3 C 2 ·• . ·. BYTES· 6 • = on bit o = off bit MR-S-031-79 SIXBIT recording mode IS specified to SORT/MERGE with the /SIXBIT switch. 4.1.3 EBCDIC Recording Mode An EBCDIC word consists of four characters per word. Each byte is nine bits long, but the first bit in each byte is unused. Each character is represented by eight bits: EBCDIC RECORDING MODE BIT NU M B E R - O 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 BINAR Y X • REPRE SENTATION - DATA . • 0 o 0 o 0 • A X • ... 1 0 0 0 • X .• 0 0 B 0 0 • 0 X · ..• · 0 0 0 2 BYTES: 4 • = on bit o = off bit X = unused bit 4-2 File Formats MR-S-1700-81 A variant form, used only for magnetic tape, is industry-compatible EBCDIC. In this form of EBCDIC, there are four characters per word, left-justified within the word. Each character is represented by an 8-bit byte. The last four bits in the word are unused: INDUSTRY-COMPATIBLE EBCDIC RECORDING MODE BIT NU M B E R - O 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 BINAR Y REPRE SENTATION DATA --. · . • o 0 0 o • .. • . 0 0 0 • ..• 0 1 A 0 0 • 0 ... • . 0 0 x x X x 0 2 B BYTES: 4 • ~ on bit o ~ off bit MR-S-1701-81 Standard EBCDIC recording mode is specified to SORT/MERGE with the /EBCDIC switch. Industry-compatible EBCDIC recording mode is specified with the /EBCDIC/INDUSTRY switch combination. 4.1.4 BINARY Recording Mode Unlike the recording modes previously mentioned, binary mode does not specify a character set for the data. In binary mode, the entire 36-bit word is interpreted as a single byte of binary data: BINARY RECORDING MODE BIT N U M B E R - O 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 BINAR Y REPR ESENTATION DATA --. o 0 o 0 o 0 o 0 000 0 0 0 . . . • . . .... 0 0 0 0 0 0 0 0 0 0 u 0 2,739,136 BYTES: 1 • ~ on bit o ~ off bit MR-S-034- 79 Binary recording mode is specified to SORT/MERGE with the /BINARY switch. 4.2 File Formats The file format specifies the structure of the record used to store the data. The following sections describe all major file formats recognized by SORT/MERGE. Each section includes a diagram of the file format and a COBOL code segment or FORTRAN program that generates the file format. Note the following conventions that are used in the diagrams: 1. Alphanumeric or numeric character data in a word is shown with each individual character enclosed in a box. The box represents one byte. Thus, a word of ASCII data is shown as follows: MR-S-1364-81 File Formats 4-3 2. Binary data in a word (fixed- and floating-point numbers) is shown by a number in the word: MR-S-1365-81 3. EBCDIC packed-decimal values are shown as two decimal digits per EBCDIC byte. The right half of the rightmost byte contains the sign. Note that neither the digits nor the sign are EBCDIC characters. 4. COBOL signed nunleric data, such as produced by PIC S9(n), is shown with the overpunched character, if the sign is negative. For example, -12345 is shown as 1234N, with the N representing both the negative sign and the value 5. DIGITAL's COBOL does not use overpunched characters for positive sign representation, so diagrams depicting positive, signed numeric data do not show a sign. (Note that SORT/MERGE accepts positive overpunched characters.) 5. Italicized characters in a diagram do not depict data; they label or clarify parts of the diagram: I RDW301 ° MR-S-1366-81 6. Heavy vertical lines are used to delimit individual fields within a record: lA B C 1 2 3 4 A 3 1 J MR-S-1367-81 7. Padding, the use of blanks or nulls to force the next record to begin on some boundary (for example, a word or disk-block boundary), is shown by white space in the word: . MR-S-1368-8 1 Note that you cannot consider padding as part of a record field, nor can you use padding as part of a key field. However, the length of any padding must be taken into account when calculating record length and key starting position. 4-4 File Formats 4.2.1 Fixed-Length ASCII A fixed-length ASCII file consists of records containing five characters per 36-bit word, with each group of five characters left-justified within the word. Fixed-length ASCII records must end with a carnagereturn/line-feed. The following diagram illustrates the format of fixed-length ASCII records: WORD RECORD I A B C D E 2 F G G!D CD A 3 B C D E F 4 G G!D CD A B 5 C D E F G 6 ~ GO A B C D E F G ~ 8 3 I 4 CD ~ ~ CARRIAGE RETURN LINE FEED MR-S-035-79 The format is specified with the following SORT/MERGE switch combination: /ASCII/FIXED 4.2.1.1 COBOL Fixed-Length ASCII - CODE SEGMENT: ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT filename ASSIGN TO DSK RECORDING MODE IS ASCII. DATA DIVISION. FILE SECTION. FD filename 01 record-1 02 field-1 02 field-2 02 field-3 02 field-4 02 field-5 VALUE OF ID "DATA FIL". DISPLAY-7. PIC X(6) VALUE "AB12EF". PIC A(3) VALUE "GHI". PIC 9(4) VALUE 3249. PIC S9(6) VALUE -481253. PIC S9(6)V9999 VALUE + 31458.5012. Figure 4-1 illustrates the record produced by the code segment shown above: File Formats 4-5 Figure 4-1: COBOL Fixed-Length ASCII WORD I A B 1 2 E /KEY:1:6/ALPHA F G H I 3 /KEY:7:3/ALPHA 2 4 9 4 8 /KEY: 1O:4/NUMER IC/UNSI GNE D 4 1 2 5 L 0 /KEY:14:6/NUMERIC/SIGNED 5 3 1 4 5 8 6 5 0 1 2 G0 2 /KEY:20:10 /NUMERIC/SIGNED G::) MR-S-1728-81 SORT/MERGE Comlnand String: * 5 0 R TED • F I L = DAT. F I L / A5 C I I / F D: E D/ RE COR D : 29 / KEY: 1 : Gf ALP HA rRITl NOTE To sort the file on the various fields of the record, replace the shaded portion of the command string with one or more of the key specifications shown in Figure 4-1. Also, to retain the FIXED format of the file shown in the example, no ADVANCING clauses on WRITE statements can be used in the COBOL code. 4.2.1.2 FORTRAN Fixed-Length (Random) ASCII PROGRAM: DIMENSION A(2),C(2) DOUBLE PRECISION Y INTEGER J REAL X 100 An) = 'ABCDE'; A(2) = 'F12' B ='LMNO' cn) = '12345'; C(2) = '6789' D = '-1234'; 1=1 J = 1234567890 X = 123456.4321 Y = -1435789432.456 OPEN (UNIT = 1,DEVICE = 'DSK',FILE = 'TEST.DAT',MODE = 'ASCII', 1ACCESS = 'RANDOM' ,RECORDSIZE = 68) WRITE n#I,lOO)A,B,C,D,J,X,Y FORMAT( 1A5,lA3,lA4,lA5,lA4,lA5,IlO,E17.8,D15.4) CLOSE (UNIT= 1) END Figure 4-2 illustrates the record produced by the program shown above: 4-6 File Formats Figure 4-2: FORTRAN Fixed-Length (Random) ASCII WORD I 3 A B C D E /KEY:1:8/ALPHA F 1 2 L M /KEY:9:4/ALPHA N 0 1 2 3 /KEY:13:9/NUMERIC/UNSIGNED 4 5 6 7 8 1 2 3 5 9 6 4 1 2 3 4 5 6 7 8 9 L..J L..J L..J 1 2 3 4 3 E L..J L..J 8 0 0 9 10 5 6 4 11 + 0 6 12 - 0 4 3 6 0 1 0 ~ GQ L..J L..J 13 l' 14 + /KEY:22:5/NUMERIC/SIGNED /KEY:27:10 /NUMERIC/UNSIGNED /KEY:37:17 /FORMAT:E17.8 /KEY:54:15/FORMAT:D15.4 L..J ~ blank MR-S-1729-81 SORT/MERGE Command String: *SORTEO.FIL=TEST.DAT/FORTRAN/ASCII/RANDOM/RECORD:GBIKEY:1:B/ALPHAm FORTRAN users can describe this file format with either of the following SORT/MERGE switch combinations: 1. /FORTRAN/ASCII/RANDOM 2. /FORTRAN/ASCII/FIXED NOTE To sort the file on the various fields of the record, replace the shaded portion of the command string with one or more of the key specifications shown in Figure 4-2. File Formats 4-7 4.2.2 Variable-Length ASCII Variable-length ASCII consists of records containing five characters per 36-bit word, with each group of five characters left-justified within the word. Variable-length ASCII records must end with some combination of the following: 1. carriage return 2. line feed 3. vertical tab 4. form feed The following diagram illustrates the format of variable-length ASCII records: A B C D E 2 F ~ GO A B 3 C D E F G 4 H I J ~ C2Q 5 A E ~ 6 A B C F GO C2Q D E 3 4 GD GO GD = CARRIAGE RETURN GO = VERTICAL TAB C2Q = FORM FEED CD = LINE FEED MR·S·037·79 SORT/MERGE strips away all end-of-line characters and replaces them with carriage-return/line-feed on output. This format is specified with anyone of the following SORT/MERGE switch combinations: 1. /ASCII/VARIABLE 2. 4-8 /ASCIIUVARIABLE in effect by default) File Formats 4.2.2.1 COBOL Variable-Length ASCII - CODE SEGMENT: ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT filename ASSIGN TO DSK RECORDING MODE IS ASCII. DATA DIVISION. FILE SECTION. FD filename 01 record-1 02 field-l 02 field-2 02 field-3 02 field-4 VALUE OF ID "DATA FIL". DISPLAY-7. PIC X(7) VALUE "AB13521". PIC S9(7)V99 VALUE -:3269.02. PIC A(3) VALUE "ILM". PIC 9(4) VALUE 1359. 01 record-2 02 field-1 02 field-2 02 field-3 02 field-4 DISPLAY-7. PIC X(7) VALUE "EFGHI95". PIC S9(7)V99 VALUE 42553.40. PIC A(3) VALUE "LMN". PIC 9(7) VALUE 3712536. PROCEDURE DIVISION. WRITE record-1 BEFORE ADVANCING. WRITE record-2 BEFORE ADVANCING. Figure 4-3 illustrates the record produced by the code segment shown above: Figure 4-3: COBOL Variable-Length ASCII WORD A B 3 1 ~- 5 IKEY: 1 :7/ALPHA 1---------- 2 1 0 3 2 IKEY:8:7/NUMERIC/SIGNED 6 9 0 K I IKEY:15:3/ALPHA L M 1 3 5 9 ~ G:Q E F G H I 9 5 4 2 5 5 3 8 4 0 L M N 9 3 7 1 2 5 10 3 6 ~ G:Q 6 I I NOTE It IS unWise to speCify a key that extends outSide the shorter records In a variable length file, unless the data type IS ALPHA NUMERIC. For other data types, the result IS undefined and will result III a warning mes sage. For thrs reason, a key specrfrcatlon IS not given for the last field In the record MR-S-1730-81 File Formats 4-9 SORT/MERGE Command String: *S 0 RTEO. F I L =0 AT A • F I L / AS C I I / t.J AR I ABL E / RECOR 0 : LI 7 / K~V~rri'1'1?rC'pJ~Aru NOTE To sort the file on the various fields of the record, replace the shaded portion of the command string with one or more of the key specifications shown in Figure 4-3. 4.2.2.2 FORTRAN Variable-Length (Sequential) ASCII PROGRAM: DIMENSION A(2),C(2) DOUBLE PRECISION Y INTEGER J REAL X 100 200 A( 1) = 'ABCDE'; A(2) = 'F12' B ='-1234' J = 1234567890 X = 123456.4321 Y = -1435789432.456 C( 1) = '12345' OPEN (UNIT = 1,DEVICE = 'DSK' ,FILE = 'TEST1.DAT' ,MODE = 'ASCII', 1ACCESS = 'SEQOUT') WRITE (1,100)A,B,J,X,Y,C(l) FORMAT(1A5,lA3,1A5,1l0,E9.2,D12.4,1A5) A(l) = 'LMNOP'; A(2) = '22C' B ='+3500' J = 4567912343 X =4569.723 Y = + 45982341234.234 C( 1) = '54402'; C(2) = '6789' WRITE (l,200)A,B,J,X,Y,C FORMAT(1A5,1A3,1A5,1l0,E9.2,D12.4,lA5,1A4) CLOSE (UNIT = 1) END Figure 4-4 illustrates the record produced by the program shown above: 4-10 File Formats Figure 4-4: FORTRAN Variable-Length (Sequential) ASCII WORD I 4 A B C D E /KEY: 1 :8 / ALPHA F 1 2 - 1 /KEY:9:5/NUMERIC/SIGNED 2 3 4 1 2 /KEY:14:10 /NUMERIC/SIGNED 3 4 5 6 7 8 9 0 L.....I 0 1 2 E + 6 L.....I 1 4 3 6 6 0 8 0 9 0 + 1 0 1 10 2 3 4 5 G:D 11 G:Q M N 0 P 12 I L -- /KEY:24:9/FORTRAN:E9.2 /KEY:33:12/FORMAT:D12.4 NOTE 13 2 2 C + 3 It IS unwise to specify a key that extends outside the shorter records In a variable· length file, unless the data type is ALPHA· 14 5 0 0 4 5 NUMERIC. For other data types, the result 15 6 7 9 1 2 sage. For this reason, a key specification IS 16 3 4 3 L.....I 0 4 6 E 4 4 L.....I L.....I 0 4 5 9 8 IS undefmed and will result In a warnmg mes not given for the last field in the record. 17 18 0 19 20 D t· 1 1 5 21 4 4 0 2 6 22 7 8 9 G:D GQ L.....I = blank MR-S-1731-81 SORT/MERGE Command String: *SORTED.FIL=DATA.FIL/FORTRAN/ASCII/SEOUENTIAL -®m RECORD: Ll8 ZWgW;l{f8':J~l,[pH:'Am # I FORTRAN users can specify this format with anyone of the following SORT/MERG switch combinations: 1. IFORTRAN/ASCII/SEQUENTIAL 2. IFORTRAN/ASCII/VARIABLE 3. IFORTRAN/ASCIIUVARIABLE in effect by default) File Formats 4-11 NOTE To sort the file on the various fields of the record, replace the shaded portion of the command string with one or more of the key specifications shown in Figure 4-4. 4.3 Fixed-Length SIXBIT In a SIXBIT file, characters are stored six per 36-bit word, and a SIXBIT record must start and end on a word boundary. The left half of the first word in the record contains one of the following: 1. The record sequence number of COBOL magnetic tape records 2. Data specific to COBOL ISAM records (lSAM files cannot be directly sorted by SORT/MERGE.) 3. Binary zeros The right half of the first word contains the number of characters in the record. To ensure that the record ends on a word boundary, the last word in the record is padded with blanks, if necessary. When determining the size of the record for memory considerations, you must take into account the first word of the record (containing file-access information and a character count) and the possible existence of padding characters (blanks) to enable the record to end on a word boundary. The following diagram illustrates the format of fixed-length SIXBIT records. Note that the character count is the same for each record: WORD 3 A B C D G H L...I L...I 4 81 cc FAD FAD I E I F L...I L...I 8I CC 5 A B C D 6 G H L...I L...I I E 1 L...I F L...I FAD = FILE ACCESS DATA CC = CHARACTER COUNT L...I = BLANK (USED AS PADDING CHARACTER) MR-S-039-79 This format combination: is /SIXBIT/FIXED 4-12 File Formats specified by the following SORT/MERGE switch 4.3.1 COBOL Fixed-Length SIXBIT CODE SEGMENT: ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT filename ASSIGN TO DSK RECORDING MODE IS SIXBIT. DATA DIVISION. FILE SECTION. VALUE OF ID "DATA FIL". DISPLAY-6. PIC X(4) VALUE "A13B". PIC A(5) VALUE "CDEFG". PIC 9(10) COMP VALUE 9654839218. PIC X(2) VALUE "HI". PIC 9(11) COMP VALUE 34567982314. PIC 9(4) VALUE 1289. PIC 9(5) COMP-1 VALUE 123.45. PIC 9(11) COMP VALUE 12398756983. FD filename 01 record-1 02 field-1 02 field-2 02 field-3 02 field-4 02 field-5 02 field-6 02 field-7 02 field-8 Figure 4-5 illustrates the record produced by the code segment shown above: Figure 4-5: COBOL Fixed-Length SIXBIT WORD CC FAD I A 1 3 E F G B 60 I c I /KEY:5:5/ALPHA I 9654839218 3 H 4 /KEY:l:4/ALPHA D I /KEY:13:10 /COMP /KEY:19:2/ALPHA 5 - 34567982314 6 1 2 8 9 I .~ /KEY:37:4/NUMERIC/UNSIGNED /KEY:43:5/COMPl 123.45 8 /KEY:25:11 /COMP 9 I-- 12398756983 1 10 /KEY:49:11 /COMP MR-S-1732-81 SORT/MERGE Command String: * S 0 RTED. F I L =0 AT A • F I L / S I )( 5 I T / F I )( E 0 / RECOR 0 : 6 <) :l$l;g l~:t~(~~1! F!:t!:~ru NOTE To sort the file on the various fields of the record, replace the shaded portion of the command string with one or more of the key specifications shown in Figure 4-5. File Formats 4-13 4.4 Variable-Length Sixbit This format is the same as fixed-length SIXBIT, except that the character count can vary from record to record. The following diagram illustrates the format of variable-length SIXBIT records: WORD RECORD FAD 2 I A B C D E F G H L...I L...I L...I L...I 3 4 5 FAD l 8 CC CC 11 A B C D E G H I J K 6 F FAD = FILE ACCESS DATA CC = CHARACTER COUNT L...I = BLANK (USED AS PADDING CHARACTER) MR-S-041-79 This format is specified by either of the following SORT/MERGE switch combinations: 1. /SIXBIT/VARIABLE 2. 4-14 /SIXBITUV ARIABLE is in effect by default) File Formats 4.4.1 COBOL Variable-Length SIXBIT CODE SEGMENT: ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT filename ASSIGN TO DSK RECORDING MODE IS SIX BIT. DATA DIVISION. FILE SECTION. FD filename 01 record-l 02 field-l 02 field-2 02 field-3 02 field-4 02 field-5 02 field-6 02 field-7 02 field-8 VALUE OF ID "DATA FIL". DISPLAY-6. PIC 9(7) COMP-l VALUE 123.4567. PIC X(3) VALUE "A3C". PIC A(3) VALUE "DEF". PIC 9(3) VALUE -55. PIC 9(10) COMP VALUE 1234567809. PIC 9( 11) COMP VALUE 98765432108. PIC X(2) VALUE "A2·'. PIC 9(5) COMP VALUE 32571. 01 record-2 02 field-l 02 field-2 02 field-3 02 field-4 02 field-5 02 field-6 02 field-7 02 field-8 DISPLAY-6. PIC 9(7) COMP-1 VALUE 1395.678. PIC X(3) VALUE "B5L". PIC A(3) VALUE "LMN". PIC 9(3) VALUE 79. PIC 9(10) COMP VALUE 8176596821. PIC 9(11) COMP VALUE 18976532150. PIC X(2) VALUE "M5". PIC 9( 11) COMP VALUE 12357986183. PROCEDURE DIVISION. WRITE record-I. WRITE record-2. Figure 4-6 illustrates the record produced by the code segment shown above: File Formats 4-15 Figure 4-6: COBOL Variable-Length SIXBIT WORD CC FAD 48 /KEY: 1: 7 /COMPl 123.4567 3 I E I F /KEY:7:3/ALPHA A 3 C 0 5 N /KEY:l0:3/ALPHA 1234567809 /KEY:13:3/NUMERIC/SIGNED 4 D 5 /KEY:19:10 /COMP 98765432108 '--- I 6 2 A /KEY:25:11 /COMP /KEY:37:2/ALPHA 32571 8 CC FAD 54 NOTE 1395.678 2 B 5 L 3 0 7 9 4 L I M I N 8176596821 It is unwise to specify a key that extends outside the shorter records in a variablelength file, unless the data type is ALPHANUMERIC. For other data types, the result is undefined and will result in a warning message. For this reason, a key specification is not given for the last field in the record. 5 '--- 18976532150 I 12357986183 I 6 M L 8 9 5 MR-S-1733-81 SORT/MERGE Command String: *SORTEO.FIL=DATA.FIL/SIXBIT/VARIABLE/RECORD: NOTE To sort the file on the various fields of the record, replace the shaded portion of the command string with one or more of the key specifications shown in Figure 4-6. 4-16 File Formats 4.5 EBCDIC File Formats On disk and in memory, the characters in an EBCDIC file are represented by 8 bits right-justified in 9-bit bytes. On tape, the characters in an EBCDIC file are represented by 8-bit bytes, and 4 bytes occur per 36-bit word. EBCDIC records are written only by COBOL programs. 4.5.1 COBOL Fixed-Length EBCDIC Within a given file, fixed-length EBCDIC records all have the same record length, and the record need not begin or end on a word boundary. The following diagram illustrates the format of fixed-length EBCDIC records: WORD CC FAD 48 123.4567 IKEY: 1,7, COMPl I A 3 C 3 0 5 N IKEY: 10,3, ALPHA 1234567809 IKEY: 13,3, NUMERIC, SIGNED 4 D E I F 2 5 IKEY: 19, 10, COMP '- 98765432108 I 6 8 32571 CC FAD 54 1395.678 B 5 L 0 7 9 4 L ~ M 9 I M I N 8176596821 18976532150 I 12357986183 I 6 8 IKEY: 25, 11, COMP IKEY: 37,2, ALPHA 2 A 3 IKEY: 7,3, ALPHA L NOTE It is unwise to specify a key that extends outside the shorter records in a variablelength file, unless the data type is ALPHANUMERIC. For other data types, the result is undefined and will result in a warning message. For this reason, a key specification is not given for the last field in the record. 5 MR-S-043· 79 The file format is specified by the following SORT/MERGE switch combination: /EBCDIC/FIXED File Formats 4-17 CODE SEGMENT: ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT filename ASSIGN TO DSK RECORDING MODE IS F. DATA DIVISION. FILE SECTION. VALUE OF ID "DATA FIL". DISPLAY-9. PIC 9(3) VALUE 123. PIC X(5) VALUE "ABCDE". PIC A(2) VALUE "LM". PIC 9(9) COMP-3 VALUE 137958795. PIC S9(6) COMP-3 VALUE -351235. FD filename 01 record-l 02 field-l 02 field-2 02 field-3 02 field-4 02 field-5 Figure 4-7 illustrates the record produced by the code segment shown above: Figure 4-7: COBOL Fixed-Length EBCDIC l 1 2 3 A B C 0 E I 3 L M 4 :8 I 5 7 :9 1 :3 7 :9 5: + 3 /KEY:1:3/NUMERIC/UNSIGNED I /KEY:4:5/ALPHA /KEY:9:2/ALPHA /KEY: 11:9 /COMP3/UNSIGNED I I 5 5 :1 2 :3 5 :- /KEY:16:6/COMP3/SIGNED MR-S-1734-81 SORT/MERGE Command String: *SoRTEo • F I L = DATA. F I L / EBCD I C / F I ){ED / RECORD: 19/KE'{ 1 £3;'<ALPHAru NOTE To sort the file on the various fields of the record, replace the shaded portion of the command string with one or more of the key specifications shown in Figure 4-7. 4.5.2 COBOL Variable-Length EBCDIC In this file format, the record lengths can vary from record to record. Each record contains a 4-byte Record Descriptor Word (RDW) at the head of the record. The left half word of the RDW specifies a value equal to the number of bytes in the record plus 4 (to allow for the length of the RDW itself). The rightmost two bytes of the RDW must be zero. If they are nonzero, they indicate spanned records, which are unsupported. The following diagram illustrates the format of variable-length EBCDIC records: 4-18 File Formats RECORD WORD r 0 ROW 12 2 A B C D 3 E F G H ROW 16 5 A B C D 6 E F G H I J K L ROW 12 9 A B C D 10 E F G H 4 8 I r 0 0 I I I 3 ROW = RECORD DESCRIPTOR WORD MR-S-045-79 This format combination: IS specified by the following SORT/MERGE switch /EBCDIC/V ARIABLE CODE SEGMENT: ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT filename ASSIGN TO DSK RECORDING MODE IS V. DATA DIVISION. FILE SECTION. FD filename 01 record-1 02 field-1 02 field-2 02 field-3 02 field-4 02 field-5 VALUE OF ID "DATA FIL". DISPLAY-9. PIC S9(7) COMP-3 VALUE -1398569. PIC S9(8) COMP-3 VALUE 57635937. PIC 9(3) VALUE 596. PIC A(2) VALUE "AB". PIC X(5) VALUE "A13DE". 01 record-2 02 field-l 02 field-2 02 field-3 02 field-4 02 field-5 DISPLAY-9. PIC S9(7) COMP-3 VALUE 5369787. PIC S9(8) COMP-3 VALUE -53896156. PIC 9(3) VALUE 593. PIC A(2) VALUE "MN". PIC X(8) VALUE "ILH5MLXY". PROCEDURE DIVISION. WRITE record-I. WRITE record-2. Figure 4-8 illustrates the record produced by the code segment shown above: File Formats 4-19 CODE SEGMENT: ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT filename ASSIGN TO DSK RECORDING MODE IS F. DATA DIVISION. FILE SECTION. FD filename VALUE OF ID "DATA FIL" BLOCK CONTAINS 1 RECORDS. 01 record-l DISPLAY-9. 02 field-l PIC 9(3 ) VALUE "194". PIC X(5) VALUE "BDEFG". 02 field-2 PIC A(2) VALUE "MN". 02 field-3 PIC 9(5) COMP-3 VALUE 13796. 02 field-4 02 field-5 PIC S9(4) COMP-3 VALUE 1985. DISPLAY-9. PIC X(3) VALUE "762". PIC X(5) VALUE "LANBH". PIC A(2) VALUE "AB". PIC 9(5) COMP-3 VALUE 76543. PIC S9(4) COMP-3 VALUE -9764. 01 record-2 02 field-l 02 field-2 02 field-3 02 field-4 02 field-5 PROCEDURE DIVISION. WRITE record-I. WRITE record-2. Figure 4-9 illustrates the record produced by the code segment shown above: Figure 4-9: COBOL Blocked Fixed-Length EBCDIC I 1 9 D E 4 B F G , M 3 ! 4 6 + 1 3 7:9 , I 11 I 918 , I i N I , /KEY:1 :3/NUMERIC/UNSIGNED I /KEY:9:2/ALPHA ,+ 5 I /KEY: 11 :5/COMP3/UNSIGNED -------~~~ I 4 7 6 2 L A N B H A , B , I 7:6 5:4 3'+ I :9 7:6 4'I - ~ - I /KEY:4:5/ALPHA /KEY:14:4/COMP3/UNSIGNED J -~~ MR-S-1736-81 File Formats 4-21 SORT/MERGE Command String: *SORTEO.FIL=OATA.FIL/EBCOIC/FI)-(EO/BLOCKEO: 1/RECORO: 18 -rBrrJ #IKEYl 1:3/NUMER I CIS I GNEOrBrrJ NOTE To sort the file on the various fields of the record, replace the shaded portion of the command string with one or more of the key specifications shown in Figure 4-9. 4.5.4 COBOL Blocked Variable-Length EBCDIC In this file format, the record length can vary from record to record. Each record contains a 1-word Record Descriptor Word (RDW) at the head of the record. This word contains (in the left half word) a count of all bytes in the record and in the RDW itself. The right half of the RDW must be zero. The records are read and written in groups called blocks. The actual number of records in a block depends on the blocking factor specified when the file was created. Each block of a record contains a 1-word Block Descriptor Word (BDW) which contains a count (in the left half word) of the bytes in the block. The bytes of data, the bytes of the RDW for each record in the block, and the four bytes of the BDW itself are included in the block count. The following illustrates the format of blocked variable-length EBCDIC records: RECORD WORD BOW 20 0 2 ROW 10 0 3 A B C D 4 E F ROW 6 5 0 0 A B I BLOCK 2 L,...--- 201 BOW 28 0 202 ROW 6 0 3 203 A B ROW 10 4 0 A B C D E F ROW 8 A B 204 205 206 207 I 0 C 2 I 5 D BOW = BLOCK DESCRIPTOR WORD ROW = RECORD DESCRIPTOR WORD MR-S-048-79 4-22 File Formats This format IS specified with the following SORT/MERGE switch combinations: 1. /EBCDIC/V ARIABLE/BLOCKED:n 2. /EBCDIC/BLOCKED:n(!V ARIABLE is in effect by default) NOTE SORT/MERGE accepts this format from disk only. SORT/MERGE does not correctly sort blocked variable-length EBCDIC files on tape. CODE SEGMENT: ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT filename ASSIGN TO DSK RECORDING MODE IS V. DATA DIVISION. FILE SECTION. FD filename VALUE OF ID "DATA FIL" BLOCK CONTAINS 1 RECORDS. 01 record-1 DISPLAY-9. 02 field-1 PIC S9(7) COMP-3 VALUE + 9356127. 02 field-2 PIC 9(7) COMP-3 VALUE 3987156. 02 field-3 PIC X(3) VALUE "198". PIC A(2) VALUE "MN". 02 field-4 PIC S9(9) COMP-3 VALUE -569138279. 02 field-5 02 field-6 PIC X(6) VALUE "ABCDEF". 01 record-2 02 field-1 02 field-2 02 field-3 02 field-4 02 field-5 02 field-6 DISPLAY-9. PIC S9(7) COMP-3 VALUE -3295865. PIC 9(7) COMP-3 VALUE 9378518. PIC X(3) VALUE "196". PIC A(2) VALUE "AL". PIC 9(9) COMP-3 VALUE 569138279. PIC X(9) VALUE "ABCDEFGHI". PROCEDURE DIVISION. WRITE record-1. WRITE record-2. Figure 4-10 illustrates the record produced by the code segment shown above: File Fornlats 4-23 Figure 4-10: COBOL Blocked Variable-Length EBCDIC BOW 32 ROW 28 0 0 I 2 3 9:3 5:6 1 12 7 ;+ I I I I I 3:9 I 8: 7 1 1 5 i 6: + 1 1 9 8 M /KEY:l:7/COMP3/SIGNED /KEY:5:7/COMP3/SIGNED /KEY:9:3/NUMERIC/UNSIGNED , 4 N 5:6 , I 5 6 2: 7 9:- C 0 BOW 35 ROW 31 3:8 I I A B /KEY:14:9/COMP3/UNSIGNED E F */KEY:19:9/ALPHA I - - - ----- ------0 0 length file, unless the data type is ALPHA· 1 5,1 ! 8,+ NUMERIC. For other data types, the result I 9:5 8:6 ~ I , 7:, 8 5: 1 1 3 1 9 6 4 L 5:6 91 1 3:8 , 9:3 I I *NOTE It IS unwise to specify a key that extends outside the shorter records in a variable· , 3:2 , /KEY:12:2/ALPHA 9: 1 is undefined and will result in a warning message. I A I I I 5 6 2: 7 9:+ , A B I C 0 E F G H I ~-------- ~ MR-S-1737-81 SORT/MERGE Command String: *SoRTEo. F I L =DATA. F I L I EBCo I C It,JAR I ABLE I BLOCK EO: 1 I RECORD: 27 -(ill) #/KEY:l:7/COMP3/SIGNED(ill) NOTE To sort the file on the various fields of the record, replace the shaded portion of the command string with one or more of the key specifications shown in Figure 4-10. 4-24 File Formats 4.6 Binary File Formats Binary records consist of contiguous 36-bit words. Each record starts and ends on a word boundary. Binary is the only recording mode which does not have a character set associated with it, and standard binary records can only be interpreted as COMPUTATIONAL and COMP1 binary numbers. However, it is possible to associate a character set with binary records by writing mixed-mode records. These records are specified with one of the following SORT/MERGE switch combinations: 1. IBINARY/ASCII 2. IBINARY/SIXBIT 3. IBINARY/EBCDIC These formats are discussed in the following sections. Note that for each file format diagram, two sets of key specifications and command strings are given. The first set illustrates sorting the file in standard binary, and the second set illustrates sorting the file in mixed-mode binary. 4.6.1 COBOL Binary File Formats COBOL programs are capable of writing all three mixed-mode binary formats. Each format is discussed below. 4.6.1.1 COBOL ASCII Mixed-Mode Binary - CODE SEGMENT: ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT filename ASSIGN TO DSK RECORDING MODE IS BINARY. DATA DIVISION. FILE SECTION. FD filename 01 BINARY-REC 02 field--1 02 field-2 02 field-3 02 field-4 02 field-5 02 field-6 02 field-7 VALUE OF ID "DATA FIL". DISPLAY-7. PIC S9(10) COMP VALUE 12345678910. PIC S9(10) COMP-1 VALUE 1246.597892. PIC X(7) VALUE "ABCDE12". PIC 9(11) COMP VALUE 12345678954. PIC 9(3) VALUE "532". PIC 9(14) COMP VALUE 12345678954. PIC A(2) VALUE "LM". Figure 4-11 illustrates the record produced by the code segment shown above: File Formats 4-25 Figure 4-11: COBOL Standard Binary and ASCII Mixed-Mode Binary STANDARD BINARY ASCII MIXED-MODE BINARY IBINARY IBINARY/ASCII /KEY:1:1/SIGNED /KEY:2:1/SIGNED CAN'T BE SORTED AS CHARACTERS /KEY: 1: 10 /COMP/SIGNED 1234568910 /KEY:6:10 /COMP1/SIGNED 1246.597892 3 A B 4 1 2 /KEY:5: 2/UNSIGNED 6 CAN'T BE SORTED AS CHARACTERS 7 /KEY:8: 2 /UNSIGNED 8 L C I I D I E /KEY:21: 11 /COMP/UNSIGNED 12345678954 5 3 2 I l /KEY:31:3/NUMERIC/UNSIGNED /KEY:36:14/COMP/UNSIGNED - 12345678954967 9 CAN'T BE SORTED AS CHARACTERS 10 /KEY:11:7/ALPHA L M l /KEY:46:2/ALPHA MR-S-1738-81 SORT/MERGE Command Strings: Standard Binary: *SORTEO. F I L =DATA. F I LIB I NARY IRECORD: 1 O/Kt::V: Ulf.$IGNEDOOl Mixed-Mode Binary: ItSORTED.FIL=DATA.FIL/BINARY/ASCII/RECORD:47 -00 1*:; K EY 1:1 01 CDMPU I S I GNED([E] NOTE To sort the file on the various fields of the record, replace the shaded portion of the standard binary command string with one or more of the key specifications given on the left-hand side of Figure 4-11. Likewise, replace the shaded portion of the mixed-mode binary command string with one or more of the key specifications given on the right-hand side of Figure 4-11. 4-26 File Formats 4.6.1.2 COBOL SIXBIT Mixed-Mode Binary CODE SEGMENT: ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT filename ASSIGN TO DSK RECORDING MODE IS BINARY. DATA DIVISION. FILE SECTION. FD filename 01 BINARY-REC 02 field-1 02 field-2 02 field-3 02 field-4 02 field-5 02 field-6 02 field-7 VALUE OF ID "DATA FIL". DISPLAY-6. PIC S9(10) COMPVALUE 12345678910. PIC S9(10) COMP-1 VALUE 1234.592175. PIC X(7) VALUE "ABCDE12". PIC 9(11) COMP VALUE 12345678954. PIC X(3) VALUE "532". PIC 9(14) COMP VALUE 12345678954. PIC A(2) VALUE "LM". Figure 4-12 illu~trates the record produced by the code segment shown above: Figure 4-12: COBOL Standard Binary and SIXBIT Mixed-Mode Binary STANDARD BINARY SIXBIT MIXED-MODE BINARY /BINARY/SIXBIT /BINARY WORD /KEY:1 :l/SIGNED /KEY:2:1/SIGNED CAN'T BE SORTED AS CHARACTERS /KEY:1 :10 /COMP/UNSIGNED 12345678910 /KEY:7:10 /COMP1/SIGNED 1234_592175 3 A 4 2 /KEY:5: 2/UNSIGNED 6 CAN'T BE SORTED AS CHARACTERS 7 /KEY:8: 2/UNSIGNED 8 L 5 I B~.cIDIE /KEY:13:7/ALPHA /KEY:25:11 /COMP/UNSIGNED 12345678954 I 2 I 3 l /KEY:37:3/NUMERIC/UNSIGNED /KEY:43:14/COMP/UNSIGNED 12345678954967 9 CAN'T BE SORTED AS CHARACTERS 10 I 1 I L M I l /KEY:55:2/ALPHA MR-S-1739-81 SORT/MERGE Command Strings: Standard Binary: *SORTED.FIL=DATA.FIL/BINARY/RECORD: 10 -ru ~ ~ -~-E>!{J;:$ !;if:lt:lNS:;J~CiI'i.V~,~ru File Formats 4-27 Mixed-Mode Binary: * 5 0 R TED. F I L =D A T A • F I L / BIN A R Y / 5 I )( BIT / RE COR D : 56 -!RET) #iKEV:25:11/COMPUjUNSJGNED~m . NOTE To sort the file on the various fields of the record, replace the shaded portion of the standard binary command string with one or more of the key specifications given on the left-hand side of Figure 4-12. Likewise, replace the shaded portion of the mixed-mode binary command string with one or more of the key specifications given on the right-hand side of Figure 4-12. 4.6.1.3 COBOL EBCDIC Mixed-Mode Binary CODE SEGMENT: ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT filename ASSIGN TO DSK RECORDING MODE IS BINARY. DATA DIVISION. FILE SECTION. FD filename 01 BINARY-REC 02 field-1 02 field-2 02 field-3 02 field-4 02 field-5 02 field-6 02 field-7 02 field-8 02 field-9 VALUE OF ID "DATA FlL". DISPLAY-9. PIC S9(10) COMP VALUE 12345678910. COMP-1 VALUE 1246.597861. PIC X(7) VALUE "ABCDE12". PIC 9(11) COMP VALUE 12345678954. PIC 9(3) VALUE "532". PIC 9(14) COMP VALUE 12345678954967. PIC A(2) VALUE "LM". PIC S9(5) COMP-3 VALUE -72539. PIC 9(8) COMP-3 VALUE 36193586. Figure 4-13 illustrates the record produced by the code segment shown above: 4-28 File Formats Figure 4-13: COBOL Standard Binary and EBCDIC Mixed-Mode Binary STANDARD BINARY EBCDIC MIXED-MODE BINARY IBINARY IBINARY (EBCDIC WORD /KEY:1: 1/SIGNED /KEY:2:1/SIGNED CAN'T BE SORTED AS CHARACTERS IKEY:5: 2/UNSIGNED 3 A B C 4 E' 1 2 5 L CAN'T BE SORTED AS CHARACTERS D 5 3 l IKEY:25:3/NUMERIC/UNSIGNED 2 IKEY:29:14/COMP/UNSIGNED 8 12345678954967 9 10 CAN'T BE SORTED AS CHARACTERS 11 CAN'T BE SORTED AS CHARACTERS 12 IKEY:9:7/ALPHA IKEY: 17: 11 /COMP/UNSIGNED 12345678954 "- CAN'T BE SORTED AS CHARACTERS IKEY:5:10 ICOMP1/SIGNED 1246.597861 2 6 /KEY:8: 2/UNSIGNED IKEY:1 :10 /COMP/SIGNED 12345678910 I M L 17 l, l2 5:3 IKEY:37:2/ALPHA I , 9 :- : 3 6 : 1 , 5! 8 6 9 : 3 :+ I IKEY:39:5/COMP3/UNSIGNED IKEY:42:8/COMP3/SIGNED MR-S-1740-81 SORT/MERGE Command Strings: Standard Binary: *SORTED,FIL=DATA,FIL/BINARY/RECORD:12 -m # IK.EY: ~ 5 ::'41 !lfN8~;GNr;:·O.m Mixed-Mode Binary: *SORTED,FIL=DATA,FIL/BINARY/EBCDIC/RECORD:4G -m # '1~K~E Y:":17=!:1}Cqtyip(J:lUI\(STGN E pm NOTE To sort the file on the various fields of the record, replace the shaded portion of the standard binary command string with one or more of the key specifications given on the left-hand side of Figure 4-13. Likewise, replace the shaded portion of the mixed-mode binary comnland string with one or more of the key specifications given on the right-hand side of Figure 4-13. File Formats 4-29 4.6.2 FORTRAN Binary File Formats FORTRAN programs can generate two types of binary files: those with Logical Segment Control Words (where MODE = (BINARY') and those without Logical Segment Control Words (where MODE = (IMAGE'). Also, each of these file types can be written, randomly (where ACCESS = (RANDOM') or sequentially (where ACCESS = (SEQOUT'). Logical Segment Control Words (LSCWs) are used to delimit each record of a file written with MODE = (BINARY'. If the file is random, only two LSCW s occur per record: a code 1 LSCW at the beginning of the record and a code 3 LSCW at the end of the record. If the file is sequential, any record that crosses a block boundary has an additional LSCW at the beginning of the block containing the remainder of the record. This additional LSCW is a code 2 LSCW. The following diagram illustrates a sequential file containing all three types of LSCWs: BLOCK 1 C C 0 D E 0 REC 1 1 D E 3 BLOCK 2 C C 0 0 D E REC 2 1 D E C C D E D E 0 REC 2 2 3 C 0 1 0 REC 3 D E 3 LSCW's REC = RECORD MR-S-1707-8i The LSCW is a 36-bit word consisting of an octal code value (1, 2, or 3) in the first nine bits of the word and a count value in the right half word. For random files and sequential files that do not cross block boundaries, the count values are as follows: LSCW COUNT CODE 1 CODE 3 N umber of words in record + 1 Number of words in record + 2 For sequential records that cross a block boundary, the count values are as follows: LSCW COUNT CODE 1 CODE 2 N umber of words in the block Number of words in the record that cross the boundary + 1 N umber of words in the record + 3 CODE 3 block A further complication is that the four file types previously discussed can each be written in standard binary or mixed-mode binary (using the ASCII character set). Thus, there are actually eight major binary file formats written by FORTRAN programs: 4-30 1. Random Standard Binary with LSCWs 2. Random Standard Binary without LSCWs File Formats 3. Random Mixed-Mode Binary with LSCWs 4. Random Mixed-Mode Binary without LSCWs 5. Sequential Standard Binary with LSCWs 6. Sequential Standard Binary without LSCWs 7. Sequential Mixed-Mode Binary with LSCWs 8. Sequential Mixed-Mode Binary without LSCWs The values for record length, key position, and length change, depending on whether or not the file is written in standard binary or mixed-mode binary. Also, the existence of control words and the use of sequential versus random 110 requires changes in the SORT/MERGE command string used to sort the file. Thus, it is very important that you understand the characteristics of a given FORTRAN-generated binary file before you attempt to sort it. The following sections describe all of the previously mentioned file formats. Note that each file format diagram includes two sets of key specifications and command strings. The first set illustrates sorting the file in standard binary mode, and the second set illustrates sorting the file in mixed-mode binary. Also, note that, for the sake of program simplicity, the sample FORTRAN programs use literals to produce mixed-mode binary. The more common practice is to use ENCODE, DECODE, and FORMAT statements to produce mixed-mode binary. 4.6.2.1 FORTRAN Random Binary (with LSCWs) - PROGRAM: DIMENSION A( 128) DOUBLE PRECISION Y; REAL X; INTEGER J A(1)='ABCDE'; A(2)='FG' A(3)='LM135' A(4) = '-1234' A(5) = '.1256'; A(6) = '7E + 03' J = 1234567890 X = 98765.43212 Y = 500400300.200101 I =1 OPEN (UNIT= 1,DEVICE ='DSK',FILE ='DATA.FIL',MODE = 'BINARY', 1ACCESS = 'RANDOM',RECORDSIZE = 132) WRITE (1#IlA,J,X,Y CLOSE (UNIT = 1) END Figure 4-14 illustrates the record produced by the program shown above: File Formats 4--31 Figure 4-14: FORTRAN Standard and Mixed-Mode Random Binary with LSCWs STANDARD FORTRAN RANDOM BINARY MIXED-MODE FORTRAN RANDOM BINARY /FORTRAN/RANDOM/BI NARY /FO RTRAN/RANDOM/BI NARY/ASCII WORD CAN'T BE SORTED AS CHARACTERS 1 I I A B C D E 2 F G L...I L...I L...I 3 L M 1 3 5 /KEY:1 1:5/ALPHA 4 - 1 2 3 4 /KEY:1 6:5/NUMERIC/SIGNED 1 2 5 6 /KEY:2 1 :10 /FORMAT:E10.5 E + 0 3 5 I 7 6 133 1 J • CODE 1 LSCW /KEY:1 : 7/ALPHA 0 8 0 127 0 128 0 ~BL OCK BOUNDARY ..-' /KEY:129:1 129 1234567890 IKEY: 641:10/COMP /KEY:130:1 130 98765.43212 /KEY:6 46:10/COMP1 /KEY:131:2 131 - 500400300,200101 - 1 134 /KEY:6 51: 15 /COMP1 132 r 3 T .. CODE 3 LSCW L-I=BLANK MR-S-"I741-81 SORT/MERGE Command Strings: Standard Binary: *SORTEO.FIL=DATA.FIL/FDRTRAN/RANDDM/BINARY/RECDRD:132 -m #/KEY: 129: 1m Mixed-Mode Binary: *SORTED.FIL=DATA.FIL/FORTRAN/RANDOM/BINARY/ASCII/RECORD:GGO -m #/KEY:G41:10/COMPUTATIONALm 4-32 File Formats NOTE To sort the file on the various fields of the record, replace the shaded portion of the standard binary command string with one or more of the key specifications given on the left-hand side of Figure 4-14. Likewise, replace the shaded portion of the mixed-mode binary command string with one or more of the key specifications given on the right-hand side of Figure 4-14. FORTRAN users can specify the file formats illustrated in Figure 4-14 as follows: Standard FORTRAN Random Binary: 1. IFORTRAN/RANDOM/BINARY 2. IFORTRAN/FIXED/BINARY Mixed-Mode FORTRAN Random Binary: 1. IFORTRAN/RANDOM/BINARY/ASCII 2. IFORTRAN/FIXED/BINARY/ASCII 4.6.2.2 FORTRAN Random Binary (without LSCWs) PROGRAM: DIMENSION A( 128) DOUBLE PRECISION Y; REAL X: INTEGER J An) = 'ABCDE'; A( 2) = 'FG' A(3)='LM135' A(4) = '-1234' A(5)='.1256'; A(6)='7E+03' J = 1234567890 X = 98765.43212 Y = 500400300.200101 I =1 OPEN (UNIT= 1,DEVICE ='DSK',FILE = 'DATA.FIL',MODE 1ACCESS = 'RANDOM',RECORDSIZE = 132) WRITE (1#I)A,J,X,Y CLOSE (UNIT= 1) END -c- 'IMAGE', Figure 4-15 illustrates the record produced by the program shown above: File Formats 4-33 Figure 4-15: FORTRAN Standard and Mixed-Mode Random Binary STANDARD FORTRAN SEQUENTIAL BINARY MIXED·MODE FORTRAN SEQUENTIAL BINARY /FOR TRAN/SEQU ENTIA L!BINAR Y /FORTRAN/SEQUENTIALIBINAflY IASCII WORD CAN'T BE SORTED AS CHARACTERS I I A B C 0 E F G L....J L....J L....J L M 1 3 5 /KEY:11 : 5/ALPHA - 1 2 3 4 /KEY:16: 5/NUMERIC/SIGNED 1 2 5 6 /KEY:21 : 10/FORMAT:E10.5 E + 0 3 7 6 I ... 1 128 CODE 1 LSCW /KEY:1:7 /ALPHA J 0 8 0 __ .. __ 0_- - ~BL OCK BOUNDARY I 2 128 /KEY: 129: 1 I ... 6 I 0 129 1234567890 /KEY:641 :10/COMP 98765.43212 /KEY:646 :10/COMP1 _ . _ - - _..••_ - - . _ - - - /KEY: 130: 1 130 /KEY:131:2 131 CODE 2 LSCW '-- 500400300.200101 /KEY:651 :15/COMP1 - 132 3 L....J I I 135 ... CODE 3 LSCW = BLANK MR·S-1742-81 SORT/MERGE Command Strings: Standard Binary: *SORTED.FIL=DATA.FIL/RANDOM/BINARY/RECORD:132 -®ill #JKEY: 129: 1m Mixed-Mode Binary: *SORTED.FIL=DATA.FIL/RANDOM/BINARY/ASCII/RECORD:GGO -m #JKEY:G41: 10/COMPUTATIONAL(RET) 4-34 File Formats NOTE To sort the file on the various fields of the record, replace the shaded portion of the standard binary command string with one or more of the key specifications given on the left-hand side of Figure 4-15. Likewise, replace the shaded portion of the mixed-mode binary command string with one or more of the key specifications given on the right-hand side of Figure 4-15. FORTRAN users can specify the file formats illustrated in Figure 4-15 as follows: Standard Random Binary: 1. IRANDOM/BINARY 2. IFIXED/BINARY 3. IBINARY(!FIXED in effect by default) Mixed-Mode Random Binary: 1. IRANDOM/BINARY/ASCII 2. IFIXED/BINARY/ASCII 4.6.2.3 FORTRAN Sequential Binary (with lSCWs) PROGRAM: DIMENSION A(l28) DOUBLE PRECISION Y; REAL X; INTEGER J A(l)='ABCDE'; A(2)='FG' A(3) = 'LMI35' A(4) = '-1234' . A(5)='.1256'; A(6)='7E+03' J = 1234567890 X = 98765.43212 Y = 500400300.200101 OPEN (UNIT = I,DEVICE = 'DSK' ,FILE = 'DATA.FIL' ,MODE = 'BINARY', lACCESS = 'SEQOUT') WRITE (l)A,J,X,Y CLOSE (UNIT = 1) END Figure 4-16 illustrates the record produced by the program shown above: File Formats 4-35 Figure 4-16: FORTRAN Standard/Mixed-Mode Sequential Binary with LSCWs STANDARD RANDOM BINARY MIXED-MODE RANDOM BINARY IRANDOM/BINARY IRANDOM/BINARY/ASCII WORD A CAN'T BE SORTED AS CHARACTERS L B C D G L-.I L-.I /KEY:1:7/ALPHA L-.I /KEY:11 :5/ALPHA M /KEY:16:5/NUMERIC/UNSIGNED 3 /KEY:21 :10/FORMAT: E10,5 r----~~_~___~___~_3__~1 128 0 ________ BLOCK BOUNDARY ~- /KEY:129:1 1234567890 /KEY:641 : 10/COMP 98765.43212 /KEY:646:10/COMP1 500400300.200101 /KEY:651: 15/COMP1 129 -. /KEY:130:1 130 -_ ..... /KEY:131 :2 131 -132 -.-~-"- [1.......,1= l B LAN K MR-S-1744-81 SORT/MERGE Command Strings: Standard Binary: *SORTED.FIL=DATA.FIL/FORTRAN/SEOUENTIAL/BINARY/RECORD:132-ru #/KEY: 128: 1ru Mixed-Mode Binary: *SORTED.FIL=DATA.FIL/FORTRAN/SEOUENTIAL/BINARY/RECORD:GGO -ru #/KEY:G41:10/COMPUTATIONAL(REJ) NOTE To sort the file on the various fields of the record, replace the shaded portion of the standard binary command string with one or more of the key specifications given on the left-hand side of Figure 4-16. Likewise, replace the shaded portion of the mixed-mode binary command string with one or more of the key specifications given on the right-hand side of Figure 4-16. 4-36 File Formats FORTRAN users can specify the file formats illustrated in Figure 4-16 as follows: Standard FORTRAN Sequential Binary: 1. IFORTRAN/SEQUENTIAL/BINARY 2. IFORTRAN/V ARIABLE/BINARY Mixed-Mode FORTRAN Sequential Binary: 1. IFORTRAN/SEQUENTIAL/BINARY/ASCII 2. IFORTRAN/VARIABLE/BINARY/ASCII There are no control words or end-of-record control characters in this format. Therefore, if the records are of variable length, it is impossible for SORT/MERGE to extract a record length for each record. Thus, you cannot correctly sort this file format unless you observe the following restrictions: 4.6.2.4 FORTRAN Sequential Binary (without LSCWs) - 1. You must ensure that all records are actually of fixed length. 2. You must specify IRANDOM (or IFIXED), even though the MODE = ~SEQOUT' statement is used in the FORTRAN program. PROGRAM: DIMENSION A(128) DOUBLE PRECISION Y; REAL X; INTEGER J A(1)='ABCDE'; A(2)='FG' A(3) = 'LMI35' A(4) = '-1234' A(5)='.1256'; A(6)='7E+03' J = 1234567890 X = 98765.43212 Y = 500400300.200101 OPEN (UNIT = I,DEVICE = 'DSK',FILE = 'DATA.FIL',MODE = 'IMAGE', lACCESS = 'SEQOUT') WRITE (1 )A,J ,X, Y CLOSE (UNIT = I,DEVICE = 'DSK',FILE = 'DATA.FIL') END Figure 4-17 illustrates the record produced by the program shown above: File Formats 4-37 FORTRAN users can specify the file formats illustrated in Figure 4-17 as follows: Standard Sequential Binary: 1. IRANDOM/BINARY 2. IFIXED/BINARY 3. IBINARY(!FIXED in effect by default) Mixed-Mode Sequential Binary: 1. IRANDOM/BINARY/ASCII 2. IFIXED/BINARY/ASCII 3. IBINARY/ASCIIUFIXED in effect by default) File Formats 4-39 Chapter 5 SORT/MERGE Error Messages 5.1 Message Format SORT/MERGE messages have the following format: 1. ?SRTxxx text 2. %SRTxxx text 3. [SRTxxx text 4. $SRTxxx text where: ? % [ $ SRT xxx text = fatal error - program must be restarted = warning message - program continues = informational message - program continues = operator intervention message - program continues when operator has replied = SORT/MERGE mnemonic = 3-letter code for the message = explanation of the message The following section contains the messages that SORT/MERGE generates. The messages are in alphabetic order by the error code. 5-1 5.2 Error Messages ?SRT2Nl TOPS-20 version of SORT/MERGE will not run on TOPS-IO. This version of SORT/MERGE was compiled for a TOPS-20 system. It does not run on a TOPS-IO system. %SRTALN ANSI label not written. No system tape label processor is present and, therefore, ANSI labels have been skipped over, but not checked. %SRTANL ANSI label not checked. No system tape label processor is present and, therefore, no ANSI labels have been checked. ?SRTARL ASCII record length incorrect. One of the following occurred: %SRTATD 1. You supplied an incorrect record length by including end-of-line characters or by not including sequence numbers in the record length count. 2. The record is not ASCII. Attempt to use temporary device failed-ignoring it. SORT/MERGE was unable to write a temporary file on the device you specified by means of the /TEMP switch. SORT/MERGE ignores this device. ?SRTATF At least two input files required for MERGE. You specified the /MERGE switch, but only specified one input file. A merge is performed on two or more input files. ?SRTBNV BINARY mode does not support variable length records. Variable-length records are not allowed in binary files, except for FORTRAN binary. ?SRTCFE Collating sequence input file error. SORT/MERGE encountered an error while trying to read your collating sequence file. Try rerunning the sort. ?SRTCFS Collating sequence file specification in error. You gave an incorrect file specification for the /COLLATE file. Verify that your specification is correct. 5-2 SORT/MERGE Error Messages %SRTCLC Cannot lower core after SORT. In a COBOL sort, someone expanded memory during a sort or merge. SORT/MERGE cannot, in this case, free the memory it was using, but otherwise continues normally. ?SRTCLS Collating sequence literal specification in error. Your /COLLATE:/LITERAL: switch argument is incorrect. Check for errors and respecify the command string. ?SRTCND Collating sequence not defined. In a FORTRAN-called sort, you specified an argument with the /COLLATE switch that SORT does not recognize. ?SRTCSD Cannot set density to ~nnn'. • The specified device cannot be set to density ~nnn'. ?SRTCSM Cannot set hardware data mode on ~~device". The specified ~~device" cannot be set to industrial compatible mode. ?SRTCTL Command string too long. The command string to (5 * 128 **-2) characters. ?SRTCWB FSORT IS longer than CaMP key must be on word boundary. You specified a key starting position that did not begin on a word boundary. All CaMP and COMP1 keys must begin on a word boundary. ?SRTDDV Double device illegal. In a FORTRAN-called sort, you specified more than one device name for the same file specification. ?SRTDFK Data mode switches must follow a /KEY switch. In a FORTRAN-called sort, the data type switch must follow the key switch. ?SRTDND Device ~dev' is not a disk. All scratch devices must be disks. You specified a nondisk temporary device. This is illegal. ?SRTDNE Device ~dev' does not exist. You specified a nonexistent device. SORT/MERGE Error Messages 5-3 • ?SRTELN EBCDIC tape labels not supported. No system tape label processor is present, and therefore SORT/MERGE cannot process EBCDIC labels. ?SRTFCE Fortran command error. This is an internal FSORT error. Please contact your software specialist or send an SPR. ?SRTFCN Attempt to free an 110 channel not retained or released. This is an internal SORT/MERGE error and is not expected to occur. Please contact your software specialist or send an SPR. %SRTFCR CORE MANAGEMENT ERROR AT RELSPC. This is an internal SORT/MERGE error and is not expected to occur. Please contact your software specialist or send an SPR. ?SRTFCW FORTRAN binary control word incorrect. You specified /FORTRAN/BINARY and SORT/MERGE checked for Logical Segment Control Words (LSCWs). However, SORT/MERGE could not find any or all valid LSCWs. Check that you have specified a file that actually contains LSCWs and that you have properly specified /RANDOM or /SEQUENTIAL. I ?SRTFEA Formal argument count exceeds actual argument count. The argument referenced by ~n exceeds the argument supplied by the user. ?SRTFMI Output switch illegal in input file. You specified an output-only switch such as /ESTIMATE (SCAN switch), on the input side of the command string. ?SRTFMO File switches illegal in output file. You specified an input-only switch such as /TEMP, on the output side of the command string. ?SRTFMR Attempt to free more memory than was originally retained. This is an internal SORT/MERGE error and is not expected to occur. Contact your software specialist or send an SPR. 5-4 SORT/MERGE Error Messages ?SRTFNT Filename may not be specified with /TEMP device. You have specified a file name with a temporary device, such as DSK:FOO.BAR/TEMP. The /TEMP switch can only be specified with a device name. ?SRTFSA /FORMAT switch argument error. Verify that the argument you specified with the /FORMAT switch is a valid format descriptor accepted by SORT/MERGE. ?SRTFSM /FORMAT switch must be preceded by /KEY switch. You can only specify the /FORMAT switch after the /KEY switch it is intended to modify. ?SRTFUF FILOP. function failed for file. This error message is followed by the ?SRTLRE LOOKUP/ENTER error message (see Table 5-1). %SRTIBL IBM label not checked. I No system tape label processor is present and, therefore, no IBM labels were checked. ?SRTICS Illegal user supplied collating sequence. SORT/MERGE discovered illegal characters in your collating sequence. Check the sequence for errors. ?SRTIDS Illegal/DENSITY: value specified. You specified an illegal value with the /DENSITY switch. ?SRTIEC Input error from indirect command file. SORT/MERGE received an error while trying to read the indirect command file passed to it by a FORTRAN program. ?SRTIIF Illegal indirect filespec. The indirect command file specification Check it for errors. ?SRTILC IS incorrect. Illegal character x in numeric field. A nonnumeric character 'x' has been found in a field described as numeric. %SRTILN IBM label not written. No system tape label processor is present and therefore, IBM labels were skipped over on input and are not written on output. SORT/MERGE Error Messages 5-5 I ?SRTINA KI-IO version of SORT will not run on KA-IO. This version of SORT/MERGE was compiled for a KI-IO. You cannot use it on a KA-IO. ?SRTINS Input file not specified. You neglected to specify an input file. ?SRTIRE Input read error, status 'xxxxxx'. SORT/MERGE got error code 'xxxxxx' from the monitor GETSTS UUO while trying to read a file. See the TOPS-10 Monitor Calls Manual for the meaning of this code. ?SRTJAL Junk in ASCII line. In a fixed-length ASCII file, the characters after the record were not CR, LF, FF, or VT. You may have specified /FIXED for a variable-length file, or you may have specified the wrong record size. ?SRTKAI Key argument incorrect. You specified an argument other than ASCENDING or DESCENDING with the /KEY switch. ?SRTKCB Key comparison code too big. The 2000 words allocated for key extraction and/or key comparison code has been exceeded. Rebuild SORT with a larger FTZXSZ internal parameter. ?SRTKEB Key extraction code too big. Same as error message ?SRTKCB. ?SRTKLR Key length required. You must specify both key length and key starting position with the /KEY switch. ?SRTKNR I Key not fully contained in record. You have given a key starting position and length to a variable length file such that a record does not fully contain the key. ?SRTKOR Key outside of record. You specified a key that extends outside the record (that is, extends past the value set with the /RECORD switch). If the data type is ALPHA and your file is variable-length, the key you specified can extend past the smaller records, but in no case can a key extend past the /RECORD value. 5-6 SORT/MERGE Error Messages ?SRTLNC LABEL not correct for (filespec'. The label on the tape does not correspond to the file specification given. Verify that you mounted the correct tape. ?SRTLNI KL-10 version of SORT/MERGE will not run on KI-10 or KA-10. This version of SORT/MERGE was compiled for a KL-10. You cannot run it on a KI-10 or a KA-10. ?SRTLRE ENTER error (n' (filespec' LOOKUP RENAME DELETE An ENTER, LOOKUP, RENAME, or DELETE error occurred for file (filespec'. The error code (n' can be found in Table 5-1, Error Codes, located at the end of this chapter. $SRTLRI Load reel (n' of output file (filespec' type CONTINUE when ready. SORT/MERGE is ready to read the records from the next reel of a multireel input file. After the tape is properly mounted, type CONTINUE, and SORT/MERGE resumes reading the file. $SRTLRO Load reel (n' of output file (filespec' type CONTINUE when ready. SORT/MERGE requires an additional magnetic tape to continue writing the output file. When the new tape is properly mounted, type CONTINUE, and SORT/MERGE resumes writing the file. ?SRTMCS Multiple collating sequences not allowed. You can only specify one collating sequence. ?SRTMGF Monitor GETTAB failed nnnnnn. This is an internal software error and is not expected to occur. Contact your software specialist or send an SPR. ?SRTMOI Multiple output specs are illegal. You can specify more than one output file specification only if you are doing output to a magnetic tape. ?SRTMOM Multiple output specs only on magtapes. You can specify more than one output file specification only if you are doing output to a magnetic tape. SORT/MERGE Error Messages 5-7 %SRTMRS MERGE record (n' not in sequence for (filespec'. SORT/MERGE has detected an out-of-sequence record in an input file during execution of the /MERGE switch when /CHECK was specified. ?SRTMSC Mode switch conflict. You may have specified two contradictory recording mode switches, such as /ASCII/EBCDIC. You can only pair recording mode switches for mixed-mode binary /BINARY/ASCII, /BINARY/SIXBIT, or /BINARY/EBCDIC. Or, you may have specified a data type that conflicts with the recording mode switch, such as using /COMP3 (or /PACKED) with /ASCII. I ?SRTMSD Multireel tape files with other than STANDARD or DEC labels not supported. SORT/MERGE has filled up your output tape and needs another, but only tapes with STANDARD or DEC labels can be multi reel. Use a larger tape, or a tape with one of these label types. I ?SRTMTE Max Temp Files must be in the range 3 to 26. The /MAXTEMP switch must have a value between 3 and 26. ?SRTMUF Monitor UUO failed xxxxxx. This is an internal SORT/MERGE error and is not expected to occur. Contact your software specialist or send an SPR. %SRTNCS Not enough core specified. The amount of memory that you specified with the /CORE switch was insufficient. SORT/MERGE uses the mInImum amount of memory for the sort or merge. ?SRTNDV I Null device illegal. The null device is illegal in a /COLLATE: switch. ?SRTNEC Not enough core. SORT/MERGE did not have enough memory to perform the sort. Try specifying more memory with the /CORE switch. Also, you may need to have your core limits increased by the system administrator. ~8 SORT/MERGE Error Messages ?SRTNEH Not enough 110 channels for SORT/MERGE. SORT/MERGE cannot get enough 110 channels from the OTS. Check your FORTRAN or COBOL program and close some files before calling SORT/MERGE. ?SRTNFS No filename specified for labeled tape ~filespec'. If you specify the /LABEL switch for a magnetic tape, then you must include a file specification which agrees with the file sI?ecification on the tape label. %SRTNLN Non-standard label not written. When you specify /LABEL:NONSTANDARD, SORT/MERGE skips over nonstandard labels on input and does not write them on output. %SRTNLS Not enough leaves specified. You specified a value with the /LEAVES switch that was too small. SORT/MERGE uses the minimum tree size of 16 leaves. ?SRTNRL Name required with labeled magtape. If you specify the /LABEL switch for a magnetic tape, then you must include a file specification which agrees with the file specification on the tape label. %SRTNSL N on-standard label not checked. SORT/MERGE does not support nonstandard tape labels. ?SRTNSW No temporary device is writeable. None of the temporary devices you specified is available. ?SRTOFF OPEN failed for (filespec'. SORT/MERGE could not open the specified file. Verify that the file you specified actually exists. ?SRTOKR At least one key is required. You neglected to specify at least one key in your command string. ?SRTONS Output file not specified. You neglected to specify an output file. ?SRTOOF Only one /FORMAT switch per /KEY switch. You specified more than one /FORMAT switch with the same /KEY switch. This is illegal. SORT/MERGE Error Messages 5-9 I ?SRTOPF OPEN or LOOKUP failure for indirect command file. Verify that the command file you specified actually exists. ?SRTOWE Output write error, status xxxxxx. SORT/MERGE got error code 'xxxxxx' from the monitor GETSTS UUO while trying to read a file. See the TOPS-10 Monitor Calls Manual for the meaning of this code. ?SRTPRI Priority must be in range -3 to + 3. The argument of the /PRIORITY: switch must be in the range -3 to + 3. ?SRTRIE Record incomplete at E-O-F. An end-of-file was encountered in the middle of a record. The input file is probably damaged or in the wrong format. ?SRTRLO RELEASE called out of sequence. SORT not active. A COBOL program executed a RELEASE verb when a sort or merge was not in progress. %SRTRNI Record number inconsistent, ~n' read, ~m' written. This is an internal SORT/MERGE error and is not expected to occur. Contact your software specialist or send an SPR. ?SRTROS Reel no. ~n' out of sequence for ~filespec'. The operator mounted the wrong reel of a multireel file. ?SRTRSR Record size required. You neglected to specify the record size. %SRTRTI Record truncation on input. One or more variable-length records were longer than the record size specified with the /RECORD switch. The extra data is lost. ?SRTRTO RETURN called out of sequence. SORT not active. A COBOL program executed a RETURN verb when a sort or merge was not in progress. ?SRTSAT Standard ASCII requires TU70 drive. To read/write standard ASCII mode on tape, SORT/MERGE requires a TU70 tape drive. Other tape drives do not have the hardware capability for standard ASCII mode. 5--10 SORT/MERGE Error Messages ?SRTSFD SFD depth greater than 5. I The SFD nesting is greater than that allowed. ?SRTSFF Switches must follow filespecs. In a FORTRAN-called sort, switches must follow the file specification. They cannot precede them. ?SRTSRM SORT/MERGE will not run on this machine. • This version of SORT/MERGE was compiled for a machine other than the one you are using. ?SRTSRS Spanned records not supported. The Record Descriptor Words (RDWs) in your variable-length EBCDIC file are nonzero. This indicates spanned variable-length EBCDIC records, a file format that SORT/MERGE does not support. ?SRTSSE Swi tch scanning error. This is an internal SORT/MERGE error and is not expected to occur. Contact your software specialist or send an SPR. ?SRTSVR Switch value required. You neglected to specify an argument for a switch that requires one. ?SRTSWP Temporary structure ~dev' is write-locked. You specified a write-locked device with the /TEMP switch, and SORT/MERGE could not use it. ?SRTTMD Too many digits in key. You specified a CaMP or COMPl key with more digits than would fit in two words (for double precision) of storage. %SRTTMT Too many temporary structures specified. You have specified more temporary devices than SORT/MERGE is able to use. The extra areas are ignored. ?SRTUDL Unknown delimiter. An illegal character was found in the command string. ?SRTUKS Unknown switch ~/switch'. You specified a switch that SORT/MERGE does not recognize. SORT/MERGE Error Messages 5-11 • • ?SRTUSV Unknown switch value. You specified a switch value SORT/MERGE does not recognize. or argument that Expanding to nK I rSRTXPN For stand-alone sorts, this indicates how much memory is being used for the sort. For COBOL or FORTRAN-called sorts, this is an internal SORT/MERGE debugging message which only occurs if the feature test switch FTDEBUG is nonzero. 5.3 Error Codes The error codes in Table 5-1 are returned in the AC on RUN and GETSEG monitor calls, in the right half of location E + 1 on 4-word argument blocks of LOOKUP, ENTER, and RENAME monitor calls, and in the right half of location E + 3 on extended LOOKUP, ENTER, and RENAME monitor calls. &-12 Table &-1: Error Codes Symbol Code Explanation ERFNFlk o File not found, illegal filename (0,*) file names do not match (UPDATE), or RENAME after a LOOKUP failed. On a FILOP., this error is given if the specified device cannot perform I/O in the direction indicated. 1 UFD does not exist on specified file structures. (Incorrect project-programmer number.) ERPRT7c 2 Protection failure or directory full on DTA. ERFBM'If 3 File being modified (ENTER. RENAME l. ERAEFlk 4 Already existing filename (RENAME or FILOP.), different filename (ENTER after LOOKUP) or supersede (on a nonsuperseding ENTER). Two LOOKUPs or two ENTERs were performed. ERISU7c 5 Illegal sequence of monitor calls (RENAME with neither LOOKUP nor ENTER. or LOOKUP after ENTERl. ERTRNlk 6 One of the following: ' 1. Transmission. device. or data error (RUN, GETSEG only). 2. Hardware-detected device or data error detected while reading the UFD RIB or UFD data block. 3. Software-detected data inconsistency error detected while reading the UFD RIB or file RIB. ERNSFo/c 7 Not a saved file (RUN, GETSEG only). ERNEClk 10 Not enough core (RUN, GETSEG only). SORT/MERGE Error Messages Table 5-1 (Cont.): Error Codes Symbol Code Explanation ERDNA% 11 Device not available (RUN, GETSEG only), ERNSD% 12 No such device (RUN, GETSEG only), ERILU% 13 Illegal monitor call (GETSEG only). No 2-register relocation capability. ERNRM% 14 No room on this file structure or quota exceeded (overdrawn quota not considered). ERWLK% 15 Write-lock error. Cannot write on file structure. ERNET% 16 Not enough table space in free core of monitor. ERPOA% 17 Partial allocation only. ERBNF% 20 Block not free on allocated position. ERCSD% 21 Cannot supersede an existing directory (ENTER). ERDNE% 22 Cannot delete a nonempty directory (RENAME). ERSNF% 23 Subdirectory not found (some SFD in the specified path was not found). ERSLE% 24 Search list empty (LOOKUP or ENTER was performed on generic device DSK and the search list is empty). ERLVL% 25 Cannot create an SFD nested deeper than the maximum allowed level of nesting. ERNCE% 26 No file structure in the job's search list has both the no-create bit and the write-lock bit equal to zero, and has the UFD or SFD specified by the default or explicit path (ENTER on generic device DSK: only). ERSNS% 27 GETSEG from a locked low segment to a high segment which is not a dormant, active, or idle segment. (Segment not on the swapping space.) ERFCU% 30 The file cannot be updated. ERLOH% 31 The low segment overlaps the high segment (GETSEG). ERNLI% 32 The user is not logged in (RUN). ERENQ% 33 The file still has outstanding locks set. ERBED% 34 The file has a bad .EXE file directory (GETSEG, RUN). ERBEE% 35 The file has a bad extension for an .EXE file (GETSEG, RUN). ERDTB% 36 The file's .EXE directory is too big (GETSEG, RUN). ERENC% 37 Network capacity has been exceeded, not enough space for connect message (LOOKUP/ENTER). ERTNA% 40 Task not available (LOOKUP/ENTER/RENAME). ERUNN% 41 Unknown network node; node went down during connect (ENTER). SORT/MERGE Error Messages 5-13 Chapter 6 SORT/MERGE Performance Considerations This chapter gives a general description of the SORT/MERGE binary tree and describes how the operation of SORT/MERGE is affected by tree size, buffer size, and number of merge passes. This is not a complete description of SORT/MERGE internals. This chapter simply gives you enough information to modify SORT/MERGE's performance by use of the /LEAVES and /CORE switches. 6.1 Performance Overview SORT/MERGE consists of two major sets of routines, I/O routines and sorting routines. The I/O routines strip off header words, control words, and control characters on input and restore them on output. This is necessary as only pure data can be passed to the sorting routines. There is nothing that you can do to improve the performance of the I/O routines. However, if the file format is not correctly specified, the data is not correctly extracted from the file; header words, control words, or control characters are erroneously passed to the sorting routines. Thus, the results are unpredictable. The sorting modules perform two functions: sorting and merging data. These two functions are described more fully in the following sections. Since you cannot actively modify the operation of the merge phase, most of the discussion is concerned with the sort phase. You can, however, optimize the number of merge passes that occur. That technique is described in this chapter. 6-1 SORT/MERGE uses a variable-size binary tree to sort and merge input files. Figure 6-1 illustrates a simple binary tree: Figure 6-1: Binary Tree 2 3 4 5 6 7 8 MR-S-1720-81 The tree size is measured by the number of its leaves and corresponds to the number of records the tree holds. For example, the tree shown above has eight leaves, and thus eight records. NOTE Although SORT/MERGE's minimum tree size is 16 leaves, this chapter uses fewer leaves in the examples for readabili ty. If you do not specify the size of the tree (with the /LEAVES switch), then SORT/MERGE picks the largest tree greater than 16 leaves that fits in your available memory space. 6.1.1 The Sort Phase The following sections should be read in conjunction with Figure 6-2. This figure illustrates how a binary tree is used to sort and merge data. To keep the figure as simple as possible, the following conditions and conventions have been used: 1. The sorting tree is limited to four leaves (versus a minimum of 16 leaves for SORT/MERGE). 2. Letters are used to represent records (not characters) of arbitrary size. The key field is assumed to be as long as the record. 3. For the purposes of this chapter, ~~smallest" refers to an ordering that fully takes into account multiple keys with possibly differing ASCENDING or DESCENDING key arguments. 4. The leaves (terminal nodes) of the tree are numbered, and these numbers represent the ~~address" of the leaves. 5. 6-2 The upper, or nonterminal, nodes contain pointers to the LOSING key of any two keys that are compared. An additional ~node', shown outside the tree, points to the WINNING key in the tree. For example, if the SORT/MERGE Performance Considerations j records are being sorted in ascending order, then the object is to find the smallest key in the tree at that time. The nonterminal nodes point to the larger of any two keys compared, while the external (node' points to the smallest key in the tree. 6. The sort shown in the figure is limited to a maximum of two temporary files (rather than the maximum of 26 temporary files for SORT/MERGE). The sorting process works as follows: SORT/MERGE fills the tree to its capacity with records from the input file. (Multiple input files are treated as one file.) All records in the tree are compared. Then the smallest record is ejected from the tree and written to a temporary file. The ejected record's position in the tree is then filled with the next input record, and the process is repeated. In the special case where the number of records initially in the tree is less than or equal to the capacity of the tree, ejected records are written directly to the output file. SORT/MERGE continues reading records until one is read that is less than the record just output. This record and all subsequent ones less than the record currently being ejected from the tree are marked to be sent to a new run. When one of the records marked for the new run reaches the top of the tree, the collection of records currently in the temporary file constitutes the longest sequence of ordered records SORT/MERGE could generate, given the size of the tree. SORT/MERGE now creates a new run, beginning with the currently ejected record. The new run is appended to the end of the next temporary file, after any existing runs. SORT/MERGE begins each run, except the first in a file, with a run marker containing the run number of the new run. SORT/MERGE continues sorting records and writing runs until all records have been read. At this point, the sort phase is over. 6.1.2 The Merge Phase For the rnerge phase, SORT/MERGE reinitializes the tree to contain as many leaves as there are temporary files, and then fills the tree with the first record from each temporary file. The smallest record is then written to a new temporary file, and another record is read into the tree from the same file that the currently ejected record was read from. New merge passes are initiated as long as more than one temporary file remains. When only one temporary file remains, this file is renamed or copied to the output file. SORT/MERGE Performance Considerations 6-3 Figure 6-2: The Operation of the SORT/MERGE Binary Tree SORT PHASE . I I Inpl~.::I~: I v I w I x I y I MIN 1 0 I P I A I B I I x Iy I MIN 1I I I I 0 P A B No. 2 No.1 3 2 TMP.l IN.FIL I v I w 3 4 TMP.l I,--V---,-'_ __ I 4 v 1wI Key M < Key V, New Run Marker Used IN.FIL I V I w I I I X y MIN I 0 I I I I P A B No.4 No. 3 4 3 2 TMP.l I I X y I MIN I I I I I 0 P A 3 2 Ivlwixi IN.FI L I V I w B NO.5 4 TMP.l I Iw I I I IN.FIL I V I w I X Iy I MIN 101 P I A I V X y No. 6 3 2 TMP.l I V TMP.2 IN.FIL I V I w I X I y I MIN 1 0 I P I A I B I 4 Iw I I I X y M--,-I_ _ _ _ _ _ _ _ _----' New Run Begins ,--I 3 TMP.l I Iw I I y V X 4 1 TMP.2 1M 1 N I Key A < Key N, New Run Marker Used NOTE: Arrows point to the record(s) currently being read into the tree. Superscripts preceding each letter are run markers. MR-S-1721-B1 6-4 SORT/MERGE Performance Considerations Figure 6-2 (Cont.): The Operation of the SORT/MERGE Binary Tree No. 7 No. 8 2 TMP.1 I Iw I I TMP.2 I MIN 1 0 1 x V 3 4 I V Iw I x I y I TMP.2 1M I N 10 I P I No.9 IVIWlxlylAIB I Run 1 TMP.2 3 TMP.1 y I No. 10 TMP.1 4 I MIN 1 0 Run 2 TMP.1 IVlwlXlylAI TMP.2 I MIN 1 0 1 P I I Run 3 I P I New Run Begins NOTE: Heavy vertical bars indicate run markers. Arrows point to the record(s) currently being read into the tree. Superscripts preceding each letter are run markers. 00 00 ~ .0 Special record used by SORT/MERGE to flush the tree of records. Special run marker. MH-S-1722-81 SORT/MERGE Performance Considerations 6--5 Figure 6-2 (Cont.): The Operation of the SORT/MERGE Binary Tree FIRST MERGE MERGE PHASE Input Files: ,....1-:.....,---r--T""'"___......---..---------. TMP.1 I Iw I I I I I It I I V X y Run 1 TMP.2 MIN A B TMP.1 I V I w I X I y Run 3 _ _ _---, 0 I A I B I A I B I P I Run 2 No. 11 No. 12 2 2 TMP.3!L-M.-JI'---_ _ _ _ _ _ _-----' TMP.1 I wI I I V I X y No. 14 2 2 TMP.3 I MIN I 0 TMP.3 I MIN I 0 I TMP.1 I V Iw I I y I 0 I I TMP.2 I MIN I X A I B I P TMP.1 TMP.2 I I V Iw MIN I P I I Iy I I I I0 I A X 8 P I No. 16 No. 15 2 2 TMP.3 I MIN I I I wI 0 P V I MR-S-1723-81 6-6 SORT/MERGE Performance Considerations Figure 6-2 (Cont.): The Operation of the SORT/MERGE Binary Tree TMP.1 I v Iw I x I y I A IB I TMP.1 I v Iw I x Iy I A I B I TMP.2 1M! N! 0 ! PI No. 17 No. 18 2 TMP.3 I MIN I 0 I PI v Iw I x I FINAL MERGE TMP.1 I v Iw I x I y I A I B I TMP.1 I v I w I x I y IA I B I TMP.3 I MIN 1 0 1 P1 v 1 w 1 x 1 y 1 TMP.3 I MIN I 0 I PI v w Ix I y I 1 t No. 19 No. 20 2 OUT.FIL 2 A--LI_ _ _ _ _ _ _----' 1...-1 TMP.1 I v Iw I x I y I A I B I TMP.1 I v Iw x I y I A I B I 1 TMP.3 I MIN 1 0 1 P1 v 1 w 1 x 1 y No. 21 1 TMP.3 IMIN 1 0 1 P1 v 1 w 1 x 1 y 1 t No. 22 MR·S·1724·81 SORT/MERGE Performance Considerations 6-7 Figure 6-2 (Cont.): The Operation of the SORT/MERGE Binary Tree TMP.1 I v I w I x I y I A I B C-~ TMP.3 I MIN I 0 I PI v Iw I x Iy I f I TMP.1 I v Iw I x I y I A I B I TMP.3 No. 24 No. 23 2 TMP.1 I v I w I x I y I A I B I ~ TMP.3 I MIN I 0 I PI v Iw Ix Iy I TMP.1 Iv Iw Ix Iy I A I B I I TMP.3 IMIN I0 I PI v Iw Ix I y I J f f No. 26 No. 25 2 2 TMP.1 Iv Iw I x I y I A I B I ------~ TMP.3 IMIN 10 I PI v I w I x Iy I TMP.1 I v Iw I x I y I A I B I TMP.3 I MIN I 0 I PI v I w I x I y I f f No. 28 No. 27 2 2 OUT. F I L IA I B IMIN I0 IPI v Iw I x I y I MR-S·1725-81 6-8 SORT/MERGE Performance Considerations 6.2 Performance Considerations There are three major areas of concern In tuning the performance of SORT/MERGE. They are: 1. Tree size 2. Memory size (low segment size) 3. N umber of merge passes The following sections describe all of these areas and give general guidelines for adjusting them to improve the performance of SORT/MERGE. Variables such as installation memory size, system load, file size, file order, key type and length, data type, and recording mode make it impossible to give a simple, well-defined formula for improving the performance of a particular sort. If you are concerned with performance, you should study the guidelines given below and experiment with them. If you are doing stand-alone sorts, then SORT/MERGE, after completion of the sort, prints statistics concerning the sort. (COBOL and FORTRAN-called sorts do not print these statistics.) Included in these statistics are the tree size in leaves, the low segment size, and the number of runs. Thus, you can study these values and decide which must be altered for performance improvement. This is especially important in sorts that are run using default values for tree size and memory size. The following illustrates the display of sort statistics: [SRT>(PN Expanding to 48P] Sorted 7 records 12 KEY COfTlParisonst 1.71 per record 4 0 r e cor dIe a \,1 e sin III e III 0 r y o run s 0:00:00 CPU tillle t 18.43 MS per record 0:00:42 elapsed tifTle 6.2.1 Tree Size During the sort phase, as the tree size increases, fewer runs and temporary files occur, requiring fewer merge passes later. However, a tree that is too large places a heavy burden on system resources and causes a subsequent performance degradation of the sort. A tree that is too small causes excessive merge passes and increases the run time of the sort. The file itself further affects performance. For a given tree size, a well-ordered file results in fewer (and longer) runs and therefore, fewer merge passes. A backwards-sorted file results in many runs and merge passes. The effect of the tree size on runs is as follows: If N is the number of leaves in the tree, then: 1. Worst case file - each run except the last has N records 2. Random order file - each run contains approximately 2:;:N records SORT/MERGE Performance Considerations &-9 3. Best case file input file produces one run equal to the size of the entire The bias is the ratio of the run to the tree size, and is a useful index of the randomness of a file. The bias is printed only if at least one temporary file is written. The following illustrates how to interpret the bias: bias 1 Descending file sorted in ascending order (or vice versa) bias 2 Randomly ordered files bias 3 60% of the records are random, 40% are in order bias 7 20% of the records are random, 80% are in order For example, a bias of 7 indicates that 80% of the records in the file are in order and each run contains approximately seven times the number of records which would fit in the tree. SORT/MERGE's default memory algorithm uses the largest tree size larger than 16 leaves that fits in the memory available. You can specify the tree size yourself with the /LEA YES switch. However, you should read Section 6.2.3 before using this switch. 6.2.2 Memory Size SORT/MERGE's low segment appears as follows during the sort or merge phase: Impure Code Binary Tree Low Segment Buffer Space MR-S-1727-81 Assuming that you have adjusted the tree size to an optimum value, you should determine how many buffers SORT/MERGE generates for the sort. A large number of 110 buffers per file causes a memory image bigger than TOPS-IO can handle. Then the sort places a heavy burden on the system and causes a subsequent performance degradation. An insufficient number of 110 buffers causes inefficient 110 data transfer. As SORT/MERGE's default algorithm cannot always use the optimum memory size, the efficiency of 110 buffer transfer can be improved if you specify a memory size that causes SORT/MERGE to create a number of buffers more appropriate for your job. 6-10 SORT/MERGE Performance Considerations The minimum number of buffers is usually two buffers for each input and output file. Two buffers allow double buffering; the monitor reads the second buffer while SORT/MERGE is processing the first buffer. For disks, a good number of buffers is the cluster size of the disk plus one (five is usually adequate). Buffer lengths are as follows: • disk files - buffer length is 131 words • tape files - buffer length is equal to the size of a physical record plus three See the TOPS-10 Monitor Calls Manual for other devices. Some calculation is involved before you can determine the approximate number of buffers used in your sort. First, examine the following terms that are used in the calculations. Unless otherwise noted, all values are DECIMAL words. 1. n - number of leaves in the tree 2. r - maximum record length in words 3. c - 7680 words (15 pages). This is the length of SORT/MERGE impure code for stand-alone sorts. 4. e - word length of extracted keys (see below) 5. p - 4 words (3 words of tree pointers plus 1 internal count word) 6. k - key length in bytes 7. lw - length of low segment in words 8. lp - length of low segment in pages 9. s - length of impure code plus length of binary tree 10. b - length of buffer space 11. t - size of binary tree in words 12. cl - disk cluster size plus 1 for nondisk devices, cl = 2 13. m - maximum of 131 (size of a temporary file buffer) and the maximum buffer length for any input device The following example explains the calculations you must perform. The following assumptions are made: 1. The sort uses only disk files having a cluster size of 1. 2. There are no extracted keys. 3. The sort does not use the /COLLATE switch. 4. SORT/MERGE statistics indicate that the tree size is 100 leaves and the low segment size is 100 pages. SORT/MERGE Performance Considerations 6-11 5. The tree size parameter has already been examined and determined to be optimum. 6. The record size is eight words. The first step is to convert the reported low segment SIze to words (in algebraic form): lw = (lp * 512) lw = (100 * 512) lw = 51200 The second step is to find the value of t, the size of the binary tree (in algebraic form): t = (n*(rl+el + p)) t = (100 * (8 I + 0 I + 4)) t = (100 * (12)) t = 1200 The third step is to find the value of s, the tree size plus impure code (in algebraic form): s = t + c s 1200 + 7680 s - 8880 The fourth step is to find the value ofb. the buffer space (in algebraic form): b = lw - s 51200 - 8880 b b = 42320 The fifth step is to divide the buffer space by 2. This is because, during the sort phase, SORT/MERGE. has exactly two files open: the current input file and a temporary file: 42320/2 = 21160 The sixth step is to divide the buffer size by m. In this case, m 131. 21160/131 = 161.5 or 161 buffers (rounded downward) Thus, SORT/MERGE used 161 buffers per file. This figure is high, as the optimum number of buffers is usually two per file, or the cluster size plus one for disk. The following computation (in algebraic form) gives you the required buffer space, assuming two buffers per file: b=cl*m*2 b = 2 * 2 * 131 b = 524 words If you add this value to the value you previously calculated for s (impure code pI us tree), you get: 8880 + 524 = 9404 words 6-12 SORT/MERGE Performance Considerations Thus, lw (length of low segment in words) 9404. To calculate lp (low segment in pages): lp = lw 1 512 lp = 9404 1 512 lp = 18.3 rounded up to 19 Thus, you would specify the following switch combination to SORT/MERGE: ILEAVES:100/CORE:19P NOTE If, after attempting to run the sort with the new ICORE value, you receive a message indicating that SORT/MERGE did not have enough core, rerun the sort after adding one or two pages to the ICORE value. Rounding errors can sometimes cause you to calculate a value that is slightly less than the required value. In the example above, you assumed no extracted keys. Thus, the value of e was zero. If the data type switch is INUMERIC, IFORMAT, ICOMPU, or ICOMP1, then e = 1 for single precision keys; and e = 2 for double precision keys. If you used the ICOLLATE: switch in the command string, then e is calculated by a different method. (Note that k = key length.) If you used the ICOLLATE:ASCII switch, or the ICOLLATE:FILE: switch, or the ICOLLATE:/LITERAL: switch, where the file or the literal contained an alternative ASCII collating sequence, then: e = (k + 4)/5 If you used the ICOLLATE:EBCDIC switch, or the ICOLLATE:FILE: switch, or the ICOLLATE:LITERAL: switch, where the file or the literal contained an alternative EBCDIC collating sequence, then: e = (k + 3)/4 In summary, the various formulas that you used are as follows: 1. Convert n pages to words: n 1 512 2. Convert n words to pages: n 3. * 512 Calculate the number of buffers per file for a given low segment value: Ilw - ((n :1: (r I +el + p)) + c)1 (cl * m) SORT/MERGE Performance Considerations 6-13 4. Calculate an optimized nun1ber of buffers: cl :,: m :,: 2 6.2.3 Number of Merge Passes The largest number of runs that SORT/MERGE can maintain before doing a merge pass is an exponential function of the number of temporary files available. For stand-alone sorts. the number of temporary files is fixed at 26. As merge passes are very expensive in terms of run time, it is important to ensure that no more merge passes occur than are absolutely necessary. You should observe the following figures: RUNS MERGE PASSES o 0 (sort contained entirely in memory) 1 - 26 (26:'::"lJ 1 26 - 676 (26:'::':2) 2 676 - 17576 (26::::::~3) :3 17576 - 456976 (26:::::'4) 4 The values shown above that are exponential powers of 26 are the merge threshold values. If the number of runs exceeds any given threshold limit, then an additional 111erge pass is necessary. This is particularly unfortunate in cases where the number of runs is only 10 to 20(k greater than the threshold limit. As an example, consider the case of a sort that uses 29 runs. This is only 3 runs above the closest threshold value (26). For the sake of 3 runs, a very substantial performance degradation is incurred. Thus, a slight increase in the size of the sort tree might reduce the number of runs to, or below, the 26-run threshold value and eliminates the need for an entire merge pass. However, a slight increase in memory usage gives a substantial reduction in the run time of a sort. Therefore, the tree size is specified with the ILEA YES switch. It is best to increase the size of the tree until the number of runs equals, or drops below. the nearest threshold value. Alternately, you may be more concerned with memory usage than with run time. If the number of runs is 10 - 20';' less than the nearest merge threshold value, you can effect a gain in system performance (at a slight expense in run time for the sort) by specifying a smaller tree. Again, decrease the tree size until the nUlllber of runs is equal to or less than the nearest merge threshold value. NOTE The length of each run is data dependent. What works one time may be incorrect the next time if the data is different. 6-14 SORTIMERGE Performance Considerations Appendix A Summary of SORT/MERGE Functions and Switches This appendix has alphabetic lists of SORT/MERGE functions and SORT/MERGE switches. Each command or switch is described briefly. Complete descriptions of functions can be found in Chapter 2. Complete descriptions of switches can be found in Chapter 3. Each switch is given a brief description that includes its function, its type, and any defaulting characteristics of the switch. A.1 Functions There are five major functions in SORT/MERGE: • EXIT - exit from SORT/MERGE and return to TOPS-IO command level. Use /EXIT • HELP - print the text of the help file. Use /HELP or /HELP:SWITCHES • MERGE - merge previously sorted files. Use /MERGE with a SORT/MERGE command string • RUN - run a program. Use /RUN: • SORT - sort the specified files. Simply specify a SORT/MERGE command string A-I A.2 Switches (in Alphabetic Order) IAFTER Place the output record after the carriage-return/line-feed characters. Function: File switch Type: Local Default: IBEFORE switch IALIGN Word align all ASCII output records. Function: File switch Type: Global Default: Not word-aligned Exceptions: 1. I ASCII/FORTRAN is word-aligned by default. 2. Line-sequenced ASCII input files are detected by SORT/MERGE, and are word-aligned on output. IALPHA The key data type is alphanumeric. Function: Key data type switch Type: Local Default: If ISIGNED, IUNSIGNED, IFORMAT, INUMERIC, ICOMPU, ICOMPl, or ICOMP3 not specified, this is the default data type. IASCII The recording mode of the data is ASCII. Function: Recording-mode switch Type: Global Default: See the explanation of this switch in Chapter 3 for a description of the defaults. IBEFORE Place the output record before the carriage-return/line-feed characters. Function: File switch Type: Local Default: This is the default. A-2 Summary of SORT/MERGE Functions and Switches /BINARY The recording mode of the data is binary. Function: Recording-mode switch Type: Global Default: See the explanation of this switch in Chapter 3 for a description of the defaults. /BLOCKED:n The n is a decimal number indicating the blocking factor for a COBOL file. Not meaningful for FORTRAN-created files. Function: File switch Type: Modified position dependent Default: Unblocked file /CHECK Check the record sequence of files that are being merged and generate an error message if out-of-sequence records are found. This switch doubles the number of comparisons and causes some increase in run time. However, it protects against erroneously merging unsorted files. Valid only for the merge function. Function: Control switch Type: Global Default: Don't check merge input files /COLLATE:n The argument to this switch (nl specifies the collating sequence to use when sorting the associated files. The possible arguments are: 1. ASCII 2. EBCDIC 3. FILE:filespec 4. LITERAL:/collating-sequence/ 5. ADDRESS:address I Arguments 1 and 2 allow you to sort ASCII data according to the EBCDIC collating sequence or vice versa. Argurnents 3 and 4 allow you to specify your own collating sequence. Argument 5 is for FORTRAN users in the format of ADDRESS:A n . Function: Control switch Type: Global Default: The collating sequence associated with the recording-mode switch used. Summary of SORT/MERGE Functions and Switches A-3 I /COMPU The key data type is COMPUTATIONAL. Function: Key data type switch Type: Key modifier Default: If the recording mode is binary. this is the default data type. /COMPI The key data type is COMPI. Function: Key data type switch Type: Key modifier Default: No default characteristics /COMP3 The key data type is COMP3. Function: Key data type switch Type: Key modifier Default: No default characteristics /CORE:n The n is the amount of the low segment to be allocated to SORT/MERGE. Function: Control switch Type: Global Default: Determined by SORT/MERGE's default core algorithm /DENSITY:n The n is a decimal number indicating the recording density to be used for reading or writing a magnetic tape. This switch is ignored for other devices. The possible values of n are: I 1. 200 2. 556 3. 800 4. 1600 5. 6250 Function: Tape switch Type: Position dependent (SCAN switch) Default: Set by SET DENSITY monitor command A-4 Summary of SORT/MERGE Functions and Switches /EBCDIC The recording mode of the data is EBCDIC. Function: Recording-mode switch Type: Global Default: See the explanation of this switch in Chapter 3 for a description of the defaults. /ERROR:addr The addr is the absolute octal address that program control transfers to when SORT/MERGE encounters a fatal error. This switch is designed for FORTRAN users, who can specify an absolute address or (indirectly) a symbolic address. See the description of this switch in Chapter 3 for further details. Function: Control switch Type: Global Default: Stop the job on a fatal error /EXIT Exit to monitor command level. Function: Control switch Type: Global (SCAN switch) Default: Prompt for another SORT/MERGE command string /FATAL:addr The addr is the absolute octal address that the SORT/MERGE error code is stored in when SORT/MERGE encounters a fatal error. This switch is designed for FORTRAN users, who can specify an absolute address or (indirectly) a symbolic address. See the description of this switch in Chapter 3 for further details. Function: Control switch Type: Global Default: Do not return a fatal error code to the program /FIXED The file contains fixed-length records. Function: File switch Type: Global Default: Depends on the recording-mode switch you specify. See the description of the appropriate recording-mode switch in Chapter 3 for more details. Summary of SORT/MERGE Functions and Switches A-5 IFORMAT:nPaw.d The key data type is FORTRAN ASCII-NUMERIC. nP = a w = d Scaling factor (positive or negative number) D decimal floating point, double precision E decimal floating point, single precision F decimal floating point, single precision G general key length number of decimal places in key Function: Key descriptor switch Type: Local Default: No default characteristics IFORTRAN The associated files are FORTRAN ASCII or FORTRAN binary files. Function: File switch Type: Global Default:- Not IFORTRAN IHELP Print the help file. IHELP:SWITCHES prints switches available to SORT/MERGE users. Function: Control switch Type: Global (SCAN switch) Default: No default characteristics IINDUSTRY Read or write a magnetic tape in industry-compatible mode. This switch is ignored for devices other than tape drives. Function: Tape switch Type: Modified position dependent (SCAN switch) Default: DEC format IKEY:n:m:x The n is the position of the first character of the key. The m is the length of the key. The x is either ASCENDING or DESCENDING. Function: Key switch (required) Type: Global Default: Default switches are: 1. IALPHANUMERIC if ISIGNED, IUNSIGNED, INUMERIC, ICOMPU, ICOMPl, ICOMP3, or IFORMAT is not specified. A-6 Summary of SORT/MERGE Functions and Switches 2. /NUMERIC - if /SIGNED or /UNSIGNED is specified and if /ALPHA, /COMPU, /COMP1, or /COMP3 is not specified. 3. /SIGNED - if /COMPUTATIONAL, /COMP1, /COMP3, /NUMERIC, or /FORMAT is specified. /LABEL:n Specifies whether or not the file contains tape labels, and, if so, what type of tape labels. This switch is ignored for devices other than tape drives. Possible arguments are: 1. ANSI 2. DEC 3. IBM 4. NONSTANDARD 5. OMITTED 6. STANDARD Function: Tape switch Type: Modified position dependent (SCAN switch) Default: /LABEL:STANDARD /LEAVES:n Specifies the size of the binary tree that SORT/MERGE is to use during the sort phase of a sort. The argument n is a decimal number that indicates how many leaves (or terminal nodes) that the binary tree is to have. This switch does not affect the merge phase of a sort, and is ignored when used with the /MERGE switch. Function: Control switch Type: Global Default: Determined by SORT/MERGE's default memory allocation algorithm. See Chapter 6 for more details. /MAXTEMP:n Indicates the maximum number (n) of temporary files that can be used during a sort or merge. Function: Control switch Type: Global Default: 26 temporary files /MERGE Merge the specified input files. Function: Control switch Type: Global Default: No default characteristics Summary of SORT/MERGE Functions and Switches A-7 IMESSAGE:arg Controls how much of an error, informational or warning, message IS printed. The possible arguments are: 1. rN01FIRST - determines whether or not the text portion of the message is printed. 2. rN01PREFIX determines whether the (i.e., SRTxxx) is printed with the message. error message code You can specify the arguments in combination. For example, IMESSAGE:(NOPREFIX,FIRST) omits the error code, but prints the text of the message. Function: Control switch Type: Global Default: IMESSAGE:(PREFIX,FIRST) INOCRLF Indicates that both input and output files are IFIXED IASCII records containing no carriage control characters. Function: File switch Type: Global Default: Both input and output records have a carriage-return line-feed characters. INUMERIC The key data type is numeric. Function: Data type switch Type: Key modifier switch Default: Causes ISIGNED to IUNSIGNED). be In effect (unless you specify IOPTION:name Reads switches from lines beginning with SORT:name in SWITCH.INI. Function: Control switch Type: Global (SCAN switch) Default: Read switches from lines beginning with SORT (unlabeled) in SWITCH.INI. IPACKED The key data type is packed decimal (4 bits). This switch is identical to ICOMP3. Function: Key data type switch Type: Key modifier Default: No default characteristics A-8 Summary of SORT/MERGE Functions and Switches /PARITY:n Specifies the parity (n) to be used when reading or writing a magnetic tape. The possible values for the parity argument (n) are: 1. EVEN 2. ODD Function: Tape switch Type: Position dependent '(SCAN switch) Default: System default /PHYSICAL Suppresses local name assignments; only physical device names are searched to find the data file. Function: Control switch Type: Position dependent (SCAN switch) Default: Search logical names first /POSITION:n Positions a magnetic tape before a file is read or written. The argument (n) can be positive to skip a number of files or negative to backspace a number offiles. This switch is ignored for devices other than magnetic tape drives. Function: Tape switch Type: Local Default: Position at the first file on the tape. /PRIORITY:n Sets the disk priority for your SORT/MERGE job. The argument (n) can be a value from -3 to 3. An argument of + 3 is the highest priority; -3 is the lowest priority. Function: Control switch Type: Position dependent Default: Normally o. The default can be changed with the DISK. monitor call. (See the TOPS-J 0 Monitor Calls Manual.) /RANDOM The associated file is a random-access file. This switch IS identical to /FIXED. Function: File switch Type: Global Default: Depends on the recording-mode switch you specify. See the description of the appropriate recording-mode switch in Chapter 3 for more details. Summary of SORT/MERGE Functions and Switches A-9 IRECORD:n The n is a decimal integer specifying the record size. Function: Record length switch (required) Type: Global Default: None. This switch is required. IREWIND Rewind the tape before the file is read or written. This switch is ignored for devices other than tape drives. Function: Tape switch Type: Local Default: Don't rewind the tape before use. IRUN :filespec Run the specified program. Three subordinate switches can also be specified with this switch: 1. IRUNCORE:n - Run the program with a memory allocation of ~n'. Run the program at the start address + n. 2. IRUNOFFSET:n - 3. ITMPFIL:nam:~string' - Store the string in TMPCOR core file 'nam'. The ~nam' can be a maximum of three characters. Function: Control switch Type: Global Default: No default characteristics ISEQUENTIAL The file is a sequential-access file. This switch is identical to IV ARIABLE. Function: File switch Type: Global Default: Depends on the recording-mode switch you specify. See the description of the appropriate recording-mode switch in Chapter 3 for more details. ISIGNED The key data is signed. Function: Key data type switch Type: Key modifier switch Default: In effect for INUMERIC, FORMAT, COMPU, COMPI, and COMP3 unless IUNSIGNED is specified. A-tO Summary of SORT/MERGE Functions and Switches /SIXBIT The recording mode of the data is SIXBIT. Function: Recording-mode switch Type: Global Default: See the explanation of this switch in Chapter 3 for a description of the defaults. /STANDARD The data should be read frqm or written to magnetic tape in Standard-ASCII format. This switch is ignored if any other device is used. Function: Tape switch Type: Modified position dependent Default: Core-dump format /SUPPRESS:n Specifies which types of messages to suppress. The possible arguments (n) are: NONE Suppress no messages. INFORMATION Suppress all information messages (those beginning with TL WARNING Suppress all information messages, and all warning messages (those beginning with ((If'). FAT AL Suppress all information messages, all warning messages, and all fatal error messages (those beginning with (?'). ALL Same as FATAL. NOTE It is not possible to suppress messages beginning with ($'. Function: Control switch Type: Global Default: /SUPPRESS:NONE /TEMP Allows you to specify the device names for temporary file storage. For stand-alone sorts, the number of device names is fixed at 15. Function: Control switch Type: Local Default: DSK: Summary of SORT/MERGE Functions and Switches A-ll /UNLOAD Rewind and unload the tape after the file is read or written. For multi-reel files, this switch affects only the disposition of the last tape. All intermediate tapes are UNLOADed regardless of the setting of this switch. This switch is ignored for any device other than a tape drive. Function: Tape switch Type: Local Default: Do not unload the last reel of a magtape file. /UNSIGNED The key is unsigned. Function: Key data type switch Type: Local Default: No default characteristics /VARIABLE The file contains variable-length records. Function: File switch Type: Global Default: Depends on the recording-mode switch you specify. See the description of the appropriate recording-mode switch in Chapter 3 for more details. A-12 Summary of SORT/MERGE Functions and Switches A.1 Switches (by Function) Required Switches File Switches IRECORD: IKEY: IAFTER IALIGN IBEFORE IBLOCKED: IFIXED IFORTRAN INOCRLF IRANDOM ISEQUENTIAL IVARIABLE Key Data Type Switches IALPHA ICOMPU ICOMPl ICOMP3 IFORMAT: INUMERIC IPACKED ISIGNED IUNSIGNED Control Switches Recording Mode Switches IASCII IBINARY IEBCDIC ISIXBIT Tape Switches IDENSITY: IINDUSTRY ILABEL: IPARITY: IPOSITION: IREWIND ISTANDARD IUNLOAD ICHECK ICOLLATE: ICORE: IERROR: IEXIT IFATAL: IHELP ILEAVES: IMAXTEMP: IMERGE IMESSAGE: IOPTION: IPHYSICAL IPRIORITY: IRUN: ITEMP Summary of SORT/MERGE Functions and Switches A-13 A.2 Switches (by Range) Global Switches Local Switches IALIGN IASCII IBINARY ICHECK ICOLLATE: ICORE: IEBCDIC IERROR: IEXIT IFATAL: IFIXED IFORTRAN IHELP IKEY: ILEAVES: IMAXTEMP IMERGE IMESSAGE: IOPTION: IRANDOM IRECORD: IRUN: ISEQUENTIAL ISIXBIT ISUPPRESS: ITEMP IVARIABLE IAFTER IALPHA IBEFORE ICOMPU ICOMPl ICOMP3 IFORMAT: INOCRLF INUMERIC IPACKED IPOSITION: IREWIND ISIGNED IUNLOAD IUNSIGNED Modified Position Dependent Switches IBLOCKED IINDUSTRY ILABEL: ISTANDARD Position Dependent Switches IDENSITY: IPARITY: IPHYSICAL IPRIORITY: A-14 Summary of SORT/MERGE Functions and Switches Appendix B Collating Sequences and Conversion Tables Table B-1 shows the ASCII and SIXBIT collating sequence and the conversions from ASCII to EBCDIC, SIXBIT to ASCII, and SIXBIT to EBCDIC. If the ASCII character does not convert to the same character in EBCDIC, the EBCDIC character is shown in parentheses next to the EBCDIC code. Note that the first and last 32 characters do not exist in SIXBIT. Also, the characters in the first column (NULL, SOH, STX, etc.) are control characters, which are nonprinting. NOTE All codes are specified in octal. B-1 Table B-1: ASCII and SIXBIT Collating Sequence and Conversion to EBCDIC ASCII Character 7-bit NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US B-2 000 001 002 003 004 005 006 007 010 011 012 013 014 015 016 017 020 021 022 023 024 025 026 027 030 031 032 033 034 035 036 037 EBCDIC 9-bit 000 001* 002* 003* 067 055* 056* 057* 026 005 045 013* 014* 025*(NL) 006*(LC) 066*(UC) 044*(BYP) 024*(RES) 064*(PN) 965*(RS) 004*(PF) 075* 027*(lL) 046*(EOB) 052*(CM) 031* 032*(CC) 047*(PRE) 023*(TM) 041 *(SOS) 040*(DS) 042*(FS) Character SIXBIT ASCII 7-bit Space 00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17 20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37 040 041 042 043 044 045 046 047 050 051 052 053 054 055 056 057 060 061 062 063 064 065 066 067 070 071 072 073 074 075 076 077 , ~~ # $ (k & , ( ) * + , - / 0 1 2 3 4 5 6 7 8 9 , < = > ? Collating Sequences and Conversion Tables EBCDIC 9-bit 100 132 177 173 133 154 120 175 115 135 134 116 153 140 113 141 360 361 362 363 364 365 366 367 370 371 172 136 114 176 156 157 Table B-1 (Cont.): ASCII and SIXBIT. Collating Sequence and Conversion to EBCDIC Character SIXBIT @ 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 [ \ ] A - 40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57 60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77 ASCII 7-bit EBCDIC 9-bit . 100 101 102 103 104 105 106 107 110 111 112 113 114 115 116 117 120 121 122 123 124 125 126 127 130 131 132 133 134 135 136 137 174 301 302 303 304 305 306 307 310 311 321 322 323 324 325 326 327 330 331 342 343 344 345 346 347 350 351 255* 340 275 137 155 Character a b c d e f g h 1 j k I m n 0 p q r s t u v w x y z { I } Delete ASCII 7-bit EBCDIC 9-bit 140 141 142 143 144 145 146 147 150 151 152 153 154 155 156 157 160 161 162 163 164 165 166 167 170 171 172 173 174 175 176 177 171 201 202 203 204 205 206 207 210 211 221 222 223 224 225 226 227 230 231 242 243 244 245 246 247 250 251 300* 117 320 241 007 * These EBCDIC codes either have no equivalent in the ASCII or SIXBIT character sets, or are referred to by difference names. They are converted to the indicated ASCII characters to preserve their uniqueness if the ASCII character is converted back to EBCDIC. Collating Sequences and Conversion Tables B-3 Table B-2 shows the conversion of ASCII code to SIXBIT code. The table does not show ASCII codes 000 through 037 because they all convert to SIXBIT 74 (\), except 11 (TAB) which converts to SIXBIT 00 (space). Table B-2: ASCII to SIXBIT Conversion Character ASCII 7-bit SIXBIT 040 041 042 043 044 045 046 047 00 01 02 03 04 05 06 07 / 050 051 052 053 054 055 056 057 10 11 12 13 14 15 16 17 0 1 2 3 4 5 6 7 060 061 062 063 064 065 066 067 20 21 22 23 24 25 26 27 8 070 071 072 073 074 075 076 077 30 31 32 33 34 35 36 37 Space ! (( # $ % & , ( ) * + , - 9 , < = > ? B-4 Character Collating Sequences and Conversion Tables (it' 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 [ \ ] ~ - ASCII 7-bit SIXBIT 100 101 102 103 104 105 106 107 40 41 42 43 44 45 46 47 110 111 112 113 114 115 116 117 50 51 52 53 54 55 56 57 120 121 122 123 124 125 126 127 60 61 62 63 64 65 66 67 130 131 132 133 134 135 136 137 70 71 72 73 74 75 76 77 Table B-2 (Cont.): ASCII to SIXBIT Conversion ASCII code ASCII character SIXBIT code SIXBIT character 140 141 142 143 144 145 146 147 , 74 41 42 43 44 45 46 47 \ 50 51 52 53 54 55 56 57 H I J 60 61 62 63 64 65 66 67 P Q R 70 71 72 73 74 75 74 74 X a b c d e f g 150 151 152 153 154 155 156 157 h i .j 160 161 162 163 164 165 166 167 p 170 171 172 173 174 175 176 177 x k I m n 0 q r s t u v w y z { I } - Delete A B C D E F G K L M N 0 S T U V W Y Z I \ I \ \ Collating Sequences and Conversion Tables B-5 Table B-3 shows the EBCDIC collating sequence and the conversion from EBCDIC to ASCII. When conversion is from EBCDIC to SIXBIT, it is as if the code was converted to ASCII and then from ASCII to SIXBIT. Table B-3: EBCDIC Collating Sequence and Conversion to ASCII EBCDIC code EBCDIC character ASCII code ASCII character EBCDIC code 000 001 002 003 004 005 006 007 NUL SOH STX ETX PF HT LC Delete 000 001 002 003 024 011 016 177 NUL SOH STX ETX DC4 HT SO Delete 050 051 052 053 054 055 056 057 010 011 012 013 014 015 016 017 SMM VT FF CR SO SI 134 134 134 013 014 134 134 134 \ \ \ 060 061 062 063 064 065 066 067 020 021 022 023 024 025 026 027 DLE DC1 DC2 TM RES NL BS IL 134 134 134 034 021 015 010 026 \ \ \ 030 031 032 033 034 035 036 037 CAN EM CC CUI IFS IGS IRS IUS 134 031 032 134 134 134 134 134 \ 040 041 042 043 044 045 046 047 DS SOS FS 036 035 037 134 020 012 027 033 RS GS US B-6 BYP LF ETB ESC VT FF \ \ \ FS DC1 CR BS SYN EM SUB \ \ \ \ \ \ DLE LF ETB ESC 070 071 072 073 074 075 076 077 100 101 102 103 104 105 106 107 110 111 112 113 114 115 116 117 Collating Sequences and Conversion Tables EBCDIC character ASCII code ASCII character \ \ ENQ ACK BEL 134 134 030 134 134 005 006 007 \ \ \ \ PN RS UC EOT 134 134 134 134 022 023 017 004 CU3 DC4 NAK SUB 134 134 134 134 134 025 134 134 \ \ \ \ \ SM CUZ Space Cent < ( + 040 134 134 134 134 134 134 134 134 134 134 056 074 050 053 174 CAN \ \ ENQ ACK BEL DC2 DC3 SI EOT NAK \ \ Space \ \ \ \ \ \ \ \ \ \ < ( + Table B-3 (Cont.): EBCDIC Collating Sequence and Conversion to ASCII EBCDIC code EBCDIC character ASCII code ASCII character EBCDIC code 120 121 122 123 124 125 126 127 & 046 134 134 134 134 134 134 134 & \ \ \ \ \ \ \ 170 171 172 173 174 175 176 177 130 131 132 133 134 135 136 137 140 141 142 143 144 145 146 147 150 151 152 153 154 155 156 157 160 161 162 163 164 165 166 167 ! $ * ) A - I , o/c > ? 134 134 041 044 052 051 073 137 055 057 134 134 134 134 134 134 134 134 134 054 045 137 076 077 134 134 134 134 134 134 134 134 \ \ ! $ * ) A \ - I \ \ \ \ \ \ \ \ \ , 7r > ? \ \ \ \ \ \ \ \ 200 201. 202 203 204 205 206 207 210 211 212 213 214 215 216 217 220 221 222 223 224 225 226 227 230 231 232 233 234 235 236 237 EBCDIC character # (u , = " a b c d e f g h i j k 1 m n 0 p q r ASCII code ASCII character 134 140 072 043 100 47 075 042 \ 134 141 142 143 144 145 146 147 \ 150 151 134 134 134 134 134 134 h i 134 152 153 154 155 156 157 160 161 162 134 134 134 134 134 134 Collating Sequences and Conversion Tables # (u , = " a b c d e f g \ \ \ \ \ \ \ j k 1 m n 0 p q r \ \ \ \ \ \ B-7 Table B-3 (Cont.): EBCDIC code 240 241 242 243 244 245 246 247 250 251 252 253 254 255 256 257 EBCDIC character s t u v w x y z r EBCDIC Collating Sequence and Conversion to ASCII ASCII code ASCII character EBCDIC code EBCDIC character ASCII code ASCII character 134 176 163 164 165 166 167 170 \ 310 311 312 313 314 315 316 317 H I 110 110 134 134 134 134 134 134 H I 171 172 134 134 134 133 134 134 y z 260 261 262 263 264 265 266 267 175 134 134 134 134 134 134 134 270 271 272 273 274 275 276 277 134 134 134 134 134 135 134 134 300 301 302 303 304 305 306 307 B-8 1 A B C D E F G 173 101 102 103 104 105 106 107 s t u v w x \ \ \ I \ \ \ \ \ \ \ \ \ \ \ \ \ \ 1 \ \ A B C D E F G 320 321 322 323 324 325 326 327 330 331 332 333 334 335 336 337 340 341 342 343 344 345 346 347 350 351 352 353 354 355 356 357 Collating Sequences and Conversion Tables J K L M N 0 P Q R S T U V W X Y Z 175 112 113 114 115 116 117 120 121 122 134 134 134 134 134 134 134 134 123 124 125 126 127 130 131 132 134 134 134 134 134 134 \ \ \ \ \ \ J K L M N 0 P Q R \ \ \ \ \ \ \ \ S T U V W X Y Z \ \ \ \ \ \ Table B-3 (Cont.): EBCDIC code 360 361 362 363 364 365 366 367 EBCDIC Collating Sequence and Conversion to ASCII EBCDIC character ASCII code ASCII EBCDIC character code 0 1 2 3 4 5 6 7 060 061 062 063 064 065 066 067 1 1 2 3 4 5 6 7 370 371 372 373 374 375 376 377 EBCDIC character ASCII code ASCII character 8 070 071 134 134 134 134 134 134 8 9 9 \ \ \ \ \ \ Collating Sequences and Conversion Tables B-9 Glossary Term Definition ASCII American Standard Code for Information Interchange. A 7-bit code in which textual information is recorded. The ASCII code can represent 128 distinct characters. These characters are uppercase and lowercase letters, numbers, common punctuation marks, and special control characters. Bias The ratio of a run to the tree size. The bias should be approximately 2.0 if the file being sorted is truly random. See Run. Buffer A device or area, such as external storage devices, used to temporarily hold information being transmitted between two processes. Data A general term used to denote any or all information (facts, numbers, letters, and symbols) that refers to or describes an object, idea, condition, or situation. It represents basic elements of information that can be processed by a computer. DSK The generic device name for disk devices. It is translated into the user's default path if a directory is not supplied, or into the structure on which the user's default path resides if a directory is supplied. Glossary-1 EBCDIC Extended Binary Coded Decimal Interchange Code. An 8-bit translation code that can· represent 256 distinct characters. Because TOPS-20 is a 36-bit system, EBCDIC disk files contain 9-bit bytes with the 8-bits of data right-justified. Four 9-bit bytes make a word. Standard 8-bit EBCDIC bytes are used when recording industry-compatible tapes. All references to EBCDIC disk files in this manual refer to the TOPS-20 implementation of EBCDIC. File Format The header words, control words, and control characters that are used to format the data into separate records. File Specification A list of identifiers that uniquely speci(y a particular file. For example, dev: <directory >filnam.ext The 'dev:' specifies the device where the file is stored, the '<directory>' specifies the name of the directory where the file is stored, the 'filnam' is the name of the file, and '.ext' is the file extension. Key The part of the record being conlpared in order to sort the file into the correct sequence. Label On magnetic tape, the leader or trailer record used to identify the reel. On random-access devices, the directory block used by the system. Logical Record The record that is created by some process, such as a program, but has not yet been written to a storage device, such as disk or magnetic tape. See Physical Record. Mixed-Mode Binary A binary file that is interpreted as containing any combination of numeric, alphanumeric, fixed-point binary and floating-point binary data. EBCDIC mixed-mode binary can include packeddecimal values; FORTRAN mixed-mode binary can include FORMAT data. Physical Record The record that is written to a storage device such as disk or magnetic tape. Factors such as blocking and default physical record size can generate a physical record consisting of many logical records. Record Glossary-2 A collection of adjacent data items treated as a unit. Run Scratch Device Segment The largest set of records ordered by key value that SORT/MERGE can generate within its memory limits. (As memory increases, fewer, but larger, runs occur.) For ascending (or descending) keys, a new run is created if SORT/MERGE encounters a record whose key is less (or greater) than the key value of the last record written to the temporary file. Runs are always in monotonically increasing (or decreasing) order. A device used to store intermediate data during a sort. A division or section of the user's virtual address space. There are two types of segments: Low Segment - starts at address zero and stops before address 400000. Program code stored in the low segment is not sharable. High Segment - starts at address 400000 and uses as much of the remaining address space required to hold the program code. This code is sharable. There are two advantages to segmenting the user's virtual address space: SIXBIT Sort Stable Sort Standard Binary 1. Allows the program code to be shared. 2. Allows programs too large for the user's address space to be divided into multiple high segments. When a particular portion of code is required, it can be overlaid on (written over) the code currently stored in the high segment of the user's address space. A 6-bit code in which textual information is recorded. It is a compressed form of the ASCII character set. The results of comparisons between groups of records. A sort which leaves the relative order of equal keys unchanged. A binary file that is interpreted as containing only fixed-point and floating-point binary values. Glossary-3 Index 36-bit, 1-13 Abbreviation, collate, 3-17 IAFTER switch, 3-11, A-2 IALIGN switch, 3-11, A-2 IALPHA switch, A-2 ALPHANUMERIC data type, 3-5 IALPHANUMERIC switch, 1-12,3-5 Arguments, ICOLLATE switch, 3-16 ILABEL switch, 3-24 ASCENDING order, 1-4 ASCII, Glossary-l COBOL fixed-length, 4-5 COBOL variable-length, 4-9 fixed-length, 4-5 FORTRAN fixed-length, 4-6 FORTRAN variable-length, 4-10 variable-length, 4-8 ASCII file, creating, 1-1 ASCII recording mode, 4-2 I ASCII switch, 1-12, 3-9, A-2 IBEFORE switch, 3-11, A-2 Bias, Glossary-l Binary, COBOL ASCII mixed-mode, 4-25 COBOL EBCDIC mixed-mode, 4-28 COBOL SIXBIT mixed-mode, 4-27 Binary file formats, 4-25 BINARY recording mode, 4-3 IBINARY switch, 3-10, A-3 Binary tree, operation of, 6-4 Binary with LSCW, FORTRAN random, 4-31 FORTRAN sequential, 4-35 Binary without LSCW, FORTRAN random, 4-33 FORTRAN sequential, 4-37 Blocked fixed-length EBCDIC, 4-20 IBLOCKED switch, 3-12, A-3 Blocked variable-length EBCDIC, 4-22 Blocking files, 3-12 Buffer, Glossary-l Calculating memory size, 6-11 Categories, switch, 3-1 Character data, sorting, 2-4 Characters in file, tab, 2-3 ICHECK switch, 3-15, A-3 COBOL, field descriptors for, 3-7 using SORT/MERGE from, 2-6 COBOL ASCII mixed-mode binary, 4-25 COBOL binary file formats, 4-25 COBOL EBCDIC mixed-mode binary, 4-28 COBOL fixed-length ASCII, 4-5 COBOL fixed-length EBCDIC, 4-17 COBOL fixed-length SIXBIT, 4-13 COBOL SIXBIT mixed-mode binary, 4-27 COBOL variable-length ASCII, 4-9 COBOL variable-length EBCDIC, 4-18 COBOL variable-length SIXBIT, 4-15 Codes, error, 5-12 Collate abbreviation, 3-17 Collate completion, 3-17 Collate equivalence, 3-16 Collate functions, 3-16 ICOLLATE switch, 3-16, A-3 ICOLLATE switch arguments, 3--16 Index-l Collating order, key, 3-5 Collating sequences, B-1 Command files, using, 2-5 Command formats, 2-4 COMP1 data type, 3-6, 3-8 ICOMP1 switch, 3-6, A-4 COMP3 data type, 3-6, 3-9 ICOMP3 switch, 3-6, A-4 Completion, collate, 3-17 ICOMPU switch, A-4 COMPUTATIONAL data type, 3-6, 3-8 ICOMPUTATIONAL switch, 3-6 Considerations, performance, 6-9 SORT/MERGE performance, 6-1 Control switches, 3-15 Control words in file, 2-3 Conversion tables, B-1 ICORE switch, 3-18, A-4 Creating ASCII file, 1-1 Creating multifield file, 1-1 Data, Glossary-1 sorting character, 2-4 sorting nonalphanumeric, 2-4 sorting nonnumeric, 2-4 Data type, 1-13 ALPHANUMERIC, 3-5 COMP1, 3-6, 3-8 COMP3, 3-6, 3-9 COMPUTATIONAL, 3-6, 3-8 FORMAT, 3-6, 3-8 NUMERIC, 3-5, 3-8 PACKED, 3-6, 3-9 Data types, key, 3-5 IDENSITY switch, 3-23, A-4 DESCENDING order, 1-4 Descriptors for COBOL, field, 3-7 Descriptors for FORTRAN, field, 3-7 Determining key length, 1-2 Determining key position, 1-2 Determining record length, 1-2 DSK:, Glossary-1 EBCDIC, Glossary-2 blocked fixed-length, 4-20 blocked variable-length, 4-22 COBOL fixed-length, 4-17 COBOL variable-length, 4-18 Index-2 EBCDIC file formats, 4-17 EBCDIC recording mode, 4-2 IEBCDIC switch, 3-10, A-5 Equivalence, collate, 3-16 Error codes, 5-12 Error messages, 5-2 SORT/MERGE, 5-1 IERROR switch, 2-8, 3-19, A-5 EXIT function, 2-4 IEXIT switch, 2-4, 3-19, A-5 IFATAL switch, 2-8, 3-19, A-5 Field descriptors for COBOL, 3-7 Field descriptors for FORTRAN, 3-7 File, control words in, 2-3 creating ASCII, 1-1 creating multifield, 1-1 line-sequence numbers in, 2-3 sorting line-sequenced, 1-6 sorting multifield, 1-3 sorting multiline, 1-11 tab characters in, 2-3 File format, Glossary-2 File formats, 4-1, 4-3 File formats, binary, 4-25 COBOL binary, 4-25 EBCDIC, 4-17 FORTRAN binary, 4-30 File specification, Glossary-2 File specifications, 2-5 File switches, 3-11 Files, blocking, 3-12 merging, 2-5 sorting nontext, 1-12 using command, 2-5 Files containing tabs, sorting, 1-8 IFIXED switch, 3-13, A-5 Fixed-length ASCII, 4-5 COBOL, 4-5 FORTRAN, 4-6 Fixed-length EBCDIC, blocked, 4-20 COBOL, 4-17 Fixed-length SIXBIT, 4-12 COBOL, 4-13 Format, IKEY switch, 3-4 message, 5-1 FORMAT data type, 3-6, 3-8 IFORMAT switch, 3-6, A-6 Formats, binary file, 4-25 COBOL binary file, 4-25 command, 2-4 EBCDIC file, 4-17 file, 4-1, 4-3 FORTRAN binary file, 4-30 FORTRAN, field descriptors for, 3-7 using SORT/MERGE from, 2-6 FORTRAN binary file formats, 4-30 FORTRAN fixed-length ASCII, 4-6 FORTRAN random binary with LSCW, 4-31 FORTRAN random binary without LSCW, 4-33 FORTRAN sequential binary with LSCW, 4-35 FORTRAN sequential binary without LSCW, 4-37 /FORTRAN switch, 3-14, A-6 FORTRAN variable-length ASCII, 4-10 FORTRAN-called sort restrictions, 2-7 FSORT program, 2-7 Function, EXIT, 2-4 HELP, 2-4 MERGE, 2-4 RUN, 2-4 SORT, 2-4 switches by, A-13 Function summary, SORT/MERGE, A-I Functions, A-I collate, 3-16 Getting started with SORT/MERGE, 1-1 Global switches, 3-1 HELP function, 2-4 /HELP switch, 2-4, A-6 How to use SORT/MERGE, 2-1 /INDUSTRY switch, 3-24, A-6 Information needed to sort files, 2-2 Introduction, 2-1 Key, Glossary-2 Key collating order, 3-5 Key data types, 3-5 Key length, 3-5 determining, 1-2 Key position, determining, 1-2 Key sign status, 3-8 /KEY starting position, 3-4 /KEY switch, 3-3, A-6 /KEY switch format, 3-4 Keys, sorting on two, 1-6 Label, Glossary-2 /LABEL switch, 3-24, A-7 /LABEL switch arguments, 3-24 /LEAVES switch, 3-20, A-7 Length, determining key, 1-2 determining record, 1-2 key, 3-5 Line-sequence numbers in file, 2-3 Line-sequenced file, sorting, 1-6 Local switches, 3-1 Logical record, Glossary-2 Lowercase text, sorting, 1-11 LSCW, FORTRAN random binary with, 4-31 FORTRAN random binary without, 4-33 FORTRAN sequential binary with, 4-35 FORTRAN sequential binary without, 4-37 /MAXTEMP switch, 3-20, A-7 Memory required, 2-2 Memory size, 6-10 calculating, 6-11 MERGE function, 2-4 Merge passes, number of, 6-14 Merge phase, 2-1, 6-3 /MERGE switch, 2-4, A-7 Merging files, 2-5 Message format, 5-1 /MESSAGE switch, 3-21, A-8 Messages, error, 5-2 SORT/MERGE error, 5-1 Mixed-mode binary, Glossary-2 COBOL ASCII, 4-25 COBOL EBCDIC, 4-28 COBOL SIXBIT, 4-27 Mode, ASCII recording, 4-2 BINARY recording, 4-3 EBCDIC recording, 4-2 SIXBIT recording, 4-2 Mode switches, recording, 3-9 Index-3 Modes, recording, 1--14, 4-1 Modified position dependent switches, 3-2 Multifield file, creating, 1-1 sorting, 1-3 Multiline file, sorting, 1-11 INOCRLF switch, 3-14, A-8 Nonalphanumeric data, sorting, 2-4 Nonnumeric data, sorting, 2-4 Nontext files, sorting, 1-12 Number of merge passes, 6-14 N umbers in file, line-sequence, 2-3 NUMERIC data type, 3-5, 3-8 INUMERIC switch, 3-5, A-8 Operation of binary tree, 6-4 IOPTION switch, 3-21, A-8 Order, ASCENDING, 1-4 DESCENDING, 1-4 key collating, 3-5 Overview, performance, 6-1 PACKED data type, 3-6, 3-9 IPACKED switch, 3-6, A-8 IPARITY switch, 3-25, A-9 Passes, number of merge, 6-14 Performance considerations, 6-9 SORT/MERGE, 6-1 Performance overview, 6-1 Phase, merge, 2-1, 6-3 sort, 2-1, 6-2 Physical record, Glossary-2 IPHYSICAL switch, 3-21, A-9 Position, determining key, 1-2 IKEY starting, 3-4 Position dependent switches, 3-2 modified, 3-2 IPOSITION switch, 3-25, A-9 IPRIORITY switch, 3-21, A-9 Program, FSORT, 2-7 Index-4 Random binary with LSCW, FORTRAN, 4-31 Random binary without LSCW, FORTRAN, 4-33 IRANDOM switch, 3-14, A-9 Range, switches by, A-14 Record, Glossary-2 Record length, determining, 1-2 IRECORD switch, 3-3, A-10 Recording mode switches, 3-9 Recording modes, 1-14, 4-1 Records, sorting variable-length, 1-10 Required, memory, 2-2 Required switches, 3-3 Restrictions, FORTRAN-called sort, 2-7 IREWIND switch, 3-26, A-10 Run, Glossary-3 RUN function, 2-4 IRUN switch, 2-4, 3-22, A-10 Running SORT/MERGE, 2-2 SCAN, 2-4 Scratch device, Glossary-3 Segment, Glossary-3 Sequences, collating, B-1 Sequential binary with LSCW, FORTRAN, 4-35 Sequential binary without LSCW, FORTRAN, 4-37 ISEQUENTIAL switch, 3-15, A-10 Sign status, key, 3-8 ISIGNED switch, A-10 SIXBIT, Glossary-3 COBOL fixed-length, 4-13 COBOL variable-length, 4-15 fixed-length, 4-12 variable-length, 4-14 SIXBIT recording mode, 4-2 ISIXBIT switch, 3-10, A-II Size, calculating memory, 6-11 memory, 6-10 tree, 6-9 Sort, Glossary-3 Sort files, information needed to, 2-2 SORT function, 2-4 Sort phase, 2-1, 6-2 Sort restrictions, FORTRAN-called, 2-7 SORT/MERGE, getting started with, 1-1 how to use, 2-1 running, 2-2 starting, 1-3 SORT/MERGE error messages, 5-1 SORT/MERGE from COBOL, using, 2-6 SORT/MERGE from FORTRAN, using, 2-6 SORT/MERGE function summary, A-I SORT/MERGE performance considerations, 6-1 SORT/MERGE switch summary, A-I SORT/MERGE switches, 3-1 Sorting character data, 2-4 Sorting files containing tabs, 1-8 Sorting line-sequenced file, 1-6 Sorting lowercase text, 1-11 Sorting multifield file, 1-3 Sorting multiline file, 1-11 Sorting nonalphanumeric data, 2-4 Sorting nonnumeric data, 2-4 Sorting nontext files, 1-12 Sorting on two keys, 1-6 Sorting uppercase text, 1-11 Sorting variable-length records, 1-10 Specifications, file, 2-5 Stable sort, Glossary-3 Standard binary, Glossary-3 ISTANDARD switch, 3-26, A-II Started with SORT/MERGE, getting, 1-1 Starting position, IKEY, 3-4 Starting SORT/MERGE, 1-3 Status, key sign, 3-8 Summary, SORT/MERGE function, A-I SORT/MERGE switch, A-I ISUPPRESS switch, 3-22, A-II Switch, IAFTER, 3-11, A-2 IALIGN, 3-11, A-2 IALPHA, A-2 IALPHANUMERIC, 1-12, 3-5 IASClI, 1-12,3-9, A-2 IBEFORE, 3-11, A-2 Switch (Cont.), IBINARY, 3-10, A-3 IBLOCKED, 3-12, A-3 ICHECK, 3-15, A-3 ICOLLATE, 3-16, A-3 ICOMPl, 3-6, A-4 ICOMP3, 3-6, A-4 ICOMPU, A-4 ICOMPUTATIONAL, 3-6 ICORE, 3-18, A-4 IDENSITY, 3-23, A-4 IEBCDIC, 3-10, A-5 IERROR, 2-8, 3-19, A-5 IEXIT, 2-4, 3-19, A-5 IFATAL, 2-8, 3-19, A-5 IFIXED, 3-13, A-5 IFORMAT, 3-6, A-6 IFORTRAN, 3-14, A-6 IHELP, 2-4, A-6 IINDUSTRY, 3-24, A-6 IKEY, 3-3, A-6 ILABEL, 3-24, A-7 ILEA VES, 3-20, A-7 IMAXTEMP, 3-20, A-7 IMERGE, 2-4, A-7 IMESSAGE, 3-21, A-8 INOCRLF, 3-14, A-8 INUMERIC, 3-5, A-8 IOPTION, 3-21, A-8 IPACKED, 3-6, A-8 IP ARITY, 3-25, A-9 IPHYSICAL, 3-21, A-9 IPOSITION, 3-25, A-9 IPRIOR.LTY, 3-21, A-9 IRANDOM, 3-14, A-9 IRECORD, 3-3, A-10 IREWIND, 3-26, A-10 IRUN, 2-4, 3-22, A-10 ISEQUENTIAL, 3-15, A-10 ISIGNED, A-10 ISIXBIT, 3-10, A-II ISTANDARD, 3-26, A-II ISUPPRESS, 3-22, A-II ITEMP, 3-23, A-II IUNLOAD, 3-26, A-12 IUNSIGNED, A-12 IVARIABLE, 3-15, A-12 Switch arguments, ICOLLATE, 3-16 ILABEL, 3-24 Switch categories, 3-1 Swi tch format, IKEY, 3-4 Index-5 Switch summary, SORT/MERGE, A-I Switches, A-2 control, 3--15 file, 3-11 global, 3-1 local, 3-1 modified position dependent, 3-2 position dependent, 3-2 recording mode, 3-9 required, 3-3 SORT/MERGE, 3-1 tape, 3-23 Switches by function, A-13 Switches by range, A-14 Tab characters in file, 2-3 Tables, conversion, B-1 Tabs, sorting files containing, 1-8 Tape switches, 3-23 /TEMP switch, 3-23, A-II Text, sorting lowercase, 1-11 sorting uppercase, 1-11 Tree, operation of binary, 6-4 Tree size, 6-9 Index-6 Two keys, sorting on, 1-6 Type, data, 1-13 /UNLOAD switch, 3-26, A-12 /UNSIGNED switch, A-12 Uppercase text, sorting, 1-11 Use SORT/MERGE, how to, 2-1 U sing command files, 2-5 Using SORT/MERGE from COBOL, 2-6 Using SORT/MERGE from FORTRAN, 2-6 IVARIABLE switch, 3-15, A-12 Variable-length ASCII, 4-8 COBOL, 4-9 FORTRAN, 4-10 Variable-length EBCDIC, blocked, 4-22 COBOL, 4-18 Variable-length records, sorting, 1-10 Variable-length SIXBIT, 4-14 COBOL, 4-15 Words in file, control, 2-3 TOPS-10 SORT/MERGE User's Guide AA-M063A-TB READER'S COMMENTS NOTE: This form is for document comments only. DIGITAL will use comments submitted on this form at the company's discretion. If you require a written reply and are eligible to receive one under Software Performance Report (SPR) service, submit your comments on an SPR form. Did you find this manual understandable, usable, and well-organized? Please mae suggestions for improvement. Did you find errors in this manual? If so, specify the error and the page number. Please indicate the type of reader that you most nearly represent. o Assembly language programmer o Higher-level language programmer o Occasional programmer (experienced) o User with little programming experience o Student programmer o Other (please specify)~~~~~~~~~~~~~~~~~~~~~_ Name Date - _ _ _ _ _ _ _ _ _ __ Organization _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Telephone ~_ _ _ _ _ _ __ Street ___________________________________________ City _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __ State ____ Zip Code _____ or Country I I 1 I 1 - -- - - -- t -~-.- _gDOmNotgTear FOa fie,re and Tape --- - - - --- --- - - - -- -- - id -rll-ll1-------- ~~~~;:;~~ -~--: I if Mailed in the United States BUSINESS REPLY MAIL FIRST CLASS PERMIT NO. 33 MAYNARD MASS. POSTAGE WILL BE PAID BY ADDRESSEE SOFTWARE PUBLICATIONS 200 FOREST STREET MR1-2/L12 MARLBOROUGH, MASSACHUSETTS 01752 I I .- - - - - - - - - Do Not Tear - Fold Here and Tape ____________________________________________ 1 I I I I I I I I I I 1 1 I 1 ( I.! I- II 1 I ! C Ie:t I ~ 1.£ I-.! I ";: Ie: I I 1
Home
Privacy and Data
Site structure and layout ©2025 Majenko Technologies