946252 9701B_DX_Sort_Merge_Users_Guide_Dec80 9701B DX Sort Merge Users Guide Dec80

User Manual: 946252-9701B_DX_Sort_Merge_Users_Guide_Dec80

Open the PDF directly: View PDF PDF.
Page Count: 244

Download946252-9701B_DX_Sort_Merge_Users_Guide_Dec80 946252-9701B DX Sort Merge Users Guide Dec80
Open PDF In BrowserView PDF
Model 990 Computer
OX Sort/Merge
User's Guide

Part No. 946252-9701 *8
15 December 1980

TEXAS INSTRUMENTS

© Texas Instruments Incorporated 1977, 1978, 1979, 1980
All Rights Reserved, Printed in U.S.A.
The information and/or drawings set forth in this document and ali rights in and to inventions disclosed
herein and patents which might be granted thereon disclosing or employing the materials, methods,
techniques or apparatus described herein. are the exclusive property of Texas Instruments Incorporated.

MANUAL REVISION HISTORY
Model 990 Computer OX Sort/Merge User's Guide (946252-9701)

Original Issue ... ............................... . 1 August 1977
Change 1 ............... ..................... . 15 March 1978 (ECN 419591)
Revision ........ ............................... . 15 August 1979 (MCR 000134)
Revision ........................................ 15 December 1980 (MCR 000325)

The total number of pages in this publication is 244.

Preface
This manual contains information on the use and operation of the Texas Instruments Sort/Merge
utility. The manual describes the following:
•

Building specification records that define the type of sort or merge

•

Executing Sort/Merge using subroutine calls from FORTRAN, COBOL, Pascal, BASIC,
or assembly language programs

•

Communicating with Sort/Merge interactively and in batch mode

•

Using Sort/Merge specifications (includes examples of specification entry)

Anyone familiar with the operating system file structure and the interactive use of the System
Command Interpreter (SCI) can use the Sort/Merge utility. Sections 1 through 3 of this manual provide an overview of the uses of the utility as well as examples of Simple sorting and merging processes. The remaining sections describe the utility's full range of capabilities. Those sections
that pertain to applications programming and using language programs with Sort/Merge assume
that you have programming experience.
Sort/Merge supports FORTRAN, COBOL, Pascal, TI 990 BASIC, and assembly language programs.
Sort/Merge no longer supports existing interfaces for Scientific and Business BASIC.
The manual contains the following sections and appendixes:
Section

1

Introduction - Describes the capabilities of the Sort/Merge utility and explains the
organization of this manual.

2

Usage Overview - Defines the types of sorts and merges and gives an example of each.
This section also explains the required sequence of the control statements.

3

Simple Sort and Merge Examples - Presents specific examples of two simple sort
operations and one merge operation using a batch stream format.

4

Header Specification - Describes in detail the specification required to perform the
various sort and merge operations and the options provided.

946252·9701

Iii

Preface

5

File Description Specification - Describes the attributes that can be designated for the
output file, work file, and input files used by Sort/Merge.

6

Record Selection Specification - Describes the options provided to select particular
records from the input file according to a specific type of record or by comparing
specific data fields within each record.

7

Reformatting Specification - Describes the criteria by which a file can be sorted or by
which several files can be merged in ascending or descending order using multiple control parameters. This section also explains how to change the order of the various data
fields within each record.

8

Sort/Merge SCI Interface and Execution - Describes the use of the SCI to interactively
specify to Sort/Merge all information required for creating the required control
statements and fi les.

9

External Interface Specifications - Describes each of the subroutines that run the
Sort/Merge utility from a language program.

10

Examples - Presents examples of the use of Sort/Merge by a parts distributing company to update a master inventory file, to record and sort daily entries, and to produce
summary listings.

11

Sort/Merge Structure _. Describes the various internal Sort/Merge modules and how
they interact.

Appendixes

Iv

A

Sort/Merge Messages

B

Alternate Collating Sequence Specifications

C

ASCII Codes

D

EBCDIC Codes

E

Data Types for FORTRAN, COBOL, Pascal, BASIC, and RPG II

F

Estimating Sorting Time

G

Sorting with Many Records or Limited Workspace

946252·9701

Preface

The following TI Model 990 Computer documents contain information related to the Sort/Merge
utility:

Title

Part Number

DX10 Operating System Release 3 Reference Manual:

946252·970'1

Volume I: Concepts and Facilities

946250·9701

Volume II: Production Operation

946250·9702

Volume III: Application Programming Guide

946250·9703

Volume IV: Developmental Operation

946250·9704

Volume V: System Programming Guide

946250·9705

Volume VI: Error Reporting and Recovery

946250·9706

Assembly Language Programmer's Guide

943441·9701

FORTRAN Programmer's Guide

945411·9701

COBOL Programmer's Guide

945412·9701

Pascal Programmer's Guide

946290·9701

BASIC Programmer's Guide

945413·9701

Link Editor Reference Manual

949617·9701

v/vl

Contents
Paragraph

Title

Page

1 - Introduction
1.1
1.2
1.3
1.4
1.5

General ................................................................ 1-1
Coding Requirements .................................................... 1.. 1·
Accessing Sort/Merge ................................................... 1·2
How to Use this Manual .................................................. 1..2
Paragraph Heading Format ............................................... 1·3

2 - Usage Overview
2.1
2.2
2.2.1
2.2.2
2.2.3
2.3
2.3.1
2.3.2
2.3.3
2.4
2.4.1
2.4.2
2.5

2.6
2.7
2.7.1
2.7.2
2.7.3
2.7.4
2.7.5
2.8

General ................................................................. 2·1
Record Fields .......................................................... 2·1
Control Fields ........................................................ 2·1
Data Fields ........................................................... 2·2
Forced Fields ........................................................ 2·2
Types of Sorts (Tag·Along, Summary Tag·Along, and Address·Only) ............. 2·2
Tag·Along Sort ........................................................ 2·3
Summary Tag·Along Sort ............................................... 2·3
Address·Only Sort ........................................•............ 2·4
Types of Merges (Normal and Summary) .................................... 2·4
Normal Merge ........................................................ 2·4
Summary Merge ...................................................... 2·5
Sort/Merge Example ..................................................... 2·5
Program Requirements .................................................. 2·5
Operator/Program Communication ......................................... 2·8
Header Specification .................................................. 2·8
File Description Specification .......................................... 2·12
Record Selection Specification ......................................... 2·12
Reformatting Specification ............................................ 2·12
Order of Specifications ............................................... 2·12
Record Selection and Reformatting ....................................... 2·15

3 - Simple Sort and Merge Examples
3.1
3.2
3.3
3.3.1
3.3.2
946252-9701

General ................................................................ 3·1
Coding the Sort or Merge ................................................. 3·1
First Sort Example ...................................................... 3·3
SM$SMC Statement ................................................... 3·3
SM$H 0 Statement .................................................... 3·3

vii

Contents

Title

Paragraph

3.3.3
3.3.4
3.3.5
3.3.5.1
3.3.5.2
3.3.6
3.3.7
3.4
3.4.1
3.4.2
3.4.3
3.4.4
3.4.5
3.4.6
3.4.7
3.4.7.1
3.4.7.2
3.4.8
3.4.9
3.5
3.5.1
3.5.2
3.5.3
3.5.4
3.5.5
3.5.5.1
3.5.5.2
3.5.6
3.5.7
3.5.8
3.6
3.6.1
3.6.2
3.6.3
3.6.4
3.6.4.1
3.6.4.2
3.6.4.3
3.6.4.4
3.6.5
3.6.6
3.7

SM$OUT Statement ................................................... 3·4
SM$IN Statement ..................................................... 3·4
SM$REF Statements .................. '.' ............................... 3·5
Control Field Specification ........................................... 3·5
Data Field Specification .............................................. 3·5
SM$CLS Statement .................................................... 3·6
XBSM Statement ...................................................... 3·6
Second Sort Example .................................................... 3·6
SM$SMC Statement ................................................... 3·7
SM$HD Statement .................................................... 3·7
SM$OUT Statement ................................................... 3·8
SM$WKF Statement ................................................... 3·8
SM$I N Statement ..................................................... 3·8
SM$SLC Statement .................................................... 3·8
SM$REF Statements ................................................... 3·9
Control Field Specifications .......................................... 3·9
Data Field Specification .............................................. 3·9
SM$CLS Statement ................................................... 3·10
XBSM Statement ...................................................... 3·10
Merge Example ........................................................ 3·10
SM$SMC Statement .................................................. 3·11
SM$H D Statement ................................................... 3·11
SM$OUT Statement .................................................. 3·11
SM$I N Statement .................................................... 3·12
SM$REF Statements .................................................. 3·12
Control Field Specification .......................................... 3·12
Data Field Specification ............................................. 3·12
SM$CLS Statement ................................................... 3·13
XBSM Statement ..................................................... 3·13
Executing Sort/Merge in Batch Mode .................................... 3·13
Beginning Exercise ..................................................... 3·14
Create an Input File ................................................... 3·15
Create a Batch Control Stream File ...................................... 3·16
Execute the Batch Control Stream ...................................... 3·17
Examine the Output .................................................. 3·17
Sort/Merge Control Statement File .................................... 3·18
Sorted Output File .................................................. 3·18
Sort/Merge Messages Listing ........................................ 3·18
SCI Batch Listing .................................................. 3·19
Perform a Merge Operation ............................................ 3·21
Delete the Exercise Files .............................................. 3·21
Summary ............................................................. 3·21

44.1
4.2
4.2.1
vIII

Page

Header Specification

General ................................................................ 4·1
Column Description ................................................. , ... 4·3
Page Number and Line Number (Columns 1 through 5) ...................... 4·3
946252·9701

Contents

Paragraph

4.2.2
4.2.3
4.2.4
4.2.5
4.2.6
4.2.7
4.2.8
4.2.9
4.2.10
4.2.11
4.2.12
4.2.13

Title

Page

Specification Type (Column 6) ........................................... 4·4
SMT - Sort Merge Type [SORTR] (Columns 7 through 12) .................... 4·4
TCL - Total Control Length (Columns 13 through 17) ....................... 4-4
SMS - Sort Merge Sequence [A](Column 18) .............................. 4·5
AS - Alternate Sequence [Blank] (Column 26) ............................. 4·5
PO - Print Option [1] (Column 27) ....................................... 4·6
DCF- Drop Control Fields [X](Column 28) ................................ 4·7
ORL - Output Record Length (Columns 29 through 32) ..................... 4·7
VAR - Variable Length Records [Blank] (Column 33) ........................ 4·8
VO - Verify Option [Blank](Column 34) ................................... 4·8
MS - Memory Size [Blank](Columns 35 to 39) .............. : .............. 4·8
Comments (Columns 40 through 80) ...................................... 4·8

5 - File Description Specification
5.1
5.1.1
5.1.2
5.1.3
5.2
5.2.1
5.2.1.1
5.2.1.2
5.2.1.3
5.2.2
5.2.2.1
5.2.2.2
5.2.2.3
5.2.2.4
5.3
5.3.1
5.3.2
5.3.3
5.4
5.4.1
5.4.1.1
5.4.1.2
5.4.1.3
5.4.2
5.4.2.1
5.4.2.2
5.4.2.3

General ................................................................ 5·1
Synonyms ........................................................... 5·1
Page and Line Numbers (Columns 1 through 5) ............................. 5·1
Specification Type (Column 6) ........................................... 5·1
Output Fi Ie Specification ................................................. 5·2
First Line of Output File Specification .................................... 5·4
File Use (Column 7) .................................................. 5·4
FT - File Type (Column 8) ............................................ 5·4
FP - File Pathname (Columns 9 through 44) ............................. 5·4
Second Line of Output File Specification ................................. 5-4
File Use (Column 7) .................................................. 5·5
LRL - Logical Record Length [Blank] (Columns 8 through 11) .............. 5·5
PRL - Physical Record Length [Blank] (Columns 12 through 15) ............ 5·5
NOLR - Number of Logical Records [Blank] (Columns 16 to 23) ............ 5·5
Work File Specification .................................................. 5·5
File Use (Column 7) .................................................... 5·6
WFT- Work File Type [E) (Column 8) ..................................... 5·6
WFV - Work File Volume [DS01] (Columns 9 through 16) .................... 5·7
Input File Specification .................................................. 5·8
First Line of Input File Specification ..................................... 5·8
File Use (Column 7) .................................................. 5·8
FT - File Type [S](Column 8) ......................................... 5·8
FP - File Pathname (Columns 9 through 44) ............................ 5·10
Second Line of Input File Specification .................................. 5·10
File Use (Column 7) ................................................. 5·10
LRL - Logical Record Length [Blank](Columns 8 through 11) ............. 5·10
NOLR - Number of Logical Records [Blank] (Columns 16 through 23) ...... 5·10

.6 - Record Selection Specification
6.1
6.2
946252·9701

General ................................................................ 6.1
Column Description ..................................................... 6.1
ix

Contents

Paragraph

6.2.1
6.2.2
6.2.2.1
6.2.2.2
6.2.2.3
6.2.2.4
6.2.3
6.2.4
6.2.4.1
6.2.4.2
6.2.5
6.2.6
6.2.7
6.2.8
6.2.8.1
6.2.8.2
6.2.9
6.2.10

Title

Page

Page Numbers and Line Numbers (Columns 1 through 5) .................... 6-1
RST - Record Selection Type [1](Column 6) ............................... 6-2
Include Line ........................................................ 6-2
Include-All-Line ..................................................... 6-4
Omit Line .......................................................... 6-4
Include and Omit Sets ............................................... 6-5
CON - Continuation [Blank] (Column 7) .................................. 6-7
CP - Character Portion [Blank](Column 8) ................................ 6-8
Character Portion Indicators (C, Z, or 0 in Column 8) ...................... 6-9
Signed ASClllndicator(S in Column 8) ................................. 6-11
01 Band 01 E - Operand 1 Beginning and Ending [Blank]
(Columns 9 through 16) .............................................. 6-12
REL - Relational Operator [Blank] (Columns 17, 18) ....................... 6-13
FOC - Field or Constant [Blank](Column 19) ............................. 6-14
Operand 2 Location or Constant [Blank](Columns 20 through 39) ............ 6-14
02B and 02E - Operand 2 Beginning and Ending [Blank]
(Columns 20 through 27) ............................................. 6-14
02 - Operand 2 Constant [Blank] (Columns 20 through 39) ............... 6-15
Comment Lines (Columns 40 through 80) ................................. 6-17
Examples ...........................................' ................ 6-17

7 - Reformatting Specification
7.1
7.2
7.2.1
7.2.2
7.3
7.3.1
7.3.2
7.3.3
7.3.3.1
7.3.3.2
7.3.3.3
7.3.3.4
7.3.4
7.3.4.1
7.3.4.2
7.3.4.3
7.3.4.4
7.3.4.5
7.3.4.6
7.3.4.7
7.3.5
7.3.6
7.3.7
7.3.8

x

General ................................................................ 7-1
Records and Fields ...................................................... 7-1
Control and Data Fields ................................................ 7-1
Field Placement within Reformatting Specification ......................... 7-4
Column Descriptions .................................................... 7-6
Page Numbers and Line Numbers (Columns 1 through 5) .................... 7-7
Line Type (Column 6) .................................................. 7-7
FT - Field Type (Column 7) ............................................. 7-7
Use of Normal and Opposite Control Fields (N or 0 in Column 7) .............. 7-8
Forced Control Field (F in Column 7) ................................... 7-8
Data Fields (0 in Column 7) .......................................... 7-11
Summary Data Fields (S in Column 7) .................................. 7-13
CP - Character Portion [C](Column 8) .................................. 7-14
Character Portion and Data Force (C,Z,D,V,S,I,F,P,U,L, or B in Column 8) .... 7-18
Signed ASCII (S in Column 8) .......................... , .............. 7-19
Signed Integer (I in Column 8) ........................................ 7-19
Floating Point Numbers (F in Column 8) ................................ 7-19
Packed and Unpacked Numeric Data (P or U in Column 8) ................. 7-20
Leading Signed Unpacked Numeric Data (L in Column 8) ................. 7-20
Beginning Signed ASCII (B in Column 8) ............................... 7-22
BL and EL - Beginning and Ending Locations [Blank]
(Columns 9 through 16) .............................................. 7-22
RC - Record Character [Blank](Column 17) .............................. 7-22
SC - Substitute Character [Blank] (Column 18) ........................... 7-23
CON - Continuation [Blank] (Column 19) ................................ 7-23
946252·9701

Contents

Paragraph

7.3.9
7.3.10

Title

Page

OVF - Overflow (Columns 20 through 22) ....................... " ........ 7-23
Specifying an Overflow Indicator Field .......................... " ........ 7-24

8 - Sort/Merge SCI Interface and Execution
8.1
8.2
8.2.1
8.2.2
8.2.3
8.2.4
8.2.5
8.3
8.3.1
8.3.2
8.3.3

General ................................................................ 8-1
Interactive Mode ........................................................ 8-1
Record-Oriented Mode ................................................. 8-1
VDT Mode ........................................................... 8-1
Foreground and Background Processing .................................. 8-2
Interactive Mode Usage ................................................ 8-2
Interactive Prompting .................................................. 8-7
Batch Mode ........................................................... 8-11
Batch Stream Commands ............................................. 8-11
Batch Record Format ................................................. 8-11
Executing Sort/Merge in Batch Mode .................................... 8-13

9 - External Interface Specifications
9.1
9.1.1
9.1.2
9.1.3
9.1.4
9.2
9.2.1
9.2.2
9 2.3
9.2.4
9.2.5
9.2.6
9.2.6.1
9.2.6.2
9.2.6.3
9.2.6.4
9.2.7
9.3
9.3.1
9.3.2
9.3.3
9.3.4
9.4
9.5

946252·9701

General ................................................................ 9-1
Intertask Subprograms ................................................. 9-1
Transmission of Records to and from Sort/Merge ........................... 9-1
Control Statement Criteria .............................................. 9-3
Use of Intertask Communication ......................................... 9-3
Subprogram Usage ...................................................... 9-3
Initialization .......................................................... 9-4
Send Records to Sort/Merge ............................................ 9-5
Receive Records from Sort/Merge ....................................... 9-5
Wait for Sort/Merge Completion ......................................... 9-6
Set Time Delay Count .................................................. 9-7
Linking FORTRAN, COBOL, Pascal, and Assembly Language Programs ........ 9-7
Linking Assembly Language Programs ................................. 9-8
Linking FORTRAN Programs .......................................... 9-8
Linking COBOL Programs ............................................ 9-8
Linking Pascal Programs ............................................. 9-8
Interfacing TI990 BASIC Programs with Sort/Merge ......................... 9-9
Program Examples ..................................................... 9-11
FORTRAN Examples ................................................. 9-11
COBOL Examples .................................................... 9-11
Pascal Examples ..................................................... 9-26
TI990 BASIC Examples ............................................... 9-30
Debug Aid ............................................................ 9-30
Sysgen Requirements .................................................. 9-32

xl

Contents

Paragraph

Title

10 10.1
10.2
10.2.1
10.2.2
10.2.3
10.2.4
10.2.5
10.2.6
10.3
10.3.1
10.3.2
10.3.3
10.3.4
10.4
10.4.1
10.4.2
10.4.3
10.4.4
10.4.5
10.5
10.5.-1
10.5.2
10.5.3
10.5.4

Page

Examples

General ............................................................... 10-1
Example 1: Sort Daily Transaction File ..................................... 10-2
HeaderSpecification ................................................. 10-7
Output File Specification .............................................. 10-8
Work File Specification ............................................... 10-8
Input File Specification ............................................... 10-9
Record Selection Specification ......................................... 10-9
Reformatting Specification ............................................ 10-9
Example 2: Selection of Particular Records ................................ 10-10
Header Specification ................................................ 10-10
File Descriptions .................................................... 10-10
Record Selection Specification ........................................ 10-15
Reformatting Specification ........................................... 10-16
Example 3: Merge Daily File into Cumulative File ........................... 10-19
HeaderSpecifications ............................................... 10-19
File Description Specifications ........................................ 10-22
Record Selection Specification ........................................ 10-22
Reformatting Specification ........................................... 10-22
Entering the Specifications Interactively and in Batch Form ................ 10-22
Example 4: Summary by Part Number ..................................... 10-24
Header Specification ................................................ 10-25
File Description Specifications ........................................ 10-25
Record Selection Specification ........................................ 10-25
Reformatting Specification ........................................... 10-25

11 - Sort/Merge Structure
11.1
11.2
11.2.1
11.2.2
11.2.3
11.2.4
11.2.5
11.2.6

General ............................................................... 11-1
Sort/Merge Modules .................................................... 11-1
Control Statement Compiler Module .................................... 11-4
Record Selection and Reformatting Module .............................. 11-4
Sort Module ......................................................... 11-4
String Merge Module ................................................. 11-5
Record Merge Module ................................................ 11-5
Summary Module ................................ '" ................. 11-5

Appendixes
Appendix

Title

Page

A

Sort/Merge Messages ................................................... A-1

B

Alternate Collating Sequence Specifications ................................ B-1

C

ASCII Codes ........................................................... C-1

xII

946252-9701

Contents

Appendix

Title

Page

o

EBCDIC Codes ......................................................... 0-1

E

Data Types for FORTRAN, COBOL, Pascal, BASIC, and RPG II .................. E-1

F

Estimating Sorting Time ................................................. F-1

G

Sorting with Many Records or Limited Workspace ........................... G-1

Illustrations
Figure

Title

Page

2-1
2-2
2-3
2-4
2-5
2-6
2-7

Example of Sort/Merge Process Showing Printouts of Results of Each Step ...... 2-6
Example of Sort/Merge Process ........................................... 2-7
Methods of Specifying Sort/Merge Control Statements ........................ 2-9
Sort/Merge Specification, Sheet A ........................................ 2-10
Sort/Merge Specification, Sheet B ........................................ 2-11
Typical Specification Sequence for a Sort .................................. 2-13
Typical Specification Sequence for a Merge ................................ 2-14

4-1
4-2

Header Specification Format .............................................. 4-1
Inserting Additional Lines ................................................ 4-5

5-1
5-2
5-3
5-4
5-5
5-6

File Description Specification ............................................. 5-2
First Line of Output File Specification ...................................... 5-4
Second Line of Output File Specification ................................... 5-5
Work File Specification .................................................. 5-6
First Line of (nput File Specification ....................................... 5-8
Second Line of Input File Specification .................................... 5-10

6-1
6-2
6-3
6-4
6-5
6-6
6-7
6-8
6-9
6-10
6-11
6-12
6-13
6-14
6-15

Record Selection Specification ............................................ 6-2
Zone and Digit Portions of ASCII Characters ................................ 6-10
Example of Specifying Signed ASCII Value ................................. 6-12
Example of Operand 1 and Operand 2 Entries ............................... 6-14
Example of Field and Constant Entries .................................... 6-15
Example of Operand 2 Field and Constant .................................. 6-16
Example of Operand 2 Constants ......................................... 6-16
Example of Multiline Constant Field ...................................... 6-16
Unpacked Constant Coding for Negative Values ............................ 6-17
Packed, Unpacked, and Signed ASCII Sort Specifications ..................... 6-18
Include Set Example .................................................... 6-18
Omit Set Example ...................................................... 6-19
Example of Include and Omit Set Mixed .................................... 6-19
Example of Omit and Include-All Set ...................................... 6-20
Example of Include Set with AND/OR Combination .......................... 6-20

7-1
7-2
7-3
7-4

Example of Specifying Normal and Opposite Order Sequencing ................ 7-8
Conditional Force Example .............................................. 7-10
Example of a Force-All Force Following Conditional Forces ................... 7-10
Example of Unconditional Force .......................................... 7-12

946252·9j701

xIII

Contents

Figure

Title

Page

7-5
7-6
7-7
7-8
7-9
7-tO
7-11

Example of Forced and Unforced Data Fields ............................... 7-13
Example of Summary Data Fields ......................................... 7-14
Specifying Signed ASCII Control Field ..................................... 7-20
Specifying Integer Control Fields ......................................... 7-21
Specifying Floating Point Control Fields ................................... 7-21
Specifying Beginning Signed ASCII Control Fields .......................... 7-23
Example of Overflow as Specified in Columns 20 through 22 .................. 7-24

8-1
8-2
8-3
8-4
8-5
8-6

SCI Interaction with Sort/Merge ........................................... 8-3
Sample Record-Oriented Mode Prompts .................................... 8-4
Sample VDT Mode Prompts ............................................... 8-4
Interactive Options - No Control File Creation .............................. 8-7
Order of Interactive Prompting for Control File Creation ....................... 8·8
Typical Interactive Prompt and Response Sequence for Building
Control Specification File .............................................. 8-9
Example of Entries to Create a Batch File and Execute Sort/Merge ............. 8-13

8-7

9-8
9-9
9-10
9-11
9-12
9-13

External Communication to Sort/Merge ..................................... 9-2
Flowchart of FORTRAN Program that Sends Records to Sort/Merge ............ 9·12
FORTRAN Program Calls Sort/Merge, Calling Program Sends
and Receives Records ................................................ 9·13
FORTRAN Program Calls Sort/Merge, Inputs Files from Disk,
and Outputs Files to Calling Program .................................... 9-14
COBOL Program Calls Sort/Merge, Inputs Files from Disk,
and Outputs Files to Disk .............................................. 9-16
COBOL Program Calls Sort/Merge, Inputs Files from Calling Task,
and Outputs Flies to Disk .............................................. 9-17
COBOL Routine that Executes Sort/Merge on Relative Record
File Containing More Than 65,536 Records ............................... 9-21
Comparison of 990 COBOL Calling Sort/Merge and ANSI COBOL SORT Verb .... 9-24
CALL Verb Combinations ................................................ 9-25
Pascal Program Calls Sort/Merge to Input and Output Files from Disk .......... 9-26
Pascal Program Calls Sort/Merge to Input and Output Files from Calling Task .... 9-28
BASIC Program Calls Sort/Merge to Input and Output Files from Calling Task .... 9-31
BASIC Program Calls Sort/Merge to Input and Output Files from Disk ........... 9-33

10-1
10-2
10·3
10-4
10-5
10-6
10-7
10-8
10·9
10-10
10·11
10·12

Inventory Example ..................................................... 10-3
Example 1, Specifications Sheets and Listing Output ........................ 10-4
Input, Work, and Output File Records ..................................... 10·11
Example 2, Specifications Sheets ........................................ 10-12
Selection for Reformatting and Resulting Reformatted Record Format ......... 10-17
Printout and Output File ................................................ 10-18
Example 3, Specifications Sheets ........................................ 10-20
Interactive Control Stream Example ...................................... 10-23
Batch Control Stream Example .......................................... 10-24
Summary Record Format ............................................... 10·25
Example 4, Specifications Sheets ........................................ 10·26
Example Output from Summary Sort ..................................... 10·28

11-1
11-2

Flow Diagram of Sort Operation .......................................... 11-2
Flow Diagram of Merge-Only Operation .................................... 11-3

9-1
9-2
9-3
9-4
9-5
9-6
9-7

xlv

946252·9701

Contents

Tables
Table

Title

Page

3-1

Batch Stream Commands and Use ......................................... 3-2

4-1

Header Specification Column Summary .................................... 4-2

5-1
5-2
5-3

Output File Specification Column Summary ................................. 5-3
Work File Specification Column Summary .................................. 5-7
Input File Specification Column Summary .................................. 5-9

6-1
6-2
6-3
6-4
6-5

Record Selection Specification Column Summary ............................ 6-3
Columns 6 and 7 Entries for Include Sets .................................... 6-6
Columns 6 and 7 Entries for Omit Sets ...................................... 6-6
Include Set Combinations of Specification Lines ............................. 6-7
Omit Set Combinations of Specification Lines ............................... 6-7

7-1
7-2
7-3

Reformatting Specification Column Summary ............................... 7-6
Possible Column 8 Entries for Column 7 Entry .............................. 7-16
Possible Column 7 Entries for Column 8 Entry .............................. 7-17

8-1
8-2

Interactive Prompts and Responses for Control File Generation ................ 8-5
Batch Stream Commands and Use ........................................ 8-12

10-1

Sign Relationship ...................................................... 10-2

946252-9701

xv/xvi

1
Introduction
1.1

GENERAL

The Texas Instruments Sort/Merge utility operates under the OX operating system. This utility can
sort one file or merge from two to five sorted files into a single file according to criteria specified
by the user. The Sort/Merge utility can perform the following functions:
•

Sort input file records into a specified sequence.

•

Merge records of sorted input files.

•

Select particular input file records to be included in the output file.

•

Rearrange the order of the data fields within the records that are in the output file.

•

Place specified characters, such as a dollar sign or a blank space, between data fields.

•

Select particular data fields according to arithmetic values or constants.

•

Sum numeric data fields and summarize alphabetic data fields.

Sort/Merge does not modify the contents of the input files. Instead, sequenced records are written
to a separate output file. In the performance of a sort, Sort/Merge uses an input file, a temporary
work file, and an output file. In a merge process, two to five input files, no work file, and one output
file are involved.
1.2

CODING REQUIREMENTS

The Sort/Merge utility uses column-oriented specifications contained in a control file or an application program to process sort and merge operations. You can prepare the required code in one
of the followi ng ways:
•

Prepare a control file that contains all of the necessary specifications arranged in the required order and ali~!l!d in the..Rro,e~r."99~!!l.Q~.

•

Use the System Command Interpreter (SCI) to interactively specify to Sort/Merge the
pathnames, values, and options in response to field prompts. Sort/Merge builds the control file from these responses.

•

Prepare a batch stream containing the control file commands and keyword parameters
that will create the control file.

•

Prepare an application program containing control statements that are passed to
Sort/Merge by the executing task using predefined subroutines.

946252·9701

1·1

Introduction

You must specify the Sort/Merge commands in the control file in a particular sequence. To aid you
in organizing the information that must be specified, a Sort/Merge Specification worksheet is
used throughout this manual. The worksheet is divided into four major categories of specifications, each of which is described in a separate section of the manual.

. 1.3

ACCESSING SORT/MERGE

You can execute Sort/Merge as a utility or from a user program written in assembly language,
FORTRAN, COBOL, Pascal, or BASIC. When executed as a utility, Sort/Merge processes userentered control statements and handles its own input/output (I/O). When Sort/Merge is executed
from a language program, the CALL statement construct is used, and control statements and/or
data records are passed between task and Sort/Merge.

1.4.

HOW TO USE THIS MANUAL

The first three sections of the manual provide a beginning user with the information necessary to
perform simple sort and merge operations. Section 3 contains batch control stream examples that
can be modified with pathnames and parameters to fit specific user requirements.
All users of Sort/Merge should read the paragraph in Section 2 entitled Record Selection and
Reformatting. The combining of sets of file selection, record selection, and reformatting
specifications is a concept that must be thoroughly understood to take full advantage of the
capabilities of Sort/Merge.
Sections 4 through 7 present all of the required and optional specifications that can be designated
for a sort or merge operation. Tables in each section list the possible options, suggested
keywords, and default values. Read these sections to become familiar with the options provided
so that this information can be located when needed.
Section 8 explains the use of the SCI to enter the necessary specifications so that Sort/Merge can
build the control file needed for processing. This section also gives details on executing
Sort/Merge in batch mode.
.
If you intend to access Sort/Merge from a language program, read Section 9 and Appendix E,
which contains a listing of the data types.

1-2

946252·9701

Introduction

1.5 PARAGRAPH HEADING FORMAT
The format of the paragraph headings in Sections 4 through 7 is a summary of information for each
specification, as shown in the following example:

1

. . - - - - - - - - DEFAULT VALUE

5.4.1.2 'FT-

PARAGRAPH
NUMBER
SUGGESTED
BATCH
KEYWORD

=rl

FILE TYPE

L

C ~b[51.f~~ATION

'[81 (Column 8) .

INTERACTIVE PROMPT

(A)135616A

The example is the heading for the paragraph describing the Input File Type specification. The
suggested batch keyword is an abbreviated form of the interactive prompt. The default value,
shown in brackets, is used if a carriage return is entered from a keyboard or no parameter is
specified in the batch stream. The applicable column numbers for coding on the specification
sheet are shown in parentheses. This formatting convention allows you to use the Table of Contents as a quick-reference summary of this information.

946252·9701

1-3/1-4

2
Usage Overview'
2.1

GENERAL

The following paragraphs define the different types of sort and merge operations and briefly
explain the ways in which fields control and manipulate data. An example of a typical application
of Sort/Merge is presented, illustrating how to combine sort and merge processes. The remainder
of the section describes the information specified under each of the four specification groups.
The Sort/Merge Specification worksheet is helpful in organizing this information. You should
examine the worksheet until you are familiar with the order in which the specifications are
entered; however, you need not memorize column numbers unless you intend to code the control
file instead of using a batch stream or the SCI to build it for you.

2.2

RECORD FIELDS

A record is a group of related data that is treated as one unit by Sort/Merge. The fields, or columns
of data, in the input records are important in the sort and merge processes. Sort/Merge uses fields
to select records that are to be included in the sort or merge operation, to reformat the records by
including only particular fields or rearranging the order of the fields, and to control the sequence
in which the records occur in the output listing.
Sort/Merge views an input record as a collection of fields that comprise one or more contiguous
character positions of the input record. Generally, you would format records that contain the same
type of information so that each contains the same kind of data in the same field positions, beginning and ending on the same column pOSitions. However, you can place common data fields in different character positions in different sets of records and use record selection and reformatting
specifications to process the records as if they had the same format.
One file can contain many different types of records that have different formats. You can use a
particular field to uniquely identify each type of record. Also, you can force a character (a 1 for example) before records having one format and another character before records having a different
format. You can then specify to Sort/Merge that records identified by one character be treated differently than records identified by another character (or characters).
The contents in specified fields can be read by Sort/Merge and used to process the records in
various ways. Sort/Merge can select certain records for processing and omit others, depending
upon the contents of a specific field. It can also rearrange selected fields for each record in the
output file. The ascending or descending sequence of entire records in the output file is determined by the selection of one or more of the fields within the records.
2.2.1 Control Fields
A controll field is the set of data that Sort/Merge places in numeric or alphabetic order. The control
fields determine the final sequence of records in the work and output files. Two or more control

946252·9701

2-1

Usage Overview

fields can give a hierarchical structure to the sorted output. The sequencing can be compounded
by ordering one control field in one sequence (ascending or descending) and another control field
in the opposite sequence.
2.2.2

Data Fields

A data field contains characters that are not used for sequencing. These fields comprise the tagalong portion of the input records that are included with the control fields in the work file and may
be included in the output file, depending upon your specifications.
2.2.3

Forced Fields

A character that is not in the input record can be forced into a particular record position or
substituted for another character when the record is placed in the work file. The forced character
appears in the work file as an additional character at the beginning or end of a record or between
fields. More than one character may be forced, but each one is considered a separate forced field
that has a field length of one character. A forced field can be used as a data field or as a control
field. You can use a forced field to perform a simple function, such as inserting a dollar sign in the
output file, or to perform complex functions, such as selecting various sets of different types of
records according to a forced field identifier. Forced fields are described in detail in Section 7.

2.3

TYPES OF SORTS (TAG-ALONG, SUMMARY TAG-ALONG, AND ADDRESS-ONLY)

The three types of sorts are as follows:
•

Tag-along sort -

•

Summary tag-along sort - This sort is the same as a tag-along sort except that certain
data fields are summed, showing only the total of the values found in that data field.

•

Address-only sort - Fields from the input records are not placed into the output file; instead, the output file consists of the relative record numbers of the input records after
they have been sorted according to the sequence specifications.

Data fields tag-along with the control fields in an output record.

For the following descriptions of these three types of sorts, assume that a file contains input
records that have only two fields, names of buyers and the amounts they purchased on account.
The names could be used as the control field for sequencing and the amounts purchased could be
the tag-along data field. The file has the following entries:

NAME (CONTROL FIELD)
RELATIVE
RECORD NU M BE R

AMOUNT PURCHASED
(DATA FIELD)

1

2
3
4
5

SMITH
DOE
GREEN
DOE

25
40
60

BAKER

75

10

INPUT
FILE

(A)135613A

2-2

946252·9701

Usage Overview

2.3.1

Tag-Along Sort

Suppose the following criteria is entered on the specification sheets:
•

Sort alphabetically by name. (Essentially, this is a sort by the numerical sequence of the
ASCII code used to make up the characters.)

•

Include data only for Smith, Green, and Baker.

A tag-along sort can include only control fields, only data fields, or both in the output records, as
shown below:

75

BAKER

75

GREEN

60

GREEN

60

SMITH

25

SMITH

25

BAKER

(A) BOTH CONTROL
AND DATA FIELDS

(B) CONTROL FIELD
ONLY

OUTPUT
FILES

(C) DATA FIELD ONLY

(A) 135614

If both are included, the control fields precede the data fields (that is, control fields are on the left,
and data fields are on the right). However, if you want the data fields to appear first or to be intermixed with the contents of control fields, the control fields must also be defined as data fields.
The control fields are then dropped when the output file is written. Only the data fields that are to
be in the output records are specified and organized in the order desired. This organization of data
fields is accomplished through the control specifications.
2.3.2

Summary Tag-Along Sort

The summary tag-along sort can include the following combinations of fields:
•

Control fields only

•

Summary data fields only

•

Summary data fields and data fields

•

Summary data fields, control fields, and data fields

In a summary tag-along sort, data fields may be summed. For instance, the input file example
shows two entries for the name Doe. A summary sort of this file with the dollar amounts to be summed according to each name produces an output file such as the following, which contains both
control and data fields:
BAKER

75

DOE

50

GREEN

60

SMITH

25

(A) 135615

946252·9701

2-3

Usage Overview

Only one Doe entry appears, showing the sum of the dollar amounts in the input records. In this
case, the dollar amount fields were designated as summary data fields.
If you do not include a summation field specification, the output file consists of records with
unlike control fields. Sort/Merge deletes all records with common control fields, retaining only
one copy of each unique record sequence.
2.3.3 Address-Only Sort
In an address-only sort, fields in the input file are not copied into the output file. The output file
contains four-byte records that specify the relative record numbers of the sorted file, according to
the sequence specifications. Input records are reformatted and entered into the work file for
sequencing. Part of their format includes the relative record number of the file. After the sort,
these relative record numbers are placed in the output file in the sequence resulting from the sort.

For example, the tag-along sort example in this section sorts names and dollar amounts according
to the alphabetical order of the names (control field). Only the data for Smith, Green, and Baker is
included. If an address-only sort is designated using the same control specifications, the following output file results:

5
3

(A)135617

2.4

TYPES OF MERGES (NORMAL AND SUMMARY)

Sort/Merge can process two types of merge operations: normal and summary.
2.4.1

Normal Merge
In a normal merge, the output is composed of fields from the input records. The merged records
can contain the following:

•

Control fields only

•

Data fields only

•

Control fields and data fields

The sequence specifications for the merge determine the type of output produced. When the output file records contain both control fields and data fields, all of the control fields precede all of
the data fields in an output file record.

2-4

946252·9701

Usage Overview

2.4.2

Summary Merge

In a summary merge, the merged (output) records can contain the following:
•

Control fields only

•

Summary data fields only

•

Summary data fields and data fields

•

Summary data fields, control fields, and data fields

A summary merge produces the same results as a summary sort.

2.5

SORT/MERGE EXAMPLE

The following is an example of a store with two departments, each keeping its own records on
amounts sold to each customer. Sales are entered into the computer daily. The resulting files are
shown at the top of Figure 2-1. At the end of each month, a list is prepared to show the accounting
department the total amount to bill each customer. Figure 2-2 shows this process in three steps:
1. Sort each file into alphabetical order; reformat the data so that the name is the first field
in the records.
2.

Merge the two files into one file in alphabetical order.

3.

Summary sort the merged file; sum the dollar amounts and show the total purchased by
each customer. Force a dollar sign before the total amount purchased.

As an alternative to steps 2 and 3, you can execute a summary merge. (The merge and summary
sort in Figure 2-2 are shown as an example only.) When restocking of the store's inventory is
necessary, you can execute a summary sort of the merged file in step 3 to show the total sold for
each part. Similarly, you can determine buying trends by producing a report that gives a summary
of the parts used by customers.

2.6

PROGRAM REQUIREMENTS

To sort a file or merge several files, Sort/Merge requires program control statements that indicate
the following:
•

Pathname of the fi le(s) to be sorted or merged

•

Size and type of fi les for the sort or merge

•

Records to be included in the sort or merge (all others are rejected)

•

Input record fields to be included in the output records

•

Order of the fieldse(left to right) in the output records

946252-9701

2-5

Usage Overview

DEPARTMENT B SALES FOR MONTH
FILE: MONTH.DEPTB

DEPARTMENT A SALES FOR MONTH
FILES MONTH.DEPTA

6 7

11

8 9

12

6 7

40 •
NAME

1 000- 1
3000-1
2000-1
5000-1
4000-1

10
10
20
20
20

BAKER
CHARLES
ABLE
CHARLES
BAKER

100
300
400
1000
350

PART NO.
7000-1
8000-1
2000-1

ORIGINAL
INPUT

11

8 9

QTY
5
40
10

12

I I
TOTAL

40
NAME

AMT
350
400
200

ABLE
DOGGER
BAKER

STEP 1: SORT BOm FILES INTO
ALPHABETICAL ORDER. REFORMAT DATA
SO THAT NAME IS THE FIRST FIELD.

ABLE
BAKER
BAKER
CHARLES
CHARLES

"

2000-1
1000-1
4000-1
3000-1
5000-1

20
10
20
10
20

ABLE
BAKER
DOGGER

400
100
350
300
1000

,.
ABLE
ABLE
BAKER
BAKER
BAKER
CHARLES
CHARLES
DOGGER

2000-1 20
7000-1
5
1000-110
2000-1 10
4000-1 20
3000- 1 10
5000-1 20
8000-1 40

"

7000-1
5
2000-1 10
8000-1 40

350
200
400

STEP 2: MERGE BOTH FILES INTO
ONE FfLE.

400
350
100
350
200
300
1000
400

NOTE: STEPS 2 AND 3
SHOWN HERE ARE EXAMPLES.
BOTH CAN BE REPLACED BY
A SUMMARY MERGE.

STEP 3: SUMMARIZE TOTAL MONTHLY
SALES FOR EACH CUSTOMER. FORCE
A DOLLAR SIGN IN FRONT OF THE
AMOUNT PURCHASED •

.'
ABLE
BAKER
CHARLES
DOGGER

$

750

.~

400

$ 650
.$1 300

(A)1356048

Figure 2-1.
2-6

Example of Sort/Merge Process Showing Printouts of Results at Each Step
946252-9701

Usage Overview

MONTH. DEPTA

SORT

MONTH. DEPTB

STEP 1 :
SORT DEPARTMENT A
BY CUSTOMER NAME

STEP 1:
SORT DEPARTMENT B
BY CUSTOMER NAME

SALES.DEPTA

SORT

SALES.DEPTB

MERGE

STEP 2. :
MERGE DEPARTMENT A AND
DEPARTMENT B CUSTOMER DATA
INTO ONE SORTED FILE

SALES.DEPTAB

SUMMARY
SORT

STEP 3:
SUMMARY SORT SALES FIELD TO SHOW
TOTAL AMOUNT TO BILL CUSTOMER

SALES. TOTALS

PRINTOUT OF CUSTOMERS IN ALPHABETICAL ORDER SHOWSTOTAL AMOUNT TO
BILL EACH

(A)135605A

Figure 2-2.
946252·9701

Example of Sort/Merge Process

2-7

Usage Overview

•

Fields that should be summed. (Values in a specific field are added together and a total
is output.)

•

Characters that are to be placed (forced) into specific locations of the output records
(which characters and which positions)

•

Characters to be added to the records to control the sort or merge process (but not
necessarily included in the output records)

•

Sequence of data fields: ascending or descending

•

Data or messages to be pri nted

•

Whether to perform a sort that does not output data records but merely gives the record
number sequence in the output file (address-only sort).

Although this list does not encompass all of the control statements that you can specify for a sort
or merge, it is a representative sample of such statements.
2.7

OPERATOR/PROGRAM COMMUNICATION

You can provide Sort/Merge with the required control statements in any of the following ways (as
shown in Figure 2-3):
•

Through the SCI, which interprets interactive and batch commands, bids (executes)
Sort/Merge, and passes control statements to Sort/Merge

•

Through
ing task
returned
COBOL,

•

By executing the Sort/Merge task and specifying the pathname of a file or physical
device that contains the control statement specifications

separate tasks that bid Sort/Merge and pass control statements to it. (The callcan also send records to Sort/Merge and can receive the processed records
from Sort/Merge. These tasks can be written in assembly language, FORTRAN,
Pascal, or BASIC.)

Control statements define the Sort/Merge process; they are provided to Sort/Merge in the order in
which they appear on the specification sheets shown in Figures 2-4 and 2-5. The order is as
follows:

2.7.1

•

Header Specification -

Section 4

•

File Description Specification -

•

Record Selection Specification -

•

Reformatting Specification -

Section 5
Section 6

Section 7

Header Specification

This specification describes the type of sort or merge, the iength of the output records, and other
program requirements (such as sequencing in ascending or descending order and whether to output messages during the sort or merge process).
2-8

946252·9701

Usage Overview

SYSTEM
COMMAND
INTERPRETER
(SCI)

BATCH
INPUT

SORT/MERGE

CASSETTE

IINTERACTIVE
DEVICE

TEXT EDITOR

CONTROL
STATEMENTS

CARDS

CONTROL
STATEMENTS

LANGUAGE
PROGRAMS

(A) 1 35606A

Figure 2-3.

946252-9701

Methods of Specifying Sort/Merge Control Statements

2-9

Usage Overview

SORT/MERGE SPECIFICATIONS, SHEET A

Header Specification

Mt"!4t!

MLHGt

L.UlW'i1

MEHGES

()f

futdi

COlltrol

Mt~,,\or

50ft

SOHfA

Recol(j

SORTR

IHyles)

y

Work SPd""

SOR TRS

(CoIUf1I1!,)

40

III

/)

J

File Description Specifications
OUTPUT

FILE

Comments

(Column~

4S

to

17)

WORK FILE

Comments

(Columns

17

to

SOl

INPUT FILE

Comments

(Columns 45

10

721

(A) 135607

Figure 2-4.
2-10

Sort/Merge Specification, Sheet A
946252·9701

Usage Overview

SORT/MERGE SPECIFICATION, SHEET B
1 2

Page

OJ

Record Selection Specification
Operand 1

Location
From
3

4

1

4

1

5

5 6 7 8

9

Op!1rand 2 (Field or Constant

ReI.
EO
NE
LT
GT
LE
GE

52 14---------

...

To

Location

From

To

10 11 12 13 14 15 16 17 18 19 20 21 22 23

I
I

Comments

I Constant
I
1

24 25 26 27128 29 30 31 32 33 34 35 36 37 38 39

(Columns 40 to 721

I

1 6
1

7

I

1 8

,

9

2 0
2

1

2

2

2

3

I
I
I

I
I

I

2 4

I

I

2 5

I

I
1

2 6

Reformatting Specification
Forced

Line

~.---

~~

i

e;

Number

c.
>

t-

i~
wO

:~ ~
1- ~

3 4

5 6

'1

~

~
~
2

<5 u

0>

"C

Location
From

To

~ "
a:

!

c:
0

.,

"c:
.~

Overflow

Reserved

Comments

u

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 36 37 38 39

(Columns 40 to 72)

2 7

2 B

2 9
3 0
3 1

3 2

3 3
3 4
3 5
3 6
3

7

3 8
3 9
4 0

1356013

Figure 2-5.
946252·9701

Sort/Merge Specification, Sheet B
2-11

Usage Overview

2.7.2 File Description Specification
This specification describes the three different files used in a sort or merge operation:

•

The output fi Ie is the fi Ie that contai ns the records after they have been processed into
the specified sequence and format.

•

The work file is the file on which strings of sorted records are temporarily stored until
the record selection process is complete. The work file is then used to combine the
strings of sorted records.

•

The input file(s) is the file to be sorted or merged. A merge is performed on from two to
five sorted input files.

Input and output files may be sequential, relative record, or key indexed.

NOTE

Relative record files sometimes contain unused records set aside
for future expansion. You should omit these unused records during
the Sort/Merge process to avoid wasting disk space.

2.7.3 Record Selection Specification
The entries on this sheet describe which records in the input file(s) are to be included or omitted
during the Sort/Merge process. Specific ASCII characters found in specific positions (fields) of the
input file records determine the record selection. You can check fields against other fields in the
same record to determine record selection, or you can compare a field to a string of constants.
Besides providing the identifying characteristics of the desired records, this specification further
specifies whether the records identified are to be included in the output file.
2.7.4 Reformatting Specification
The Reformatting Specification designates which record fields are to be summed, how the input
record fields are to be ordered in the output records, the sequencing of individual fields, and the
characters to be forced into output record positions or substituted for other characters. It also
states which fields are to be treated as signed ASCII, integer, or floating pOint.
2.7.5 Order of Specifications
You must input the four specifications to Sort/Merge in a specific order. Input the Header
Specification first, followed by the File Description, Record Selection (if used), and Reformatting
Specifications.

Figure 2-6 shows the typical specification sequencing for a sort. Three sets of Record Selection
and Reformatting Specifications are used because each of the record types selected by the
Record Selection Specifications requires different formatting for the fields within the records. If
all of the records in the file are to be included in the sort, the Record Selection Specification is not
necessary and you can describe the formatting using only one group of Reformatting Specifications. Note that in a sort operation, only one input file, is described in the File Description
Specification (that is, only one file can be sorted at a time); however, from two to five files can be
merged in a merge operation.

2·12

946252-9701

Usage Overview

HEADER SPECIFICATION
OUTPUT FILE
FILE
DESCRIPTION
SPECI FICATION

WORK FILE
INPUT FILE

RECORD SELECTION SPECIFICATION NO.
REFORMATTING SPEC I FICATION NO.

1

RECORD SELECTION SPECIFICATION NO.

REFORMATTING SPECIFICATION NO.

2

2

RECORD SELECTION SPECIF ICATION NO.

REFORMATTING SPECIFICATION NO.

1

3

3

(A)135609

Figure 2-6.

Typical Specification Sequence for a Sort

Although a sort or merge operation has only one Header Specification and one File Description
Specification, the number of Record Selection Specifications and Reformatting Specifications
can vary. Record Selection Specifications and Reformatting Specifications are specified in
groups unless all of the records in the file are to be sorted or merged. In the latter case, only a
Reformattiing Specification is required; this is called an implied include-all sort or merge.
Figure 2·7 shows the specifications required for a typical merge procedure. Note at the bottom of
the figure that different input files have their records selected by the same Record Selection
Specification and corresponding Reformatting Specification. However, Input File 2 (in the center
of Figure 2-7) is merged according to a selection of records specified in two different Record
Selection Specifications and their accompanying Reformatting Specifications.

946252-9701

2-13

Usage Overview

HEADER SPECIFICATION
SAME FOR ALL
INPUT FILES
FILE
DE S CR I PT ION
SPECIFICATION

OUTPUT FILE
WORK FILE

FILE
DESCRIPTION
SPECIFICATION

INPUT FILE NO.

1

RECORD SELECTION SPECIF ICATION NO.
REFORMATTING SPECIFICATION NO.

FILE
DESCRIPTION
SPECIFICATION

1

1

INPUT FILE NO.

2

RECORD SELECTION SPECIFICATION NO.
REFORMATTING SPECIFICATION NO.

2A

2A

RECORD SELECTION SPECIFICATION NO.

FILE
DESCR IPT ION
SPEC IFICATION

INPUT FILE NO.

28

3

INPUT FILE NO.4

RECORD SELECTION SPECIFICATION NO.
REFORMATTING SPECIFICATION NO.

INPUT FILE NO.2
RECORD SELECTION
AND REFORMATTING

28

REFORMATTING SPECIFICATION NO.

FILE
DESCRIPTION
SPECIFICATION

INPUT FILE NO. 1
RECORD SELECTION
AND REFORMATTING

INPUT FILES NO.3
AND 4 RECORD
SELECTION AND
REFORMATTING

3.AND 4

3 AND 4

(A)135610A

Figure 2-7.

2-14

Typical Specification Sequence for a Merge

946252-9701

Usage Overview

2.8

RECORD SELECTION AND REFORMATTING

The following procedure is an example of how the Sort/Merge program processes the records in a
file.
1.

Sort/Merge reads a record from the input file:
5

I

I

CONTROL
FIELD A

•

6

DATA

I

CONTROL
. FIELD B •

I

•

(A)135661

2.

Sort/Merge checks the Record Selection Specifications to see if this record is to be included in the sort or merge. (You might not want to sort or merge all of the records in the
file.)

3.

If the record is to participate in the sort or merge, Sort/Merge builds a work record, formatting it according to the Reformatting Sequence Specifications. (The format of the
work record is important because it controls the format of the output record.) The Reformatting Specifications might specify the following:

a.

Put the contents of positions 27-30 of the input record into the first available positions (1-4) of the work record.

b.

Put the contents of positions 1-5 in the input record into the next available positions (5-9) of the work record.

c:.

Put the contents of positions 6-26 in the input record into the next available positions (10-30) of the work record.

The resulting work record would look like this:
9

~ONTROL

I
_

FIELD B

I
.

CONTROL
FIELD A

10

DATA

(A)135612

Control fields that are not dropped always precede data fields in the work and output
records. To specify dropping control fields from output records, enter an X in column 28
of the Header Specification.
4.

Sort/Merge checks the sequence specifications to see how to arrange the records in the
output file (ascending or descending order by control fields) and writes the records to
the work file in sorted strings.

5.

Sort/Merge writes the records to the output file in the order specified. The only exception occurs when control fields are dropped from the output record.

946252·9701

2-15/2-16

3
Simple Sort and Merge Examples
3.1

GENERAL

The Sort/Merge program is a powerful, general-purpose utility that provides many different
options. Optimum use of the utility requires familiarity with these options.
Until you have become familiar with the specifications required to perform more complex operations, you can use the examples presented in this section to quickly sort or merge data file
records. These examples show two simple sort operations and a simple merge operation and
describe how to modify them for general use.
If you are not an experienced programmer, read through the material presented in this section,
then perform the exercise near the end of the section.

3.2

CODING THE SORT OR MERGE

The following sort and merge examples are in batch control stream format. You can modify the
values, column locations, and pathnames (file names and device names) to specify the parameters
and pathnames appropriate for your application and system. In all examples, you can replace the
device names (such as OS01 or OS02) with volume names. Use the Text Editor to create a sequential file to contain the batch control stream. Enter the batch control stream statements in the exact
order given in the examples. The pathname that you assign to this file is the pathname you will use
with the Execute Batch (XB) command to execute the batch control stream. The procedure for executing the batch control stream is presented in a paragraph following the examples.
Table 3-1 lists and explains the command statements used in the examples. Some of the command statements are optional and are excluded, when appropriate, from the batch streams in the
examples. Table 3-1 contains all of the Sort/Merge command statements in the order in which they
must be entered, if used, when creating a batch control stream.
If a command statement is included in the batch stream, it may be followed by one or more
keywords that specify parameters. The keywords used in the examples in this section are briefly
defined to help you understand their use. Keywords for other options are listed in Sections 4
through 7. The ordering of the keywords within each command statement line is not critical.
Several of the command statements are optional because Sort/Merge automatically creates an
unblocked sequential output file and assigns the temporary work file to disk if you do not specify
another destination.

946252·9701

3-1

Simple Sort and Merge Examples

Table 3-1.
Command

3·2

Batch Stream Commands and Use
Remarks

BATCH

Indicates the beginning of a batch stream. This command is required.

SM$SMC

Creates the control file that will contain the specifications created by the subsequent commands. This statement is required and must immediately follow the
BATCH statement.

SM$HD

Builds the header control statement. This statement is required and must immediately follow the SM$SMC command. The type of sort or merge can be
specified on this line; if the type is not specified, a tag-along sort (SORTR) is the
default value assumed.

SM$OUT

Builds the output file control statement. It must immediately follow the SM$HD
command.

SM$WKF

Builds the work file control statement. This statement is optional for a sort operation; when used, it must immediately follow the SM$OUT command. If a merge is
specified, this command is not necessary and will be ignored if specified.

SM$IN

Builds the input file control statement(s). The first SM$IN must follow SM$WKF.
For a sort, only one SM$IN may be specified. For a merge, at least two and no
more than five SM$IN commands may be used; also, from two to five sets of the
SM$IN, SM$SLC, and SM$REF sequence may be specified to create more complex selection and reformatting patterns.

SM$SLC

Builds the record selection control statement(s). This command is optional. If no
SM$SLC command is used, the default includes all records in the input file. The
SM$SLC command may be used in combination with the SM$IN and SM$REF
commands to create different selections patterns for different record types.

SM$REF

Builds the reformatting control statement(s). SM$REF commands must be present since they define the sort control fields (keys) and data fields. SM$REF commands may be used in combination with SM$IN and SM$SLC commands to create
different selection patterns for different record types or to rearrange the order of
the data fields within specified records.

SM$CLS

Terminates after the file creation procedure. This must be the last command of the
file creation section of a batch stream.

XBSM

Executes Sort/Merge using the specified batch file name and listing device.

EBATCH

Indicates the end of the batch control stream. This statement is required.

946252-9701

Simple Sort and Merge Examples

3.3

FIRST SORT EXAMPLE

This example sorts the BO-character records from the file DS01.INFIL in the control field's ascending order (columns 5 through 10) and places the output in file DS01.0UTFIL. The batch control
stream is as follows:
1. BATCH
2. SM$SMC CFN = DS01.CONTRL
3. SM$HD TCL = 6,ORL = BO,MS = 16000
4. SM$OUT FP = DS01.0UTFIL,LRL = BO,PRL = 576
5. SM$IN FP = DS01.1NFIL
6. SM$REF FT = N,BL = 5,EL = 10
7. SM$REF FT= D,BL= 1,EL=BO
B. SM$CLS
9. XBSM CFN = DS01.CONTRL,LDN = LP01
10. EBATCH
The following paragraphs describe each of the command statements in detail.
3.3.1

SMSSMC Statement

SM$SMC CFN = DS01.CONTRL
The second line specifies that a Sort/Merge control file is to be created with the path name
DS01.CONTRL. If a file with this path name already exists, Sort/Merge replaces the contents of
that file with the newly created control file. The execution of the batch control stream generates
seven Sort/Merge control statements and places them in this file. This file is not the Sort/Merge input or output file. Sort/Merge dynamically allocates the control file if it has not already been
created. Sort/Merge does not delete this file at the end of the sort. For additional Sort/Merge runs,
use this file with the Execute Batch Sort/Merge (XBSM) command.
This line uses the following keyword:
•

3.3.2

CFN (Control File Name) - Specifies the name of the file that will contain the command
statements for this sort. It may be a maximum of 36 characters.
SMSHD Statement

SM$HD TCL = 6,ORL = BO,MS = 16000
The third line uses many of the default options for the header command statement. A full sort (tagalong sort) in ascending order is the default.
This line uses the following keywords:
•

946252·9701

TCL (Total Control Length) - Specifies the total length, in characters, of all control
fields. In this example, the control field is in columns 5 through 10, which is a length of 6
characters. (This parameter has no default.)

3-3

Simple Sort and Merge Examples

•

ORL (Output Record Length) - Specifies the total length, in characters, of the output
record. Since 80-character records are being sorted, the length of the output records is
80 characters. (This parameter has no default.)

•

MS (Memory Size) - Specifies the work memory available for the sort, in bytes. Specify
a memory size in the range of 3,000 to 45,000 bytes, or use the default. A size of 16,000
bytes is only a suggested size to allow the sort to run faster than when the default value
(2,800 bytes) is used. If 32,000 bytes are available, specify that amount.

Additional information on the Header Specification is in Section 4.
3.3.3

SM$OUT Statement

SM$OUT FP= DS01.0UTFIL,LRL=80,PRL=576
The fourth line specifies the output file path name and attributes. If the file has been previously
created, only the file pathname is required. This example assumes that the file has not been
created and gives attributes to allow it to be created. If file attributes are given and the file was
previously created, the attributes assigned at creation are used, and attributes specified in the
SM$OUT statement become commentary.
This line uses the following keywords:
•

FP (File Pathname) - Specifies the pathname of the file (or the name of the device) that
Is to contain the output data. The maximum is 36 characters.

•

LRL (Logical Record Length) record output.

•

PRL (Physical Record Length) - Specifies that the physical records written to the output file are to be 576 characters in length. Each physical record contains more than one
logical record.

Specifies a length of 80 characters for each logical

Additional information on the Output File Specification is in Section 5.
3.3.4

SM$IN Statement

SM$IN FP = DS01.1NFIL
The fifth line specifies the path name for the input file (or device that contains the input records).
Since the attributes of the input file are available to Sort/Merge, none are specified. Also, since
this is a sort operation, only one file is specified.
This line uses the following keyword:
•

FP (File Pathname) - Specifies the pathname of the file (or the name of the device) that
contains the input file. The maximum is 36 characters.

Additional information on the Input File Specification is in Section 5.

3-4

946252·9701

Simple Sort and Merge Examples

3.3.5

SM$REF Statements

This example includes two reformatting command statements. The first one specifies the control
field by which the records are to be ordered. The second one defines the data field. The use of
more than one control field and more than one data field is explained in Section 7.

J 3.3.5.1

Control Field Specification.

SM$REF FT = N,Bl = 5,El = 10
The sixth nne specifies the location within the record of the field to be used as the control field
that determines the order of the records during the sort. The default character selection is a full,
ASCII-character sort.

*'

NOTE

All control fields must be specified before data fields are specified.

This line uses the following keywords:
•

FT (Field Type) - Specifies the type of control field: N specifies normal sequence, and
specifies an opposite sequence. A parameter in the header control statement
specifies the order of the sort operation as either ascending or descending. In this example, since no parameter is specified, the default (ascending sequence) is assumed. In
this case, N means ascending order.

•

Bl (Beginning location) - Specifies the high-order column of the control field. Since
the control field is columns 5 through 10, the Bl is 5.

•

El (Ending location) - Specifies the low-order column of the control field. Since the
control field is 5 through 10, the El is 10.

o

You can specify additional control fields before specifying data fields. The control field specified
first is the primary control field, and all records are sorted in order according to the primary control
field. If a second control field is specified, all records that have identical primary control fields are
sorted according to the secondary control field, and so on. Refer to Section 7 for additional information on using multiple control fields.

J3.3.5.2

Data Field Specification.

SM$REF FT= D,Bl= 1,El=80
The seventh line specifies the location of the data field. Since the data is 80 characters long, the
field specifies that 80 characters of data are to be written to the output file for each record in the
input file.
This line uses the following keywords:
•

946252-9701

FT (Field Type) - Specifies that this is a data field (D).

3-5

Simple Sort and Merge Examples

•

BL (Beginning Location) -

•

EL (Ending Location) -

Specifies that the field begins in column 1.

Specifies that the field ends in column ao.

Multiple data fields can also be used to reformat
3.3.6

recor~s

(Section 7).

SM$CLS Statement

SM$CLS
The eighth line terminates generation of the control file.
3.3.7

XBSM Statement

XBSM CFN

=DS01.CONTRL, LDN =LP01

The ninth line executes the Sort/Merge program by using the control file that the previous
statements built.
This line uses the following keywords:
•

Control File Name) - Specifies the pathname of the file (or device that contains the
control file. In this example, the control file DS01.CONTRL has been built by the
previous seven statements.

•

LDN (Listing Device Name) - Specifies the path name of the file (or device) onto which
Sort/Merge information, error, and warning messages are to be written. The line printer
(LP01) is used as an example. (To avoid interrupting the printing operation of another
user on your system, you can write this listing to a file.)

When the sort is complete, the EBATCH statement terminates the batch stream. Note that no
work file was specified in this batch stream. The work file for this sort was defaulted to the system
disk DS01 and was automatically released at program completion. You can use multiple XBSM
statements if the control files have been previously built.

3.4

SECOND SORT EXAMPLE

This example shows a sort with record selection. It sorts (tag-along sort) aO-character records from
the input file DS01.INFILE and places the output in DS03.0UTFIX. Assume that DS03.0UTFIX has
been previously created; it is not necessary to specify logical or physical record length. Also, only
records with a value greater than 100 in columns 5 through 10 are to be included in the sort. These
records will be selected and will appear in the output file. The primary control field (columns 5
through 10) specifies ascending order. A second control field (columns 12 through 15) is specified
with descending order. The total length of the combined control fields is 10.
This sort demonstrates the optimal positioning of the output file, work file, and input file for maximum sort speed. The input and output files can be on the same disk volume, but the work file
should be on a different volume.

3-6

946252·9701

Simple Sort and Merge Examples

The batch control stream statements are as follows:
1. BATCH
2. SM$SMC CFN = DS01.CONTRlA
3. SM$H D TCl = 10,PO = O,ORl = aO,MS = 16000
4. SM$OUT FP = DS03.0UTFIX
5. SM$WKF WFV = DS02
6. SM$I N FP = DS01.1 NFl lE
7. SM$SlC CP = C,01 B = 5,01 E = 10,REl = GT,FOC = C,02C = 000100
a. SM$REF FT = N,Bl = 5,El = 10
9. SM$REF FT=O,Bl= 12,El= 15
10. SM$REF FT = D,Bl= 1,El= ao
11. SM$ClS
12. XBSM CFN = DS01.CONTRlA,lDN = DS01.LlST
13. EBATCH

3.4.1

SM$SMC Statement

SM$SMC CFN = DS01.CONTRlA
The second line specifies that the Sort/Merge control file be created and placed in a file named
DS01.CONTRlA.
3.4.2

SM$HD Statement

SM$HD TCl = 10,PO = O,ORl = aO,MS = 16000
The third line specifies by default a full sort in ascending order.
This line uses the following keywords:
•

TCl (Total Control length) - Specifies the total length, in characters, of all control
fields. In this example, an ascending field is in columns 5 through 10 and a descending
field is in columns 12 through 15. This gives a total length of 10 characters. (This
parameter has no default.)

•

PO (Print Option) - Specifies that the generated control statements be listed along
with information, error, and warning messages.

•

ORl (Output Record length) - Specifies the total length, in characters, of the output
record. Since aO-character records are being sorted, the length of the output records is
ao characters. (This parameter has no default.)

•

MS (Memory Size) - Specifies the work memory available for the sort, in bytes. A size of
16,000 bytes is only a suggested size to allow the sort to run faster than when the default
value (2,aOO bytes) is used. If 32,000 bytes are available, you should specify that amount.

946252-9701

3-7

Simple Sort and Merge Examples

3.4.3

SM$OUT Statement

SM$OUT FP = DS03.0UTFIX
The fourth line specifies the output file path name. No file attributes are specified since, in this ex·
ample, the file has been previously created on DS03. If not previously created, a sequential file will
be created by Sort/Merge with BO-character records unblocked.
This line uses the following keyword:
•

3.4.4

FP (File Pathname) - Specifies the path name of the file (or device) that is to contain the
output listing. The maximum is 36 characters.
SM$WKF Statement

SM$WKF WFV = DS02
The fifth line specifies that the work file be allocated on disk DS02. The work file is allocated as a
temporary file. For maximum efficiency, always allocate the work file on a volume that contains
neither the input nor the output file.
This line uses the following keyword:
•

3.4.5

WFV (Work File Volume) allocated.

Defines the device or volume to which the work file is to be

SM$IN Statement

SM$IN FP= DS01.INFILE
The sixth line defines the pathname for the input file (or device). Since the attributes assigned to
the file when created are available to Sort/Merge, no attributes are specified.
This line uses the following keyword:
•

3.4.6

FP (File Pathname) - Specifies the pathname of the file (or device) that contains the input file. The maximum is 36 characters.
SM$SLC Statement

SM$SLC CP = C,01 B = 5,01 E = 10,REL= GT,FOC = C,02C = 000100
The seventh line specifies selection of certain records to be included in the sort. Records that
meet the criteria are sorted and appear in the output file. All records that do not meet the criteria
are omitted. Omitted records are not sorted and do not appear in the output file. In this example,
all records with a value greater than 100 in columns 5 through 10 are included.
This line uses the following keywords:
•

3-8

CP (Character Portion) -

Specifies an ASCII character comparison.

946252·9701

Simple Sort and Merge Examples

•

01 B (Operand 1 Beginning) - Specifies the high-order, leftmost column of the comparison field. In this example, columns 5 through 10 have an 01 B of 5.

•

01 E (Operand 1 Ending) - Specifies the low-order, rightmost column of the comparison
field. In this example, columns 5 through 10 have an 01 E of 10.

•

IREL (Relationship) - Specifies the type of comparison, as follows:
GT
LT
EQ
NE
LE
GE

-

Greater than
Less than
- Equal
- Not equal
- Less than or equal
- Greater than or equal

•

FOC (Field or Constant) - Specifies if the comparison is to another field within the
record or to a constant. The C specifies constant. (See Section 6 for additional information.)

•

02C (Operand 2 Constant) - Specifies the constant to be used in the comparison.
Since a number must be specified for each position within the field, leading zeros are required. In this example, the constant 000100 is to b~ compared with the value in
columns 5 through 10.

3.4.7

SMSREF Statements

The following paragraphs explain the reformatting specifications in this example.
3.4.7.1

Control Field Specification.

SM$REF FT = N,BL = 5,EL = 10
SM$REF FT=O,BL= 12,EL= 15
The eighth and ninth lines specify the control fields. Since columns 5 through 10 are specified
first, they constitute the primary control field; columns 12 through 15 are the secondary field.
This line uses the following keywords:
•

FT (Field Type) - An N specifies normal control field or ascending sequence in this example. An 0 specifies opposite control field or descending sequence.

•

BL (Beginning Location) - Specifies the beginning column position of the control field
in the input file.

•

EL (Ending Location) - Specifies the ending column position of the control field in the
input file.

3.4.7.2

Data Field Specification.

SM$REF FT= D,BL= 1,EL= 80
The tenth line specifies the data field.
946252·9701

3-9

Simple Sort and Merge Examples

This line uses the following keywords:
•

FT (Field Type) - The 0 specifies that this is the data field to be written to the output
file for each sorted record. Since the order of the fields within the record remains the
same as in the input file, the entire data field (columns 1 through 80) is specified.

•

BL (Beginning Location) - Specifies the beginning column position of the data field in
the input file.

•

EL (Ending Location) - Specifies the ending column position of the data field in the input file.

3.4.8

SM$CLS Statement

SM$CLS
The eleventh line terminates generation of the control statement file.
3.4.9

XBSM Statement

XBSM CFN = DS01.CONTRLA,LDN = DS01.LlST
The XBSM statement executes the Sort/Merge program using the control statement file that the
previous statements built.
This line uses the following keywords:

3.5

•

CFN (Control File Name) - Assigns the pathname DS01.CONTROLA to the control file
created by this batch stream.

•

LON (Listing Device Name) - Specifies the path name of the device or file to which
Sort/Merge is to list the information, error, and warning messages produced during the
sort process. In this example, the file name is DS01.LlST. If this file already exists,
Sort/Merge replaces the contents of the current file with the messages listing. If the file
does not exist, Sort/Merge creates a sequential file to contain the messages listing.
Delete this file after checking it for errors.

MERGE EXAMPLE

The following control statements specify that three input files are to be merged into one output
file in descending order, using a control field contained in columns 5 through 10 of the input files.
All three input files have been previously sorted in descending order, using the same control field.
1.
2.
3.
4.
5.
6.

3-10

BATCH
SM$SMC CFN = DS01.CONTRLM
SM$HD SMT = MERGE,SMS = D,TCL = 10,ORL = 80,MS = 16000
SM$OUT FP= DS01.MRGOUT
SM$IN FP = DS01.MRG1
SM$IN FP = DS01.MRG2

946252·9701

Simple Sort and Merge Examples

7. SM$IN FP= DS01.MRG3
a. SM$REF FT = N,BL = 5,EL = 10
9. SM$REF FT= D,BL= 1,EL= ao
10. SM$CLS
11. XBSM CFN = DS01.CONTRLM,LDN = LP01
12. EBATCH
3.5.1

SM$SMC Statement

SM$SMC CFN = DS01.CONTRLM
The second line specifies that the Sort/Merge control statement file be placed in a file with the
pathname DS01.CONTRLM. Sort/Merge creates a sequential file with this pathname if the file
does not already exist. If the file does exist, Sort/Merge replaces the existing contents of the file
with the newly created control statement file.
3.5.2

SM$HD Statement

SM$HD SMT= MERGE,SMS= D,TCL=6,ORL=aO,MS= 16000
The third line specifies a merge operation in descending order.
This line uses the following keywords:

3.5.3

•

SMT (Sort/Merge Type) - Specifies that a merge process is to be performed.

•

SMS (Sort/Merge Sequence) - The 0 specifies that the normal ordering sequence is to
be descending. (An A would specify ascending.)

•

TCL (Total Control Length) - Specifies the total length, in characters, of all control
fields. In this example, only one control field, columns 5 through 10, is used. This field
has a length of 6 characters. (This parameter has no default.)

•

ORL (Output Record Length) - Specifies the total length, in characters, of the output
record. Si nce aO·character records are bei ng merged, the length of the output records is
ao characters. (This parameter has no default.)

•

MS (Memory Size) - Specifies the work memory available for the merge, in bytes. A size
of 16,000 bytes is only a suggested size to allow the merge to run faster than when the
default value (2,aOO bytes) is used. If 32,000 bytes are available, you should specify that
amount..
SM$OUT Statement

SM$OUT FP = DS01.MRGOUT
The fourth line is the pathname of the file (or device) that is to contain the merged output created
by Sort/Merge. If the file does not exist, Sort/Merge creates a sequential file with this pathname.

946252-9701

3-11

Simple Sort and Merge Examples

This line uses the following keyword:
•

FP (File Pathname) - Specifies the pathname of the file (or the name of the device) that
is to contain the output listing. The maximum is 36 characters.

Note that no work file is specified in this command stream since a merge operation does not use a
work file.
3.5.4

SM$IN Statement
SM~IN FP= DS01.MRG1
SM$IN FP= DS01.MRG2
SM$IN FP= DS01.MRG3

The fifth through seventh lines specify the pathnames of the three input files. The files must be in
the same sequence and must use the same control field. Any out-of-sequence condition may terminate the merge process or cause unpredictable results.
These lines use the following keyword:
•

FP (File Pathname) - Specifies the pathname of the file (or the name of the device) that
contains the input file. The maximum is 36 characters.

3.5.5 SM$REF Statements
The following paragraphs explain the reformatting specification statements.
3.5.5.1

Control Field Specification.

SM$REF FT = N,Bl = 5,El = 10
The eighth line specifies the order and location of the control field.
This line uses the following keywords:
•

FT (Field Type) - Specifies that this is a control field ordered in normal (N) order. Since
the header specification designated the sequence as descending, normal means
descending.

•

Bl (Beginning location) - Specifies that column 5 in the input files is the beginning
location of the control field.

•

El (Ending location) - Specifies that column 10 in the input files is the ending location
of the control field.

3.5.5.2

Data Field Specification.

SM$REF FT= D,Bl= 1,El=80
The ninth line specifies that this is a data field.

3-12

946252-9701

Simple Sort and Merge Examples

This line uses the following keywords:
•

FT (Field Type) -

•

BL (Beginning Location) column of the data field.

•

EL (Ending Location) - Specifies column 80 in the input files as the ending column of
the data field.

3.5.6

The 0 specifies that this is a data field.
Specifies column 1 in the input files as the beginning

SM$CLS Statement

SM$CLS
The tenth line terminates generation of the control statement file.
3.5.7

XBSM Statement

XBSM CFN

=DS01.CONTRLM,LDN =LP01

The elev1enth line executes the Sort/Merge program by using the control statement file that the
previous statements built.
This line uses the following keywords:

3.5.8

•

CFN (Control File Name) - The name of the file (or device) that is to contain the control
file built by the previous command statements.

•

LON (Listing Device Name) - The pathname of the file (or device) to which Sort/Merge
information, error, and warning messages are to be written. The line printer (LP01) is
used as an example.
Executing Sort/Merge in Batch Mode

When you have prepared the batch control stream file by copying the format of the examples in
this section, use the Execute Batch (XB) command to execute the batch control statements that
will code the control file which will run the Sort/Merge utility. Both the input file (or files) and the
batch control stream file must have been previously prepared before you execute this command.
The XB command has the following field prompts:

EXECUTE BATCH
INPUT ACCESS NAME:
LISTING ACCESS NAME:




In response to the INPUT ACCESS NAME prompt, enter the pathname you assigned to the file (or
device) that contains the batch control stream. This is not the pathname used in the batch control
stream to specify the control file path name (SM$SMC).

946252·970'1

3-13

Simple Sort and Merge Examples

In response to the LISTING ACCESS NAME prompt, enter the pathname of a file (or device) to
which the listing made by the SCI during the batch processing may be written. This is not the
same as the listing of Sort/Merge messages specified for the XBSM command statement in your
batch control stream.
To reuse the control file built with the batch control stream, execute Sort/Merge in batch by using
the Execute Batch Sort/Merge (XBSM) command.
The XBSM command has the following field prompts:

EXECUTE BATCH SORT/MERGE
CONTROL FILE NAME:
LISTING DEVICE NAME:





In response to the CONTROL FILE NAME prompt, enter the path name of the control file, that is,
the pathname specified for SM$SMC.
In response to the LISTING DEVICE NAME prompt, enter the path name of a file (or device) to
which the listing made by the SCI during the batch processing may be written. This is not the
. same as the listing of Sort/Merge messages specified for the XBSM command statement in your
batch control stream.
You can also specify the XBSM command when in the SCI command mode by entering the
following:
XBSM CFN = ,LDN = 
The file name following CFN is the pathname you specified in the batch stream as the control file
name.

3.6

BEGINNING EXERCISE

Use the steps described in the following paragraph to create an input file named DS01.TESTIN and
a batch control stream file named DS01.TEST. Check with the person in charge of your system to
confirm that these path names are acceptable. If not, obtain another character string to replace the
D501 component of the path name in all occurrences for the following exercise.
The input file contains the records to be sorted or merged. The batch control stream file,
D501.TEST, contains all of the control statements and keywords needed to perform any of the sort
or merge examples presented in this section. Some of the control statements are not required;
however, they are included so that you can use this file to experiment with different types of sorts
and merges by modifying the keyword parameters.

NOTE

The following procedures assume you have a 911 VDT. If you are
using any other type of input device, use the comparable function
keys for that term i nal.
3-14

946252·9701

Simple Sort and Merge Examples

3.6.1

Create an Input File

The input file consists of records (in this case, BO-character lines) containing data fields. To
facilitate moving from one field to another, use the Modify Tabs (MT) command to set tab stops.
Then, use the Execute Editor with Scaling ~XES) command to create the file. Use the following
procedure:
1.

Enter SCI command mode by pressing the CMD key.

2.

Specify the Modify Tabs command by entering MT, and press the RETURN key.

3.

In response to the TAB COLUMNS prompt, specify tab stops at 1, 10, 20, and 30 as
follows and then press RETURN:
MODIFY TABS
TAB COLUMNS:

1,10,20,30

4.

Press the CMD key again, enter XES, and press RETURN.

5.

In response to the FILE ACCESS NAME prompt, press RETURN.

6.

When the end-of-file (EOF) marker appears, enter the data, using the New Line (blank
gray) key or Compose Mode (F7) key as necessary ..

7.

Type the following, using the TAB key and pressing the RETURN key at the end of each
line. To be sorted properly, the input in each data field should be typed in the same manner. As an experiment, type the name Don Baker with both uppercase and lowercase
characters (as shown in line 5). Place last names in columns 10 through 19; first names
in columns 20 through 29; and numbers in columns 30 through 39, right justified.
Although this particular column designation is arbitrary, it is easy to remember and
gives you extra space to experiment by entering data fields of your own.
DON
BAKER
SMITH
SAM
WOOD
DOny
BAKER
HANK
Baker
Don
SMITH
SAM
.... 1 ............ 2 ............ 3

200
50
100
2
100
100
............ 4 ............ 5 ............ 6 .. .

B.

Align the number column and proofread the input, correcting any errors.

9.

To quit the text edit mode, press the CMD key, type QE, and press RETURN.

10.

Enter a response of NO to the ABORT? prompt by pressing RETURN.

11.

Specify the path name DS01.1 N in response to the OUTPUT FI LE ACCESS NAM E prompt.

12.

Respond NO to the REPLACE? prompt.

13.

Enter a null response to the MOD LIST ACCESS NAME prompt by pressing RETURN.

946252·9701

3-15

Simple Sort and Merge Examples

3.6.2

Create a Batch Control Stream File

Creating a batch control stream file also requires the use of the Text Editor. The control file that
this batch control stream builds is named DS01.TESTCTR. This is to be a tag-along sort with three
control fields specified. The primary field contains the last names in the input file, and the secondary field contains the first names in the file. Both fields are sorted in ascending order. The third
control field, the numbers column in the input file, is sorted in descending order (highest number
listed first) if the person has more than one record.
To create a batch control stream file, use the following procedure:
1.

Enter SCI command mode by pressing the CMD key.

2.

Specify the Execute Editor with Scaling command by typing XES and pressing RETURN.

3.

In response to the FilE ACCESS NAME prompt, press the RETURN key.

4.

When the EOF marker appears, type the following batch control stream, using the New
Line (blank gray) key or Compose Mode (F7) key as necessary:
BATCH
SM$SMC CFN = DS01.TESTCTR
SM$HD SMT = SORTR,SMS = A,TCl = 30,ORl::: BO,MS = 16000
SM$OUT FP = DS01.TESTOUT,lRl = BO,PRl = 576
.
SM$WKF WFV = DS01
SM$IN FP = DS01.TESTIN
SM$REF FT= N,Bl= 10,El= 19
SM$REF FT= N,Bl= 20,El= 29
SM$REF FT = O,Bl = 30,El = 39
SM$REF FT= D,Bl= 1,El= BO
SM$ClS
XBSM CFN = DS01.TESTCTR,lDN = DS01.TESTLIST
EBATCH

5.

Proofread your input and correct any errors.

6.

To quit the text edit mode, press the CMD key, type QE, and press RETURN.

7.

Enter a response of NO to the ABORT? prompt by pressing RETURN.

B.

Specify the pathname DS01.TEST in response to the OUTPUT FilE ACCESS name
prompt.

9.

Respond NO to the REPLACE? prompt.

10.

3-16

Enter a null response to the MOD LIST ACCESS NAME prompt by pressing RETURN.

946252·9701

Simple Sort and Merge Examples

3.6.3

Execute the Batch Control Stream
Using the following procedure, enter the Execute Batch (XB) command to execute the batch control statements that will run the Sort/Merge utility.

1.

Enter the SCI command mode by pressing the CMD key.

2.

Enter XB and press RETURN.

3.

Respond to the XB command prompts as follows and press RETURN.
EXECUTE BATCH
INPUT ACCESS NAME:
LISTING ACCESS NAME:

4.

DS01.TEST
DS01.TEM PLiST

Since this is a quick sort operation, press the CMD key, type WAIT, press RETURN, and
wait for the background task to complete.

3.6.4 Examine the Output
When Sort/Merge has completed processing, use the Show File (SF) command or Print File (PF)
command to examine the following files:

•

DS01.TEST - Contains the reusable batch control stream. To use this file for all of your
sort or merge operations, modify the input parameters and the path names to fit each
example.

•

DS01.TESTCTR - Contains the Sort/Merge control file that the batch control stream
built. This file is reusable.

•

DS01.TESTIN -

•

DS01.TESTOUT - Contains the sorted records from the input file. This file is reusable.

•

DS01.TESTLIST - Contains the information, error, and warning messages listed by
Sort/Merge. Delete this file after confirming the output file information, or continue to
use this same pathname for the Sort/Merge message listings each time you perform a
sort or merge operation.

•

DS01.TEMPLIST - Contains the complete listing of the batch process and should be
examined to confirm that the sort operation completed successfully. This file contains
information about any errors made in preparing the batch control stream file. Delete this
file after examining the information, or continue to use this same pathname.

Contains the data input. This file is reusable.

The DS01.TEST and DS01.TESTIN files should match the input given in the preceding paragraphs.

946252·9701

3-17

Simple Sort and Merge Examples

3.6.4.1

Sort/Merge Control Statement File.

The DS01.TESTCTR file should contain the fo!!owing:

OOOOOHSORTR
30A
000lODOSDS01. TESTOUr
00020DA 80 576
00030DISDS01. TESTIN
00040DA
00050FNC
OOObOFNC
00070FOC

00080FDC

10
30

19
29
39

1

80

20

IX

80

16000

3.6.4.2 Sorted Output File. The DS01.TESTOUT file should contain the sorted records, as
follows:

DON
HANK
Don
SAM
SAM
DOny

BAKER
BAKER
Baker
SMITH
SMITH
WOOD

200
2
100
100
50
100

Notice that the line typed in initial capital letters was sorted at the end of the records beginning
with B. Also, notice that HANK BAKER was inserted after DON BAKER, as specified by the secondary control field, and that the figures following SAM SMITH are in descending order, as specified
by the third control field.

3.6.4.3 Sort/Merge Messages Listing. The DS01.TESTLIST file contains the Sort/Merge messages
and should be similar to the following:

3-18

INFO

4:

END OF GENERATION PHASE

INFO

3:

NUMBER OF SPECIFICATIONS=

INFO

0:

NO ERRORS

INFO

23:

BYTES OF WORKING STORAGE AVAILABLE= 16000

INFO

24:

BYTES REGUIRED FOR SPECIFICATIONS =

INFO

14:

INPUT FILE RECORD SIZE=

80

INFO

15:

INPUT FILE BLOCK SIZE =

864

9

352

946252·9701

Simple Sort and Merge Examples

80

INFO

16:

OUTPUT FILE RECORD SIZE =

INFO

17:

OUTPUT FILE BLOCK SIZE=

lNFO

5:

INFO

18:

INFO

9:

INFO

10:

NUMBER OF INPUT FILE RECORDS SELECTED

::::

INFO

30:

NUMBER OF WORK FILE UNITS

1

INFO

29:

NUMBER OF PASSES REMAINING=

'INFO

25:

SORT FINAL PASS HAS BEGUN

INFO

26:

SORT FINAL PASS COMPLETED

INFO

13:

NUMBER OF OUTPUT RECORDS WRITTEN=

576

SORT EXECUTION HAS BEGUN
WORK FILE RECORD SIZE =

112

NUMBER OF INPUT FILE RECORDS READ =

USED =

10

10

0

10

3.6.4.4 SCI Batch Listing. The DS01.TEMPLIST created during the batch operation should con·
tain the following. If an error occurred, examine both DS01.TESTLIST and DS01.TEMPLIST to
determine the cause. Correct the error in the batch control stream file (DS01.TEST), and execute it
again.

**

SCI990 ** SCI990 ** SCI990 ** SCI990 **BATCH
(0001:> BATCH
LS (LIST SYNONYMS) ?
NO
BATCH LISTING ACCESS NAME
DSO!. TEMPLIST
BATCH INPUT ACCESS NAME
DSO!. TEST
STATIPN ID
ST15
USER ID
CK001!
2: 13: 15 FRIDAYI SEP 191 1980.
(0002> SM$SMC CFN=DSOI. TESTCTR
CONTROL FILE NAME
0801. TESTCTR
<0003> SM$HD SMT=SORTRISMS=AJTCL=3010RL=80,MS=16000
SORT MERGE TYPE
SORTR
TOTAL CONTROL LENGTH
30
SORT MERGE SEQUENCE
A
OUTPUT RECORD LENGTH
80
MEMORY SIZE
16000
VERIFY OPTION
** NULL **
VARIABLE LENGTH RECORDS
** NULL **
DROP CONTROL FIELDS
X .
PRINT OPTION
1
ALTERNATE SEQUENCE
** NULL **
<00.04> SM$OUT FP;DSOl. TESTOUT, LRL=80, PRL=576
FILE PATHNAME
DS01.TESTDUT
80
LOGICAL RECORD LENGTH
PHYSICAL RECORD LENG1H
'576
946252·9701

3-19

Simple Sort and Merge Examples

NUMBER OF LOGICAL RECORDS
** NULL **
FILE TYPE
(0005> SM$IN FP=DS01.TESTIN
FILE PATHNAME
DSO!. TESTIN
NUMBER OF LOGICAL RECORDS
** NULL *~(­
LOGICAL RECORD LENGTH
** NULL **
FILE TYPE
S
(0006> SM$REF FT=NIBL=10IEL=19
FIELD TYPE
N
BEGINNING LOCATION
10
ENDING LOCATION
19
OVERFLOW
** NULL **
CONTINUATION
** NULL **
SUBSTITUTE CHARACTER
** NULL **
RECORD CHARACTER
** NULL **
CHARACTER PORTION
C
(0007> SM$REF FT=N,BL~20,EL=29
FIELD TYPE
N
BEGINNING LOCATION
20
ENDING LOCATION
29
OVERFLOW
** NULL **
CONTINUATION
** NULL **
SUBSTITUTE CHARACTER
** NULL **
RECORD CHARACTER
** NULL **
CHARACTER PORTION
C
(0008> SM$REF FT=OIBL=30,EL=39
FIELD TYPE
0
BEGINNING LOCATION
30
ENDING LOCATION
39
OVERFLOW
** NULL **
CONTINUATION
** NULL **
SUBSTITUTE CHARACTER
** NULL **
RECORD CHARACTER
** NULL **
CHARACTER PORTION
C
(0009> SMSREF FT=DIBL~1,EL=80
FIELD TYPE
D
** SCI990 ** SCI990 ** SCI990 ** SCl990 **BATCH
BEGINNING LOCATION
1
ENDING LOCATION
80
OVERFLOW
** NULL **
CONTINUATION
** NULL **
SUBSTITUTE CHARACTER
** NULL **
RECORD CHARACTER
** NULL **
CHARACTER PORTION
C
(0010:> SM$CLS
<0011> XBSM CFN=DS01. TESTCTRILDN=DSOI. TESTLIST
CONTROL FILE NAME
DS01. TESTCTR
LISTING DEVICE NAME
DSOI. TESTLIST
SORT/MERGE COMPLETED NORMALLY
(0012:> EBATCH
CODE
** NULL **
TEXT
. ** NULL **
LS (LIST SYNONYMS) ?
NO
3-20

946252·9701

Simple Sort and Merge Examples

3.6.5 Perform a Merge Operation
Create a second input file with pathname DS01.TESTIN2 and sort the file using the same control
fields as in the previous exercise. In the batch control stream file, change the input file and output
file pathnames. When the sort process is completed, merge the two sorted output files. Use the
following input for DS01.TESTIN2 or create your own list. Since all of the numbers in this list end
in 2, you can easily identify them when the lists are merged; consequently, you can determine the
priority assigned to the first input file.

BAKER
MURPHY
ACKER
STEWART
PALMER
JONES
PACE
BAKER

DON
JAN
DIXIE
KIM
DOUGLAS
EVAN
ELAINE
DON

52
52
72
102
12
122
62

202

3.6.6 Delete the Exercise Files
When you have finished the exercises, delete the created files by using the Delete File (OF)
command.

3.7

SUMMARY

The control statements in this section are models that can be adapted by the one-time user to fit
specific applications. As a result, many of the features of Sort/Merge have not been shown in any
of the examples. The remaining sections of this manual provide details about the additional
features of Sort/Merge.

946252·9701

3-21/3-22

4
Header Specification
4.1

GENERAL

The Header Specification provides Sort/Merge with the following information:
•

Type of sort (address only, tag-along, or summary tag-along)

•

Type of merge (normal or summary)

•

Primary collating sequence (ascending or descending)

•

Sequence of the sorted file (standard ASCII or alternate)

•

Type of execution information to be printed, if any (for example, diagnostic messages
and status data)

•

Whether to keep or drop the control fields in the output file

•

Whether to verify the data sent to the work file

NOTE

Use only one Header Specification for each sort or merge.

Figure 4-1 shows the column headings on the Header Specification sheet; Table 4-1 lists the
options that can be entered for these parameters.

1

Page

SORT/MERGE SPECIFICATIONS, SHEET A

2

~~

Ltne

Header Specification

Merge
MERGE
MERGES
Sort
SORTA
SORTR
SORTRS

Largest Total
of Control

Comments
Record Type
(Bytes)

(Columns 40 to 72 I

Figure 4-1.
946252-970"1

Header Specification Format
4-1

Header Specification

Table 4-1.
Suggested
Batch
Keywords

Columns

Header Specification Column Summary

Entries

00

Page number

4.2.1

3-5 '

000

Header line number

4.2.1

H

Header Specification line

4.2.2

Sort/Merge type:
- Tag-along sort
- Address-only sort
- Summary tag-along sort
- Normal merge
- Summary merge

4.2.3

SORTR2
SORTA
SORTRS
MERGE
MERGES

Total control length: length (in characters) of
the longest control field used to sort the
characters; numeric, right-justified.

4.2.4

Sort/Merge sequence:
- Sorted records in output file to be in
ascending sequence
- Sorted records in output file to be in
descending sequence

4.2.5

1-256

TCl

SMS

D

19-25

Blank

26
Blank2
S

PO

27

o or
blank
12

2
3
4

DCF

28
Blank

ORl

4-2

Paragraph
Number

1-2'

SMT

AS

Explanation
(Interactive Prompts Capitalized)

1-4096

Reserved
Alternate sequence:
- Use standard ASCII code collating
sequence
- Use an alternate collating sequence.
AlTSEQ statement defines the sequence

4.2.6

Print option:
- Specification lines, diagnostic messages,
and program-status messages
- Program-status messages
- Reserved
- No messages
- SpeCial use as debug aid (see Section 9)

4.2.7

Drop control fields:
- Keep control fields in tag-along output
records
- Drop control fields in tag-along output
records

4.2.8

Output record length: length (in characters)
of the longest output record in tag-along sort

4.2.9

946252-9701

Header Specification

Table 4-1.
Suggested
Batch
Keywords

Header Specification Column Summary (Continued)

Columns

Entries

va

Variable length records:
- Fixed length output records
- Variable length output records

4.2.10

Verify option:
- Do not verify data sent to work file
- Verify data sent to work file

4.2.11

Blank2
V

Memory size (workspace)
- Reserve 2800 bytes for workspace
- Number of bytes to reserve for workspace

4.2.12

Blank2
3000-45000

Comment field; enter any ASCII characters.

4.2.13

34

35-39

MS

Paragraph
Number

Blank2
V

33

VAR

Explanation
(Interactive Prompts Capitalized)

40-80
Notes:

4.2

1

These columns must be filled.

2

Default value.

3

These columns must be filled for a tag-along sort or merge.

COLUMN DESCRIPTION

The following paragraphs explain each of the column entries for the Header Specification.
4.2.1 Page Number and Line Number (Columns 1 through 5)
Columns 1 through 5 comprise a five-digit number that ensures that Sort/Merge receives
specification lines in the correct order. This order follows two rules:

•

Specification Sheet A lines are entered before Sheet B lines

•

Li nes are entered as shown on the sheets, top to bottom

This means that the Header Specification will be the first line entered and will be on page 00 and
line 000. All File Description Specifications follow the Header Specification with line numbers in
ascending order as printed on Sheet A. Note that the Record Selection and Reformatting
SpeCifications have higher line numbers preprinted in columns 3 and 4 so that Sheet B lines will
follow Sheet A in the prescribed ascending order. If an additional Sheet B is needed, its page
number must be a higher number to maintain the proper sequence. Reformatting Specifications
always follow the Record Selection Specifications, even though the latter may require more than
one sheet.

946252-9701

4-3

Header Specification

Column 5 is blank to allow you to insert data between two lines that are already filled in. For example, to include two lines of additional data between lines 28x and 29x (by default these are 280 and
290), write the data on two unused lines with numbers between 280 and 290 (such as, 281 and 282).
These lines should be entered after line 280, as shown in Figure 4-2.

NOTE

You should fill in column 5 with a zero when using the default value.

4.2.2 Specification Type (Column 6)
Column 6 contains a preprinted H to identify this as the header line.
4.2.3 SMT - Sort/Merge Type [SORTR] (Columns 7 through 12)
Columns 7 through 12 indicate the type of Sort/Merge, as follows:
Columns 7 through 12 Entry

Explanation

SORTA

Address-only sort

SORTA

Tag-along sort

SORTRS

Summary tag-along sort

MERGE

Normal merge

MERGES

Summary merge

Entries are left justified (that is, they must begin in column 7).
4.2.4 TCL - Total Control Length (Columns 13 through 17)
Use the following to determine the appropriate entry for columns 13 through 17:

4-4

1.

Sum the lengths (in characters) of the control fields (denoted by an N, 0, or F entry in
column 7 of the Reformatting Specification) for each record type.

2.

Enter the largest sum (that is, the largest sum of the control field lengths) in these columns. The sum can range from 1 to 256 characters. (For more information, see
paragraph 7.3.3.)

946252-9701

Header Specification

Reformatting Specification
Forced
'--r--

LIne

"
.r::

<0
.t::.

Number

c.
>

"0

1-

Location

..

5

7

6

8910111213

0

7 () F~C

2

8~ FNC

2

9~

....

l{ 2i

c

F

I~

F

Fe

2,f

0'

2<1 I
3

2

f-

3

3

F

3

4

F

~

~

c

0

I

2
"10

2..0
b4

Cl

10

Comments

Reserved

Overflow

U

14 15 16 17 18 19 20 21 22

I

l

:>

a::

To

From

3 4

U

u

23 24

25 26

28 29 30 31

32 33 34 35 36 37 38 39

(Columns 40 to 72 )

$
I

4

135624

Figure 4-2.

4.2.5

SMS -

Inserting Additional Lines

Sort/Merge Sequence [A] (Column 18)

Input records can be sorted in an ascending or descending order, depending upon the entry in column 18 of the Header Specification. Control fields in the Reformatting Specification can further
specify that individual control fields be sorted in an opposite manner or in the sequence specified
in column 18 of the Header Specification. An A is placed in column 18 of the Header Specification
to specify ascending order; a 0 specifies descending order.
Column 18 Entry

4.2.6

AS -

Explanation

A

Normal sequence is ascending

o

Normal sequence is decending

Alternate Sequence [Blank] (Column 26)

Collation is accomplished according to the logical relationships of the ASCII character set or according to the values of an alternate character set. Appendix C defines the values of the ASCII
character set.
Column 26 Entry

Blank
S

946252·9701

Explanation

Use ASCII collating sequence
Use alternate collating sequence

4-5

Header Specification

Most users leave column 26 blank. Generally, the only users of the alternate collating sequences
are European firms that use special alphabetic characters (such as the German a, 0, U, and the
Spanishii') in their collating sequence or users that must interface with computers that do not accept the standard ASCII character set. The collating sequences are defined as follows:
•

ASCII Collating Sequence - The ASCII collating sequence is the ASCII character set as
supported by the TI 990 computer system. A blank in column 26 tells the system to use
the ASCII collating sequence. Slight variations in the ASCII collating sequence occur
depending on whether it is desired to use both the zone and digit portions of the
characters in the records, the zone portions only, or the digit portions only. Appendix C
explains the ASCII code character set and identifies the zone and digit portions of the
code.

•

Alternate Collating Sequence - An S in column 26 tells the program to use an alternate
collating sequence. You must supply Alternate Sequence (ALTSEQ) statements immediately following the Header Specification. (See Appendix B.)

4.2.7

PO -

Print Option [1] (Column 27)

The Sort/Merge program can print the following:
•

A list of the control specifications (Header, File Description, Record Selection, and
Reformatti ng)

•

Diagnostic messages appropriate for control specifications

•

Program-status messages indicating the progress of the sort or merge

•

Information, error, and warning messages when debugging an external subroutine that
accesses Sort/Merge. This debug aid is described in Section 9.

Column 27 indicates which information is to be printed:

4-6

Column 27 Entry

Explanation

o or blank

Print control specifications, diagnostic messages, and programstatus messages

1

Print program-status messages

2

Reserved

3

Pri nt none of these

4

Debug messages

946252-9701

Header Specification

4.2.8

DCF - Drop Control Fields [X] (Column 28)
Column 28 applies only to a tag-along sort (SORTR or SORTRS) operation. Column 28 indicates
whether the control fields are to be included in the output records after the records are sorted or
merged.
Column 28
Entry

Explanation

Blank

Keep control fields in output

x

Drop control fields in output

Control fields should be dropped whenever integer, real, floating point, opposite control fields, or
an alternate collating sequence is used. In these situations, control field characters may be
altered by the SortlMerge program in a way that makes them meaningless to the user. For
example, ALTSEQ changes the control fields to the characters specified in the alternate sequence
specification.
To retain a meaningful version of the control field information, define the same input character
positions twice: once as a control field and once as a data field. Data fields are not disturbed by
the SortlMerge program.
4.2.9 ORL - Output Record Length (Columns 29 through 32)
Columns 29 through 32 apply to all jobs and must be nonzero. The entry in these columns tells the
program the length of the records in the final sorted file.

When control fields are not dropped (a blank in column 28), the output record length is the sum of
all control field and data field lengths.
When control fields are dropped (an X in column 28), the entry in columns 29 through 32 of the
Header Specification is the sum of the lengths of all data fields only. Because data field lengths
may vary on different input record types, the output record length is the sum of data field lengths
for anyone record in the file.
For an address-only sort (SORTA), the output record length must always be specified as 4. SORTA
outputs a four-byte binary record number in the format required by the 1/0 supervisor call (SVC)
block, bytes 12 through 15 (record number). Refer to the Model 990 Computer DX10 Operating
System Release 3 Reference Manual, Volume III, Application Programming Guide, for more information.
If the results of a SORTA are placed in a relative record output file, you cannot use COBOL to input
that file because the COBOL delete indicator is in byte 1 of each record. When using COBOL,
place the output from SORTA in a sequential file only. Refer to the Model 990 Computer COBOL
Programmer's Guide for more information on the delete-indicator with relative record files.

946252·9701

4-7

Header Specification

4.2.10 VAR - Variable Length Records [Blank] (Column 33)
Input files to Sort/Merge may contain variable-length records. If column 33 is blank, the length of
the output records is fixed at the size specified in the output record length. If a V is specified, the
record size is determined by the smaller value of the specified output record size and the input
record size.
Column 33 Entry

Blank

V

Explanation

Fixed length output records
Variable length output records

4.2.11 VO - Verify Option [Blank] (Column 34)
To verify that data was not changed during the write from memory to the work file on disk, use the
verify option. The verify option compares the disk image to that in memory. Using this option ensures accuracy but requires additional time, thus decreasing operation speed.
Column 34 Entry

Blank

V

Explanation

Do not verify data in work file
Verify data in work file

4.2.12 MS - Memory Size [Blank] (Columns 35 through 39)
In these columns, specify the decimal number of bytes to be used for the Sort/Merge memory
work area. If you leave this field blank, 2800 bytes will be allocated automatically for the
Sort/Merge work area. You can specify any value between 3,000 and 45,000 bytes. In general, the
more memory available for the work area, the faster the sort will run. (See Appendix F.) This
parameter is not required for a merge.
4.2.13 Comments (Columns 40 through 80)
These columns are used to make comments using any characters in the computer's character set.
If listing of control specifications is selected for this task (the column 27 entry is a zero or blank),
the comments are printed with the specifications. Comments have no effect on Sort/Merge.

4-8

946252·9701

5

File Description Specification
5.1

GENERAL

The File Description Specification (Figure 5-1) provides Sort/Merge with information about the
files to be used in the operation. The order in which the files are specified is critical. The output
file is described first; the work file, when designated, is described next; and the input file(s) is
described last, as follows:
•

Output File - Mandatory specification that provides the path name of the output file (or
device) that is to contain the results of the sort or merge process. The second line on the
form is optional and is used to specify the physical record length, the logical record
length, and the number of logical records.

•

'Work File - Optional specification that defines the disk volume that will contain a temporary file to be used as a scratch file during a sort process. If this one-line specification
is not used, Sort/Merge will define this file using the logical record length entry from the
Input File Specification, and this file will be allocated on the system disk. The work file
is not used for the merge operation.

•

Input File - Mandatory entry that provides the pathname(s) of the file or files (or device)
containing the records to be processed. While a sort operation has only one input file, a
merge operation can merge from two to five input files. The second line is used to
specify the logical record length, the physical record length, and the number of logical
records and is optional; however, you must specify the approximate number of records
if the work file is to be created nonexpandable.

Tables 5-1 through 5-3 list the options that can be specified for the output file, work file, and input
file. Subsequent paragraphs describe these options in detail.
5.1.1 Synonyms
You can use synonyms in file pathnames. Only 36 column positions are available for specification
of a path name to Sort/Merge. However, by using synonyms, you can specify a path name that contains 48 characters. For the work file, the synonym is assigned only to the disk name.
5.1.2 Page and Line Numbers (Columns 1 through 5)
The page numbers and line numbers preprinted on the worksheet are explained in Section 4.
5.1.3 Specification Type (Column 6)
A preprinted D in column 6 of each line on the worksheet identifies these lines as file description
specifications.

946252-9701

5-1

File Description Specifications

File Description Specifications
OUTPUT FILE

Comments

(Columns 45

to

72 I

WORK FILE

Comments

(Columns

17

to

SO)

INPUT FILE

Comments

(Columns 45

to

721

i356G7

Figure 5-1.

5.2

File Description Specification

OUTPUT FILE SPECIFICATION

The output file specified will contain the output of the sort or merge process. Table 5-1 lists the
parameters that you may specify for the output file. These parameters describe the type of disk
file, and its pathname, physical and logical record length" and number of physical records.

5-2

946252·9701

File Description Specifications

Table 5·1.
Suggested
Batch
Keywords

Columns

Output File Specification Column Summary

Entries

Explanation
(Interactive Prompts Capitalized)

Paragraph
Number

Line 1:

00

Preprinted; identifies page 00

4.2.1

010

Preprinted; identifies line 010

4.2.1

D

Preprinted; designates this as a line in the File
Description Specification

5.1.4

o

Preprinted; identifies first line of Output File
Specification

FT

FP

File type:
- Specifies sequential file
- Specifies relative record file
- Specifies key-indexed file

9-44 2

File pathname; output file name in the format
required by the operating system; maximum of
36 characters for Sort/Merge

45-80

Comments; enter up to 36 ASCII characters

5.2.1.2
5.2.1.2
5.2.1.2
5.2.1.3

Line 2:

020

Preprinted; identifies line 020

4.2.1

D

Preprinted; designates this as a line in the File
Description Specification

5.1.4

7

A

Preprinted; identifies a second line of Output
File Specification

5.2.2.1

LRL

8-11

Integer

Logical record length, specified in bytes;
default is explained in paragraph 5.2.2.2

5.2.2.2

PRL

12-15

Integer

Physical record length, length is specified in
bytes; default is explained in paragraph 5.2.2.3

5.2.2.3

NOLR

16-23

Integer

Number of logical records; this is the record
capacity of the output file; default is explained
in paragraph 5.2.2.4

5.2.2.4

1

45-80

Comments; enter up to 36 ASCII characters

Notes:
1 These columns must be filled.
2 Default value.

946252-9701

5-3

File Description Specifications

5.2.1 First Line of Output File Specification
Figure 5-2 shows the entries to this line.
5.2.1.1 File Use (Column 7).
Specification.
5.2.1.2

A preprinted 0 in column 7 identifies the first line of the Output File

FT - File Type (Column 8).

This column specifies the file type for the output records.
Explanation

Column Entry

S

Sequential file organization

R

Relative record file organization
Key-indexed file organization

The Sort/Merge task can only create a sequential file. If you want the output to be a relative record
or key-indexed file, you must create the file with the proper specifications prior to executing
Sort/Merge. See the Model 990 Computer DX10 Operating System Release 3 Reference Manual,
Volume 1/, Production Operation, for additional information on creating key-indexed files.
5.2.1.3 FP - File Pathname (Columns 9 through 44). You must use a file (or device) for the output
destination. The pathname syntax is defined in the reference manual for the DX10 operating
system. The maximum pathname length that can be specified is 36 characters. The output file
pathname may be the same name as the input file pathname. In this case, the output is written
over the input file and the previous contents of the input file are destroyed.
5.2.2 Second Line of Output File Specification
Figure 5-3 shows the entries for this line. This line is optional.

File Description Specifications

OUTPUT FILE

Comments

(Columns 45

Figure 5-2.

5-4

to 72)

First Line of Output File Specification

946252-9701

File Description Specifications

File Description Specifications

OUTPUT FILE

Comments

(Columns 45 to 721

Figure 5-3.

Second Line of Output File Specification

The following rules apply:
•

If the file was previously created, the record sizes specified at creation are used and this
line becomes commentary.

•

If the second line is not used and the file was not previously created, Sort/Merge creates
an unblocked, sequential file using the output record length from the header statement.

•

If both the output logical record length and the output physical record length are
specified and the file was not previously created, an expandable sequential file is
created.

•

If the output logical record length, the output physical record length, and the number of
logical records are specified and the file was not previously created, a nonexpandable,
sequential file is created.

5.2.2.1 File Use (Column 7). A preprinted A in column 7 identifies this as a continuation of the
entries for the previous line.
5.2.2.2 LRL - Logical Record Length [Blank] (Columns 8 through 11). The logical record length for
the output file is specified in these columns. If Sort/Merge is to create the file, the logical record
length specified in the Header Specification is used. If the file already exists and the logical
record length is not specified, the logical record length specified at file creation is used.
5.2.2.3 PRL - Physical Record Length [Blank] (Columns 12 through 15). The physical record length
may be specified for output files. If it is not speci"fied and the file already exists, the physical
record length specified at file creation is used. If the length is not specified in the Output File
Specification and Sort/Merge is to create the file, the file is created unblocked.
5.2.2.4 NOLR - Number of Logical Records [Blank] (Columns 16 through 23). The number of
logical records may be specified for an output file. If this number is not specified for a file that
must be created by Sort/Merge, an expandable output file is created.

5.3

WORK FILE SPECIFICATION

The Work File Specification (Figure 5-4) defines an area on the disk to be used as a work area
during the sort process. The work file is not used for a merge operation; if specified, it is ignored.
946252·9701

5-5

File Descriptions Specifications

FILE

WORK

Z
0-

Lllie

I-

NUITIufl'r

~

3

4

5

01 J

I

;

Volume

0.

>

e

IV

Name

l-

.L
8

6
[)

'!'

9

10

11

(Columns 17 to 72 )

12 13 14 15 16

III I 111

135628

Figure 5-4.

Work File Specification

You can specify only one work file per sort operation; however, specification of the work file is
optional. If not specified, the work file is automatically created on the system disk and is released
upon completion of Sort/Merge processing. When possible, the work file should be specified on a
disk unit that is not being used for the Sort/Merge input or output files. This technique results in
faster sorts.
It is not necessary to specify variables such as the logical and physical block size and the number
of physical blocks in the file for the work file. The Sort/Merge optimization algorithm determines
optimal physical block size based on the available memory, the record (or control field) size, and
the number of input records. Thus, any attempt to specify block size could result in slower sort
times. (See paragraph 5.4.2.3.)
Table 5·2 lists the entries for the Work File Specification.
5.3.1 File Use (Column 7)
A preprinted W in this column identifies this as the Work File Specification.
5.3.2 WFT - Work File Type [E] (Column 8)
If the Input File Specification (paragraph 5.4) does not specify the number of records to be sorted,
this field is ignored and the work file is allocated expandable.

Column 8 Entry
N or blank

E

5-6

Explanation
File is allocated nonexpandable
File is allocated expandable

946252·9701

File Description Specifications

Table 5-2.
Suggested
Batch
Keywords

Work File Specification Column Summary

Columns

Entries

3-51

030

61

0
W

71
WFT

a
N or blank
p
9-16

WFV

DS01 2
or blank
DSnn
or volume

Explanation
(Interactive Prompts Capitalized)

Paragraph
Number

Preprinted; identifies line 030

4.2.1

Preprinted; designates a line in File
Description Specification

5.1.4

Preprinted; identifies this as the Work
File Specification

5.3.1

Work fi Ie type:
- File allocated nonexpandable
- File allocated expandable

5.3.2

Work file volume:
- System disk

5.3.3

-

Disk nn; a-character volume name

Notes:
1

These columns must be filled in if Work File Specification is used.

2

Default value.

5.3.3 WFV - Work File Volume [OS01] (Columns 9 through 16)
This is the disk name or volume on which the file is to be created. The volume name under which
the disk is installed is a maximum of eight characters long, with the first character alphabetic.
Column 9 through 12 Entry
OS01 or blank
OSnn

Volume

946252·9701

Explanation

File is allocated on system disk
File is allocated on disk nn
One- to eight-character name is
specified when disk is installed

5-7

File Description Specifications

5.4

INPUT FILE SPECIFICATION

The Input File Specification is located at the bottom of the File Description Specification (Figure
5-5). This specification has two-line entries, similar to those of the Output File Specification at the
top of the worksheet. Space is provided to describe up to five input files, the maximum that can be
used in a merge program. (Only one file is used for a sort operation.) Table 5-3 describes the entries available for specifying the output file.
Sequential, relative record, or key-indexed files created by the file management routines or
devices (such as card readers), can be used as an input file for Sort/Merge (for example, a COBOL
file or a file from a previous Sort/Merge run).

NOTE
Relative record files sometimes contain unused records set aside
for future expansion. You should delete these unused records
during the Sort/Merge process to avoid wasting disk space.

5.4.1 First Line of Input File Specification
Figure 5-5 shows the entries for this line.
5.4.1.1 File Use (Column 7). A preprinted I in this column identifies the first line of a two-line
entry describing the input file.
5.4.1.2 FT - File Type [S] (Column 8). This specification defines the file organization as either
sequential, relative record, or key-indexed.
Column 8 Entry

Explanation

s

Sequential file organization

R

Relative record file organization
Key-indexed file organization

INPUT FILE

Coml1ents

(C,)lumns 45

to 72)

135630

Figure 5-5.
5-8

First Line of Input File Specification
946252-9701

File Description Specifications

Table 5·3.
Suggested
Batch
Keywords

Input File Specification Column Summary

Columns

Entries

3-51

04x-12x

61

D

Explanation
(Interactive Prompts Capitalized)

Paragraph
Number

Line 1:

71

8

FT

S2
R
I
FP

Prepri nted; numbers
specification lines

specify sequence of

4.2.1

Preprinted; designates a line in File Description
Specification

5.1.4

Preprinted, every other line; designates first line of
Input File Specification

5.4.1.1

File type:
- Sequential file
- Relative file
- Key-indexed file

5.4.1.2

9-44 1

File pathname; the input file pathname in the format required by the operating system (for example,
DS05.HDWRDIR.TOOLlB.HMRFIL); maximum of
36 characters

45-80

Comments; enter up to 36 ASCII characters

5.4.1.3

Line 2:

3-5

05x-13x

6

Preprinted; numbers specify
specification lines

sequence of

4.2.1

D

Preprinted; designates a line in File Description
Specification

5.1.4

7

A

Preprinted, every other line; identifies second line
of Input File Specification

5.4.2.1

LRL

8-11

Integer

Logical record length; required by the language
interfaces or when using devices that do not have
a default logical record length

5.4.2.2

NOLR

16-23

Integer

Number of logical records; required if the work file
is created nonexpandable

5.4.2.3

Notes:
1

These columns must be filled.

2 Default value.

946252-9701

5-9

File Description Specifications

FP - File Pathname (Columns 9 through 44). You must specify a file or device for an input
file pathname. The pathname syntax is defined in the reference manual for the DX10 operating
system. The maximum pathname length allowed is 36 characters.

5.4.1.3

5.4.2

Second Line of Input File Specification
Figure 5-6 shows the entries for this line. If expandable is specified in the Work File Specification,
this line is usually optional (see paragraph 5.4.2.2); otherwise, Sort/Merge uses the data on this
line to allocate the work file area.
File Use (Column 7). A preprinted A in this column signifies that this is the second entry
of a two-line entry describing an input file. It always follows a first-line entry marked by an I in
column 7.
5.4.2.1

LRL - Logical Record Length [Blank] (Columns 8 through 11). This is the logical record
length, right-justified (ends in column 11), of the input file. It is required when Sort/Merge is accessed from a language program and is required for intertask communication. It is also required
when using an input device that does not have a defined logical record length (for example,
magnetic tape). If a value is specified and is larger than the defined logical record length of the
file, the specified length is used. If this field is specified and is smaller than the defined logical
record length, the defined logical record length is used.
5.4.2.2

NOLR - Number of Logical Records [Blank] (Columns 16 through 23). This field must be
specified if the work file is to be allocated nonexpandable. If NOLR is specified and the work file is
expandable, NOLR/8 is used for both primary and secondary disk file allocation parameters when
the work file is created. If NOLR is not specified, the work file is allocated using default primary
and secondary disk allocations.
5.4.2.3

NOTE

No increase in performance is gained by using nonexpandable files.
In addition, Sort/Merge will not produce the desired results if the
nonexpandable files are not created large enough to handle the
desi red sort.

iNPUT FILE

Comments

(C.)iumns 45

td

72

~

135629

Figure 5-6.

5-10

Second Line of Input

Fi~e

Specification

946252·9701

6
Record Selection Specification
8.1

GENERAL

The Record Selection Specification designates which records Sort/Merge is to select for the work
and output files. Criteria for record selection include the following:
•

One or more specified characters in positions of the input record

•

An input record field that contains a value with a specific relationship to a value in
another field within that same record; that relationship is one of the following: equal to,
not equal to, less than, greater than, less than or equal to, or greater than or equal to.

The following are examples of records that Sort/Merge can select from an input file:
•

Records that have an A or a B in the first position of the iflput record

•

Records that have a value between 120 and 140 in positions 6 through 10

•

Records that have one of the letters A through M (inclusive) in position 44

•

Records in which the value in positions 66 through 67 is greater than or equal to the
value in positions 68 through 69

•

Records that meet all of the above criteria

Figure 6·1 shows the entries to the Record Selection Specification. Table 6·1 is a summary of the
entries to the Record Selection Specification.

NOTE

If all records in a file have the same format and all are to be sorted or
merged, a Record Selection Specification is not necessary.

8.2

COLUMN DESCRIPTION

The following paragraphs explain the column entries for the Record Selection Specification.
8.2.1 Page Numbers and Line Numbers (Columns 1 through 5)
The page numbers and line numbers are described. in paragraph 4.2.1.

946252-9701

6-1

Record Selection Specification

SORT/MERGE SPECIFICATION, SHEET B
1

:>

OJ

Pr

Record Selection Specification

R.,

Operand 1

Operand 2 (F leld or Constant

EO

I
I

NE
LT

G1
LE

LocatIon

.
4

,
1

5

,

6

1

7

Fro~
5 E

B

a

10

t

GE

Tl~

1 17 13 1.

From

'!; ,

Co,..,ment~

- - - , Constant
~ ___- LocatIon
I
To

6 17 18 t9 20 21 27 23 14 75 26

I

nJ 28

29 30 31 37 33 34 35 36 37 38 39

I

I
I

I
I
I

, e
1

9

1

0

7

,

I

J

I

I
1

2

1

3

I
I
I
J

I

2 •

I

I
I

I

1 6

I

Figure 6-1.

Record Selection Specification

6.2.2 RST - Record Selection Type [I](Column 6)
Use column 6 to specify the type of line. An I in this column indicates either an include or an
include-all line; an 0 indicates an omit line.
Column 6 Entry

Explanation
Include or include-all line

o

Omit line

6.2.2.1 Include Line. Include lines identify records that you want sorted or merged with your output file. A record is commonly identified by the presence (or absence) of a certain character in a
specific record position; this identification method distinguishes one input record type from the
other types in the file. The record identification is entered on an include line. Records not described in include lines will not be sorted.

6-2

946252·9701

Record Selection Specification

Table 6-1.
Suggested
Batch
Keywords

Columns

Record Selection Specification Column Summary

Explanation
(Interactive Prompts Capitalized)

Entries

01-99
14x-26x
RST

o
CON
Blank2

A

o
CP

Z
D
S
P
U

4.2.1

Page number
Preprinted; numbers specify sequence
of specification lines
Record selection type:
- Include records described on this
line
- Omit records described on this line

6.2.2

Continuation:
- A blank indicates that this is the
only line or the first line describing
the record type; if more than one
line, continuation lines with A or 0
in column 7 follow this entry
- An AND continuation line
- An OR continuation line

6.2.3

Character portion:
- Compare both zone and
portions
- Compare only zone portion
- Compare only digit portion
- Compare signed ASCII
- Compare packed fields
- Compare unpacked fields

6.2.4
digit

Blank2

Operand 1 beginning:
- Field is one position; see columns

1-4096

-

01B

Paragraph
Number

6.2.5

13-16

01E

13-161

REL

1-4096

17-181
EQ

NE
LT
GT
LE
GE

946252-9701

Position on the input record in
which operand 1 begins

Operand 1 ending:
column position in input record of one
character field or position in which
operand 1 ends

6.2.5

Relational operator:
Shows the relation of operand 1 to
operand 2:
- Equal
- Not equal
- Less than
- Greater than
- Less than or equal
- Greater than or equal

6.2.6

6-3

Record Selection Specification

Table 6-1.
Suggested
Batch
Keywords

Record Selection Specification Column Summary (Continued)

Columns

Entries

191

FOC

F
C
20-231

02B

Blank2
1-4096

02E

24-27

02C

20-39

40-80

1-4096

Explanation
(Interactive Prompts Capitalized)

Field or constant:
- Operand 2 is a field
- Operand 2 is a constant

Paragraph
Number

6.2.7

Operand 2 beginning:
- Field is one position; see columns
24-27
- Position on the input record in
which operand 2 begins

6.2.8.1

Operand 2 ending; position in input
record where operand 2 ends

6.2.8.1

Operand 2 constant; these columns
contain the character string to which
the operand 1 field is being compared;
can be several lines long (256
characters maximum)

6.2.8.2

Comments; enter up to 41
characters

ASCII
6.2.9

Notes:
1

These columns must be filled.

2 Default values.

6.2.2.2 Include-All Line. An include-all line designates that all input record types that have not
been described by preceding include and/or omit lines will be sorted. Because of the inclusive
nature of this line, record identifications are not supplied in columns 7 through 39. However,
record types included by an include-all line must have identical Reformatting Specifications.

NOTE
Only one include-all line is allowed per input file. When used, the
line must be the last line of the set of Record Selection Specifications.

Records not described by either include or include-all

line~

do not take part in the sort or merge.

6.2.2.3 Omit Line. Omit lines identify those records that you do not want sorted. Omit lines are
not required but can be helpful when you are using many types of records but are omitting only a
6-4

946252-9701

Record Selection Specification

few. An include-all line usually follows an omit line to ensure that all records not described by
omit lines will be sorted.
6.2.2.4 Include and Omit Sets. Reformatting Specification lines complete the identification of input records involved in the sort or merge. Section 7 describes these Reformatting Specifications
in detail. The combination of Record Selection Specifications and Reformatting Specification
lines for lone or more record types is called an include set.
A record type is identified by at least one characteristic for all records in that type. For example,
records may be recognized by the characters ABC in positions 4, 5, and 6 of the input records.
Besides the include set, there is an omit set. An omit set identifies record types to be omitted (or
excluded) in a sort or merge. An omit set never requires Reformatting Specification lines because
excluded fields need not be described.
Sort/Merge processes both the include and omit sets in the order in which they appear in the
sequence specifications.
Using Include or Omit Sets.

Include sets are used when sorting or merging only a few records in a
file or files. An include set is used for each type of record to be sorted or merged.

Omit sets are used when sorting or merging all but a few records in a file. All omit sets must be
followed by either an include set for each type of record to be sorted or an include-all set. The
include-all states that the sort or merge should include all records not omitted or included by
previous omit or include sets.
Mixing Include and Omit Sets.

You can mix include and omit sets. However, you should take care
in doing so since Sort/Merge processes the sets in the order in which they are coded. For
example, to omit all records with a 3 in position 20, while including all records with a 3 in positions
20 and 25, you must specify the include set before the omit set. If the omit set were specified first,
all of the records to be sorted would be omitted.

Include/Omit Set Summary.

The following summarizes the criteria for record selection:

•

An include set must have at least one Reformatting Specification line.

•

An omit set does not need a Reformatting Specification line.

•

An omit set must be followed by an include set (usually an include-all); the only records
to be included will be those in the include set.

•

A typical omit set is followed by an include set that states that the sort or merge should
include all records not specifically omitted by the previous omit lines.

•

The last entry in the Record Selection Specification must specify an include set.

•

Only one include-all line is allowed for an input file. Tables 6-2 through 6-5 show examples of include and omit sets. Note that the combinations of include and omit sets
depend on the entry in column 7 (explain'ed in paragraph 6.2.3).

946252·9701

6-5

Record Selection Specification

Table 6-2.
Column 6

Column 7

Explanation

Blank

This is the first line of an include set on the
Record Selection Specification. This line
describes a record type to be included in a sort
or merge. Additional specifications for record
selection in this include set can follow with an A
or 0 in column 7.

A

This is an additional line to an include set
description. This line describes additional
specifications that a record must meet in order
to be included in the sort or merge. (The record
must meet both the previous criteria and these
additional criteria to be included.)

o

This is an additional line to an include set
description. This line states that a record
meeting the criteria on this line will be selected.
(The record must meet either previous criteria or
these criteria to be included.)

Table 6-3.

6-6

Columns 6 and 7 Entries for Include Sets

Columns 6 and 7 Entries for Omit Sets

Column 6

Column 7

Explanation

o

Blank

This is the first line of an omit set on the Record
Selection Specification. This line describes a
record type to be omitted in a sort or merge. Additional specifications for record selection in
this omit set can follow with an A or 0 in column
7.

o

A

This is an additional line to an omit set description. This line describes additional specifications that a record must meet in order to be omitted in the sort or merge. (The record must meet
both the previous criteria and these additional
criteria to be omitted.)

o

o

This is an additional line to an omit set description. This line states that a record meeting the
criteria on this line will be omitted. (The record
must meet either the previous criteria or these
criteria to be omitted.)

946252-9701

Record Selection Specification

Table 6-4.
Column 6

Include Set Combinations of Specification Lines

Column 7

Explanation

Blank
A

One or more lines with A in column 7
following the first line signifies include AND
lines.

Blank

One or more lines with 0 in column 7 following
the first line signifies include OR lines.

Blank
A

One or more A and 0 lines, in any order, following the first line signifies include AND lines
and OR lines describing one record type.

Blank

One include line without A or 0 lines following
signifies an include-all entry. This tells
Sort/Merge to include all records not previously defined by preceding include or omit
lines.

Blank

An implied include-all line. If no Record Selection Specification line is used, all records in
the input file will be sorted.

o

o

Blank

Table 6-5.

Omit Set Combinations of Specification Lines
Explanation

Column 6

Column 7

0
0

Blank
A

One or more lines with A in column 7 following
the first line signifies omit AND lines.

0
0

Blank
0

One or more lines with 0 in column 7 following
the first line signifies omit OR lines.

0
0
0

Blank
A
0

One or more A and 0 lines, in any order, following the first line signifies omit AND lines and
OR lines describing one record type.

6.2.3 CON - Continuation [Blank] (Column 7)
Column 7 indicates the relationship between this line and the preceding Record Type Specification line.
An AND line is a continuation of the set of identifiers for a single Record Type Specification line.
This type of line is used if more than one condition is required to identify a record. Record descriptions in an AND relationship use a single set of Field Specifications, since only one record is
being defined by this include set.
946252-9701

6-7

Record Selection Specification

An OR line provides an alternate record type (or types) to share a single set of Field Specifications.
Again, all of the Record Type Specification lines in an OR relationship share a single set of Field
Specifications. Together, these lines form an include set.
Define a new include set (blank in column 7) when a preceding field description is not appropriate
for the record type about to be defined. The following summarizes the column 7 entries.

Column 7 Entries

6.2.4

CP -

Explanation

Blank

The first line of a set of include or
omit lines. (The type of set is in·
dicated by the column 6 entry.)

A

This line is a continuation of the
preceding line (AND line).

o

This defines a different record type
than the preceding line, but the
Field Specifications are the same
for both (OR line).

Character Portion [Blank] (Column 8)

Column 8 tells Sort/Merge how to interpret data in the operand 1 and operand 2 fields during compare operations. The only allowable entries are alphanumeric and signed ASCII. When the fields
contain alphanumeric data, a C, Z, or D entry tells Sort/Merge what portions of the characters to
use.
The letter S in this column specifies that the field contains a signed ASCII value. This means the
characters contain a sign character signifying plus or minus; this character is the least significant
character of the field. Thus, Sort/Merge will use the signed value of the numerical string to determine relationships of that field to other fields or absolute values.
The letter P in this column specifies that the field contains numeric data in packed format. The letter U in this column specifies that the field contains numeric data in unpacked format.
The following specifies the possible values for Column 8 entries.

6-8

946252·9701

Record Selection Specification

Column 8
Entry

Explanation

Maximum Field Length
(In characters)

256

C

Compare both zone and digit portions of
characters

z

Compare only zone portion of the character

o

Compare only the digit portion of the
characters

16

5

Compare using the least significant byte of
the field as a sign byte

16

Compare numeric data in packed format

8 (16 digits)

Compare numeric data in unpacked format

16

Note:

Do not specify P or U when an alternate collating sequence is being used (5 in
column 26 of header line).

1

6.2.4.1 Character Portion Indicators (C, Z, or 0 In Column 8). As explained in paragraph 6.1,
Sort/Merge can select only those records having specific values in certain portions of the record.
For example, each record being searched in the input file might be in an aO-position format, with
each position corresponding to a character in a column on a card. The values for each character on
the card are stored in memory or on the disk in a binary format, the same format that comprises
the ASCII character set.

Figure 6-2 shows several of the ASCII characters. This figure also shows how the eight-bit ASCII
binary code is divided into zone and digit portions.
On inspection of the ASCII number set, notice that all numbers have the same zone portion (that
is, all eight-bit representations of ASCII numbers have the binary representation of 0011 2 for the
first four bits). However, the digit portions of ASCII numbers are different, ranging from 0001 2 (a
binary 1) for decimal 1 to 1001 2 (a binary 9) for decimal 9.
Letters in ASCII code use different zone portions as well as different digit portions. Note that the
codes range from a 41111 for an A (the zone portion is 4, the digit portion is 1) to a 5A'8 for a letter Z.
Depending on the particular application, you may want either to compare only the digit portions of
the characters in the input record or to use the entire binary representation (zone and digit portions) in the comparison. DeSignating this is the purpose of the column a entry.
The comparison of zone and digit portions of characters may not be as important to the ASCII user
as it is to the user who employs an alternate sequence to sort or merge files created in EBCDIC or
in another character coding scheme. Appendix D shows the EBCDIC collating sequence.

946252·9701

6-9

Record Selection Specification

Column 8 is involved in the identification of a record type. The record item whose location is
entered into operand 1 (columns 9 through 16) is compared against the constant or item specified
in operand 2 (columns 20 through 27). Column 8 specifies the type of comparison to make. When
operand 1 is an alphanumeric item, column 8 specifies whether a comparison should be made on
the basis of the high-order four bits (the zone), the low-order four bits (the digit), or the entire eight
bits of each character of the operand 1 field.
With a zone comparison or a digit comparison, several characters share an equal comparison. A
full character or zone comparison on the characters 1 and A yields an unequal result; however, 1
and A yield an equal result in a digit comparison.
If, in another example, a D is entered in column 8 when only those records with a 3 in column 20
and a 3 in column 46 are needed, the entry might produce not only the records requested but also a
lot of unwanted records (for example, records with C in those positions, because an ASCII C and
an ASCII 3 both have 001 2 in their zone portion). To obtain only the records with a 3 in column 20
and a 3 in column 46, enter a C in column 8. The C tells Sort/Merge to use both the zone and digit
portions of characters in its comparison; no other ASCII character has both the same zone and
digit portions as a 3.

o0

1

0 0 0 0

o0

1

0 0 0 1 = 31 16 = one (decimal)

o0

1

0 0 1 0

= 32 16 = two (decimal)

o0

1

1 0 0 1

= 39 16 = nine (decimal)

o

1 0 0 0 0 0 1

= 41 16 = A (letter)

o

0 0 0 0

o

0 0 0 0 1

= 43 16 = C (letter)

o

1 0 0 1 1 1

= 4F 16 = 0 (letter)

o0

0

= 42 16 = B (letter)

0 0

= 50 16 = P (letter)

010

1 0 1 0

'-v-'

'-v-'

= 5A 16 = Z (letter)

Zone
Portion

Digit
Portion

010

135631

Figure 6·2.

6-10

= 30 16 = zero

Note: A complete ASCII character set is
shown in Appendix C.
Zone and Digit Portions of ASCII Characters

946252·9701

Record Selection Specification

Signed ASCII Indicator (S in Column 8). If signed ASCII is used, the sign is placed in the
least significant byte of the numerical character string, as shown below, for the number -1975:

6.2.4.2

SIGN BYTE
31 16

39 ,6

37 ,6

35 ,6

20 ,6

BYTE
1
(1 )

BYTE
2
(9)

BYTE
3
(7)

BYTE
4
( 5)

BYTE
5

1=

1975-

(-)

(A)135632

The sign in the least-significant byte is indicated by the ASCII code for a minus sign (2D1~or a
positive sign (28 11 ). A positive value is also indicated by the ASCII code for a space (2011 ).

NOTE

When specifying a signed ASCII constant, specify all digits, with
the exception that you can use a blank space to denote the positive
sign.

Since the sign must be in the least significant byte, you can enter data in the input file in the
following format:
11

10

I

PART NUMBER

3144
150

18

17
BALANCE

15000300

3144

7000-

3144

30000+

150

200-

I

80
COMMENTS
SHIPPED TO ACCT. A
RECEIVED FROM MFGR.
SHIPPED TO ACCT. C
RECE IVED FROM MFGR.
SHIPPED TO ACCT. X

(A) 135633

Thus, Sort/Merge uses the sign value to make the record selection. In the above example, the sign
byte is in position 17 of the input file, and the field containing the balance values begins in position 11 (and ends in position 17). To specify this in the operand 1 columns, place the first position
of the field in the From columns, right-justified, and the last position of the field in the To columns, right-justified. The To column is the column of the sign. Figure 6-3 shows how to include all
records when the BALANCE entries in the above example contain values greater than zero.

946252·9701

6-11

Record Selection Specification

SORT/MERGE SPECIFICATION, SHEET B
1 2

Page

Record Selection Specification

IT]
6
~

Line
Number

3

4

Operand 1

c:

S

0

-

~ .~ ~
~ .g ~
>I-

1

4~I

1

5

Location

u!~

5 6 7

8

f-rom

9

,

Operand 2 (Field or Constant

ReI.
EO
NE
LT
GT
LE
GE

I
I

Location

To

From

10 11 12 13 14 15 16 17 18 19 20 21 22 23

5

I

Comments

I Constant

~

I
To

I

24 25 26 27128 29 30 31 32 33 34 35 36 37 38 39

I 7 GIT C 00 ~ 00 o!+

(Column, 40 to 72)

I

I
I

I

SPECIFIED:

INCLUDE RECORDS IN WHICH THE SIGNED ASCII VALUES IN
INPUT RECORD POS ITIONS t t TO t 7 ARE GREATER THAN
(GT) ZERO.

135634

Figure 6-3.

Example of Specifying Signed ASCII Value

6.2.5 01 Band 01 E - Operand 1 Beginning and Ending [Blank] (Columns 9 through 16)
The operand 1 field identifies the positions on the input records that are to be compared (included
or omitted from the output records). Sort/Merge obtains an image of the data at these specified
positions in the input records and compares it to the data identified by the operand 2 entry
(paragraph 6.2.8) according to the comparison criteria (for example, equal to or greater than) in columns 17 and 18 (paragraph 6.2.6).

The operand 1 field cannot describe a field length larger than the length of the records being used.
For example, if the records are in an 80-column format (such as records contained on 80-column
cards), the value of the operand 1 field cannot exceed 80.
Column Number

Column Entry

Explanation

9-12

Blank or 1-4096

Identifies first position of input record
field (blank if field is one character
long).

13-16

1-4096

Identifies last position on record field.

The maximum total characters that can be specified in an operand 1 or 2 field is 256. The operand 1
entry is further restricted by the column 8 entry, as follows;

6-12

Column 8 Entry

Maximum Characters
In Factor 1 Field

c

256

z

1

D

16

946252-9701

Record Selection Specification

Column 8 Entry
(Continued)

Maximum Characters
in Factor 1 Field

s

16

p

8 (16 digits)

u

16

Sometimes it is necessary to identify a record type by characters at several record positions, requiring several sets of operand 1 and operand 2 fields. To define additional fields, use additional
lines on the Record Selection Specification; however, you must place the letter A or 0 in column 7
for additional lines .
The operand 1 field contains two four-column entries. The first, marked From, identifies the first
record position; the second, marked To, identifies the last record position. For example, to select
zip codes specified in record positions 61 through 67, specify record position values, rightjustified, in columns 11/12 and 15/16, respectively. However, if you check for one character in
record position 25, this value is marked in the To field, right-justified, without an entry in the From
field.
In Figure 6-4, the user specified a search for those records with an X in position 3 and a number
between 100 and 199 in positions 21 through 23. Note that several operand 1 and 2 fields are required to describe the desired records.
6.2.6 REL - Relational Operator [Blank] (Columns 17 and 18)
The operand 1 and 2 entries establish the position of certain ASCII characters on the record. These
characters must be compared to other characters or values to determine whether to send the
record to the output file. Columns 17 and 18 specify the relationship between operand 1 and
operand 2, as follows:
Columns 17
and 18 Entry

Explanation

EQ

Operand 1 is equal to operand 2

NE

Operand 1 is unequal to operand 2

LT

Operand 1 is less than operand 2

GT

Operand 1 is greater than operand 2

LE

Operand 1 is less than or equal to operand 2

GE

Operand 1 is greater than or equal to operand 2

Sort/Merge selects records for the input file on the basis of these relationships being true.

946252-9701

6-13

Record Selection Specification

SORT/MERGE SPECIFICATION, SHEET B

rn
1 2

Pag,~

Record Selection Specification
Operand 1

-

11

EO
NE
LT
GT
LE
GE

"";;3
0

~

~ ·~I~

Line
Nu!nber

w§j.e

cc
>-

C
0

IN

Location

~

~U~

3

4

1

4~II ~

1

5~

1

61c

5 6

7 8

IlAlc
tIAlc

I
I

~

...

From

10 11 12 13 14 15 16 17 18 19 20 21 27 23

3E Qc
23 GE C I 00
213 LE C , c, Itt
)(

ZI
2I

SPECIFIED:

Comments

I Constant
I

Location

To

"'rom
9

Operand 2 (F ield or Constant

Rei

~

To

1

24 25 26 27128 29 30 31 32 33 34 35 36 37 38 39

(Columns 40

to 72)

I

I
I

I
I

I

- -- -

INCLUDE RECORDS WITH X IN POSITION 3 AND NUMBERS 100
TO 199 IN POS ITIONS 21 TO 23.

135635

Figure 6·4.

Example of Operand 1 and Operand 2 Entries

6.2.7 FOe - Field or Constant [Blank] (Column 19)
The operand 1 field can be one or more characters or a string of numerical values. To compare this
field to another field (of equal length), specify the appropriate record positions in the operand 2
field. You can also compare the contents in the operand 1 field to one or more constants, such as
a specific number or one or more characters.

The following specifies the possible values for column 19 entries:
Column 19 Entry

Explanation

c

Operand 2 is a constant; value in operand 1
position(s) is compared to this constant.

F

Operand 2 is a field; value in operand 1
position(s) is compared to the values in the
field in operand 2.

To define the contents of the operand 2 field, place either C for constant or F for field in column
19, as shown in Figure 6-5.
6.2.8 Operand 2 Location or Constant [Blank] (Columns 20 through 39)
The following paragraphs explain the entries for the operand 2 location or constant.
6.2.8.1 02B and 02E - Operand 2 Beginning and Ending [Blank] (Columns 20 through 27). These
columns identify the record positions that will be compared to the positions specified in the
operand 1 location field. Since this identifies a field on the input record, the letter F must be in column 19. The values in the From column identify the record position that begins the field. The
values in the To column identify the last position in the field on the input record. The operand 1
field and the operand 2 field must be on the same record, and the number of characters in both
fields must be the same.

6-14

946252-9701

Record Selection Specification

SORT/MERGE SPECIFICATION, SHEET B
1 7

Page

CD

Record Selection Specification
Operand 1

Operand 2 (F ield or Constant

ReI.

EO

~

L,ne

GT

Number ~

6

LE

Location

>-

I-

"

I
I

NE
LT

rrom
7

8

9

~

Location

GE

From

To

10 11 12 13 14 15 16 17 18 19 20 21 22 23

3

4

1

4()I C

ZO

1

50 I~C

'II

Z9 GTF
'fIS E. Q

SPECIFIED:

I Constant

3~

c PA RoT

Comments

I
To

1

24 25 26 27128 29 30 31 32 33 34 35 36 37 38 39

(Columns 40 to 72 )

39:
M0

I

•I

INCLUDE RECORDS IN WHICH POSITIONS 20 TO 29 ARE GREATER
THAN POSITIONS 30 TO 39 AND POSITIONS 4 t TO 48 CONTAIN
THE CHARACTERS PART NO.

135636

Figure 6-5.

Example of Field and Constant Entries

NOTE
If operand 2 is a field, the field position values in the From and To
columns are right·justified to columns 23 and 27, respectively.
If operand 2 is a constant or a constant string, the constants are left·
justified; that is, the character in the first position in operand 1 is
compared to the character in column 20.

Figure 6-6 shows how operand 1 and operand 2 describe fields in the input record.
If the constant in operand 2 is a character string requiring more than the 20 positions in columns
20 through 39 on the Record Selection Specification sheet, you can use additional lines, as shown
in Figure 6-8. The operand 2 constant field, in columns 20 through 39, contains the character string
with the input record columns defined in the operand 1 field. You can use up to 256 characters as
constants if both zone and digit fields are checked. (See paragraph 6.2.4 for the use of other
fields.)
6.2.8.2 02 - Operand 2 Constant [Blank] (Columns 20 through 39). These 20 columns contain the
constant or a constant string to which operand 1 is to be compared. When this field contains a
constant, place the letter C in column 19.
When operand 2 is a constant, it must occupy the same number of input record positions as
specified in operand 1. For example, assume that the operand 1 field specifies three positions and
the relational operator and operand 2 specify a number greater than 5 in that three·position field; in
this case, the operand 2 entry should also be three positions long, with the 5 in the least·
significant position (a 005 entry in columns 20 through 22). Unused character positions to the left
of the operand 2 character(s) can be blanks or zero filled. Figure 6-7 shows an example of zero· and
blank·filled fields; in this example, operand 1 specified more positions than the constant contains.

946252·9701

6-15

Record Selection Specification

SORT/MERGE SPECIFICATION, SHEET B

rn
I 7

PJ'le

Record Selection Specification
Operand 1

(3

EO

-

J

'Ec:

I-

<3

6

7

~)

4

r., I 11

I

LT
GT
LE
GE

:J

~
>-

NUIl'i>P.I

I
I

NE

g .~
Lint'

Operand 2 (F leld or Constant

Rei

~

LocatIOn

9

Ll.

Loc~t

ro

r-I urn
,

So'

ro

From

10 1 I 12 13 14 15 16 17 18 19 20 21 22 23

C()mm~nt5

I Constant
I

Ion

I
(Co!Unll\<;

24 2!o 26 27128 29 30 31 32 33 34 35 36 37 38 39

40

III

72)

I I I{, I 1/12 GIT != I I/lb I IZ12: I I I 11 JJ I I 11

~
~

SPECIFIED:

INCLUDE RECORDS IN WHICH POSITIONS 6 TO 12 ARE GREATER THAN
POSITIONS 16 TO 22.

135637

Figure 6-6.

Example of Operand 2 Field and Constant

SORT/MERGE SPECIFICATION, SHEET B

Record Selection Specification
Operand 1

Q

EO
NE
LT
GT
LE
GE

0

~ '§

LII)e

Nllmber

~ 'f

L.ocatlon

>- b

I- U

6

~)

hom

3

4

I

401 Ie

I

5 ,...

7.0 '-

1

60

IIII\'C

8

9

Operand 2 (F leld or Constant

Rei

~

I
I

S:'
Location

To

I

,

I
To

From

10 I I 12 13 1415161718 19 20 21 22 23

5G TC 00
iP-.F l:J C A

3

I

24 25 26 27128 29 30 31 32 33 34 35 36 37 38 39

(Columns 40 to 72 i

I

S

I
I

I

, 10

) 'I GT C

SPECIFIED:

Comments

I Constant

u..

I

I

INCLUDE RECORDS WITH A VALUE GREATER THAN 5 IN POSITIONS
3 TO 5. THE LETTER A IN POSITION 8 AND A VALUE GREATER
THAN 10 IN POSITIONS 1 1 TO 14.

135638

Figure 6-7.

Example of Operand 2 Constants

SORT/MERGE SPECIFICATION, SHEET B
1 7

Page

Record Selection Specification

[JJ
EO
NE

c:

line
NlImher

~w ~::
~ g

4

~)

()

I
I

LT

GT
LE
GE

Locatlun

I- U

3

Operand 2 IF ield or Constant

A",

Operand 1

(3

~

rrom

7 8

9

u..

Location
From

To

10 I I 12 13 1415161718 19 20 21 22 23

1

4

r c

lie

1

5

II\C

3~

I

6

II~C

SiC)
SPECIFIED:

Comments

I Constant
I

So'
To

I

24 25 26 27128 29 30 31 32 33 34 35 36 37 38 39

29 EQ CA JA X 5T K>:R ~' s sp IE cl l\L
49 ~ ~ C CltJ IS 11(; IN! E:« elc InIE. 1\2 4~ ~
51 EI~ Ie 0'
I
_.
I

-

-- ' - -

'-

(Columns 40 tu 72 I

FINO
(! H4RAc. T~R

STRING

INCLUDE RECORDS WITH A SPECIFIC CHARACTER STRING IN INPUT
RECORD POS ITIONS 10 THROUGH 51 •

1 35639

Figure 6-8.
6-16

Example of Multiline Constant Field
946252·9701

Record Selection Specification

If operand 1 is packed, the last character in the constant must be its sign (+ or -). If operand 1 is
unpacked and the constant is a negative number, the last character in the constant must indicate
both the numeric value of the last digit and the negative sign for the entire constant (Figure 6-9).
For a signed ASCII constant, the sign (+ or -) is always the last character of the constant.
In Figure 6-10, the entries specify sorting records that have a packed negative 2 (- 2) in positions 2
and 3, an unpacked negative 27 in positions 6 through 9, an unpacked negative 10 in positions 12
through 17, and a signed ASCII negative 14 in positions 19 through 23.

6.2.9 Comment Lines (Columns 40 through 80)
To include annotated comments about a Record Selection Specification line, place the comments
in columns 40 through 80. These comments will be printed with a specification summary if a zero
or blank is placed in column 27 of the Header Specification.
6.2.10 Examples
Figures 6-11 through 6-15 show different forms of the completed Record Selection Specification.

Last Digit

Character to Code

o

}or] (minus zero code)

1
2

J
K

3
4
5

L
M

o

7
8
9

Q

Figure 6·9.

946252·9701

N

6

P

R

Unpacked Constant Coding for Negative Values

6-17

Record Selection Specification

SORT/MERGE SPECIFICATION, SHEET B

rn
1 2

Page

Record Selection Specification
Operand 1

0

~

EO
NE
LT
GT
LE
GE

g~~

Line

-

::>-

>-

0

~

5 6

7

8

~ .~ ~

Nunlher

Location

-

f- U

Operand 2 (Field or Constant

Rei.

~

To

From

I
I

I Constant
Location

I

To

From

3

4

1

4

I f

1

5

rAU

1

6

1

7

1

8

,

9

2

0

2

1

2

2

2

3

2

4

I

2

5

I

2

6

I

9

10 11 12 13 14 15 16 17 18 19 20 21, 22 23

I~U
l~S

24 25' 2627128 29 30 3132 33 34 35 36 37 38 39

t ..

:~
I,t

13~ f-C
I'IM I~ C1'1
C

It P

, ct

2. ~E '~ 'C

,~-

Z.

"Q

Comments

I

i

IColumns 40

10

721

PACKlD -2.
UN~c..~e.D

I J
I

-2.7

UNP~KEO -10
SI_uNE. 0 ~c:..en 14

-

j
I
I

I
I
I
I

I

Figure 6-10.

Packed, Unpacked, and Signed ASCII Sort Specifications

SORT/MERGE SPECIFICATION, SHEET B
1 2

Page

IT]

Record Selection Specification
Operand 1

Q
Line

Number

~

Location

>-

f-

hom
3

4

1

4

1

5

~

6

7

8

I C

9

Operand 2 (Field or Constant

ReI.

EO
NE
LT
GT
LE
GE

I

I

~

To

9£ ~ ~

I

I

24 25 26 27/28 29 30 31 32 33 34 35 36 37 38 39

7

Comments

I
To

From

10 11 12 13 14 15 16,17 18 19 20 21 22 23

7

I Constant

Location

I

(Columns 40 to 72 I

9/
I

I
SPECIFIED:

INCLUDE ALL RECORDS IN WHICH THE CHARACTERS IN INPUT
RECORD POS ITIONS 7 TO 9 ARE THE SAME AS THOSE IN
POSITIONS 17 TO 19. CHECK BOTH ZONE AND DIGIT PORTIONS
OF CHARACTERS.

135640

Figure 6-11.

6-18

Include Set Example

946252·9701

Record Selection Specification

SORT/MERGE SPECIFICATION, SHEET B

rn
I 7

Pa(je

Record Selection Specification
Operand 1

~

Line

Numher ~

Locdtiol1

>I-

3

Rei.
EO
NE
LT
GT
LE
GE

7 8

9

4

I

5

1

6

1

7

s>
To

From

30

kJO~

50
70

1

(Columns 40 to 72 )

24 25 26 27128 29 30 31 32 33 34 35 36 37 38 39

I

33 ~ QC Dl\ TA
53 &.Q C OA T£\

I
I

I

.p

73 GT C

Comments

I Constant
I

Location

10 11 12 13 14 15 16 17 18 19 20 21 22 23

III

~
ICl J\~

I

I
I

To

J-rom

(, 6

4

Operand 2 (Field or Constant

I

I

IONUT If

DATA

J~ ~o5 \ T • l) ~ c;.

1l)1I\ I r

IF :> .0

I
I
\...uDe
OM IT ALL RECORDS WHICH HAVE THE WORD DATA IN COLUMNS
30 THROUGH 33 AND 50 THROUGH 53 OR WHICH HAVE A VALUE
GREATER THAN 1 0 IN COLUM NS 70 THROUGH 73.

I

-ALL

"Iuc.

SPECIFIED:

1 35641

Figure 6-12.

Omit Set Example

SORT/MERGE SPECIFICATION, SHEET B
1 2

Page

OJ

Record Selection Specification
Operand 1

~

ReI.
EQ
NE
LT
GT
LE
GE

- g I- (.,) ~
From

3 4
1

4

1

5

5 6 7 8

~

Co

9

Operand 2 (Field or Constant

~

I
I

From

To

I It

SPECIFIED:

IE. Q~ )(

I
To

,G J tOO SOO

10 11 12 13 14 15 16 17 18 19 20 21, 22 23

S

Comments

I Constant
Location

1

(Columns 40 to 72)

24 25 26 27128 29 30 31 32 33 34 35 36 37 38 39

I

J

I

) '500
':l:ND K

INCLUDE ALL RECORDS WITH AN X IN POSITION 3 BUT OMIT
ALL RECORDS WITH A VALUE GREATER THAN 500 IN POSITIONS
5 TO 9. CHECK BOTH ZONE AND DIGIT PORTIONS OF CHARACTERS.

135642

Figure 6-13.

946252·9701

Example of Include and Omit Set Mixed

6-19

Record Selection Specification

SORT/MERGE SPECIFICATION, SHEET B
1 7

Record Selection Specification

IT]

Page

e.5
pg
L IIlP
Nurnt,PI

3

4

1

4

1

~

~

Rul

Operand 1

== ~

~ .~

Locatlun

;8
t

Operand :2 (F leld or Constant

EO

NE
LT
GT
LE

"-

To

From

10 11 12 13 14 15 16 17 18 19 20 21 2223

k: K:

11

1

J~

ON'"

I

I t=

~G l}~t

~LL

'I)l c.l_ uOE -

I

SPECIFIED:

IColum", 40 to 72 )

24 25 26 27128 29 30 31 32 33 34 35 36 373M 39

I~

"IE QF

3

Commp.nts

I Constant
I

Locdtlon

GE

To

r-10rn

7 R 9

I
I

S:'

INCLUDE EVERY RECORD EXCEPT THOSE IN WHICH THE VALUE
IN POSITIONS 3 TO 6 IS EQUAL TO THE VALUE IN POSITIONS
13 TO 16. CHECK BOTH ZONE AND DIGIT PORTIONS OF CHARACTERS.

135643

Figure 6·14.

Example of Omit and Include-All Set

SORT/MERGE SPECIFICA rION, SHEET B
1 7

Paql'

OJ

Record Selection Specification
Operand 1

Operand 2 (F leld or Constant

R~-'I

EO

L

Inp

NE
LT
GT

~

NUI'1ue, ~
f-

3

4

,

4

1

'l

1

6

5 6

LE

Location

>f-rom

7 ci

9

From

To

!2
-1E. Q~ IZ

I
I Constant
I

Location

GE

To

10 11 12 13 14 15 16 17 1M 19 20 21 22 23

I]
lie

SPECIFIED:

II~ G11 Ie

I

----1.J

Comments

1

I

-,

-

(Colum", 40 to 72 I

24 25 26 27128 29 30 31 32 33 34 35 36 373M 39

171~ IG
.... ~

I]~

11A

I
U
"-

In

I

I
I

I

FIAJD

z

FIND

z..

~

OJ~

2000

INCLUDE RECORDS WHICH HAVE THE LETTER Z IN EITHER
POSITION 7 OR 8 AND WHICH HAVE A VALUE GREATER
THAN 2000 IN POSITIONS 10 TO 15. CHECK BOTH ZONE
AND DIGIT PORTIONS OF CHARACTERS.

135644

Figure 6·15.

6-20

Example of Include Set with ANDIOR Combination

946252·9701

7
Reformatting Specification
7.1

GENERAL

This section describes the Reformatting Specification and how to use this specification to
designate the following:

7.2

•

Arrangement of records in the output file

•

lFields of the selected input records that will be used in the sort process

•

Order of the fields of individual records in the work and output files (for example,
customer name, part number, cost, and date)

•

Sequence of individual fields (ascending order or descending order)

•

ASCII character that will replace another character or be placed between fields in the
work and output files (Sort/Merge does not change input records)

•

Method of summing (adding) a selected field, the end result being the numeric total or
the list of common data for the selected field

RECORDS AND FIELDS

Records that Sort/Merge inputs or outputs are divided into fields. No individual field can have
more than 256 characters. However, you can combine individual fields to produce larger records.
Thus, if a record contains 500 characters, the following field representations are valid:
•

Two fields of 250 characters each

•

One field of 256 characters and one field of 244 characters

•

Any number of fields that have a combined length of 500 characters

Since the total length of the fields combined to produce the control (key) field is limited to 256
characters, the maximum length of the sort or merge is 256 characters. You can combine data
fields to produce fields larger than 256 characters in length.
7.2.1 Control and Data Fields
The Reformatting Specification designates one or more control fields that Sort/Merge uses as key
fields for sequencing records or fields within records. A control field can be one character or a
sequence of characters identified by position in the input record.

946252-9701

7..1

Reformatting Specification

You can specify another type of control field to force a particular character into a specified position in the work file, which places the character in the output file. This character can replace the
character currently in that position, or it can be placed into a work file position unconditionally.
Fields other than control fields are called data fields. As with control fields, you can force and sum
data fields; however, you cannot use data fields as control fields for sequencing. Data fields tag
along after their control fields.
In many cases, you will not want to include all of the characters of an input file record in the work
file and output file records. You can view the input records as a collection of fields, each field
being one or more characters identified by its character positions. For example, a customer name
in positions 1 through 20 can be one field, a part number in positions 21 through 30 can be another
field, and so on. By breaking the input record into a collection of fields, you can then identify the
fields to be included in the SortlMerge process.
For example, suppose that some of the records of the input file are divided into the following
fields:
20 2 1
CUSTOMER NAME

30

3 1 37

38

45 46

PART NO.

80
PART DESCRIPTION

(A)135649

Through the Reformatting Specification, you can change the data structure in various ways. You
can rearrange the fields by specifying that PART NO. be listed first and by deleting DATE and
PART DESCRIPTION, as follows:

10
PART NO.

11

30
CUSTOMER NAME

31

38

COST

(A)135650

7-2

946252-9701

Reformatting Specification

Also, you can sequence one field in ascending order (for example, Able, Baker, Charles in the
name field) and another field in descending order (for example, 100, 99, 98 in the PART NO. column). Thus, the Reformatting Specification can specify exactly how the output records will
appear. In this example, they appear as follows:

1

10
100
100
100

38

11

25
60
40

ABLE
BAKER
. CHARLES
99 ABLE
99 BAKER
99 CHARLES

100
90

150

•
•
•
100

1 ABLE
1 BAKER
1 CHARLES
\

5

25
I

v

'-.r-'

Data Field

Control Fields
135651

Note that this file is sequenced by PART NO. and CUSTOMER NAME, while COST tags along with
the first two fields. Since the part number and customer name fields are sequenced, they are the
control fields; COST is a data field. In the work file, control fields will be first (left or high-order
side) and data fields will follow (right or low-order side). Only data fields can be summary fields.
If the example file is formatted with PART NO. as a descending-order control field and COST as a
summary data field, the following file results:

1

10111
100
99

181
125
340

•
•
•
1

T

Control Field

130
-,-Summary Data Field

135652

946252·9701

7-3

Reformatting Specification

Both control fields and data fields can be forced fields, allowing a character to be forced between
fields or to be substituted for another character in a particular position. For example, you can
force a dollar sign into the position preceding the COST data field.
7.2.2 Field Placement within Reformatting Specification
The order in which you make entries on the Reformatting Specification indicates the order in
which the fields are to appear on the output records. For example, suppose the following is the
input record format:
1

20 21

I

26 27

NAME fACCT '#

I

31

ZIP

32

50 5156

I

UNUSED

I

BILLI

(A)135645

Also, suppose the desired output format is as follows:
56

1112313237

38

(A)135646

If the sort control field is the zip code and the sort control fields are not dropped, the following
Reformatting Specification is used. (This section explains each specification in detail.)

Reformatting Specification
Forced

lHW

-..--.--

2

iii
-l>-

'"
"' "'
"' U.<:

e-

u::~
NUlIllwf

~

o~

.<:
U

we-

1::l

Z

> -

I-

~
N

I>-

Location

>-I-~

.1 <1

"

8 9

7

Ii

10 1 I 12 13

,

14 1 ~ 16

2

7h r NIC.

2.1

31

2

8~

rOC

Il

2.. ~

2

9~

FOC

3

o Ii)

F

31
'--_

Ole.
:0 F IOV;
r-i•

I

,
I

5

20
5~

"

Reserved

Overflow

1

0

;;

II:

~

17

18 19 20 21 22

Ii!

To

Frolll

a

Comments

u

}3

24

25 26

28

29 30

31

32 33 34 35 36 37 38

39

(C\)lUmnS

40

10721

,

135647

7-4

946252·9701

Reformatting Specification

If the sort control field is ACCT # and the same output format is required, drop the control fields
and use the following Reformatting Specification:
Reformatting Specification
Farced

Llrle

I--r--r--

-3

.,

a~

C

-LL _>

o- LL
_
Number

'"

.r:.

U

~~ ~w 0~

I-

Location

~ ~

....

3 4 5 6

"0

7

~

0

~

To

From

ZI

Z~

2

80 FiD~

21

.3

3

FCC.

Ojel FIC~

3 10

2

0

dJ~
I

~

I

D;V

l

Reserved

Overflow

Comments

U

:?3 24 25 26

28 29 30 31 32 33 34 35 36 37 38 39

IColumns 40 to 72 )

,
, 21D

lb f~~

3

:J

0

8 9 10 11 12 13 14 15 16 17 i8 19 20 21 22

')

2 90

a:

.r:.

U

I
I
5

20
5~

I

I

135648

Note in the second Reformatting Specification that the ACCT # field (columns 21 through 26) is
specified twice-once as a control field and once as a data field. When the control fields are
dropped, this control field does not appear in the output file and the output format is as previously
defined.
Use the following data field guidelines:
•

Describe all control field lines before data field lines for each record type.

•

The number of data fields need not be the same for all record types.

•

The total lengths of data fields for one record type need not equal the lengths of data
fields in other types. Shorter fields will be blank-filled on the low-order end.

For control fields, follow these guidelines:
•

The number of control fields need not be the same for all record types.

•

The total lengths of control fields in one record type need not equal the lengths of control fields in other record types.

NOTE

When two records with identical control field contents are sorted,
the actual order of the records in the,output file is unpredictable.

946252-9701

7-5

Reformatting Specification

7.3

COLUMN DESCRIPTIONS

Table 7-1 summarizes the entries on the Reformatting Specification.

Table 7-1.
Prompt

Columns

Reformatting Specification Column Summary
Entries

Paragraph

Page number.

4.2.1

27x-40x

Preprinted; numbers specify sequence of
specification lines.

4.2.1

F

Preprinted; designates a line in the Refor·
matting Specification.

7.3.2

01-99

FT

N

a

F

D
S

CP
C2

Z

D
V

S
I

F
P
U

L
B

BL

Field type:
- Normal sequence.
- Opposite sequence.
- Forced control field.
- Data field.
- Summary data field.
Character portion:
- Use both zone and digit portions.
- Use only the zone portion (1-character
only).
- Use only the digit portion.
- Force a character into a data field.
- Field is signed ASCII format.
- Field is signed integer format.
- Field is floating point format.
- Field is a signed packed decimal
number.
- Field is a signed unpacked decimal
number.
- Field is unpacked format with a leading
sign.
- Field is signed ASCII with a beginning
sign.

7.3.3
7.3.3.1
7.3.3.1
7.3.3.2
7.3.3.3
7.3.3.4
7.3.4
7.3.4

7.3.4.1
7.3.4.1
7.3.4.2
7.3.4.3
7.3.4.4
7.3.4.5
7.3.4.5
7.3.4.6

7.3.4.7

Beginning location:
- Field contains only one character.
- Starting position of field in record.

7.3.5

Blank2
1-4096

Ending location:
Last position of field in record.

7.3.5

1-4096

Record character:
Character to be conditionally forced into
position specified in columns 13-16.

7.3.6

EL

RC
ASCII
character

7·6

Explanation

946252·9701

Reformatting Specification

Table 7-1.
Prompt

Columns

Reformatting Specification Column Summary (Continued)
Entries

SC
ASCII
character
CON
Blank2
Nonblank
ASCII
character

20-22

OVF

Integer

40-80

Explanation

Paragraph

Substitute character:
Force this character between fields.

7.3.7

Conti nuation:
Not a continuation of a conditional
. force.
Continuation of the preceding
conditional force.

7.3.8

Overflow:
For summary sorts and merges; specify
total positions required to contain
resulting sum.

7.3.9

Comments;
characters.

enter

up to 41

ASCII

Notes:
t

Columns that must be filled for all sorts.

2 Default values.
3

Columns that must be filled when using forced control fields.

7.3.1 Page Numbers and Line Numbers (Columns 1 through 5)
The page numbers and line numbers are described in paragraph 4.2.1.
7.3.2 Line Type (Column 6)
This column contains the preprinted letter F, identifying these lines as Reformatting Specifications.
7.3.3 FT- Field Type (Column 7)
The following summarizes the column 7 entries:
Column 7 Entry

Explanation

Paragraph Number

N

Normal sequencing, as specified in column
18 of the Header Specification. This is a con·
trol field.

7.3.3.1

946252·9701

7-7

Reformatting Specification

Paragraph Number

Explanation

Column 7 Entry

o

Opposite sequencing, as specified in column
18 of the Header Specification. This is a control field.

7.3.3.1

F

Forcing of a character into a particular position. The character can also substitute for a
character already in a position. This is a control field.

7.3.3.2

D

Data field.

7.3.3.3

S

Summary data field. Data in this field is to be
summed (added).

7.3.3.4

7.3.3.1 Use of Normal and Opposite Control Fields (N or 0 in Column 7). An N in this column indicates that fields are to be sequenced in either ascending or descending order as specified in
column 18 of the Header Specification. The letter 0 in this column specifies that the sequence is
to be opposite the order specified in column 18.

Figure 7-1 shows a Reformatting Specification that specifies that the output file is to be sequenced according to the data in input record positions 1 through 4, 5 through 9, and 11 through
15. Data in positions 1 through 4 and 5 through 9 will be sequenced in the order specified in column 18 of the Header Specification; data in input record positions 11 through 15 will be sequenced in the order opposite that specified in column 18 of the Header Specification.
7.3.3.2 Forced Control Field (F in Column 7). You might need to force a character into a record
position and then use that character in the sequencing process. For example, in selecting different record types, for three different include sets, you can force the first character of each
record type to a 1, 2, or 3. Then, a sort controlled by these first numbers results in the output file
containing the types grouped in the order 1, 2, 3.
Reformatting Specification
Forced

r-r--r--

Reserved

\ 4 5

b

7

8 ')

7

7

F

~~

2

8

r

tile.

2

9

'OC

10 11 17 13

\ I

2930 31

32 33 34 35 36 3738 39

(Cniu",ns 40

to 72 )

'15

SEQUENCE DATA IN INPUT RECORD POSITIONS 1 TO 4 AND
5 TO 9 IN NORMAL ORDER ACCORDING .TO COLUMN 18 OF THE
HEADER SPECIFICATION. SEQUENCE DATA IN INPUT RECORD
POSITIONS 1 1 TO 15 IN OPPOSITE ORDER.

Figure 7-1.
7-8

2324 1526 27 28

14

s

SPECIFIED:
1 35653

14 15 16 17 18 19 20 21 22

COllllllAnts

Example of Specifying Normal and Opposite Order Sequencing
946252-9701

Reformatting Specification

You can also specify a data field force (paragraph 7.3.3.3); however, you cannot use data field force
to sequence data.
The three types of forces are as follows:
•

Conditional force - A character is forced into a specific position in the work file only if
a certain character presently occupies that position. For example, an X is placed in position 4 only if the number 1 is now in that position. If the character is not found and
ascending order was specified, a character with the code FF 18 is substituted. If the
character is not found and descending order was specified, a null character (hexadecimal zero) is substituted. One position can have more than one conditional force.
For example, an X in position 7 is changed to a 1; a Y in position 7 is changed to a 2; a Z
in position 7 is changed to a 3; and so on.

•

Force-a" - If the character specified in a conditional force is not found! an alternate
character is forced into that position. For example, a conditional force looks for the
character Z in input record position 23; if found, the Z is changed to number 1 in the work
file records. If a Z is not found, a" such records wi" have a null character in that position
if the order is ascending. The force-a" prevents the position from being forced to a zero
if Z is not found. A force-a", if used, must follow a conditional force.

•

Unconditional force - A specific character is forced to a position regardless of the
character currently in that position.
.

For a conditional force, use the following steps:
1.

Enter an F in column 7 to indicate a force.

2.

Enter the location of the character to be changed in columns 13 through 16, rightjustified. (You can place blanks or zeros in the unused columns.)

3.

Enter the character to be changed (conditional character) in column 17. If this character
is not found and a force-a" force does not follow this conditional force, the position indicated is changed either to a null character if descending order was specified or to FF 18
(binary ones) if ascending order was specified.

4.

Enter the substitute character in column 18.

5.

If the same position has more than one conditional force, enter the additional conditional forces on the lines following the first; also, enter any nonblank ASCII character in
column 19 to indicate a continuation. You can specify only one character in one
specification line. Figure 7-2 is an example of a continuing conditional force operation.

For a force-a" force, use the following steps:
1.

IEnter the force-a" line after its accompanying conditional force line.

2.

Enter an F in column 7 to indicate a force.

3.

Enter the substitute character in column 18.

946252·9701

7-9

Reformatting Specification

Reformattll1g Specification
Forced

r-.....-",-

LillI'

~'1

2

l,_

~

() e:.

c:

~) ~
N

1111t1I'

u"

2~~N

Locatloll

~~

f= ~

<1

2

S

14 15 16

8 'l 10 11 12 13

b

Ff(.

7

f-

2 B

f~

f-IFlc

9

2

To

F'!()!n

SPECIFIED:

0

"

U

"0
0

:J

II

~

:J

Comments

Reserved

Overflow

c:
c:
0

u

17 18 19 20 71 22

23 24

25 26 27 2K

29 30 31

32 33 34 35 36 37 38

(CoIUlTln, 40 to 72 I

39

7X I

CO'l\) , t=0ic.£

7'1 Z.X
72. 31x

Co~o.

fo~ce:

co~n.

foRc.£.

CHANGE THE CHARACTER IN POSITION 7 AS FOLLOWS:
I F AN X. CHANGE TO A 1 •
IF A Y. CHANGE TO A 2.
IF A Z. CHANGE TO A 3.

135654

Figure 7-2.

Conditional Force Example

4.

Enter a nonblank ASCII character in column 19 to indicate that this line is a continuation
of the preceding conditional force line.

5.

Do not enter any characters in columns 9 to 17. (Notice that the record position is not
specified as in the preceding conditional force line.)

Figure 7-3 is an example of a force-all following a conditional force .

•
Reformatting Specification
Forcp.d

Lfn~

in

~

r-.--.....-

~

c:

~
~
(3

~"Jl,rnt)e,

C.
I-

U;

W

N
~

7

8

a..

"0

C

I-

>-

6

"

u
Locatlun

9

(0

It

"

II

To

Flom

.J:.

U
:J

"

'c:"
:J

Re,erveu

U

'"
:J

121314151611 1B 192021222324252627282930313233343536373839

~

4
7

F

F~

115 ~ ,

2

B

f'

Ft.

2

9

F

FIe.

15&2.X
$[><

SPECIFIED:

Comments

V)

1

5

Overflow

c:
0

[Cotumns 40 to 72 I

c.o~ O.

FoQ.c.E:

f'o\2.c.E. - ~ LL

CHANGE THE CHARACTER IN POSITION 15 A .....
S--'F-.......
O-L......L--O..LW-!-S-·---------·-----IF AN A. CHANGE TO A 1 (CONDITIONAL FORCE).
•
IF A B. CHANGE TO A 2 (CONDITIONAL FORCE).
IF NE ITHER AN A OR B. CHANGE TO A DOLLAR SIGN
(FORCE-ALL FORCE).

135655

Figure 7-3.

7-10

Example of a Force-All Force Following Conditional Forces

946252-9701

Reformatting Specification

For an unconditional force, use the following steps:
1.

Enter an F in column 7 to indicate a force.

2.

Enter the character to be forced in column 18.

3.

Do not enter any characters in columns 9 through 17.

For example, if an input record with dollar values is in positions 20 through 24 and 30 through 34,
you can reformat the output record with data in positions 30 through 34 by specifying this field
first in the Reformatting Specification. By using the unconditional force and placing a character(s)
before or after specific fields, the character(s) can be unconditionally forced between fields, in
front of fields, and so on. Do not specify a location for the character in columns 9 through 16; the
character will be placed in the work and output files according to its positions in regard to other
fields, as shown in the Reformatting Specification.
Figure 7-4 is an example of an unconditional force.
Remember the following rules for forced control fields:
•

Only the work file and output file records are affected (the input records are not
changed).

•

If a force-all does not follow a conditional force and the conditional character is not
found in the one-position field specified, the contents of that position are changed
either to null characters (hexadecimal zero) for a descending format or to a character
with code FF1I' (binary ones) for an ascending format.

•

You can specify only one forced character per line on the Reformatting Specification.

•

To describe more than one conditional force for the same position, use additional conditional force lines with a nonblank character in column 19.

•

Unconditional forces place characters in the next work record position in the order in
which fields appear on the Reformatting Specification.

7.3.3.3 Data Fields (D in Column 7). A data field (0 entry) is appropriate for tag-along sorts only
(SORTR and SORTRS). In an address-only sort, a data field is treated as a comment. Data fields are
units of information that are included in the output records but not used in the sequencing of the
file.

NOTE

Within an include set, you must describe all control field lines
before any data field lines.

Paragraph 7.3.3.1 describes how data fields are formatted in work files when you specify more
than one record type (in more than one Record Selection Specification).

946252·9701

7-11

Reformatting Specification

Reformatting Specification
FI);ct!{i

-r--r--

CommPflt,
Location
J-IIlIn

.1

I

2

13

S

6

7

H Y

10 11 17 13

14

1~)

16

11 III 19 207122

2J 24

2~)

26 27 28

2<) 30 31

32:lJ 34 3S 36 3738

"Fe.-+--t>--+--+
F

\Ie.

20

SPECIFIED:

3;)

(Columns 40

1ll

72 )

~oltN\"L. s~q

24

FORCE THE NUMBER 1 INTO THE FIRST POSITION OF THE WORK
FILE AND THEN USE THIS NUMBER IN THE SEQUENCING OF DATA.
THIS SPECIFICATION AND ITS ACCOMPANYING RECORD SELECTION
SPECIFICATION CAN BE USED WITH OTHER SUCH SPECIFICATION
SETS (EACH WITH A DIFFERENT NUMBER FORCED INTO POSITION 1)
TO SEQUENCE RECORDS OF DIFFERENT RECORD TYPES (AS SELECT~D
BY THE RECORD SELECTION SPECIFICATION).

(A)135656A

Figure 7-4.

Example of Unconditional Force

As with control fields, you can also force data fields; however, data fields (forced or not) are not
used for output file sequencing. The position of the data fields in the Reformatting Specification
is the order of the fields in the output records.
To specify a data field, use the following steps:
1.

Enter a D in column 7.

2.

If a field consists of only one character, leave columns 9 through 12 blank and enter the
column location of the one character in columns 13 through 16, right-justified. If a field
is longer than one character, enter the beginning character position of the data field in
columns 9 through 12, right justified, and the ending character position in columns 13
through 16, right justified. Right-justify position numbers with zeros or blanks on the
left.

To specify a forced data field, the following steps are necessary:
1.

Enter a D in column 7.

2.

Enter a V in column 8.

3.

Enter the character to be forced in column 18.

4.

Leave columns 9 through 17 blank.

5.

The character in column 18 is forced into the next available position on the work record.

Figure 7-5 shows examples of both forced and unforced data fields.

7-12

946252-9701

Reformatting Specification

Reformatting Specification
Forced

Line

~-r-

'"
....'"" .c.... c:
..c:
u
"
" g
u

0

.c

Numtler

c.

U

Comments

Reserved

Overflow

u

>

I-

Location

a:

To

From

7

0

8 9 10 11 12 13

U

14 15 16 17 18 19 20 21 22

J 4 5

6

2

7

F~~

2()

l4

2

8

FD~

'10

, 12-

2 9

" ID\I

3 0

F~\I

3 1

Fb~

4

9

SPECIFIED:

~

Ul

23 24 25 26 27 28

29 30 31

32 33 34 35 36 37 38

39

(Column's 40 to 72 )

IW

8L~~K SPAC.e.

~

DOLL~~

S'G~

SEQUENCE THE FILES BY DATA IN INPUT RECORD POSITIONS 20 TO 24.
IF THE CONTROL FIELD IS TO BE INCLUDED IN THE OUTPUT RECORDS.
IT IS FOLLOWED BY THE DATA IN POSITIONS 10 TO 12 A BLANK
(FORCED DATA). A DOLLAR SIGN (FORCED DATA). AND THEN THE DATA
IN POSITIONS 4 TO 9.

135657

Figure 7-5.

Example of Forced and Unforced Data Fields

7.3.3.4 Summary Data Fields (S in Column 7). Summary fields are fields of data that are summed
(added). Figure 7-6 is an example of a Reformatting Specification to summarize sales records. The
fields within these records include part number, sales quantity by day, and dollar amounts of sales
by day., This specification creates a summary record showing total number of items sold and total
sales (the two summary data entries) according to part number (the control field entry).

NOTE

The sum might require more spaces than the size of the summary
data field. Use columns 20 through 22 to allow for overflow, as explained in paragraph 7.3.9.
You can specify summary fields for any Sort/Merge type, but addition actually occurs only in a
summary sort (SORTRS) or summary merge (MERGES). In a tag-along sort (SORTR) or normal
merge (MERGE), summary fields are treated as data fields. In an address-only sort (SORTA), summary field descriptions are treated as comments.
You can summarize no more than 24 fields for each record type, and you can sum only the zone
portion of characters.
The first include set that contains summary specifications defines the summary format for all included records. All include sets should contain the same summary specifications if possible; the
data specification should align the data for summarizing.

946252-9701

7-13

Reformatting Specification

Sort/Merge sorts all records according to control fields first; then, it summarizes the summary
data fields. !f a SORTRS is requested but no summary data fields are defined in the Reformatting
Specification, Sort/Merge outputs one record for each control field; this record will be the first
record sorted. In other words, Sort/Merge retains only one record for each specific control field.
7.3.4 CP - Character Portion [C) (Column 8)
The column 8 entry further defines the fields by specifying the following:

•

Whether the fields contain characters, digits, zones, signed ASCII characters, signed
integers, floating point numbers, or packed or unpacked numeric data

•

Whether this line is forcing a data character

•

Whether the sort uses the entire ASCII character or only the zone or digit portion

•

Overflow indication

INPUl RECORDS
PART NUMBER

o

3
Reformatting Specification

Forced

Line

-r-r-

in

o

., .,
"
u'"

S
c;:

u: >
(3 U:

!\lUlnt.el

~ ~W ~0

~

CL.

-

J:

u

"C

Location

>- '"

I-

I 4

5

6

I

~

F 9

~~

~

I

c

)

8

Fst

2

9

\

0

I

F~"
Fls~

J:

0

ii:

cr:

To

From

10 11 12 13

14 15 16

c

C
~

Comments

Reserved

Overflow

c

2 g

j

u

17 18 19 20 21 22

23 24

25 26 27 2H

29 30 31

32 33 34 35 36 37 38

39

(Columns 40 to 72 )

~2.

i~

~~\ ~e,

I I

~O.

115

1g

20

$

SOLO

DOLL~2

SOLD

OUTPUT RECORD
PART NUMBER

13
SPECIFIED:

NOTE:

SORT A SERIES OF INPUT RECORDS THAT SHOWS THE NUMBER SOLD AND
DOLLAR AMOUNT SOLD OF DIFFERENT PART NUMBERS. SORT THESE
INTO AN OUTPUT FILE WITH EACH RECORD SHOWING THE TOTAL NUMBER
SOLD AND TOTAL DOLLAR AMOUNT SOLD FOR EACH PART NUMBER. FORCE
A DOLLAR SIGN BEFORE THE TOTAL AMOUNT SOLD.
THE SUM MAY REQU IRE MORE SPACES THAN THE SIZE OF THE SUMMARY
DATA FIELD. TO PROVIDE SUFFICIENT ROOM FOR THE SUM. ALLOW FOR
AN OVERFLOW US ING COLUMNS 20 TO 22.

(A)13565BA

Figure 7-6.
7-14

Example of Summary Data Fields
946252-9701

Reformatting Specification

Note that the Record Selection Specification also uses the C, Z, 0, P, U, and S entries in column 8;
however, the V, I, F, L, and B entries are unique to the Reformatting Specification. The I and F
entries identify fields containing signed integers and floating point numbers, respectively. I format supports both single and extended integer formats. F format supports both real and double
precision numbers. You can use the I, F, L, and B fields only as control fields (with an N or 0 in column 7) and in record selection or summation. For example, you cannot specify that records with a
- 3.56 be included in or omitted from a sort or merge.
Tables '7-2 and 7-3 summarize the combinations of column 7 and column 8 entries and the maximum amount of characters that can be in the accompanying data or control field for that combination. Use the V entry in column 8 only with a or S in column 7, as shown in Table 7-3. Forced
fields can only be one character in length (an F or V in column 8).

°

You can designate C, Z, 0, P, U, or S in column 8 for both the Record Selection Specification and
the Reformatting Specification. However, their differences are apparent:
•

The Record Selection Specification uses this column entry to determine which records
to include in the operation. This specification compares characters in two different
fields or compares one field to a character string.

•

The Reformatting Specification determines the sequencing of the records selected by
ordering them in ascending or descending sequence, according to the numerical values
in designated fields.

NOTE

Results of the Sort/Merge program are unpredictable if you enter an
operator other than C, Z, 0, V, S, I, F, P, U, L, or B in column 8.

The following summarizes the column 8 entries:
Column 8 Entry

Explanation

Use both the zone and digit portions of ASCII characters.
Use only the zone portion of ASCII characters.
Use only the digit portion of ASCII characters.
Force the data character (in column 18) or summary overflow
character into the next position in the work file record.
This field contains a signed ASCII value.
This field contains a signed integer value.
This field contains a floating pOint value.
This field contains packed numeric data.
946252-9101

7-15

Reformatting Specification

Explanation

Column 8 Entry

This field contains unpacked numeric data.
This field contains unpacked numeric data with a leading
sign.
This field contains ASCII data with a beginning sign.
Notes:
1 Field
location identified by beginning and ending column positions (when
applicable).

2

Must be used with a control field (N or 0 in column 7) only.

Table 7-2.

Possible Column 8 Entries for Column 7 Entry

Column 7 Entry

Column 8 Entry

Maximum Field Length
(In Characters)

N orO

C

256

Z

1

0

16

S

16
2,4, or 8

F

0

7-16

F

4 or 8

p

8

U

16

C

1

Z

1

0

1

L

16

B

16

C

256

Z

1

946252·9701

Reformatting Specification

Table 7-2.

Possible Column 8 Entries for Column 7 Entry (Continued)

Column 7 Entry

S

Column 8 Entry

Maximum Field Length
(In Characters)

o

16

v

1

p

8

u

16

L

16

B

16

c

256

o

16

S

16

v

Table 7-3.

Column 7 Entry

N,O,D,orS

p

8

u

16

Possible Column 7 Entries for Column 8 Entry

Column 8 Entry

Maximum Field Length
(in Characters)

c

256

1

F

N, 0, F, or 0

z

1

N,O,D,orS

o

16

F

o or S

v

1

N, 0, or S

S

16

N orO

946252-9701

1

2,4, or 8

7-17

Reformatting Specification

Table 7·3.

Possible Column 7 Entries for Column 8 Entry (Continued)

Column 8 Entry

Maximum Field Length
(in Characters)

°

F

4 or 8

N,O,D,orS

P

8

N,O,D,orS

U

16

L

16

8

16

Column 7 Entry

Nor

N, F, or
N, F, or

°
°

7.3.4.1 Character Portion and Data Force (C, Z, D, V, S, I, F, P, U, L, or B in Column 8). The column 8
entry specifies which portion of the character (zone, digit, or both) should be used to determine
the sequencing of data in the work and output files. It also designates whether a data field is a
forced data field. Observe the following when using these entries:

•

You can use any of the column 7 entries.

•

The beginning and ending positions of input records specify the field length.

For sorting in ascending or descending order, use both the zone and digit portions of the
characters since the ASCII code values use both portions to define the entire character. It may be
possible to sort numerical-only values by using only the digit portion since only the digit portion of
the ASCII code varies for numbers (the zone portion is the same for all numbers). Appendix C provides a complete list of ASCII codes and their binary portions.
For example, if a one-character control field for three input records contains the ASCII code for
the characters A (41 1,), B (42 1,), and 5 (35 18), the records are sorted in a different ascending order,
depending on the column 8 entry, as shown below:
Column 8

=C

5

Column 8

= Z

5

Column 8

=

D

A

A

B

B

5
Note:
1

Letters will follow in unpredictable order.

The letter V in column 8 signifies that this is a forced entry. (See Figure 7-5.)

7-18

946252-9701

Reformatting Specification

7.3.4.2 Signed ASCII (S in Column 8). You can use signed ASCII fields for sorting. Note the
following rules:

•

The sign must be in the least-significant (rightmost) byte of the field.

•

The field must be a control or summary field for a sort or merge (that is, N, 0, or Sentry
in column 7).

•

The beginning and ending input record positions specify the field length.

•

Signed ASCII numbers have the sign in the least-significant byte of the character string.
For example, the number - 673 is constructed as follows:

BYTE

BYTE

1
2
(6)
(7)
(A) 135659

BYTE

BYTE

3
(3)

4
(-)

The S in column 8 tells Sort/Merge to treat the rightmost byte of the field as a sign. If a blank (20 18)
or a plus sign (28 18) is found in the sign byte, the number is positive; if a minus sign (20 18) is found,
it is negative. Figure 7-7 shows an example of an input file containing a signed ASCII field and a
Reformatting Specification to include the values in this field.
Signed Integer (I in Column 8). A signed integer contains a sign indicator in its most
significant bit and is a two's complement value. The following are rules for signed integers:

7.3.4.3

•

The integer must be a control field for sorting or merging only (that is, N or 0 entry in
column 7).

•

Records may contain binary data as well as ASCII characters. Values can be multiple
precision, and the field normally begins on a word boundary (that is, in an odd-numbered
column of the input file).

The I in column 8 tells Sort/Merge to treat the field as a signed integer with the sign bit as the most
significant bit. Place the starting position of the field in columns 9 through 12. Usually, this value
is an odd number. (Since integers must be on a word boundary, input record positions 1, 3, and so
on are in memory on a word boundary.) Both the From and To location entries are right-justified.
Figure 7-8 shows both single and extended integer entries.
Fl,oating Point Numbers (F in Column 8). The first byte of floating point fields contains the
sign bit (most significant bit) and a seven-bit exponent expressing the values of 16-84 to 1683 • The
following are several rules for floating point numbers:

7.3.4.4

•

The field must be a control field for sorting or merging only (that is, N or 0 entry in
column 7).

•

Fields can be multiple precision and normally begin on a word boundary (that is, in an
I::>dd-numbered column of the input file).

946252·9701

7-19

Reformatting Specification

INPUT RECORDS
9
PART NO.

16

10

I

17

80

I

QTY

PART DESCRIPTION

325400
1000-

1000
1001
1074

WIDGET NO.
WIDGET NO.
WIDGET NO.

1
2
75

Reformatting Specification
Forced

lone

~r--r--

~) ~

0-

~ ~

Nl.lTlbf'r

(lJ

C ::::

u'"

C
:-..

-Z

en

"0

C1.

N

f-

:: e
~ ~

J

4

~

7171

b

r

I

.c

1 1'10

SPLCIFIED:

a:

To

8910111213

tJ S

0
g

Location
F'drn

'"
'"

.c

U

~

~

c:

0

~

Commpnts

Reserved

Overflow

g

u

14 15 16 17 18 19 20 21 22

I Illb

23 24

II

25 26 27 28

1I

29 30 31

32 33 34 35 36 37 38

tColumns 40 to 72 )

39

I I I I It I I I I I II I

Sl6~e:D

A5<"1:J:

----

SORT IN NORMAL ORDER THE SIGNED ASCII FIELD IN POSITIONS 10 TO 16
OF THE I NPUT RECORD (INCLU DING THE SIGN BYTE).

(A)135660

Figure 7-7.

Specifying Signed ASCII Control Field

Entries in the From and To columns must be right-justified, and the From column entry may be an
odd· numbered position of the input file. Figure 7-9 shows entries for a floating pOint field.
Packed and Unpacked Numeric Data (P or U in Column 8). If you specify packed or un·
packed control fields (N or 0 in column 7), Sort/Merge modifies the control fields while building
the work record. Therefore, it is recommended that packed and unpacked control fields be dropped (by entering X in column 28 on the header line).

7.3.4.5

7.3.4.6 Le'ading Signed Unpacked Numeric Data (L in Column 8). If you specify leading signed unpacked control fields (N or 0 in column 7), Sort/Merge modifies the control fields while building
the work record. It is recommended that unpacked control fields be dropped (by entering X in column 28 on the header line). The example in Figure 7-11 shows leading signed unpacked numeric
data.

For example, the numbers -14 and + 10 are constructed as follows:
+10

-14

\4A16

BYTE
(A)143698

7-20

1
(-1)

3416

1

31 ,6

3016

BYTE

BYTE

1

BYTE
2

(4)

1
(1)

2

(0)

946252·9701

Reformatting Specification

Reformatting Specification
Forced

LlIle

~r-r--

u

Numher

c

~
u

'>-"

c.

Cl

~

(;

Localtlon

:'

6

7

F

2

a

F~ll

WI

C

Reserved

Overflow

7

Comments

U
.0
::J

U'l

23 24 25 26 27 28 29 30 31

32 33 34 35 36 37 38 39

6
IKl

5

SPECIFIED:

::J

::J

14 15 16 17 18 19 20 21 22

8 9 10 11 17 13

3 4 5

2

'c"
0

~

a:

To

From

0

~

U

IColu",ns 40

S.Nt;LE
nl'\lIlll C

ID

72 I

PRF/" ,c..,~

~\&'O~

SORT IN NORMAL SEQUENCE SINGLE PRECISION INTEGERS (TWO
BYTES IN LENGTH) BEGINNING IN INPUT RECORD POSITION
SORT IN NORMAL SEQUENCE DOUBLE PRECISION INTEGERS (FOUR
BYTES IN LENGTH) BEGINNING IN INPUT RECORD POSITION'.

s.

135661

Figure 7-8.

Specifying Integer Control Fields
Reformatting Specification

Forced

LIne

in

'" '" c
0
'"U u'" '"
c
Cl
'" C

~

~

(3
Nurnber

::J

~ ~

~

3 4 5

~

6

~

Location

,

>
~

From

7

8 9 10 11 12 13

7171

FI~F

2f aT

F~f

I
JI,

SPECIFIED:

Reserved

Overflow

Comments

::J

0

a:

To

0

~

u

14 15 16 17 18 19 20 21 22

J4

zz

23 24 25 26 27 28 29 30 31

32 33 34 35 36 37 38 39

(Columns 40 to 72 I

I
I

-

SORT IN NORMAL ORDER THE FOUR-BYTE FLOATING POINT VALUE
THAT BEGINS IN POSITION 11. SORT IN OPPOSITE ORDER THE
EIGHT-BYTE VALUE THAT BEGINS IN POSITION 15

135662

Figure 7-9.

946252·9701

Specifying Floating Point Control Fields

7-21

Reformatting Specification

7.3.4.7 Beginning Signed ASCII (B in Column 8). You can use beginning signed ASCII fields for
sorting. The following are several rules for using beginning signed ASCII:

•

The sign must be in the most significant (leftmost) byte of the field.

•

The field must be a control field for sorting or merging only (that is, N or 0 entry in
column 7).

•

The beginning and ending input record positions specify the field length.

Beginning signed ASCII numbers have the sign in the most significant byte of the character string.
For example, the number - 704 is constructed as follows:

37

2016

1

1

BYTE

BYTE

1

2

(-)

(A)143699

30 16

16

1

(7)

34 16

1 =-704

1

BYTE
3
(0)

BYTE
4
(4)

The B in column 8 instructs Sort/Merge to treat the leftmost byte of the field as a sign. If a blank
(20 18) or a plus sign (2B 18) is found in the sign byte, the number is positive; if a minus sign (20 18) is
found, the number is negative. Figure 7-10 shows an example of an input file containing a beginning signed ASCII field and a Reformatting Specification to include the values in this field.
7.3.5 BL and EL - Beginning and Ending Locations [Blank] (Columns 9 through 16)
These columns identify the beginning and ending positions in the input record of the field being
sorted or merged.

Place the number of the beginning position in the From columns and the number of the ending
position (when applicable) in the To columns. Both entries must be right-justified and blank- or
zero-filled on the left. If the field contains only one character, leave the From column blank and
enter the character's position in the To column (right-justified). Column entries are summarized as
follows:
Columns

Entry

Explanation

9-12

Blank or
1-4096

Position in input record identifying
start of field

13-16

1-4096

Position in input record identifying
end of field

7.3.6 RC - Record Character [Blank] (Column 17)
To conditionally force a character (if a certain character is in a specific input record position),
place the conditional character in column 17. (See paragraph 7.3.3.2 and Figure 7-2 for a complete
explanation of conditional forcing and the use of this column.)

7-22

946252-9701

Reformatting Specification

INPUT RECORDS
9

16

10

I

PART NO.

1000

17

80

I

QTY

PART DESCRIPTION

-325
-400
-1000

1001
1074

WIDGET NO.
1
WIDGET NO.
2
WIDGET NO. 75

Reformatting Specification
Forced

Line

~-.--

.. ..

-5

~ii:

0-

~~

Numher

0::;

.- I:;
3 4

2171

5

6

Ii:
7

e

Location'
Flo,"

I

10 11 12 13

8 9

F~ e

t'

;

g

cr

~

:;

~

Reserved

Overflow

Comments

u

14 15 16 17 18 19 20 21 22

/ /. /0 I I/lb

SPECIFIED:

Q

~

~

To

c

U

o

N

~

j

.r

U

; z Vi
11.1

23 24 25 26

27 28

29 30 31

32 33 34 35 36 37 38

39

II IIIII IIII IIIIIII

(Columns 40 to 72 I

BE.&lNNING

AS~lI

SORT IN NORMAL ORDER THE BEGINNING SIGNED ASCII FIELD IN POSITIONS 10
'TO 16 OF THE INPUT RECORD (INCLUDING THE SIGN BYTE).

(A)143712

Figure 7·10.

7.3.7

SC -

Specifying Beginning Signed ASCII Control Fields

Substitute Character [Blank] (Column 18)

To force a character into a specified position, place the character in column 18. (This applies
whether the character is a control field force or a data field force.) Paragraph 7.3.3.2 provides a
complete explanation of control field forcing and the use of this column; paragraph 7.3.3.4 and
Figure 7-5 provide a complete explanation of data field forcing and the use of column 18.
7.3.8

CON -

Continuation [Blank] (Column 19)

Use this column to set two or more conditions for a conditional force of one control field. For instance, to make a conditional force on one input record position if the character in that position is
X, Y, or Z, place the succeeding conditions on successive lines. To make the entries a continuation of the first condition, place a nonblank ASCII character in column 19 on the lines following
the first condition. Paragraph 7.3.3.3 and Figure 7-2 provide a complete explanation of a continued
conditional force.
7.3.9

OVF -

Overflow (Columns 20 through 22)

To ensure against an overflow condition on a summary sort or merge, you can specify additional
spaces for an overflow field in columns 20 through 22. Since the sum of values contained in a certain number of columns can take up more space than any individual number, this entry provides
additional space for the overflow. This value must be the sum of the summary data field plus
enough bytes for the overflow. The entry is right-justified, ending in column 22, and cannot be
more than the maximum field length of the data type to be summed (as specified in Tables 7-2 and
7-3).
For example, if the summary field is three characters long and five characters are needed for the
sum, enter the number 5 in column 22, as shown in Figure 7-11.

946252·9701

7·23

Reformatting Specification

Reformatting Specification
!

f. Hetod

LIlP

f--.--r-

~--r-

iii

~

Q
NUll

lip,

C

;.

0-

~

~

W

>- N
~

ti

I

"Q

a

I~

~ .:;

S 9

0

I.OCdtIOII

10

I-rflllt

10 I;

I) 13

14 1b Ib

~

Rc~el

OVI~II!()W

u

~ u;
Q.

.1 'I

<1>

ved

c

a

u

oc

]

11

If! 19 2tl :'1

2~

13 24

~"

26 27 JB

29]0 31

32 :Ll 34

3~

36 37 3!l

3'1

fCoIUOlr,,>

40

It}

72 ,

SORT RECORDS ACCORDING TO THE DATA IN POSITIONS 21 TO 29
AND SUM THE VALUES IN POSITIONS 1 1 TO 13 FOR EACH CONTROl
FIELD. PROVIDE AN OVERFLOW OF TWO ADDITIONAL CHARACTERS
FOR THE SUM.

135663

Figure 7-11.

7.3.10

Example of Overflow as Specified in Columns 20 through 22

Specifying an Overflow Indicator Field

To set an overflow indicator, perform the following steps:

7-24

1.

Enter an S in column 7.

2.

Enter a V in column 8.

3.

If an overflow occurs in any summary sort or merge, the initial value of the overflow field
is replaced by the character specified in column 17. If no character is specified, an
asterisk (*) is used as a replacement character.

4.

If no overflow occurs in any summary sort or merge, the overflow field contains the
character specified in column 18.

946252-9701

8
Sort/Merge SCI Interface and Execution
8.1

GENERAL

The System Command Interpreter (SCI) serves as the single interface between the user and the
operating system. The SCI accepts input from interactive devices, such as data terminals or video
display terminals (VOTs), or from sequential devices, such as disk files, card readers, or cassettes.
The input is interpreted through command procedure definitions. These procedures activate processors that use the information collected by the procedures. The SCI operates in two modes, interactive or batch. Also, the interactive mode may operate in either record-oriented or VOT mode.
The following paragraphs describe how to use SCI to create Sort/Merge command statements in
each SCI mode and how to use these statements to execute Sort/Merge. Figure 8-1 shows the interaction of Sort/Merge with the SCI.

8.2

INTERACTIVE MODE

In the interactive mode, SCI issues prompts either on a VOT screen or to an interactive printing
device such as an ASR. Respond to each prompt as it appears; SCI and its associated processors
then use the information to build the Sort/Merge control file. The two types of interactive mode are
record-oriented mode and VOT mode.
8.2.1

Record-Oriented Mode

In record-oriented mode, prompts appear one at a time on the device; your response is required
before the next prompt appears. Prompts are of the following form:
KEYWORO(s): user response
When you enter a response, the input is checked to see if it is an integer, a string, or a pathname. If
the response does not match the required data type, the prompt reappears. If the response can be
defaulted, you can choose the default by using the carriage return key. Figure 8-2 shows an example of prompts in the record-oriented mode.
8.2.2

VOT Mode

In the VOT mode, the entire set of prompts for the command procedure appears on the screen at
one time" A heading (if supplied) also appears, and defaults are shown for the prompts that have
defaults. Figure 8-3 shows an example of prompts in the VOT mode.

946252-9701

8-1

Sort/Merge SCI Interface and Execution

SEQUENTIAL
INPUT
(BATCH FORMAT)
INTERACTIVE
DEVICE
INPUTS
(RESPONDS
TO PROMPTS)

SYSTEM
COMMAND
INTERPRETER

SORT/MERGE

SORT/MERGE
CONTROL
STATEMENT
FILE
(CREATED
BY SCI OR
USER)

(A)135757

Figure 8-1.

8.2

SCI Interaction with Sort/Merge
946252·9701

Sort/Merge SCI Interface and Execution

[] XSMF
EXECUTE SORT/MERGE
NEW CONTROL FILE?:
N
CONTROL FILE NAME:
. SPEC
SORT/MERGE EXECUTION OPTION
RUN SORT/MERGE?: YES
SORT/MERGE LISTING DEVICE
LISTING DEVICE NAME:
LPOl
SORT/MERGE COMPLETED NORMALLY
Figure 8-2.

Sample Record-Oriented Mode Prompts

**SORT/MERGE HEADER SPECIFICATION**
SORT MERGE TYPE: SORTR
TOTAL CONTROL LENGTH:
SORT MERGE SEQUENCE: A
ALTERNATE SEQUENCE:
PRINT OPTION: 1
DROP CONTROL FIELDS: X
OUTPUT RECORD LENGTH:
VARIABLE LENGTH RECORDS:
VERIFY OPTION:
MEMORY SIZE:
Figure 8-3.

Sample VOl Mode Prompts

8.2.3

Foreground and Background Processing
Use either of the following two commands to invoke Sort/Merge in the interactive mode:

•

XSM (Execute Background Sort/Merge) - Issues prompts on an interactive device and
then starts execution of Sort/Merge in the background mode. When you use XSM, control of the interactive device returns to the SCI when Sort/Merge execution begins; consequently, you can continue working with other activities in foreground while
Sort/Merge is processing. When Sort/Merge completes, a message is queued to and
displayed by the SCI. This message states how the sort or merge operation completed
(such as SORT/MERGE NORMAL COMPLETION). When you use XSM, the response to
the LISTING DEVICE NAME prompt cannot be the interactive device from which execution began.

•

XSMF (Execute Sort/Merge Foreground) - Issues prompts on an interactive device and
then runs Sort/Merge in the foreground. Control of the interactive device does not return
to the SCI until completion of the sort or merge operation. You can specify your terminal
in response to the LISTING DEVICE NAME prompt.

946252·9701

8-3

Sort/Merge SCI Interface and Execution

8.2.4

Interactive Mode Usage

Use the Execute Sort/Merge (XSMF) and Execute Background Sort/Merge (XSM) commands to
enter command statement specifications in the interactive mode. In response to either of these
commands, the following field prompt appears:
NEW CONTROL FILE?:
Enter a Y or YES to create a new Sort/Merge control file; enter N or NO to specify an existing file. If
the card reader or cassette contains the control file, the answer must be N or NO.

NOTE

Sort/Merge must have a valid control file in order to execute correctly. When in doubt, create a new control file.

The next prompt is as follows:
CON fROL FI LE NAM E:
Respond to this prompt by entering the control file name to be created or used to run Sort/Merge.
If the control file is on cassette or cards, specify CSnn or CRnn (where nn is the device number).
You must enter a valid pathname.
If you are creating a new control file, the Header Specification prompts (Figures 8-2 and 8-3) ap- .
pear next. Additional prompts are issued until the full control file has been created. (See Table
8-1.)

When you specify that an existing control file be used (by responding NO to the NEW CONTROL
FILE? prornpt) or when all prompts have been issued and a new control file has been created, the
following field prompt is displayed:
RUN SORT MERGE?:
If the response to this prompt is N or NO, control returns to SCI and no further prompts appear. If
the response is Y or YES, the following prompt appears:
LISTING DEVICE NAME:
Enter the name of the file or device that will receive the output of the Sort/Merge command
statements and warning, error, and information messages. After you have specified the file or
listing device, Sort/Merge executes.

8-4

946252·9701

Sort Merge SCI Interface and Execution

Table 8-1.

Interactive Prompts and Responses for Control File Generation

Suggested
Batch
Keyword

Prompt

Default

Other Values

SMT

SORT M ERG E TYPE

SORTR

TCL
SMS
AS
PO
DCF
ORL
VAR
VO
MS

TOTAL CONTROL LENGTH
SORT MERGE SEQUENCE
ALTERNATE SEQUENCE
PRINT OPTION
DROP CONTROL FI ELDS
OUTPUT RECORD LENGTH
VARIABLE LENGTH RECORDS
VERI FY OPTION
MEMORY SIZE

SORTRS/SORTAI
MERGE/MERGES
(integer)

Header Specification (SM$HD):

A
blank
1

0
S
0/1/3

X
blank
blank
blank

(integer)
V
V
(integer)

Alternate Sequence Specification (SM$AL T):1
EAP

(string of pairs)

ENTER ALTERNATE PAIRS

Output File Specification (SM$OUT):
FP
FT
LRL
PRL
NOLR

FILE PATHNAME
FILE TYPE
LOGICAL RECORD LENGTH
PHYSICAL RECORD LENGTH
NUMBER OF LOGICAL RECORDS

S
blank
blank
blank

(pathname)
RII
(integer)
(integer)
(integer)

DS01
E

(volume pathname)
N

S
blank
blank

(pathname)
RII
(integer)
(integer)

Work File Specification (SM$WKF):2
WFV
WFT

WORK FILE VOLUME
WORK FILE TYPE

Input: File Specification (SMSIH):
FP
FT
LRL
NOLR

FILE PATHNAME
FILE TYPE
LOGICAL RECORD LENGTH
NUMBER OF LOGICAL RECORDS

Record Selection Specification (SMSSLC):
RST
CON
CP
01B
01E
REL

946252-9701

RECORD SELECTION TYPE
CONTINUATION
CHARACTER PORTION
OPERAND 1 BEGINNING
OPERAND 1 ENDING
RELATIONAL OPERATOR

blank
blank
blank
blank
blank

blank
AlO
CIZID/S/P/U
(integer)
(integer)
EQ/NE/LT/GTI
LE/GE

8-5

Sort/Merge SCI Interface and Execution

Table 8-1.
Suggested
Batch
Keyword

FOC
02B
02E
02C

Interactive Prompts and Responses for Control File Generation (Continued)

Prompt

FIELD OR CONSTANT
OPERAND 2 BEGINNING3
OPERAND 2 ENDING3
OPERAND 2 CONSTANP

Default

blank
blank
blank
blank

Other Values

F/C
(integer)
(integer)
(constant)

Reformatting Specification (SM$REF):

FT
CP
BL
EL
RC
SC
CON
OVF

FIELD TYPE
CHARACTER PORTION
BEGINNING LOCATION
ENDING LOCATION
RECORD CHARACTER'
SUBSTITUTE CHARACTER'
CONTINUATION'
OVERFLOWII

C
blank

blank
blank
blank
blank

N/O/F/D/S
ZlDN IS/FII/P/UlUB
(integer)
(integer)
(ASCII)
(ASCII)
(integer)
(integer)

Notes:

Displayed only if the response to ALTERNATE SEQUENCE (AS) is S. A null response to
ENTER ALTERNATE PAIRS terminates alternate sequence specifications.

1

2

Displayed only if the response to SORT/MERGE TYPE (SMT) is not MERGE or MERGES.

3 Displayed if response to FIELD or constant (FC) is not C.
4

Displayed if response to FIELD or constant (FC) is C.

, Displayed if FIELD TYPE (FT) is F.
II Displayed if FIELD TYPE (FT) is S.

8-6

946252-9701

Sort/Merge SCI Interface and Execution

Figure 8-4 shows the various options available to the interactive user. The following paragraph
discusses interactive prompting methods for running Sort/Merge.

BACKGROUND EXECUTION

l]XSM
EXECUTE BACKGROUND SORT/MERGE
NEW CONTROL FILE?: N
CONTROL FILE NAME: .XYZ
RUN SORT MERGE?:
LISTING DEVICE NAME:

Y
LP01

[]

Other Tasks

SORT/M ERGE Execution

SORT/MERGE NORMAL COMPLETION
[]
FOREGROUND EXECUTION
(From 5T02)

[ ]XSMF
EXECUTE SORT/MERGE
NEW CONTROL FILE?:
CONTROL FILE NAME:

NO
CR01

RUN SORT MERGE?:
LISTING DEVICE NAME:

YES
ST02

SORT/M ERG E Executes
[]

Figure 8-4.

Interactive Options - No Control File Creation

8.2.5 Interactive Prompting
To specify that SCI build a control file, respond Y or YES to the NEW CONTROL FILE? prompt,
issued by the XSM or XSMF command. SCI then interactively issues all of the field prompts to obtain the necessary information. Figure 8-5 shows the categories of prompts, in the order in which
they appear.

946252·9701

8-7

Sort/Merge SCI Interface and Execution

Prompting Category

HEADER SPECIFICATION
ALTERNATE SEQUENCE

Remarks

If S in response to ALTERNATE
SEQUENCE prompt of Header
Specification

OUTPUT FILE
If SORTR, SORTA, SORTRS in
Header Specification

WORK FILE

INPUT FILE
NEXT INPUT FILE

Only if MERGE or MERGES in
Header Specification

RECORD SELECTION SPECIFICATION or REFORMATTING SPECIFICATION
NEXT:
RECORD SELECTION SPECIFICATION
REFORMATTING SPECIFICATION

Figure 8-5.

Order of Interactive Prompting for Control File Creation

The prompts are presented in the proper order to create the control file until the NEXT prompt is
encountered. The NEXT prompt allows you to specify a variety of sorts and merges using the SCI.
The NEXT prompt has the following two forms:
ENTER NEXT SPECIFICATION NEXT:

INPUT, SELECTION, REFORMATTING

ENTER NEXT SPECIFICATION NEXT:

SELECTION OR REFORMATTING

The first soecification is used with merges where more than one input file is specified. In a sort
only . one input file is used and the second form of the specification is used. Respond to the NEXT
prompt with an I to specify input file, an S to specify Record Selection, or an R to specify Reformatting Specification. The NEXT prompt gives the flexibility to mix selection and reformatting
specifications to produce more complex control sequences. When only the new line (carriage
return) is entered in response to the NEXT prompt, specification of the control file is completed
and the following prompt appears:
RUN SORT/MERGE?:
Figure 8-6 gives an example of a complete interactive session to build a control file on
DS01.CONTRL. Notice that the Sort/Merge utility is executed at the end of the session, using the
control file built during the session.

8-8

946252·9701

Sort/Merge SCI Interface and Execution

[] XSMF
EXECUTE SORT/MERGE
NEW CONTROL FILE?
YES
CONTROL FILE NAME:
. CONTRL
**SORT/MERGE HEADER S?ECIFICATION**
SORT MERGE TYPE: SORTR
TOTAL CONTROL LENG1H:
6
SORT MERGE SEGUENCE: A D
ALTERNATE SEQUENCE:
PR INT OPTION: 1
3
DROP CONTROL FIELDS: X
OUTPUT RECORD LENGTH:
80
VARIABLE LENGTH RECORDS:
VERIFY OPTION:
MEMORY SIZE:
16000
**SORT/MERGE OUTPUT FILE SPECIFICATION**
FILE PATHNAME:
. S~.OUTl
FILE TYPE: S
LOGICAL RECORD LENGTH:
80
PHYSICAL RECORD LENGTH:
560
NUMBER OF LOGICAL RECORDS:
**SORT/MERGE WORK FILE SPECIFICATION**
WORK FILE VOLUME: D501
WORK FILE TYPE: E
**SORT/MERGE INPUT FtLE SPECIFICATION**
FILE PATHNAME:
. SM.SRTDAT
FILE Ty'PE: S
LOGICAL RECORD LENGTH:
NUMBER OF LOGICAL RECORDS:
ENTER NEXT SPECIFICATION - SELECTION OR REFORMATTING
NEXT:
5
**SORT/MERGE RECORD SELECTION SPECIFICATION**
RECORD SELECTION TYPE: I
0
CONTINUATION:
CHARACTER PORTION:
C
OPERAND 1 BEGINNING:
OPERAND 1 ENDING:
5
RELATIONAL OPERATOR:
LT
FIELD OR CONSTANT:
C
SELECTION COMPARISON CONSTANT
OPERAND 2 CONSTANT:
3
ENTER NEXT SPECIFICATION - SELECTION OR REFORMATTING
NEXT:
S
**SORT/MERGE RECORD SELECTION SPECIFICAT!ON**
RECORD SELECTION TYPE: I
CONTINUATION:
CHARACTER PORTION:
OPERAND 1 BEGINNING:
OPERAND 1 ENDING:
RELATIONAL OPERATOR:
FIELD OR CONSTANT:
Figure 8-6.

946252-9701

Typical Interactive Prompt and Response Sequence for Building
Control Specification File (Sheet 1 of 2)
8-9

Sort/Merge SCI Interface and Execution

SELECTION COMPARISON FIELD
OPERAND 2 BEGINNING:
OPERAND 2 ENDING:
ENTER NEXT SPECIFICATION - SELECTION OR REFORMATTING
NEXT:
R
**SORT/MERGE REFORMATTING SPECIFICATION**
FIELD TYPE:
F
CHARACTER PORTION: C
BEGINNING LOCATION:
ENDING LOCATION:
5
FORCED CHARACTER INFORMATION
RECORD CHARACTER:
4
SUBSTITUTE CHARACT~H:
A
CONTINUATION:
ENTER NEXT SPECIFICATION - SELECTION OR REFORMATTING
NEXT:
R
**SORT/MERGE REFORMATTING SPECIFICATION**
FIELD TYPE:
F
CHARACTER PORTION: C
BEGINNING LOCATION:
ENDING LOCATION:
5
FORCED CHARACTER INFORMATION
RECORD CHARACTER:
SUBSTITUTE CHARACTER:
CONTINUATION:
C
ENTER NEXT SPECIFICATION - SELECTION OR REFORMATTING
NEXT:

R

**SORT/MERGE REFORMATTING SPECIFICATION**
:=IELD TYPE:
N
CHARACTER PORTION: C
BEGINNING LOCATION:
23
ENDING LOCATION:
27
ENTER NEXT SPECIFICATION - SELECTION OR REFORMATTING
NEXT:

R

**SORT/MERGE REFORMATTING SPECIFICATION**
FIELD TYPE:
D
CHARACTER PORTION: C
BEGINNING LOCATION:
1
ENDING LOCATION:
80
ENTER NEXT SPECIFICATION - SELECTION OR REFORMATTING
NEXT:
SORT/MERGE EXECUTION OPTION
RUN SORT/MERGE?: Y~S
SORT/MERGE LISTING DEVICE
LISTING DEVICE NAME:
LPOl
SORT/MERGE COMPLETED NORMALLY

LJ
Figure 8-6.

8-10

Typical Interactive Prompt and Response Sequence for Building
Control Specification File (Sheet 2 of 2)

946252-9701

Sort/Merge SCI Interface and Execution

8.3

BATCH MODE

You can use a file containing batch command statements to produce a Sort/Merge control file and
to run Sort/Merge. Use the Text Editor or other means of creating records in the batch format
described in the following paragraphs. Use the Execute Batch (XB) command or the Execute Batch
Sort/Merge (XBSM) command to initiate a batch input. For further information on the batch commands, see the DX10 Operating System Reference Manua/, Volume II.
8.3.1

Batch Stream Commands

Use the commands described in this paragraph to create control files and run Sort/Merge in batch
mode. The first record in a batch file must be the BATCH command, and the second must be the
SM$SMC command.
NOTE

If SM$SMC is not the second command of a Sort/Merge batch
stream, the results of XB are unpredictable.

The format of SM$SMC is as follows:
SM$SMC CFN = filename
The file specified will contain the completed control specifications.
Table 8-2 details the various commands and the order in which they must be given. You can repeat
SM$IN once for each input file in a merge. You can repeat SM$SLC and SM$REF in sets to create
detailed specifications. Execute these commands in the order required by the specification
sheets (as shown in earlier sections of this manual). Although the order of keywords within a
specification is not critical, you should use the same order as you would use on the specification
worksheets. You need not specify keywords that are defaulted, but, if you fail to specify a required
entry, an E~rror termination of Sort/Merge results.
The last command of the control file creation sequence is SM$CLS. This command terminates the
creation of the control stream in an orderly fashion. It is a good practice to always include this
command, although no harm is done if it is omitted.
The EBATCH command must be the last record in a batch file.
8.3.2

Batch Record Format

Batch records must conform to the following rules:
•

The maximum length of a record is 80 characters. If you need more than one record to
specify the parameters for a command statement, end the first record with a comma or
an equal sign.

•

Each record in the file begins with a particular procedure name. If any keyword-response
sets are required, the first set must be on the same record as the procedure name.

•

Keyword-response sets are separated' by commas, as follows:
COMMAND KEY1 = RESPONSE1,KEY2= RESPONSE2

946252-9701

8-11

Sort/Merge SCI Interface and Execution

The order of the keywords is not critical. Table 8-1 gives suggested batch keywords. If you use
keywords other than those recommended, the keyword selected might not be unique, producing
unpredictable results.
Table 8-2 describes each of the Sort/Merge commands. The table presents the commands in the
order in which they must occur if used.
Table 8-2.

8-12

Batch Stream Commands and Use

Command

Remarks

SM$SMC

Creates the control file that will contain the specifications
created by the subsequent commands. This statement is required and must be the second command in the batch stream
(that is, following the BATCH command).

SM$HD

Builds the header control statement. Must be specified and
must immediately follow the SM$SMC command.

SM$OUT

Builds the output file control statement. It must be specified immediately after SM$HD.

SM$WKF

Builds the work file control statement. It may be specified for a
sort; when used, it must follow the SM$OUT command. This
command is not necessary for a merge and will be ignored if
specified.

SM$IN

Builds the input file control statement(s). The first SM$IN must
follow SM$WKF. For a sort, only one SM$IN may be specified.
For a merge, at least two and no more than five SM$I N commands may be used. For a merge, these commands may be intermixed with SM$SLC and SM$REF commands to create more
complex selection and reformatting patterns.

SM$SLC

Builds the record selection control statement(s). SM$SLC commands may be mixed with SM$IN and SM$REF commands to
create different selection patterns for different record types. The
SM$SLC command is not required. If no SM$SLC command is
used, the default value includes all records.

SM$REF

Builds the reformatting control statement(s). SM$REF commands may be mixed with SM$IN and SM$SLC commands to
create different reformatting for differentselected record sets or
different input files. SM$REF commands must be present to
define the sort control fields or keys.

SM$CLS

Terminates after the file creation procedure. This should be the
last command of the file creation section of a batch stream.

XBSM

Executes Sort/Merge by using the specified batch file name and
listing device.

946252-9701

Sort/Merge SCI Interface and Execution

8.3.3 Executing Sort/Merge in Batch Mode
The command to execute Sort/Merge in batch is as follows:

XBSM CFN = filename,LDN

=device(or filename)

If the control file has previously been created, only the XBSM command is required. If the control
file is being built in the batch stream, the file name on the XBSM statement must match the file
name on the SM$SMC statement. Figure 8-7 shows a file created by the Text Eqitor and then used
as a batch stream with the XB command.

BATCH

SMSSMC CFN=DS03.FILNAM
SMSHD SMT=SORTR~TCL=6~ORL=80,MS=8000
SMSOUT FP=DS03. TEST,LRL=80,PRL=560

SM$WKF WFV=DS02,WFT:E
SMSIN FP=DS03. INFIL
SMSSLC RST=I
SM$REF FT=N,CP:C,BL=32,EL=37
SM$REF

FT=D,CP~C,BL=1IEL=80

SM'$CLS
XBSM CFN=DS03.FILNAM,LDN=LPOl
EBATCH

Figure 8-7.

946252·9701

Example of Entries to Create a Batch File and Execute Sort/Merge

8-1318-14

9
External Interface Specifications
9.1

GENERAL

You can access Sort/Merge from COBOL, FORTRAN, Pascal, BASIC, or assembly language programs as either a synchronous task or an asynchronous task, as follows:
•

As an asynchronous task, executing concurrently with the calling task to process
records from input files and to send processed records to an output file.

•

As a synchronous task, to receive records from the calling task for processing and/or to
send records to the calling task following processing; in this case, a certain degree of
asynchronous processing occurs when the String Merge Module of Sort/Merge is
operating on the work file.

9.1.1 Intertask Subprograms
Data is transferred between the calling program and'Sort/Merge via intertask communication
using GETDATA and PUTDATA supervisor calls (SVC). The following subroutines are linked to the
calling task to provide this intertask communication. All of these subroutines are optional except
SRTINT.

SRTINT

Initializes the Sort/Merge task by bidding Sort/Merge and passing the
control specifications to Sort/Merge. This is a mandatory subroutine.

SENREG

Sends records to Sort/Merge from the calling program.

RCVREG

Transfers records that the calling program receives from Sort/Merge.

SMSTAT

Suspends the calling program until the entire Sort/Merge task is
completed.

SETDLY

Modifies the delay count for the Time Delay SVC used by the SMSTAT
subrouti ne.

9.1.2 Transmission of Records to and from Sort/Merge
After the calling program initializes Sort/Merge, the Control Statement Compiler Module interprets the File Description Specification to determine the input and output files. If the pathname
describes a file, Sort/Merge directly accesses the records from the input disk file and returns them
to the output disk file (part A of Figure 9-1). You cannot use synonyms for file names within the
sort control block definition of a calling program; however, you may use logical names. If the input
or output file pathname is specified by the characters @ PROC@, the respective input record
source or the output record destination will be the calling program. Part B of Figure 9-1 shows the
three modes of this type of access.

946252·9701

9-1

External Interface Specifications

DISK FILE

APPL H .. ABLfc
F-IC,URf NO.

CALLING TASK

SORT MERGE UTILITY

FIGURE
NO.
COBOL

9-')

SENREC

PASCAL

9-10

RCVRFC

BASIC

9-13

FORTRAN

9-.~

CONTROL
STATEMENTS
INITIALIZE S/M
SORT,
MERGE
UTILITY

S/M COMPLETF
STATUS CHECK

SET DELAY COUNT

A.

SRT I NT

SMSTAT

SETOLY

FILES ACCESSED DIRECTLY BY SORT'MERGE
CONTROL
STATEMENTS

EJ
WORK

:::L

..

SORT,'
MERGE
UTILITY

-...

~

-

r---------.-.

INITIALIZE S/M

SRTINT

PASS RECORDS
TO S'M

SENREC

BASIC

')-12

RCVREC

PASCAL

9-11

FORTRAN

9-4

RECE IVE RECORDS
FROM SIM

SMSTAT
SETDLY

CONTROL
STATEMENTS

SORT;
MERGE
UTILITY

INITIALIZE S/M

SRTINT

PASS RECORDS
TO S/M

SENREC

RCVREC
S/M COM PLETE •
STATUS CHECK

SMSTAT

SET DELAY COUNT

SETDLY

CONTROL
STATEMENTS

SORTI
MERGE
UTILITY

INITIALIZE SIM

SRTINT
SENREC

RECE IVE RECORDS
FROM S/M

COBOL

RCVREC
COBOL

9-7

SMSTAT
SETDLY

B.
(A) 1 35766A

9-2

FILES ACCESSED THROUGH CALLING PROGRAM

Figure 9-1.

External Communication to Sort/Merge
946252·9701

External Interface Specifications

The rules for using @PROC@ as the path name are as follows:
•

An @PROC@ for the output file pathname requires no continuation line.

•

An @PROC@ for the input file pathname requires a continuation line with the logical
record length specified.

•

In a merge, @PROC@ can be used for only one of the two to five input files. If used, it requires a continuation line specifying the logical record length.

9.1.3 Control Statement Criteria
Control statements in assembly language, FORTRAN, COBOL, Pascal, or BASIC must be contained in a. contiguous array; each statement must be 44 characters long. This corresponds to the
first 44 characters of the control statement specifications and means that comments are not supported.

The last control statement must be a slash-asterisk (/*), which is the end-of-file (EOF) mark. This
mark must be included in the count when specifying the number of control statements.
9.1.4 Use of Intertask Communication
Sort/Merge uses the GETDATA and PUTDATA SVCs to transmit and receive records and control
statements between the calling task and the Sort/Merge task. The run-time task ID number of the
calling task and the Sort/Merge task is used as the communication channel identifier with the
GETDATA and PUTDATA calls.

9.2

SUBPROGRAM USAGE

Paragraphs 9.2.1 through 9.2.6 contain information on linkable subprograms that communicate
with Sort/Merge. These examples use a general CALL format; however, the formats for the
FORTRAN, COBOL, Pascal, and BASIC CALL statements are analogous; assembly language also
follows a similar format. A comparison of the statement used to call the initialization subprogram
for each of these languages is as follows:
FORTRAN:

CALL SRTINT(CNTRL,NUMSTS,STATIS)
COBOL:

CALL "SRTINT" USING CNTRL,NUMSTS,STATIS.
BASIC:

CALL ".SMLlB.BASCSM"(SRTINT,A$(1),N,S)
Pascal:

SRTINT(CNTRL,NUMSTS,STATIS);

946252·9701

9-3

External Interface Specifications

Assembly Language:

REF

ARGlST

SRTINT

LI
RO,ARGlST
BlWP @SRTINT

Address of argument list
Call subroutine

DATA 6

Byte count of argument list
(twice the number of arguments)
Control statement area address
Number of control statements
Return status area

DATA CNTRl
DATA NUMST
DATA STATIS

9.2.1 Initialization
Sort/Merge must be initialized before you can send records to or receive records from the
Sort/Merge module. The general format for calling initialization is as follows:

CAll SRTI NT(CONTROl-STATEM ENTS, NUM BER-ST ATEM ENTS,ST ATIS)
where:
CONTROL-STATEMENTS is the name of the array containing the control statements in the
calling program. Each statement must be 44 characters.
NUMBER-STATEMENTS is the maximum number of control statement records to be sent
to Sort/Merge (INTEGER or COMP-1).
STATIS is the parameter in which the status code will be returned following initialization
(INTEGER or COMP-1). STATIS may contain the following values:
Value

9-4

Meaning

o

Indicates initialization successful.

1

Indicates error in control statements.

2

Indicates error in initialization of Sort/Merge.

3

Indicates Sort/Merge not installed on system.

4

Indicates no /* (EOF mark) found.

5

Indicates Sort/Merge abnormal termination.

6

Indicates SRTINT cannot allocate a buffer for the intertask
communication message.

946252-9701

External Interface Specifications

9.2.2

Send Records to Sort/Merge
Following initialization, you can transmit records from the calling program to Sort/Merge by using
subroutine SENREC. Use the following format to call SENREC:

CALL SEN REC(RECORD-AREA,RECORD-LENGTH,STATIS)
where:
RECORD-AREA is the array containing the record to be sent. The array must begin on a
word boundary in memory.
RECORD-LENGTH is the length in bytes of the record to be sent. Zero indicates an EOF
to Sort/Merge (INTEGER or COMP-1). The record length must be an even number of bytes.
ST.ATIS is the parameter in which the status code will be returned (INTEGER or COMP-1).
ST.ATIS may contain the following values:
Value

Meaning

o

Indicates that Sort/Merge successfully received the record.

1

Indicates an error in the send operation. Check to be sure
that SRTINT was called prior to calling SENREC.
Sort/Merge terminates.

2

Indicates that the Sort/Merge processor is no longer an
active task. The system log may contain an error entry for
task 2A11 (if Sort/Merge terminated abnormally). Check all
control statements and calling sequences carefully, and
use the debug aid explained in a subsequent paragraph in
this section.

9.2.3 Receive Records from Sort/Merge
Use subroutine RCVREC to enable the calling program to receive records from Sort/Merge. Use
the following format to call RCVREC:

CALL RCVREC (RECORD-AREA,RECORD-AREA-LENGTH,BYTES-RECEIVED,STATIS)
where:
RECORD-AREA is the array where the received record is to be stored. The array must
begin on a word boundary in memory.
RECORD-AREA-LENGTH is the length in bytes of the record area (INTEGER or COMP-1).
The length must be an even number of bytes.
BYTES-RECEIVED is the actual number of bytes placed in the record area. A zero in this
area indicates that an EOF mark was received from Sort/Merge (INTEGER or COMP-1).

946252-9701

9-5

Exteran! Interface Specifications

STATIS is the parameter in which the status code is returned following the operation.
STATIS may contain the following values:
Meaning

Value

o

Indicates successful receipt of data.

1

Indicates an error in receipt of data or that SRTINT was
not called prior to calling REVREC. The system log may
contai n an error entry for task 2A '8 (if Sort/Merge terminated abnormally). Check all control statements and
calling sequences carefully, and use the debug aid
explained in a subsequent paragraph in this section.

2

Indicates that an EOF mark was received.

NOTE

STATIS or BYTES-RECEIVED can be monitored to determine if an
EOF mark has been received.

9.2.4 Wait for Sort/Merge Completion
Use the SMSTAT call only if you specified a disk file for the output file in the control specifications. The SMSTAT call suspends the calling task until Sort/Merge completes transmitting
records to the output disk file and finishes execution. The calling task is then reactivated, and
completion status can be checked. Sort/Merge must finish or terminate execution before the calling task is reactivated; thus, if improperly used, this call can indefinitely suspend the calling program.

The format of the SMSTAT call is as follows:
CALL SMSTAT(STATIS)
where:
STATIS is the parameter (INTEGER or COMP-1) in which the status code will be returned
upon completion of the Sort/Merge processing. STATIS may contain the following values:
Value

9-6

Meaning

o

Indicates Sort/Merge completed with no errors.

1

Indicates Sort/Merge encountered control statement
errors.

2

Indicates Sort/Merge encountered fatal I/O errors.

3

Indicates Sort/Merge terminated for unknown reasons.

8

Indicates Sort/Merge completed but encountered locked
key-indexed file records.

946252·9701

External Interface Specifications

9.2.5

Set Time Delay Count

The SETDLY subroutine allows you to set the time delay between checks, thus minimizing the
number of times the application task resides in memory.
Subroutine SMSTAT checks the execution of the Sort/Merge task to be sure that execution is continuing. Since SMSTAT is part of the application task, the application task must be in memory
when this checking occurs. In a small memory system in which both the application task and
Sort/Merge cannot bein memory at the same time, this monitoring function might suspend and
roll out the Sort/Merge task so that the SMSTAT subroutine can execute. This can have a significant impact on the speed at which Sort/Merge operates, in that swapping the application task and
Sort/Merge may take more time than the sort operation itself.
The format for the SETDLY call is as follows:
CALL SETDLY(SECN DS)
where:
SECNDS is the parameter (INTEGER or COMP-1) containing the number of seconds that
SMSTAT should wait before checking the status of the Sort/Merge task. The limit of this
parameter is 30 seconds. If a value of 0 is passed, a default of 26 seconds is used. If a value
greater than 30 is passed, a value of 30 is used.
For example, consider the time required to sort 3000 records in a 128K-byte system. If the
subroutine SETDLY is not called, the time required to sort the records is approximately 12
minutes; if the subroutine SETDLY is called with a value of 0, the time required to sort the records
is approximately 2 minutes and 14 seconds.

NOTE

If the Sort/Merge task terminates prematurely, the application does
not reactivate until after the specified time delay occurs.

9.2.6

Linking FORTRAN, COBOL, Pascal, and Assembly Language Programs

The library .SMLlB contains the following Sort/Merge interface subroutines. The subroutine
SETDLY is contained in the module SRTINT.
FORTRAN, COBOL, Pascal, or Assembly Language

SRTINT
SENREC
RCVREC
SMSTAT
In addition, COBOL and assembly language programs use a subroutine called COBINT and Pascal
uses a subroutine called PSCINT.
946252·9701

9-7

External Interface Specifications

NOTE

SRTINT must be either in the root segment in overlay structures or
in the same segment as SENREC, RCVREC, and SMSTAT.

SENREC, RCVREC, and SMSTAT each call internal subroutines contained in SRTINT. The other
subroutines call COBINT and PSCINT and must be placed in the same manner as SRTINT.
In the following paragraphs, .MAINPROG denotes the user-written code. In each example, all
subroutines in .SMLlB are included, but only subroutines that are called need to be linked.
Linking Assembly Language Programs. Assembly language requires that COBOL
subroutine COBINT be included in the link control file, as follows:

9.2.6.1

NOSYMT
PHASE O,MAIN
INCLUDE .MAINPROG
INCLUDE .SMLlB.SRTINT
INCLUDE .SMLlB.SENREC
INCLUDE .SMLlB.RCVREC
INCLUDE .SMLlB.SMSTAT
INCLUDE .SMLlB.COBINT
Only SRTINT and COBINT are required. COBINT must follow the same rules that apply to SRTINT
(as stated previously); that is, COBINT must be in either the root segment in overlay structures or
in the same segment as SENREC, RCVREC, and SMSTAT.
linking FORTRAN Programs. Perform the linking procedures for FORTRAN, as outlined
in the FORTRAN Programmer's Guide. INCLUDE statements are necessary for SRTINT, SENREC,
RCVREC, and SMSTAT. F$RGMY is part of the library .FORTRAN.STLOBJ and does not need an
INCLUDE statement because it is included by the library commands required to link FORTRAN.

9.2.6.2

9.2.6.3 Linking COBOL Programs. Perform the linking procedures for COBOL are outlined in the
COBOL Programmer's Guide. The INCLUDE statements for SRTINT, SENREC, RCVREC, and
SMSTAT are necessary. COBINT follows the same rules that apply to SRTINT in that it must be in
either the root segment in overlay structures or in the same segment as SENREC, RCVREC, and
SMSTAT.
9.2.6.4 Linking Pascal Programs. Perform the linking procedures for Pascal as outlined in the
Pascal Programmer's Guide. The INCLUDE statements for SRTINT, SENREC, RCVREC, and

SMSTAT are necessary. Pascal also requires the following:
INCLUDE .SMLlB.PSCINT
9-8

946252-9701

External Interface Specifications

This is a functional replacement for the COBOL COBINT. PSCINT follows the same rules that apply to SRTINT, as noted in paragraph 9.2.6.
9.2.7 Interfacing TI 990 BASIC Programs with Sort/Merge
The file BASCSM in the Sort/Merge library .SMLlB contains the subroutines required to interface
TI 990 BASIC to the Sort/Merge utility. The first parameter in the argument list of the calling sequence must be an integer value between 1 and 5, indicating which subroutine is being called. The
following is a list of the Sort/Merge subroutines and the corresponding integer values used when
calling them:
Subroutine

Value

1
2
3
4
5

SRTINT
SETDLY
SENREC
RCVREC
SMSTAT

The SRTINT subroutine uses the following format:
nnn SRTINT == 1
nnn CALL ".SMLlB.BASCSM"(SRTINT,A$(1),N,S)
where:
SRTINT contains the integer value indicating that the subroutine SRTINT is being called.
A$(1) is a string array containing the control statements in the calling program.
N is. the integer containing the maximum number of control statements.
S is the integer STATIS return parameter.
The SENREC subroutine uses the following format:
nnn SENREC = 3
nnn CALL ".SMLlB.BASCSM"(SENREC,S$,L,S)
where:
SENREC contains the integer value indicating that the subroutine SENREC is being called.
S$ is the stri ng that contai ns the record to be sent.
L is the integer length (in bytes) of the string to be passed to Sort/Merge. L may be less than
or equal to the actual length of S$. When L equals zero, it specifies the EOF to Sort/Merge. L
must be an even number.
S is the integer STATIS return parameter.

946252·9701

9-9

External Interface Specifications

The RCVREC subroutine uses the following format:
nnn RCVREC = 4
nnn S$ = RPT$(""),L
nnn CALL ".SMLlB.BASCSM"(RCVREC,S$,L,B,S)
where:
RCVREC contains the integer value indicating that the subroutine RCVREC is being called.
S$ is the string that will receive the record returned from Sort/Merge. You must initialize the
string to the expected return length by using the TI990 BASIC intrinsic function RPT$ before
calling the subroutine RCVREC.
L is the integer length in bytes of the record to be received in S$. L must be an even number.
B is the integer length in bytes of the string returned in S$. A zero indicates the EOF. B will be
less than or equal to the length of S$.
S is the integer STATIS return parameter.
The SMSTAT subroutine uses the following format:
nnn SMSTAT = 5
nnn CALL ".SMLlB.BASCSM"(SMSTAT,S)
where:
SMSTAT contains the integer value indicating that the subroutine SMSTAT is being called.
S is the integer STATIS return parameter.
The SETDLY subrouti ne uses the followi ng format:
nnn SETDLY = 2
nnn CALL ".SMLlB.BASCSM"(SETDLY,N)
where:
SETDLY contains the integer value indicating that the subroutine SETDLY is being called.
N is the integer variable containing the number of seconds that the application task should
delay before checking the status of Sort/Merge.
You must load the file BASCSM before execution of the TI 990 BASIC program; use the following
statement:
nnn LIBRARY"· .SMLlB.BASCSM"
All numeric variables used as parameters to the Sort/Merge subroutines must be declared as
INTEGER type.
9-10

946252·9701

External Interface Specifications

NOTE

Use of commas and blanks in strings in TI 990 BASIC may cause
position problems within a string when using Sort/Merge. For ex·
ample, if blanks are present in the first few columns of a record, the
string begins with the first nonblank column. This may cause con·
trol and data fields to be out of their normal positions. Consult the
TI 990 BAS/C Reference Manua/ for further details.

The Sort/Merge utility supports only the alphanumeric and integer data types of TI 990 BASIC.

9.3

PROGRAM EXAMPLES

The following paragraphs give examples and explanations of FORTRAN, COBOL, Pascal, and
BASIC listings.
9.3.1

FORTRAN Examples

Figure 9·2 is a flowchart and Figure 9·3 is a FORTRAN listing of a task that initializes Sort/Merge,
passes records to Sort/Merge, and receives the records returned from Sort/Merge via intertask
communication. In this example, both input and output file pathnames are @PROC@ to indicate
to Sort/Merge that this intertask communication is to be done. Figure 9·4 is an example of a
FORTRAN task that allows Sort/Merge to read the input file from the disk and return the sorted
output records to the calling task.
9.3.2

COBOL Examples

Figure 9·5 shows a COBOL routine that calls Sort/Merge to input records from a disk file and out·
put the sorted records to a second disk file. Note the proper use of SMSTAT.
Figure 9·6 shows a COBOL routine that calls Sort/Merge and passes records read by the COBOL
routine to Sort/Merge. The sorted records are output to a disk file. Note the proper use of SMSTAT.
Figure 9·7 is an example of a COBOL routine that executes a SORTA on a relative record file can·
taining more than 65,536 records. Note how the COBOL routine must manipulate the output from a
SORTA (a binary relative record number) so that the correct record is read from the relative record
file.

NOTE

You can specify control statements in COBOL as shown in these ex·
amples or by using a PIC X(44) VALUE IS construction in a manner
similar to that of the FORTRAN examples.

Figure 9·8 compares interfacing Sort/Merge by using the 990 COBOL CALL verb with interfacing
Sort/Merge by using the ANSI COBOL SORT verb; the latter is not supported on the 990. The CALL
interface gives the COBOL user additional capA~ilities not found with the ANSI SORT statement.
By using the CALL, you specify selection reformatting, summation, and alternate sequence
specifications for use in sorting or merging. Figure 9·9 shows the combinations available with the
COBOL CALL verb.
946252·9701

9-11

External Interface Specifications

INITIALIZE
S/M MODULE
(CALL SRTINT)

RECEIVE RECORD FROM SM
(CALL RCVREC)

NO

YES

GENERATE A"
RECORD (A
READ WOULD
ALSO WORK)

NO

SEND RECORD
TO S/"M
(CALL SENREC)

WRITE RECORD
TO FILE

SEND FOF
(CALL SENREC
WITH 0 BYTES)

ERROR
MESSAGE

NO

DO
SORT/MERGE

NOTE:

THIS FLOW CHART CORRESPONDS
TO LISTING OF FORTRAN PROGRAM
IN FIGURE 9- 3

(A) 135767

Figure 9-2.

9-12

Flowchart of FORTRAN Program that Sends Records to Sort/Merge

946252·9701

External Interface Specifications

C*
C*

INTERTASK COMMUNICATION TEST PROGRAM
PRINTED OUTPUT IS UNIT 6

(PPP)

INTEGER BUFFER(220}, LIN1(22), LIN2(22), LIN3(22)
INTEGER LIN4 (22),LIN5 (22),LIN6 (22),LIN7 (22)
INTEGER LIN8 (22),LIN9 (22)~LINI0(22), STATUS, IMAGE(40»
EGUIVALENCE(LINl (1), BUFFER ( 1», (LIN2( 1), BUFFER(23»
EGUIVALENCE(LIN3 (1), BUFFER(45», (LIN4( 1), BUFFER(67»
EGU I VALENCE ( L I 1'15 (1)., BUFFER ( 89 ) » (L I N6 ( 1 ) , BUFFER ( 111 ) )
EGUIVALENCECLIN7 (1), BUFFER (133»
(LIN8( 1), BUFFER (1 :=,5»
EGUIVALENCE(LIN9 (1), BUFFER ( 177», (LIN10( 1), BUFFER ( 199»
THIS FORTRAN TEST OF THE INTERTASK COMMUNICATIONS
GENERATES A RANDOM NUMBER BETWEEN 0 AND 1000.
THIS NUMBER IS ENCODED AND PASSED VIA THE
@PROC@ INTO THE SM.
8M SORTS THE DATA AND
PASSES THE DATA BACK T:~ROUGH THE @PROC@.
I

r

C
C
C
C

,..
~-------------------------------------------------------

C*
C

SORT CONTROL BLOCK DEFINITION
00000000011111111112222222222333333333344444
12345678901234567890123456789012345678901234
DATA LIN1 /'01000HSORTR
6A
80
8000
.' "
, I
DATA LIN2 /~01010DOS@PROC@
.'
DATA LIN3 /'OI030DWNWORKDISK
.'
/I
DATA LIN4 l'OlOSODIS@PROC@
.:'
DATA LIN5 /JOI0S5DA 80
100
DATA LIN6 1 ' 010601
DATA LIN7 /'01065FNC 32 37
'/
;/
DATA LIN8 l'OI070FDC
1 31
I
DATA LIN9 l'01080FDC 38 80
1/
DATA LIt-HOI '1*
DATA NUMSP 1101
C------------------------CALL SRTINT TO TRANSFER SORT/MERGE
C---------------------SPECIFICATIONS TO THE SORT/MERGE TASK
CALL SRTINTCBUFFER,NUMSP,STATUS)
IF(STATUS.EG.O) GOTO 20
C-------------STATUS INDICATES AN ERROR, DISPLAY AND EXIT
11
WRITE(6,12)STATUS
12
FORMAT(' SORT ERROR STATUS = " I4)
STOP 1
C------------------------GENERATE 100 RECORDS, DISPLAY
20
DO 45 1=1, 100
I

..

I

)

J

I

~VAL=IFI{T1}(1000.0*RANF(I»

22

32

ENCODE(80,22, IMAGE,NUMC}~VAL, I
FORMAT( -'**', 29X, 16, 20X, 13, 19X, '*')
WRITE(6,32) IMAGE
FORMAT(1{Tl},40A2)

c--------------------------------CALL SENREC(IMAGE,80,STATUS)

PASS THE RECORDS

IFCSTATUS.EQ. O)GOTO 45
WRITE(6,12)STATUS
Figure 9-3.

946252-9701

FORTRAN Program Calls Sort/Merge, Calling Program Sends and
Receives Records (Sheet 1 of 2)
9-13

External Interface Specifications

45

STOP 2
CONTINUE

C---------------------------------------------SEND EOF

ICOIJNT=O
CALL SENREC(IMAGE, ICOUNT,STATUS)
IF(STATUS. EG.O}GO TO 65
WRITE(6,12)STATUS
STOP 3
C-------------------RECEIVE THE SORTED RECORDS AND DISPLAY
65
DO 115 1=1,200
C--------------------WE WILL TRY TO RECEIVE MORE THAN WE SENT
CALL RCVREC(IMAGE,80, IBYTE,STATUS)
IF (STATUS. EG. 1) GO TO 95
IF (STATUS. EG. 2) GO TO 77
ICOUNT = ICDUNT + 1
WRITE (6,112) IBYTE} IMAGE
55

GO TO 115

C---------------------------------------END OF FILE ENCOUNTERED
77
WRITE (6,82) ICOUNT
82
FORMAT ( I RECORDS RECEIVED BACK = I ; 17)
STOP
95
WRITE(6,12)STATUS
STOP 4
112
FORMAT(lX,I2,40A2)
115
CONTINUE
C-------------------------RECEIVED TOO MANY RECORDS *ERROR*
t·JR I TE (6, 122)
122
~ORMAT(
RECEIVED TOO MANY RECORDS BACK ! ~: ')
STOP 100
:::ND
I

Figure 9-3.

C*
C*

FORTRAN Program Calls Sort/Merge, Calling Program Sends and
Receives Records (Sheet 2 of 2)

COMMUNICATION TEST PROGRAM
OUTPUT IS TO UNIT 6

IN~ERTASK

(FNPP)

DIMENSION IHD(22), INFL(22), INFLCT(22), IWRKFL(22)
DIMENSION IOUTFL(22), IDUTCT(22), IFLD1(22), IREC(40)
DIMENSION IFLD(22), IFLD3(22), IENDCD(22») !SPECS(220)
E{)UI'·JALENCE (ISPECS(lL IHD(l»} (ISPECS(23), IOUTFL(i}»)
+
(ISPECS(45), IOI.JTCT( 1»} (ISPECS(67)' It~RKFL( 1»,
+
(ISPECS(89), INFL(l»' (!SPECS(111), INFLCT(l) ).'
+
(ISPECS( 133)) IFLDl (1», (ISPECS( 155) > IFLD~ 1»)
+
( I SPECS ( 177), I FLD3 ( 1 ) ), (I SPECS < 199) I ENDeD ( i ) )
THIS TASK USES SM ROUTINE RCVREC AND PERFORMS A SORTR.
THE :NPUT IS READ BY THE SORT FROM A FILE.
THE FILE TO BE SORTED IS A 400, SO-BYTE RECORD FILE.
THE OUTPUT IS RETURNED TO TliE FORTRAN PROGRAM.
j

c

Figure 9-4.
9-14

FORTRAN Program Calls Sort/Merge, Inputs Files from Disk, and Outputs Flies to
Calling Program (Sheet 1 of 2)
946252-9701

External Interface Specifications

c -------------------------------------------------------

C
C

SORT CONTROL BLOCK DEFINITION
00000000011111111112222222222333333333344444
12345678901234567890123456789012345678901234
.I
DATA IHD
/'OOOOCHSORTR 00006A
0080
8000
I
DATA IOUTFL
j'00001DOS@PROC@
DATA rOUTeT
/'00002DA0080080000000101
'/
l/
DATA IWRKFL
/'00004DWNWORKDISK
1/
DATA INFL
/'00006DISDS01,MARY. EIGH4
.I
DATA INFLCT
J'00008DA0080
00000400
DATA IFLD1
/'OOOlCFNC00320037
'/
DATA IFLD
/'00012FDC00010031
, ,/
DATA IFLD3
/'00014FDC00380080
I
DATA IENDCD
/'/*
DATA KNTSTJ IRECLN/I0,80/
c-----------------------------------------------INITIALIZE SORT
C
SORT WILL READ INPUT FILE AND SORT RECORDS.
C
RCVREC WILL WAIT FOR RECEIVE THE RECORDS
C
~ETURNED FROM THE SORT.
CALL SRTINTCISPECS,KNTST, ISTAT)
IF (ISTAT. NE. 0)
GOTO 909
C-----------------------------------------------RECEIVE RECORDS
ICOUNT = 0
C RECEIVE THE NEXT RECORD.
55
CONTINUE
CALL RCVREC(IREC, IRECLN, IRECBY, ISTAT)
C CHECK IF LAST RECORD HAS BEEN SENT.
IF (IRECBY.EG.O)
GOTO 75
IF (ISTAT. NE.O)
GOTO 929
ICOUNT = ICOUNT + 1
WRITE(6,61) IRECBY,IREC
61
FORMAT(lX, 14, lX,40A2)
GOTO 55
75
WRITE(6,101) ICOUNT
101
FORMAT(J NUMBER OF RECORDS ',15)
STOP
c--------------------------------------------------ERROR
909
WRITE(6,911) 1STAT
911
FORMAT(' ERROR IN SRTINT', 14)
STOP
c---------------------------------------------------ER ROR
929
WRITE(6,930) ISTAT
930
FORMAT(J ERROR IN RCVRECJ, 14)
STOP 2
C--------------------------------------------------ERROR
939
WRITE(6,940} ISTAT
940
FORMAT(' SORT/MERGE COMPLETED ABNORMALLY 14)
STOP 3
END
I

J

J

I

J

/

J

Figure 9-4.

946252-9701

,

FORTRAN Program Calls Sort/Merge, Inputs Flies from Disk, and Outputs Files to
Calling Program (Sheet 2 of 2)
9-15

External Interface Specifications

IDENTIFICATION DIVISION.
PROGRAM-ID. CTRSE.
*THIS IS A SORT/MERGE INFORMATION GIJEIJE TEST. IT
*TESTS THE CASE WHERE BOTH INPUT AND OUTPUT ARE
*PASSED DIRECTLY FROM A FILE TO THE SORT (NO @PROC@).
AUTHOR. TEXAS INSTRUMENTS.
DATE-WRITTEN. 11-6-80.
ENVIRONMENT DIVISION.

CONFIGURATION SECTION.
TI-990-10.
TI-990-10.

SOURCE-COMPUTER.
OB0ECT-COMPUTER.
DATA DIVISION.
WOR~,ING-STORAGE

77 MAX-NO-RECS

SECTION.
PIC 9(5)

77 STATIS
77 RECORD-LENGTH

PIC 9(S}
PIC 9 (5)

77 RECORD-AREA-LENGTH

PIC 9(5)
PIC 9 ( 5)

77 BYTES-RECEIVED
77 OFILRCRD
77 ALLDONE

PIe x (80).

VALUE
USAGE
USAGE
VALUE
USAGE
USAGE
USAGE

IS
IS
IS
IS
IS

10
COMP-1.
COMP-1.
80

COi"tP-1.

IS COMP-l.
IS COr-IF'-1.

PIC 9(5) VALUE IS ZERO
USAGE IS COl"1P-1.
*SORT-CONTROL-BLOCK CONTAINS THE BORT/MERGE
*CONTROL SPECIFICATIONS.
01 SORT-CONTROL-BLOCK.
03 HEADER
PIC X(44) VALUE IS
"OOOOOHSORTR 00006A
0080
* OUTPUT IS PASSED DIRECTLY FROM THE SORT TO THE FILE.
03 OUT-FILE-SPEC PIC X(44) VALUE IS

*

"00002DOSDS01.0UTX
03 CNT-OUT-FILE-SPEC PIC X(44) VALUE IS
"00004DA00800800
03 WRK-FILE-SPEC PIC X(44) VALUE IS
IJ00006DWEDSOl
INPUT IS DIRECTLY FROM A FILE TO THE SORT.
03 INPT-FILE-DESCRPT PIC X(44) VALUE IS
n00008DISDS01. SRTDAT
03 INPT-FILE-CONTIN PIC X(44) VALUE IS
1I00010DA
00000400
03 REFORMAT-DESCRIPT-O PIC X(44) VALUE IS
"00012FNC00320037
03 REFORMAT-DESCRIPTION PIC X(44) VALUE IS
"00015FDC00010031
03 REFORMAT-DESCRPT-2 PIC X(44) VALUE IS

Ii

II

"
IJ

"

II00017FDC00380080

03 ENDKRD

PIC X(44)

VALUE IS

Il/*

Figure 9-5.

9-16

COBOL Program Calls Sort/Merge, Inputs Flies from Disk, and Outputs Files to Disk

946252·9701

External Interface Specifications

PROCEDURE DIVISION.
*~~~~=;;~~;~~~------------------------COBOL

EXAMPLE

*INITIALIZE SORT/MERGE:
CALL IISRTINTn USING SORT-CONTROL-BLOC;'<'~
MAX-NO-RECS, STAT IS.
IF STATIS NOT EGU~L ZERO GO TO ERRSTRT.
*-------------------------------------COBOL EXAMPLE
C~STATS.

*WAIT UNTIL THE SORT/MERGE IS DONE.
CALL nSMSTATu USING STATIS.
IF STATIS EGUAL ZERO
DISPLAY
SORT /MERGE COMPLETE) NO ERRORS.
ELSE DISPLAY " SORT /MERGE COMPLETED ABNORf'1t-;LLY. ".
GO TO END-IT.
*-------------------------------------COBOL EXAMPLE
It

H

ERRE)TRT.

DISPLAY
ERROR IN STRINT CALL. ".
END--IT.
STOP RUN.
END PROGRAM.
It

Figure 9-5.

COBOL Program Calls SORT/MERGE, Inputs Flies from Disk, and Outputs Files to Disk
(Sheet 2 of 2)

IDENTIFICATION DIVISION.
PROGRAM-ID. CPNP.
*THIS IS A SORT/MERGE INFORMATION QUEUE TEST. IT TESTS THE
*CASE WHERE INPUT IS DIRECTED BY THE COBOL PROGRAM (@PROC@)
*AND OUTPUT IS DIRECTLY FROM SORT/MERGE TO A FILE (NO @PROC@).
AUTHOR. TEXAS INSTRUMENTS.
DATE-t.-JRITTEN. 11-6-80.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. TI-990-10.
OBJECT-COMPUTER. TI-990-10.
INPUT-OUTPUT SECTION.
FILE -CONTROL.
SELECT INFILNAME ASSIGN TO INPUT IIINFILEH j
ACCESS MODE IS SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD INFILNAME
DATA RECORD IS INFILRCRD
LABEL RECORDS ARE STANDARD
RECORD CONTAINS 80 CHARACTERS
BLOCK CONTAINS 10 RECORDS.
01 INFILRCRD
PIC X(SO)'
Figure 9-6..

946252-9701

COBOL Program calls Sort/Merge, Inputs Flies from Calling Task,
and Outputs Flies to Disk (Sheet 1 of 4)

9-17

External Interface Specifications

WORKING-STORAGE SECTION.
77 MAX-NO-RECS
PIC 9(5)
VALUE IS 10
USAGE IS COMP-1.
77 STATTS
PIC 9(5)
USAGE 1'3 ·:ClMP-l.
77 RECORD-LENGTH
PIC 9(S}
VALUE IS "0 ....,...,
USAGE IS COrP-i.
77 RECORD-AREA-LENGTH PIC 9(5) USAGE rs COl"1P-l.
PIG 9(S)
USAGE IS COi"i?-l.
77 BYTES-RECEIVED
PIC X (80),
77 OFILRCRD
PIC 9(5) VALUE IS ZERO
77 ALLDONE
USAGE IS COl"iP-1.
*SORT-CONTROL-BLOCK CONTAINS THE SORT/MERGE
*CONTROL SPECIFICATIONS.
01 SORT-CONTROL-BLOCll..
03 HEADER.
05 SEQ
PIC X (5)
VALUE IS )'00000",
05 FILLER
PIC A
VALUE IS ilHH.
05 SORT-TYPE
PIC A(6)
VALUE IS JlSORTR "
05 MAX-TOT-CONTL-LEN PIC 9( 5) VALUE IS 6.
VALUE IS "AU.
05 ASCND-DSCND PIC A
05 FILLER
PIC X~7)
VALUE IS SPACES.
VALUE IS SPi;CE.
05 COLLATNG-SEG PIC X
05 PRINT-OPTION PIC X
VALUE IS SPACE.
05 OUTPUT-OPTION PIC X
VALUE IS SPACE.
05 OIJTPUT-REC-LEN PIC X(4) VALUE IS >10080",
05 VERIFY-OPTN
PIC X VALUE IS SPACE.
05 WRK-SPACE
PIC xes)
VALUE IS SPACES.
05 FILLER
PIC X(6)
VALUE IS SPACES.
*OUTPUT IS PAsseD DIRECTLY FROM THE SORT TO A FILE.
03 OUT-FILE-SPEC.
05 SEa
PIC x  STATIS.
IF STATIS NOT EQUAL ZERO GO TO ERRSTRT.
*-------------------------------------------COBOL EXAMPLE
* START THE INPUT SECTION.
OPEN INPUT INFILNAME.
*--------~----------------------------------COBOL

NEXREC.

READ INFILNAME AT END GO TO BEGWRT.

CALL IISENRECu USING INFILRCRD,
RECORD-LENGTH} STATIS.
IF STATIS NOT EGUAL ZERO GO TO ERRSEN.
GO TO NEXREC.
*-------------------------------------------COBOL EXAMPLE
* START THE OUTPUT SECTION.
BEGt,JRT.
*-------------------------------------------COBOL EXAMPLE
* BEGIN SORT PHASE. SENDING A RECORD LENGTH OF 0 (ALLDONE)

*

INDICATES THAT THE LAST RECORD HAS BEEN SENT.
CALL IISENREC" USING INFILRCRD, ALLDONE, STAT IS.
IF STATlS NOT EQUAL ZERO GO TO ERRSEN.

*-------------------------------------------COBOL EXAMPLE
CLOSE INFILNAME.
CH~,SORT.

CALL IJSMSTAT" USIN(i STATrs.
IF STATIS NOT EQUAL ZERO GO TO ERRWRT.
1<

SORT !S DONE.

GO TO Ei'!D-IT.

*-------------------------------------------COBOl
ERRSTRT.
DISPLAY " ERROR IN
GO TO END-IT.

EX~M?LE

STR INT CALL. ".

ERRSEN.
DISPLAY " ERROR IN SENREC CALL. ".
GO TO END-IT.
ERRWRT.
DISPLAY 1/ ERROR IN SNSTAT. ".
*-------------------------------------------COBOL EXAMPLE
END-IT.

STOP RUN.
END PROGRAM.
Figure 9·6.

9-20

COBOL Program Calls Sort/Merge, Inputs Files from Calling Task,
and Outputs Flies to Disk (Sheet 4 of 4)
946252-9701

External Interface Specifications

IDENTIFICATION DIVISION.
PROGRAM-ID. CSORTA.
*THIS IS A SORT/MERGE INFORMATION QUEUE TEST. IT
*TESTS THE CASE WHERE INPUT IS DIRECTLY FROM A
*FILE (NO @PROC@) AND OUTPUT IS RETRIEVED BY THE
*COBOL TASK. (@PROC@).
AUTHOR. TEXAS INSTRUMENTS FDT.
DATE-WRITTEN. 04-9-79.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. TI-990-10.
OB~ECT-COMPUTER.
TI-990-10.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT OUTFLNAM ASSIGN TO OUTPUT nOUTFL"j
ACCESS MODE IS SEGUENTIAL.
SELECT INFILNAM ASSIGN TO RANDOM "INFILEllj
ORGANIZATION IS RELATIVE;
ACCESS MODE IS DYNAMIC)
RELATIVE KEY IS REC-NUMBER;
FILE STATUS IS RR-STATUS.
DATA DIVISION.
FILE SECTION.
FD OUTFLNAM
DATA RECORD IS OUTREC
LABEL RECORDS ARE STANDARD
RECORD CONTAINS 20 CHARACTERS
BLOCK CONTAINS 10 RECORDS.
01 OIJTREC.
03 RRNUM
PIC XXXXXX.
03
ONEREC
PIC X(14).
FD INFILNAM
DATA RECORD IS INREC
LABEL RECORDS ARE STANDARD
RECORD CONTAINS 6 CHARACTERS
BLOCK CONTAINS 1000 RECORDS.
01 INREC
PIC X(6)WORKING-STORAGE SECTION.
77 MAX-NO-RECS
PIC 9(5) VALUE IS 8
USAGE IS CONP-1.
77 STATIS
PIC 9(5) USAGE IS COMP-1.
77 RECORD-LENGTH
PIC 9(5}
VALUE IS 80
USAGE IS COMP-I.
77 RECORD-AREA-lF.NGTH PIC 9 (5) USAGE IS COMP-1.
77 BYTES-RECEIVEn
PIC ':t( 5) USAGE IS COl"1P-l.
77 OFILRCRD
PIC X (80).
77 ALL DONE
PIC 9(5) VALUE IS ZERO
USAGE IS COMP-1.
77 OP N·-FLAG
PIC 9(5) VALUE IS 0
USAGE IS CCMP-1.

77 REC-NUMBER
Figure 9-7.

946252·97101

PIC 99999 USAGE 13 COMPo

COBOL Routine that Executes Sort/Merge on Relative Record File Containing More Than
65,536 Records (Sheet 1 of 3)
9-21

External Interface Specifications

PIC 99999 VALUE IS 65536
USAGE IS COMPo
PIC XX.

77 MAX-REC
77 RR-STATIJS
01 RECS.
03 REC-NUMBER!
03 REC-NUMBER2
01 ERR-REC.
03 ERR-RR
03 FILLER

PIC 9(5) USAGE IS COro1P-1.
PIC 9(5) USAGE IS COMP-1.

PIC XXXXXX.
PIC X(9) VALUE IS
ERROR =
03 ERR-STATUS
PIC XX.
*SORT-CONTROL-BLOCK CONTAINS THE SORT/MERGE
*CONTROL SPECIFICATIONS.
01 SORT-CONTROL-BLOCK.
03 HEADER PIC X(44) VALUE IS
OOOOOHSOR TA
SA
0
30000" .
03 OUTFILE-SPEC PIC X(44) VALUE IS
"00010DOS@PROC@u.
03 OUTFILE-SPEC 2 PIC X(44) VALUE IS
u00020DA
03 WDRKFILE-SPEC PIC X(44} VALUE IS
"00030DWEDSO 1 n .
03 INPUT-SPEC-1 PIC X(44) VALUE IS
IJ00040DIR. RELBOII.
03 INPUT-SPEC-2 PIC X(44} VALUE IS
It

11

It

It

"OOOSODA" .
03 REFORMAT-1
It OOOaOFNC
1

03 ENDKRD

PIC X(44) VALUE IS
5n

.

VALUE IS 11/*11.
PROCEDURE DIVISION.
*-------------------------------------------COBOL EXAMPLE
MA IN-PROGRAM.
OPEN OUTPUT OUTFLN~M.
*INITIALIZE SORT/MERGE.
CALL "SRTINTu USING SORT-CONTROL-BLOC~\,
MAX-NO-RECS, STATrS.
IF STATIS NOT EGUAL ZERO GO TO ERRSTRT.
*-------------------------------------------COBOL EXAMPLE
CHKSORT.
* RECEIVE RECORDS.
CALL "RCVREC" IJSING RECS, RECORD-LEr·H~TH,
BYTES-RECEIVED, STATIS.
IF BYTES-RECEIVED EGUAL ZERO GO TO END-IT.
* OPEN INPUT FILE, IF NOT ALREADY OPENED.
IF OPN-FLAG ~GUAL ZERO
OPEN INPUT INFILNAM.
MOVE 1 TO OPN-FLAG.
Figure 9-7.

9-22

PIC X(44)

COBOL Routine that Executes Sort/Merge on Relative Record File Containing More Than
65,536 Records (Sheet 2 of 3)
946252·9701

External Interface Specifications

*

COMPUTE ABSOLUTE RELATIVE RECORD NUMBER.
MULTIPLY REC-NUMBER! BY MAX-REC GIVING
REC-NUMBER.
ADD REC-NUMBER2 TO REC-NUMBER.
MAKE RECORD NUMBER RELATIVE TO ONE.
ADD 1 TO REC-NUMBER.
READ ONLY THOSE ABOVE 65536.
IF REC-NUMBER LESS THAN MAX-REC GO TO CHKSORT.

*
*

READ INFILNAM WITH NO LOCK INVALID KEY GO TO
KEYERR.
SET UP TO OUTPUT RECORD.
MOVE INREC TO ONEREC.
MAKE RECORD NUMBER RELATIVE TO ZERO.
SUBTRACT 1 FROM REC-NUMBER.
MOVE REC-NUMBER TO RRNUM.
WRITE OUTREC.

*
*
*

GO

TO CHKSORT.

*---------------·-----------------------COBOL
ERRSTRT.
DISPLAY
ERROR IN STR INT CALL.
GO TO END-Il.
U

EXAMPLE

II.

~EYERR.

SUBTRACT 1 FROM REC-NUMBER.
MOVE REC-NUMBER TO ERR-RR.
MOVE RR-STATUS TO ERR-STATUS.
WRITE OUTREC FROM ERR-REC.
GO TO CHKSORT.
ERRWRT.
DISPLAY n ERROR IN RCVREC CALL.
*----------------------------------------COBOL EXAMPLE
Ii.

END-IT.

CLOSE OUTFLN~:M.
STOP RUN.
END PROGRAM.
Figure 9-7.

COBOL Routine that Executes Sort/Merge on Relative Record File Containing More Than
65,536 Records (Sheet 3 of 3)

946252-9701

9-23

External Interface Specifications

ANSI COBOL

TI 990 COBOL

FILE SECTION.

WORKING-STORAGE SECTION.
SMIB.

.J 1

SD

SORTF
DATA RECORD IS SRN.

03

INPUT ...

CALL "SRTINT" USING SMIBl

01

NO-CTRL-REC,

SRI'J.

SORT SORTF ON ASCEND-

STATIS.

IN(~

KEY X

INPUT PROCEDURE IS ASR

OUTPUT PROCEDURE IS
GO TO DONE.
ASR

ASR.

READ FN INTO RN AT END GO TO SOR.

AR.

BSR

SECT ION.

TO READ FN INTO RN AT
END GO TO A-EX.

CALL JlSENREC" USING RECORD-AREAl
ReRD-LENGTH, STAT IS.

RELEASE SRN FRON RN.

GO TO ASR.

GO TO AR.

CALL "SENREC" USING RECORD-AREAlO,STATIS.
A-EX.
SOR.
BSR.

CALL "RCVRECII USING RECORD-AREA
RCRD-LENGTH,RETURN-SIZE,STATIS.

EXIT.

ESR SECTIOr/.
BR.
RETURN SORTF INTO RN2
AT END GO TO B-EX.

IF STATIS = 2 GO TO DONE.
WRITE RN2.
GO TO BSR.

WRITE RN2.
GO TO BR.
B-EX.

DONE SECTION.

DONE.

Figure 9-8.

9-24

EXIT.

Comparison of 990 COBOL Calling Sort/Merge and ANSI COBOL SORT Verb

946252-9701

External Interface Specifications

I~~~1:Wo¥h~G I
it ASCENDING I

SORT file-name-l ON
[ ON

DESCENDING

KEY

KEY

"den t"f"
2
1 ler-

1

identifier-l

000

J

00.

INPUT PROCEDURE IS section-name-l [THRU section-name-2]
OUTPUT PROCEDURE IS section-name-3 [THRU section-name-4]
990 COBOL
CALL

Input
Output :

SORT file,"name 1 ON
[ ON

1~~~1:Wtfr~~G

I

@PROC@ SENREC
@PROC@ RCVREC

!~~tCE~~~~~G I
KEY

KEY

identifier-2

00

identifier-l

oJ

0

0

0

000

USING file-name-2
OUTPUT PROCEDURE IS section-name-3 [THRU section-name-4]
990 COBOL
CALL

Input:
Output:

SORT file-name-l ON
[ ON

!ASCENDING I
DESCENDING

File
@PROC@ RCVREC

!~~~1:Wtfr~~G I
KEY

KEY

"den t"f"
2
1 ler-

1

0

•

0

identifier-l

J

00'

INPUT PROCEDURE IS section-name-l [THRU section-name-2]
GIVING file-name-3
990 COBOL
CALL

Input
Output

SORT file-name-l ON
[ ON

I

DESCENDING
ASCENDING

I

@PROC@ SENREC
FILE
(SMSTAT)

I~~~1:tNJ:~~G I
KEY

KEY

identifier-2

0

0

oJ

identifier-2
0

0

•

USING file-name-2
GIVING file-name-3
990 COBOL
CALL

Input
Output
Figure 9-9.

946252"9701

FILE
FILE

(SMSTAT)

CALL Verb Combinations
9-25

External Interface Specifications

9.3.3

Pascal Examples

Figure 9-10 is an example of a Pascal routine that calls Sort/Merge to input records from a disk file
and output the sorted records to a second disk file. Note the use of SETDLY to modify the time
delay count.
Figure 9-11 shows a Pascal routine that calls Sort/Merge and passes records read by the Pascal
routine to Sort/Merge. The sorted records are returned to the Pascal routine, which outputs them
to a disk file.
You must declare external procedures by using the FORTRAN linkage convention.
PROGF~AM

PCNPNP;

PROGRAM TITLE:

PCNPNP

ABSTRACT:
7HIS IS A SORT/MERGE INFORMATION QUEUE TEST.
IT
TESTS THE CASE WHERE BOTH INPUT AND OUTPUT FILES
ARE ACCESSED DIRECTLY BY SORT/MERGE.

CONST

1"1AX_NO_RECS = 10;
SECNDS
26;

TYPE

CONTROL_RECORD = PACKED ARRAY [1 .. 44] OF CHARi

=

;"lAR
(*

THE FOLLOWING STATEMENTS ARE THE CONTROL RECORDS FOR
SRTINT.
THEY MUST BE DECLARED AS ONE CONTIGUOUS BLOCK *>
SCB_HEADER
CONTROL_RECORD,
SCB_OUTFILE_SPEC
CONTROL_RECORD;
CONTROL_RECORD;
SCB_OUTFI LE_SPEC2
SCB_WRKFILE_SPEC
CONTROL_RECORD;
SCB_INFFILE_SPEC
CONTROL_RECORD;
SCB_INPFILE_SPEC2
CONTROL_RECORD;
SCB_REF_DESC_l
CONTROL_RECORD;
SCB_REF _DESC_2
CONTROL_F:ECORDj
SCB_REF_DESC_3
CONTROL_RECORD;
SCB_ENDKRD
CONTROL_RECORD;
<* END OF SORT CONTROL RECORDS
*)
STATIS

:

INTEGER;

PROCEDURE SRTINT eVAR SORT_CONTROL_BLOC~ : CONTROL_RECORD;
MAX_NO_RECS : INTEGER;
VAR STATIS : INTEGER}i EXTERNAL FORTRAN;
PROCEDURE SETDLY (SECNDS :
Figure 9-10.

9-26

INTEGER);

EXTERNAL FORTRAN;

Pascal Program Calls Sort/Merge to Input and Output Files from Disk (Sheet 1 of 2)
946252-9701

External Interface Specifications

PROCEDURE SMSTAT (VAR STATIS

INTEGER); EXTERNAL FORTRAN;

BEGIN

<* INITIALIZE SORT CONTROL BLOCK
seB_HEADER :=
; »OOOOHSOR TR
6D
SCB_OUTFILE_SPEC
'OOOOlDOS. OUTX
SCB_OUTF!LE_SPEC2 :=

*>
4

80

12';:;00

0

)

I .
I

I

J

,
.

0

I

400

J

0

1

,

J •

, /*
(*

0

}

or

"00002DA00800864

SCB_WRKFILE_5PEC
J00003DWEDSOl
5CB_INPFILE_SPEC
'00004015. SRTDAT
SCB_INPFILE_SPEC2
J00008DA0080
SCB_REF_DESC_l :=
'00010FNC 3~ 37
SCB_REF_DESC_2 :=
'00014FDC
1
31
SCB_REF_DESC_3 :=
'OOOi6FDC 38 80
SCB_ENDKRD

J

SET UP TIME DELAY COUNT FOR SMSTAT

I

,

J

,

l

;

.

•

*)

SETDL Y( SECNDS) i
(*

INITIALIZE SORT/MERGE

*)

.

SRTINT(SCB_HEADER,MAX_NO_RECS,STATIS);
IF STATIS (:;. 0 THEN .
MESSAGE ( 'ERROR IN SRTINT CALL. ')

<*

ELSE
BEGIN
WAIT FOR SORT/MERGE TO COMPLETE
*)
Sr-1ST A T ( ST A TIS) i
IF STATIS <> 0 THEN
MESSAGE ( 'ERROR IN SMSTAT CALL.

')

END;
END.
Figure 9-10.

946252·9701

Pascal Program Calls Sort/Merge to Input and Output Flies from Disk (Sheet 2 of 2)

9-27

External Interface Specifications

PROGRAr1 PCpp;

<*

PROGRAM TITLE:

PCPP

ABSTRACT:
THIS IS A SORT IMERGE INFORl"1ATION QUEUE TEST.
IT
TESTS THE CASE WHERE BOTH INPUT AND OUTPUT ARE
DIRECTED BY THE PASCAL PROGRAM (@PROC@).

CONST

l'1AX_NO_RECS::. 10;
RECORD_LENGTH : 80;
ALLDONE = 0;

TYPE

CONTROL_RECORD = PACKED ARRAY [1 .. 44] OF CHAR;
DATA~REC = PACKED ARRAY [1 .. 80] OF CHAR;

<* THE FOLLOWING STATEMENTS ARE THE CONTROL RECORDS FOR
SRTINT.
THEY MUST BE DECLARED AS ONE CONTIGUOU3
SCB_HEADER
CONTROL_RECORD.;
SCB_OUTFILE_SPEC
CONTROL_RECORD;
SCB_OUTFILE_SPEC2
CONTROL_RECORD;
SCB_WRKFILE_SPEC
CONTROL_RECORD;
SCB_INPFILE_SFEC
CONTROL_RECORD;
SCB_INPFILE_SPEC2
CONTROL_RECORD.:
SCD_REF _DESC_l
CONTROL_RECORD;
SCB_REF_DESC_2
CONTROL_RECORD.;
SCB_REF_DESC 3
CONTROL_RECORD;
SCB_ENDKRD
CONTROL_RECORD:.
END OF SORT CONTROL RECORDS
INFILREC
OUTFILREC
STATIS
BYTES_RECEIVED
ESC_FLAG
INFILE
OUTFL

BLOC~

DATA_REG;
DATA_REC;
INTEGER.
INTEGER;
BOOLEAN;
FILE OF DATA_REC;
FILE OF DATA_RECi

PROCEDURE SRTINT (VAR SORT _CONTROL_BLoep:, : CONTROL_RECORD;
MAX_NO_RECS : INTEGER;
VAR STATIS : INTEGER). EXTERNAL FORTRAN;
PROCEDURE SENREC (VAR INFILREC : DATA-REe;
RECORD_LENGTH : INTEGER;
VAR STATIS : INTEGER)i EXTERNAL FORTRAN;
PROCEDURE RCVREC eVAR OUTFILREC : DATA_REC;
RECORD_LENGTH : INTEGER;
V;.R B"tTES_RE:':EIVED : Ir··~TE;~EFL
VAR STATIS : !NTEGER ); EXTERN~L FORTRAN;
Figure 9-11.

9-28

Pascal Program Calls Sort/Merge to Input and Output Flies from Calling Task
(Sheet 1 of 3)
946252·9701

External Interface Specifications

BEGIN

<* INITIALIZE SORT CONTROL

B~OCK

SCB - HEADER 'OOOOOHSORTR
6A
SCB_OUTFILE_SPEC 'OOOOlDOS@PROC@
SCB - OIJTFILE- SPEC2 'OOOO2DAOO800864
seB - WRKFILE - SPEC 'OOOO3DWEDSOl
seB - INPFILE - SPEC -

*)

4

80

12000

, ,-.
I

l

,
•

.
}

...

'OOOO4DIS@PROC;~

SCB - INPFILE _SPEC2 , 00008D;'\OO80
SCB _REF_DESC -. 1 'OOO10FNC 32 37
SCB _REF - DEse - 2 'OOO14FDC
1
31
SCB _REF_DESC 3
'OOO16FDC 38 80
5CB _ENDKRD -

' ,.

}

' ..-

400

.'.
~

, 1*

.'

;

l

,
.

I .
}

RESET ( INFILE);
(*

INITIALIZE SORT 11"1ERGE

*)

SRTINT(SCB_HEADER,MAX NO_RECS,STATIS)j
IF STATIS <> 0 THEN
MESSAGE ( "ERROR IN SRTINT CALL.
ELSE
BEGIN
VAR STATIS : INTEGER); EXTERNAL FORTRAN;
READ RECORDS FROM INPUT FILE AND SEND TO SORT/MERGE
REPEAT
READ(INFILE, INFILREC)j
SENREC ( I NF I LREC , RECORD_LENGTH, ST AT IS);
UNTIL EOFCINFILE) OR (STATIS <> 0);
I

<*

)

*)

IF STATIS <> 0 THEN
MESSAGE ( JERROR IN SENREC CALL. ' )
ELSE
BEGIN
<* SEND RECORD LENGTH OF ZERO *i
5ENREC(INFILREC,ALLDONE,STATIS);
IF STATIS <> 0 THEN
MESSAGE ( 'ERROR IN SENREC C.t;LL.
Figure 9-11.

946252·9701

J)

Pascal Program Calls Sort/Merge to Input and Output Flies from Calling Task
(Sheet 2 of 3)
9-29

External Interface Specifications

(*

ELSE
BEGIN
<* OPEN OUTPUT FILE *)
REWR I TE (OUTFL);
ESC_FLAg := FALSE;
WHILE ESC_FLAG = FALSE DO
BEGIN
WRITE SORTED RECORDS TO OUTPUT FILE Y)
RCVREC(OUTFILREC, RECORD LENGTH,
BYTES_RECEIVED,STATIS);
IF (STATIS = 0) AND CBYTES RECEIVED
THEN WRITE (OUTFLIOUTFILREC)
ELSE ESC_FLAG
TRUE

<> 0

END;

IF STATIS = 1 THEN
MESSAGE ( 'ERROR IN RCVREC CALL.
END

J)

END
END;

END.

Figure 9-11.

Pascal Program Calls Sort/Merge to Input and Output Flies from Calling Task
(Sheet 3 of 3)

9.3.4 TI 990 BASIC Examples
Figure 9·12 is an example of a TI990 BASIC program that calls Sort/Merge and passes records read
by the BASIC program to Sort/Merge.
Figure 9·13 shows a TI 990 BASIC program that calls Sort/Merge to input records from a disk file
and output the sorted records to a second disk file.
9.4

DEBUG AID

The intertask communication subroutines suppress the values for the normal print option (0, 1, 2,
or 3 in column 27 of the Header Specification). This suppression occurs because you cannot
specify a listing device or file. Problems can occur in debugging these programs since the
STATUS parameters that are returned in many cases do not diagnose the problem.
To aid in the debugging process, you can place a 4 in column 27 of the Header Specification; as a
result, Sort/Merge returns to the device named ME a listing of the information, error, and warning
messages. This allows easy diagnosis of problems during debugging, although you must ensure
that there is no contention for the device ME.

9-30

946252·9701

External Interface Specifications

100

300
310
320

PROGRAM NAME = BPP
THIS PROGRAM TESTS THE INTERFACE BETWEEN BASIC
REM AND SORT/MERGE WHERE BOTH INPUT AND OUTPUT ARE
REM DIRECTED BY THE BASIC PROGRAM (@PROC@)
REM
LIBRARY u*. 5MLIB. BASCSM"
INTEGER ALL
DIM A$(10)
REM
INITIALIZE CALLS TO SORT/MERGE ROUTINES
SRTINT = 1
SENREC = 3
RCVREC = 4
REM INITIALIZE SORT CONTROL BLOCK
A$(1) = "OOOOOHSORTR 00006A
4 0080 16000
"
A$(2) = "00002DOS@PROC@
A$(3) = "00004DA00800800
A$(4) = "00006DWEDSOl
,.
A$(S) = "00008DIS@PROC@
A$(6) = "00010DA0080
A$(7) = "00012FNC00320037
"
A$(S) = "00014FDCOOOI0031
U
A$(9) = n00016FDC00380080
A$(lO) = n/*

330

N

340

S = -1

350

CALL
SMLIB. BASCSM u (SRTINT A$ ( 1 ), N .• S)
IF S = -1 THEN 650
IF S > 0 THEN 710

il0

120
130

140
150

160
170
180

190
200
210
220
230
240
250
260
270
280
290

360
370
380

390
400

REM
REM

II

..
\I

II

/I

It

=

OPEN #20: IIINFILE"
IF EOF (20) THEN 470
INPUT #20:5$
= LEN(S$)

L

420
430
440

CALL

460

470
480
490
500
510

520
530
540
550

I

tI,

410

450

10

S

= -1

II.

SMLIB.BASCSMU(SENREC,S$,L . S)

IF S = -1 THEN 670
IF S > 0 THEN 730
GOTD 390
L = 0
S

=

-1

CALL ".SMLIB. BASCSM"(SENREC,S$,L .. S)
IF S = -1 THEN 670
IF S > 0 THEN 730
CLOSE #20
REM OPEN FILE FOR OUTPUT
OPEN #22: ", SMTST. SJlrl0UT. BPP n UPDATE, SEQUENT I AL
I

L = SD

560

S = -1

570

REM

INITIALIZE STRING LENGTH TO 80

~80

S$ =

RPT$(~

590
600

CALL ". SMLIB. BASCSMII(RCVREC,S$,L,B,S)
IF S = -1 THEN 690

Figure 9-12.

946252-9701

n,L)
'

BASIC Program Calls Sort/Merge to Input and Output Flies from Calling Task
(Sheet 1 of 2)
9-31

External Interface Specifications

610

620

630
640
650
660

670
680
690
700
710
720
730

740
750
760
770

780
790
800

IF B = 0 THEN 770
., 0 THEN 750
IF S -,.
PRINT #22:S$
GOTO 550

PRINT "INVALID PARAMETER LIST IN SRTINT C..:;LL
GO TO 790
PRINT "INVALID PARAMETER LIST IN SENREC CALL"
GO TO 790
PRINT uINVALID PARAMETER LIST IN RCVREC C;;LL"
GOTO 790
PRINT l>ERROR IN SRTINT ) .::J
GO TO 790
PRINT "ERROR IN SENREC , .::J
GO TO 790
PRINT uERROR IN RCVREC ,S
GOTO 780
PRINT nSORT/MERGE TERMINATED NORMALLyn
CLOSE #22
STOP
END

11

)J

l"'

11

.-.

II

Figure 9-12.

BASIC Program Calls Sort/Merge to Input and Output Flies from Calling Task
,
(Sheet 2 of 2)

NOTE

The designation of 4 as the Print Option value is not available in
utility specifications and will result in an error if used.

When using this debugging aid from a COBOL program, be sure that the MESSAGE ACCESS
NAME prompt field does not contain ME.

9.5

SYSTEM GENERATION

You must specify an intertask communication area during system generation (sysgen) to use
Sort/Merge with COBOL, FORTRAN, Pascal, BASIC, or assembly language. In response to the
INTERTASK parameter requested at sysgen, specify the number of words of system table area
that may be used for intertask communication.

9-32

946252·9701

External Interface Specifications

100

REM

110

REM

120

REM
REM
REt1

i30
140
150
160
170

PROGRAM NAME = BNPNP
THIS PROGRAM TESTS THE INTERFACE BETWEEN BASIC AND
SORT /MERGE W: JERE BOTH INPUT AND OUTPUT IS DIRECTLY
TO A FILE

LIBRAR'( u*. SMLIB.

BI-~SCSM"

INTEGER SRTINT~SMSTAT,SETDLY
INTEGER L,N,S

180

DIM A$(10)

190
200

300
310
320
330
340

REM INITIALIZE CALLS TO SORT/MERGE ROUTINES
SRTINT = 1
SETDL\' = 2
SI"1STAT = 3
REM INITIALIZE SORT CONTROL BLOCK
A$ ( 1) .- OOOOOHSORTR 00006ti
4 0080
16000
A$(2) := "00002DOS. SMTST. SMOUT. BNPNP
A$(3) .- "00004DA00800800
A$(4) .- "00006DWEDSOl
A$(S) .- "00008DIS.SMTST.FILE.'SRTDAT
A$(6) .- "00010DA0080
A'$ (7) '- "00012FNS00320037
A$(8) .- "00014FDC00010031
A$(9) ,- "00016FDC003800aO
A$(10) = "/*
REM INITIALIZE SORT/MERGE

210

220
230
240
250

260
270

280
290

IJ

350

N = 10

360

S

370

CALL ". SMLIB. BASCSM (SRTINT,A$(l),N,S)
IF S = -1 THEN 530
IF S > 0 THEN 490
REM UPDATE TIME DELAY COUNT FOR SMSTAT
N = 26
CALL II. SMLIB. BASCSI"1 11 (SETDLY, N)
REM WAIT FOR SORT/MERGE TO COMPLETE

380
390

400
410
420

430
440

=

PRINT" INVALID PARAMETER LIST IN SRTINT CALL"

540

GOTO 580
PRINT "INVALID PARAMETER LIST IN St-1STAT CALLI!
GOTO 580
PRINT ltSORT /MERGE TERMINATED NORMALLY
STOP

480
490
500
510

550
~60

570
580
590

II

"
11

iJ

END

Figure 9-13.

946252·9701

"

S = -1

530

470

II

U

520

460

II

-1

CALL ". SMLIB. BASCSMII(SMSTAT,S)
IF S = -1 THEN 550
IF S > 0 THEN 510
GOTO 570
PRINT nERROR IN SRTINT ",S
GOTO 580
PRINT !tERROR IN SNSTAT H,S
GOTD 580

450

IJ
II

BASIC Program Calls Sort/Merge to Input and Output Flies from Disk

9-33

External Interface Specifications

Sort/Merge uses a minimum of two 44-word buffers. Use the following formula to compute the
value to specify in the INTERTASK response field.
I (words) = (M RL(by,.s) + 96)
2

x

NS

where:
MRL is the maximum record length to be passed, in bytes. You must specify a minimum
value of 80 to give Sort/Merge enough space for its control communication; and also, the
specified value must be an even number.
NS is the maximum number of programs that may interface with Sort/Merge, using intertask
communication, at one time.
For example, if you use 80-character records and only one program using Sort/Merge via intertask
communication is to be active at one time, the following formula applies:
(80 + 96) x 1
2

= 88 words

If you use 120-character records and two programs will be active using Sort/Merge via intertask
communication, the following applies:
(120 + 96) x 2
2

= 216 words

If sufficient memory is available, you can increase the size of the intertask communication area so
that more records can be put in the intertask area at one time. This decreases the amount of time
required to send and/or receive records through the intertask communication area.

9-34

946252-9701

10
Examples
10.1

GENERAL

This section contains examples of sort and merge processes. The examples include completed
specification sheets, examples of both the interactive and batch methods of entering these control specifiications, and examples of file and listing formats. This section does not show the complete design or use of Sort/Merge within an application system; instead, it shows a variety of ways
to use this processor.
In the examples presented in this section, a simplified inventory system is used in a variety of sort
and merge operations. For the examples, assume that a distributing company tracks its parts inventory daiily. It uses a 46-byte inventory transaction file that contains information on parts that are
sold, received from Cl vendor, or returned by a customer. The following column format is used in
this data file to categorize information:

CODE CUST/
VEND
NO.
~
CV
1

2

5

6

11

12

VENDOR
INVOICE
NO.

PART
QTY

PART
NO.

DATE

21

22

29

30

AMOUNT

35

36

$

46

(A) 1 359B 1

This one file contains both customer transactions and vendor transactions. The CODE in column 1
is a C for customer transactions or a V for vendor transactions. The parts maintained in inventory
are assigned a positive value; the parts disbursed from inventory are assigned a negative value.
The values for PART (columns 22 through 29) and AMOUNT (columns 36 through 46) are signed
ASCII. In anyone record, the sign value (+ or -) for the entry under PART matches the sign value
for the entry under AMOUNT.
Thus, in the customer record, positive quantities indicate the return of the items to inventory, and
negative quantities indicate the sale of parts from the inventory. In the vendor record, positive
quantities indicate receipt of a shipment of parts, which are added into the inventory; negative
quantities ,indicate the return of parts from the inventory to the vendor (Table 10-1).

946252-9701

10-1

Examples

Table 10-1.

Sign Relationship

TRANSACTION TYPE
SIGN of QTY and AMT

CUSTOMER (C)

POSITIVE
NEGATIVE

RETURN
SALE

VENDOR (V)
RECEIPT
RETURN

At any time, a summation by part number produces the number of parts in inventory as well as the
total dollar value of those parts. Also, you can obtain a listing that summarizes the transactions for
each day, or you can list only information pertaining to parts that were returned.
The daily transactions are entered from a terminal into a file called INV.lNPUT. This file is sorted
by CODE, CUST/VEND NO., and PART NO. to produce a daily transaction file, INV.DAILY. From
this file, you can select and list returns. You can also use this file to update the master file
INV.CUMB to produce INV.CUMN. Then you can perform a summary sort to provide an inventory
status report.
Although the purpose of this section is not to provide details about an inventory system, many of
the functions described in the following paragraphs can be used in such a system. Figure 10-1
shows the basic flow of files and processes described' in this section.

10.2

EXAMPLE 1: SORT DAILY TRANSACTION FILE

This example shows the preparation of the daily transaction file for updating the master file. A
simple Sort is performed by CODE (column 1), CUST/VEND NO. (columns 2 through 5), and PART
NO. (columns 12 through 21).
You can use the Sort/Merge Specifications form to plan the sort or merge operation and organize
the information into the required order. When planning a sort or merge, you might fill in the the
Reformatting Specification first to obtain the information necessary for the Header Specification.
However, the explanations in this section are presented from the beginning to the end of the form.
When the form is completed, the information is then entered in batch form or in response to the
prompting messages presented by the Sort/Merge utility.
The following paragraphs describe each entry required on Sort/Merge Specifications Sheets A and
B to specify the sorting of the daily transaction file. Remember that all integers are entered, rightjustified, In the appropriate columns. Figure 10-2 shows the completed specifications sheets;
refer to them as you read through this example.

10-2

946252-9701

Examples

INV. INPUT

BY CODE
(COLUMN 1)
CUST /VEND NO.
(COLUMNS 2-5)
PART NO.
(COLUMNS 12-21 '\

INV. CUMS
(CUMULATIVE)

BY CODE
(COLUMN
1) CUST /
VEND NO 0
(COLUMN
2-5)
PART NO.
(COLUMNS

INVo DAILY

12- 21 )

INV. CUMN
(CUMULATIVE)

INV. RET

LIST
:RETURNS

BY PART
NO.
(COLUMNS
12- 21)

SUMMARIZING
QUANTITY
AND
AMOUNT
RETURN
REPORT
INV. PNS

LIST
INVENTORY
STATUS

INVENTORY
REPORT

(A) 135986

Figure 10-1.
946252·9701

Inventory Example
10-3

Examples

1

SORT/MERGE SPECIFICATIONS, SHEET A

2

Page~

Header Specification

Merge
MERGE
MERGES
Sort
SORTA
SORTR
SORTRS

line

Largest Total
Conlrol

of

Memory
Work-Space

Record
(Bytes)

Commellts

(Columns

40

to

72)

File Description Specifications

OUTPUT FILE

WORK fiLE

Comments

(Columns

17

10

80)

INPUT FILE

Comments

(Columns 4b

Figure 10-2.
10-4

10

721

Example 1, Specifications Sheets and Listing Output (Sheet 1 of 3)
946252·9701

Examples

SORT/MERGE SPECIFICATION, SHEET B
Record Selection Specification
O~lPrand

Oplnand 2 (F letd or ConstantJ

n"l

1

--------

---r-----------~--------------~------------~

r{\

I
I

~J[

u
Gf

hom

4

1

5

1

6

1

7

1

8

1

9

2

0

2

1

2

2

2

3

7

4

2

5

G~

....---- - - - - - - I Constant
l.Olc~tl()n
I

To

Fror'll

10 11 12 13 14 I'> 16 17 1"

345G7Hl
1

~

a

Location

I

To

24 25 26 27128 29 30 :!1 32 33 34 35 36 37 3B 39

1\1 20 ?1 2223

(C"ltlm1\',

40

to)

72 I

:

-- -'-- ---.-!--

lI
I

I
I

I
I

I
I

I
I

:

2 6

Reformatting Specification
Forced

Llfw

1-,..--..-ii) ::;

~j

~o i~
IL

Number

Cl

;

f·

~~

w

i3

>-

t'>l

Q..

"0

Location

.~

~ ~~

3 4

5

ti

7

10 11

8 9

1~,

12

90 F~t

\2

7

3

0'0 F10le

~

1

,

F

,--- --.
J

2

f'

:J

J

F

.l

1

F

.;

5

F

G

,

3

:l ;

If

8

f

j

4

a

c
0
:l

Comments

Resprved

Ovp,f!ow

c
0

U

.0
:l

til

17

14 1S i6

.--

'5
II
14

23 24

18 19 20 21 22

--- - - " - --

"

-- II
J

25 26 27 28

29 30 :11

32 33 34 35 36 37 38

39

IColumns 40

to 72 I

CoOe:

CbJ ~, ~I )L

D A·

r~: :EL [)

I~

t ~y rf5

CUST/V~ND NO.

PA~'
'r~

F I'

"t.n

41'"

NO·

t~~ T S~~

!

j

I

i

t

I

-3 ?

u

I

o~

2

2

13

"

0

--~---,-,

LO

NF-

:~
:f
;.

I1 4

OP'~I ilnd 2 (F leld

R'I

~,----

I

i

-

I

'2

3

l

4

2

5

I
I

'}

6

I
L

t

I

.

I

Reformatting Specification
Fl)ft.:ed
~r--r--

LIne

c
J::
J::

1'\11j.nhpf

u

§

Location

6

7

8 9

7

7

10 " NC

2

8

10 FNC

2

9

OF~ C

0

10 F~ V

t-:;

1

I--~

Z

t OF[) K:
J

6

Of-

pv

'"'

I

Ojl

,DC

:.; s
4

FPV

10 I'IV

~

JI~

0

U

~
0)

I,
15

2 3 24 25 26 27 28

-~

i__
i

29 30 31

C~~ ~7 R.~ )1,.

5 1~~ ~ ~c)

32 33 34 35 36 37 38 39

r::: ~1. LO

1--

~2

30'

3!~

i

316

f

p Air tl

+_i
i

~

1$

o~ c~~

rl

II 1ft,

(A)135991A

Figure 1G-4.

ii+!
i

:

-

72'

BY CODE.

aa-,.NK

I i

!z,

'0

BY veNO NO.

---r-

1-- f-'-'~ ..-

(Column,; 40

CODE.
SLII AJ/<...
VEND tJo.

!

1
29

F

946252·9101

Comments

I
--L; -ff>'- -ft-

OiP V

~114 ec~ ~

Reserved

O\,'!~rfl~IV.1

16
2

--~

;r, Orp

--

I

---o c!D C

, 80

c

:J

10 11 12 13 14 15 16 17 18 19 20 21 22

f-r- fJ

:>

.:>

a:

To

Frolll

l 4 5

c'"

C.
'0,

0

G

_Ii

r~~L C

4 ~ Is

'"

T EIS

--

PA1tt NO.
gLAN~

PART QTV.
BLANk'
I.NvoxcE NO.
!>L.AN~

$
IAI1IOUNT

Example 2, Specification Sheets (Sheet 2 of 3)
10-13

Examples

SORT/MEHG[ SPECIFICATION, SHEET B

Record Selectiol1 SpecificatIOn
0111'1,111<12 (f''''I,; or

Op",,,,,d I
---------

t_U

~;:

(',_illS 1,", I)

--. ,--. -- .---.- --- ._-----------------1
I

Nt
l1

~

I

14---- ------------------ I C:omtdnt
I

I.ncdtlOIl

Gf

ro

Illllll

LOJllinf~11IS

---------------------+

I
':Column<; 40

c

~ IO~

I E~ c C :
~'+_~,-_I_0+_ll+~-+S+_+-___+=t..:::j..:.:::Z~+_+_FZ-+=_9+=G=+T=_+-~:~ Ql~ ~O 0 0
,

6

~1-+-iR_+_+-++-~~_+_+_+-+-+_++-t_+-+-+

+: -:.:.=:::-::f--++--f-+-_::f-++-

+
t
~-+-~-

l

-

:

.

to 72)

CUSTOM~R.

-=-=7i:U=RN:_-=--..;...!_-_~-__- ___
- --I

.:...!.R=-..=E.':::'"

-+--+--11--+-1-+-.--

.+--If-+--+-----------I

-+.+-t-+_++--t--+-+-+-.J-----------~

I

~~-~+-~4-

~1-+-9~-+-+-+.+-"~-+- +-+-+-+-+-+--+---+--+-+-+-+---+-t-+--..:I-. ~ -+--+-i~-+-+-~-+-+----.--------I
-;>

I

0

_1--_
,

-L+-+-+_+--I- -+-+-+-+---+--~.----------~
I

1

~++-H-++_+_+_t--+.-i-+-+-+-+-+-+_+-. --.-~+_-+_+---LI-- .'

2

.'

J

"

4

I
I
I

- .-t-+--t-+-t-+--t-+-f------------f

I

I
I

Reformatting SpecIfication
f-orceo
1--;--;--

L ,ne

Ovt!rlioN

Rf',\t-:l

Comments

ved

Location
r··'lill

I 4

~,

G

7

I

It

9101112131415161718 19}O 21 :'223 /425 _'627 lB

29:1

45

fo

72)

Example 3, Specifications Sheets (Sheet 1 of 2)
946252·9701

Examples

SORT/MERGE SPECIFICATION, SHEET B

rn
1 )

Paqc

Record Selection Specification
OperJnd 1

Op",,")(i 2 (Fie:d 01 COllstalltl

R"I

1------------

f--r---------.------------.-----t
I
I

EU
rIE

LT
L II)P

lOT
Lf

Numhf'r ~

>
r
t--10111

3

4

1

4

1

!)

1

G

1

7

~ ~------1.!ll'dtrDI'l

c;r

'J G 7

H 9

F fOIH

T{l

To

n n

10 11 12 13 14 1S 16 1 1 1H 19 70 ) 1

COlnIlWI11,

I Constant
I

I
3!~

;'4 ),' :lfi 27 L8 )9 30 31 32 33 34 35 36 .3 7

(CoItHlIIl"

30

40

to

72 J

!

tf-~+--

+-+--+--+-+--+--+---+-+-+--r-r I~-

1--118

I

~---

~~~:-+-~~.~-r-+'-c-c---I- _~·-+r--+-+-+-+-~-+-+-+-+~I-4-4-4~~-4~I--I--I--~~+-------------4
7

1

}

2

2

5

2

6

I

I

I
I

I
I

Reformatting Specification
forced

f--iir
"I~
81

llllP

NU!l1!H~'

1:"

li

H 9

7

10 11

In

70 'N~
2

8~ ~'NC

2

90

J

0

'J)

~- 2

I--~-

I !

'5

I

,~

G,

OF IO~

I

46

+i

-

1 1

F

~~I~t-

I

,-

.1

f

J

4

F

5

,

u

,

l

.3

)

,

f--

3 9

r--4

\)

1'1

I

--r- t-++ +-- ~tt11
~-+-t -t--~1-r--Ti-"1
i

I

t-- ~.

I'

-- ,
..

-- ---.

"

~I

I

1-:'I-"-l-~f-rI
_

i

~

..

-

I

."

-

10

721

elv CODE

BY C/v NO.
BY PART NO.

~:::l

I

!

---

f--tI
Hi
_+_ .. __
: :

f--

i_r-- _

I

m

BY

, 'E 5

'04 1':[ ~ D;~

(Columns 40

I

1

+.____1!

I

!

32 33 34 35 36 37 38 39

-

-~-l--+--

1

f-I--

29 30 31

:

1

.

-I-- r--f---

-1----

!

Comrnf~nts

sa
... ...
~ ~ ~ F U:L 0 l/~ 'c T t

I> Cp~

tt~W111

I

8

23 24 ::>5)6 27 78

I)

1

i

l

n

I

N~

F

i

14 1 ~ In 11 18 19 71) :'1

1J

~.o

C

;:

fies", vp.d

()'.l'rftO\/"

"

oo

,+-

~ ~
~ ~IU

Loedtlon
FI (1111

~

u

6 :;

u

Cfo-

3 4

~

~

L .1....,-

I

I

.- -

~

I

I

--

i

I

I

(A) 135990A

Figure 10-7.
946252·9701

Example 3, Specifications Sheets (Sheet 2 of 2)
10-21

Examples

10.4.2

File Description Specifications
Specify INV.CUMN as the output file. The file attributes on line 2 of the form remain the same.

Specify DS01 as the expandable work file.
Specify INV.CUMB and INV.DAILY as the input files for the merge operation. Since these are both
sequential files, place an S in column 8 for each of these files. Note that from two to five input files
are specified for a merge. The file specified first will have its records output first when an equal sequence condition is sensed. Both files must be in the same sequence (ascending or descending)
before the merge begins.
10.4.3 Record Selection Specification
Since all records from each input file are to be included in the merge, no record selection
specification is required. The default value includes all records.
10.4.4

Reformatting Specification
Both of the input files for this merge have the same record format. The file INV.CUMB contains the
cumulative inventory information; the file INV.DAILY was sorted in example 1 and contains new
records to be added to the cumulative inventory file.

Three control fields are used; the N in column 7 of the form designates that these fields are to be
merged in normal (ascending) order. The file records are to be merged by CODE first (column 1 of
the input files). All records having the same CODE are then merged by CUST/VEND NO. (columns
2 through 5 of the input files). All records having the same CODE and CUST/VEND NO. are then
merged by PART NO. (columns 12 through 21 of the input files).
All data fields in the input records are to be in the output records. Thus, the data field is specified
as columns 1 through 46 of the input file, and the 0 in column 7 identifies line 300 as a data field
specification.
10.4.5 Entering the Specifications Interactively and in Batch Form
After you have organized the necessary information on the worksheets for the merge operation,
prepare the control file. This can be done interactively by using the Execute Sort/Merge (XSMF)
command and entering the information in response to the field prompts. The control file could
also be prepared by batch a stream.

Figure 10-8 shows the interactive entry of the merge specifications used in this example. Since
you can repeat the input file specification prompts, you can specify several files.
Figure 10-9 shows a batch control stream for the same merge.

946252-9701

10-22

Examples

(] XSMF
EXECUTE SORT/MERGE
NEW CONTROL FILE?:
YES
CONTROL FILE NAME:
.CONTM
**SORT/MERGE HEADER SPECIFICATION**
SORT MERGE TYPE: SORTR MERGE
TOTAL CONTROL LENGTH:
15
SORT MERGE SEQUENCE: A
ALTERNATE SEQUENCE:
PRINT OPTION: 1 0
DROP CONTROL FIELDS: X
OUTPUT RECORD LENGTH:
46
VARIABLE LENGTH RECORDS:
VERIFY OPTION:
MEMORY SIZE:
16000
**SORT/MERGE OUTPUT FILE SPECIFICATION**
FILE PATHNAME:
INV. CUMN
FILE TYPE: S
LOGICAL RECORD LENGTH:
46
PHYSICAL RECORD LENGTH:
576
NUMBER OF LOGICAL RECORDS:
**SORT/MERGE INPUT FILE SPECIFICATION**
FILE PATHNAME:
INV. CUMB
FILE TYPE: S
LOGICAL RECORD LENGTH:
NUMBER OF LOGICAL RECORDS:
ENTER NEXT SPECIFICATION - INPUT, SELECTION, REFORMATTING
NEXT:
INPUT
**SORT/MERGE INPUT FILE SPECIFICATION**
FILE PATHNAME:
INV.DAILY
FILE TYPE: S
LOGICAL RECORD LENGTH:
NUMBER OF LOGICAL RECORDS:
ENTER NEXT SPECIFICATION - INPUT, SELECTION, REFORMATTING
NEXT:
Po
**SORT/MERGE REFORMATTING SPECIFICATION**
FIELD TYPE:
N
CHARACTER PORTION: C
BEGINNING LOCATION:
ENDING LOCATION:
1
ENTER NEXT SPECIFICATION - INPUT, SELECTION, REFORMATTING
NEXT:
R
**SORT/MERGE REFORMATTING SPECIFICATION**
FIELD T\"PE:
N
CHARACTER PORTION: C
BEGINNING LOCATION:
2
ENDING LOCATION:
5
ENTER NEXT SPECIFICATION - INPUT,SELECTION,REFORMATT!NG
NEXT:
R
**SORT/MERGE REFORMATTING SPECIFICATION**
FIELD TYPE:
N
Figure 10-8. Interactive Control Stream Example (Sheet 1 of 2)
946252·9701

10-23

Examples

CHARACTER PORTION: C
BEGINNING LOCATION:
12
ENDING LOCATION:
21
ENTER NEXT SPECIFICATION - INPUT)SELECTIoN,REFORMATTING
NEXT:
R
**SORT/MERGE REFORMAT1ING SPECIFICATION**
FIELD TYPE:
D
CHARACTER PORTION: C
BEGINNING LOCATION:
1
ENDING LOCATION:
46
ENTER NEXT SPECIFICATION - INPUT, SELECTION, REFORMATTING
NEXT:
RUN SORT MERGE?: YES NO
[] G
Figure 10-8.

Interactive Control Stream Example (Sheet 2 of 2)

BATCH
SM$SMC CFN = DS01.CONTM
SM$HD SMT= MERGE,TCL= 15,PO = O,ORL= 46,MS= 16000
SM$OUT FP = INV.CUMN,FT = S,LRL = 46,PRL = 576
SM$IN FP = INV.CUMB,FT = S
SM$IN FP= INV.DAILY,FT=S
SM$REF FT= N,CP= C,EL= 1
SM$REF FT = N,CP = C,BL = 2,EL = 5
SM$REF FT = N,CP = C,BL = 12,EL = 21
SM$REF FT = D,CP = C,BL = 1,EL = 46
SM$CLS
XBSM CFN = DS01.CONTM,LDN = LP01
EBATCH

Figure 10-9.

10.5

Batch Control Stream Example

EXAMPLE 4: SUMMARY BY PART NUMBER

This example shows a summary sort. The output will be one record for each part number, showing
the total quantity on hand and the dollar value of that quantity. Blanks are forced between fields to
allow the output to be printed with a simple listing program. Overflow fields are provided for each
summary field. Figure 10·10 shows the format of the input and summary output record. Each part
number will have only one record output.

10-24

946252·9701

Examples

INPUT
FILE
RECORD

CODE
~

DATE

CUST,!
VEND
NO.

PART
NO.

PART
QTY

AMOUNT

$

36

46

VENDOR
INVOICE
NO.

CV
1

5

2

B

PART
NO.

SUMMARY
FILE
RECORD

11

6

L
A
N

7
OVF

PART
QTY

10

11

B

L
A
N

K

1

22

21

12

29

30

35

/
$

OVF

AMOUNT

$

26

36

K

12

13 14

21

22

23

24

25

(A)13!;984

Figure 10-10.

Summary Record Format

10.5.1 Header Specification
Two parameters differ from previous examples on this Header Specification, as shown in Figure
10-11 and explained by the following:

•

A SORTRS is specified in columns 7 through 12 to specify summary sort.

•

Control fields are not dropped (no X in column 28). Since the control field is in the
desired position for output and is not modified, it is not dropped. As a result, the work
file contains shorter records.

10.5.2 File Description Specifications
The output file pathname is INV.PNS, the work file is assigned to OS01, and the input file
pathname is INV.CUMN. The file attributes are the same as previously used.
10.5.3 Record Selection Specification
All records are to be included; no specification is necessary.
10.5.4 Reformatting Specification
The control field is to be the PART NO. field (columns 12 through 21 of the input file, INV.CUMB).
This is specified on line 270 of the form (Figure 10-11). A forced blank space is specified on line
280. Dollar signs are specified as forced charact~rs on lines 300 and 310.

946252-9701

10-25

Examples

1

SORT/MERGE SPECIFICATIONS, SHEET A

~,

Paye~

Header Specification

Meq.Jt

M'RGE
MtRGES

LlIle

Sort
S()RTA

S(lRTR
S( )RTRS

Largest

Totdl

Memory
Work-Space

Record

Commellts

IBytesl

IColumns

40 to 72)

File Description Specifications
OUTPUT FILE

Comments

(Columns

wor~K

4S

II.)

72}

FILE

Comments

IColumns

t 7 10

801

INPUT FILE

Comments

IColumns 45

Figure 10-11.
10-26

'"

721

Example 4, Specifications Sheets (Sheet 1 of 2)
946252·9701

Examples

SORT/",1ERGE SFEClrlC.'\TION,

',' [0
i

"

Sll~[ T

q

f~,:co,d SclectiolO "j.lecificiltion

'-I;WllhF ~:~.~-=f~:l-[=~~;:"d :, Ifi::::-':':'~~':...-tl_.===_ ~. 1~llllll§
,','

I)·

, -.-

L 
?
0011 1111
@
01000000
A
01000001
8
01000010
01000011
C
0
01000100
01000101
E
F
01000110
G
01000111
H
0100 1000
I
0100 1001
J
0100 1010
K
0100 1011
L
0100 1100
M
0100 1101
N
0100 1110
0
0100 1111

!

ASCII Character Code1

Hexadecimal
Code
20
21
22
23
24
25
26
27
28
29
2A
28
2C
20
2E
2F
30
31
32
33
34
35
36
37
38
39
3A
38
3C
·30
3E
3F
40
41
42
43
44
45
46
47 .
48
49
4A
48
4C
40
4E
4F

Character
P

a
A
S

T
U
V
W
X

Y
Z

[
\
]

"
\

a
b
c
d
e

f
9
h
j
k
I
m
n
0

P
q
r
s
t
u

v
w
x
Y

z

{
I

I

}

(underline)

Binary
Code

Hexadecimal
Code

0101 0000
0101 0001
0101 0010
0101 0011
0101 0100
0101 0101
0101 0110
0101 0111
0101 1000
0101 1001
0101 1010
0101 1011
0101 1100
0101 1101
0101 1110
0101 1111
01100000
01100001
01100010
01100011
01100100
01100101
01100110
01100111
0110 1000
0110 1001
0110 1010
0110 1011
0110 1100
0110 1101
0110 1110
01101111
0111 0000
0111 0001
0111 0010
0111 0011
0111 0100
0111 0101
0111 0110
0111 0111
0111 1000
0111 1001
0111 1010
01111011
0111 1100
0111 1101
01111110

50
51
52
53
54
55
56
57
58
59
5A
58
5C
50
5E
5F
60
61
62
63
64
65
66
67
68
69
6A
68
6C
60
6E
6F
70
71
72
73
74
75
76
77
78
79
7A
78
7C
70
7E

Note:
1

American Standards Institute Publication X3.4-1968

946252-9701

C-3/C-4

Appendix D
EBCDIC Codes
The following diagram shows the zone and digit character portions of the EBCDIC codes for binary
and for hexadecimal:

CHARACTER PORTION

Letter A

.

=

ZONE PORTION

1

~

1100 0001

I I

=

2

CHARACTER
PORTION

ellS

11

DIGIT PORTION

ZONE PORTION
DIGIT PORTION

(A)135751

Binary
Code

Hexadecimal
Code·

PF
HT
LC
DEL

coop 0000
0000 0001
0000 0010
0000 0011
0000 0100
0000 0101
0000 0110
0000 0111

00
01
02
03
04
05

RLF
SMM
VT
FF
CR
SO
SI
OLE
DC1
DC2
DC3
RES
NL
BS
IL
CAN
EM
CC

0000 1001
0000 1010
0000 1011
0000 1100
0000 1101
00001110
0000 1111
0001 0000
0001 0001
0001 0010
0001 0011
0001 0100
0001 0101
0001 0110
0001 0111
00011000
0001 1001
0001 1010

Meaning
NUL
SOH
STX

ETX

948252·9701

06
07

09
OA
OB
OC
00
OE
OF
10
11
12
13
14
15
16
17
18
19
1A

Binary

Hexadecimal

Code

Code

CU1
IFS
IGS
IRS
IUS
OS
SOS
FS

0001 1011
00011100
00011101
0001 1110
0001 1111
00100000
00100001
00100010

1B
1C
10
1E
1F

BYP
LF
EOBor ETB
PRE or ESC

00100100
00100101
00100110
00100111

24
25
26
27

SM
CU2

00101010
00101011

2A
2B

ENQ
ACK
BEL

0010 1101
0010 1110
00101111

20
2E
2F

SYN

0011 0010

32

PN
RS
UC
EOT

0011
0011
0011
0011

34

Meaning

0100
0101
0110
0111

20
21

22

35
36
37

1).1

EBCDIC Code

Meaning

Binary
Code

j
k
I
m
n

0011 1111

3F

0

01000000

40

0011 1011
0011 1100
0011 1101

SU8
SP

0100 1010
01001011
0100 1100
0100 1101
0100 1110
0100 1111
0101 0000

4A
48
4C
4D
4E
4F
50

-I

0101 1010
0101 1011
0101 1100
0101 1101
01011110
0101 1111

5A
58
5C
5D
5E
5F

-(minus)
I

0110 1111
01100001

60
61

,(comma)

01101011
01101100
01101101
01101110
0110 1111

68
6C
60
6E
6F

.(period)

<
+
I
&

$
*(asterisk)
)

%
_(underline)

>
?

Meaning

38
3C
3D

CU3
DC4
NAK

~

Hexadecimal
Code

P
q

s
t
u

v
w
x

Y
z
{
A
8
C
D
E
F

G
H

I

J

#
@

'(single quote)

=
"(doublp, quote)
a
b
c
d
e

f
9
h

0111 1010
01111011
0111 1100
0111 1101
0111 1110
0111 1111

7A
78
7C
7D
7E
7F

10000001
10000010
1000 0011
10000100
10000101
10000110
1000 0111
1000 1000
1000 1001

81
82
83
84
85
86
87
88
89

J
K
L

M
N

0
P
Q

A

5
T
U

V
W

X
y

Z

0-2

Binary
Code
1001
1001
1001
1001
1001
1001
1001
1001
1001

Hexadecimal
Code

0001
0010
0011
0100
0101
0110
0111
1000
1001

91
92
93
94
95
96
97
98
99

1010 0001
1010 0010
1010 0011
10100100
10100101
10100110
10100111
1010 1000
1010 1001

A1
A2
A3
A4
A5
A6
A7
A8
A9

11000000
11000001
11000010
11000011
11000100
11000101
11000110
11000111
1100 1000
1100 1001

CO
C1
C2
C3
C4
C5
C6
C7
C8
C9

1101 0000
1101 0001
1101 0010
1101 0011
1101 0100
11010101
1101 0110
1101 0111
1101 1000
1101 1001

DO
D1
02
03
D4
05
06
07
08
D9

11100010
11100011
11100100
11100101
11100110
11100111
1110 1000
11101001

E2
E3
E4
E5
E6
E7
E8
E9

946252-9701

EBCDIC Code

Meaning
0
1
2
3
4

946252·9701

Binary
Code
1111
1111
1111
1111
1111

0000
0001
0010
0011
0100

Hexadecimal
Code
FO
F1
F2
F3
F4

Meaning
5
6
7
a
9

Binary
Code
1111
1111
1111
1111
1111

0101
0110
0111
1000
1001

Hexadecimal
Code
F5
F6
F7
Fa
F9

D-3/D-4

Appendix E
Data Types for FORTRAN,
COBOL, Pascal, BASIC, and RPG II
E.1

INTEGER

o

15
15 SIGNIFICANT BITS
NOTE:

S IS THE SIGN BIT
1 =NEGATIVE

~

O=POSITIVE~

(A)135752

This is a 16·bit two's complement value.
Nomenclature:
FORTRAN:
COBOL:

E.2

INTEGER

COMPUTATIONAL-1

Pascal:

INTEGER

BASIC:

INTEGER

RPG II:

BINARY

EXTENDED INTEGER

o
S

1

15

I

15 MOST SIGNIFICANT BITS (MSB)
16 LEAST SIGNIFICANT BITS (LSB)
NOTE:

S IS THE SIGN BIT
1 =NEGATIVE.

~

O=POSITIVE

~

(A) 135753

946252·9701

E-1

Data Types for FORTRAN, COBOL, BASIC and RPG 1/

This is a 32-bit two's complement value.
Nomenclature:
FORTRAN:
COBOL:

EXTENDED INTEGER

COMPUTATIONAL-4

Pascal:

LONGINT

BASIC:
RPG II:

E.3

FLOATING POINT

o

1

7

S1

8

15

r

EXPONENT

8 MSB

16 LEAST SIGNIFICANT BITS
NOTE:

S IS THE SIGN BIT ~ O=POSITIVE ~
1 =NEGATIVE

(A)135754

Nomenclature:
FORTRAN:

REAL

COBOL:
Pascal:

REAL (n), where n

BASIC:

REAL

~

7

RPG II:

E.4

EXTENDED FLOATING POINT

o
S

7

I

EXPONENT

8

I

15
8 MSB

16 BITS
16 BITS
16 LEAST SIGNIFICANT BITS
NOTE:

S IS THE SIGN BIT
1 ==NEGATIVE

~

O=POSITIVE

~

(A)135755

E-2

946252-9701

Data Types for FORTRAN, COBOL, BASIC and RPG /I

Nomenclature:
FORTRAN:

DOUBLE PRECISION

COBOL:
Pascal:

REAL (n), where n

~8

BASIC:
RPG II:

E.S

SIGNED ASCII

ASCII NUMBER (HEX)

ASCII NUMBER (HEX)

•
•
•
ASCII NUMBER (HEX)

ASCII SIGN (HEX)

(A)135756

The ASCII code for numbers 0 through 9 is 3011 through 3911, respectively.
fhe ASCII code for the sign of a signed ASCII field is 20 11 for minus, and 2B11 or 2011 for plus.
Nomenclature:
FORTRAN:
COBOL:

Display (9) with sign

Pascal:
BASIC:
RPG II:

946252·9701

E-3

Data Types for FORTRAN, COBOL, BASIC and RPG /I

E.6

RPG II COMPATIBLE PACKED FORMAT

I I I I I
DIGIT

o

DIGIT

DIGIT

DIGIT

•••

I I I
DIGIT

o

3470347

3

SIGN

4

7

RPG II compatible packed numeric data format contains two decimal digits per byte, except for
the rightmost byte which contains a sign in the four right bits of the byte. Sign is F when positive
and D when negative.

E.7

RPG II COMPATII;JLE UNPACKED FORMAT

I I I I I
ZONE

o

DIGIT

ZONE

DIGIT

•••

I I I
SIGN

o

3470347

DIGIT

3

4

7

RPG II compatible unpacked numeric data format contains one decimal digit per byte and a sign in
the rightmost zone field of the data.

E.8

LEADING SIGN UNPACKED FORMAT

I I I I I
SIGN

o

DIGIT

34

ZONE

70

DIGIT

34

7

•••

I I I
ZONE

o

3 4

DIGIT

7

(A)143696

Leading sign unpacked format contains one decimal digit per byte and a sign in the leftmost zone
field of the data.
Nomenclature:
FORTRAN:
COBOL:

Display sign is leading

Pascal:
BASIC:
RPG II:

E-4

946252-9701

Data Types for FORTRAN, COBOL, BASIC and RPG /I

E.9

BEGINNING SIGNED ASCII

ASCII SIGN (HEX)

ASCII NUMBER (HEX)

•
•
•
ASCII NUMBER (HEX)

ASCII NUMBER (HEX)

(A)143697

The ASCII code for numbers 0 through 9 is 30 18 through 39 18, respectively.
The ASCII code for the sign is in the leftmost byte: 20 18 for minus, and 28 18 for plus.
Nomenclature:
FORTRAN:
COBOL:

Display sign is separate leading

Pascal:
BASIC:
RPG II:

946252·9701

E-S/E-e

Appendix F
Estimating Sorting Time
You can use the following formula to obtain a rough estimate of sorting time on a dedicated
system with all files on Trident disks:
Time = NOLR x LRL x 10
MEM
where:
Time

=

sorting time in seconds

NOLR = number of logical records to be sorted
LRL

= logical record length of the work file; this is the sum of all reformatting specifications fields plus 2

MEM

= bytes of memory; this is the value given on the header line

This gives a value with ± 10 percent accuracy for most combinations of up to 40,000 records.

946252·9'701

F-1/F-2

Appendix G
Sorting with Many
Records or Limited Workspace
The DX10 disk storage allocation algorithm uses a set of predefined defaults for allocating disk
space. If large files are sorted (70,000 or more records), or you have limited disk storage, the work
file and output file might not use the disk space most efficiently. To make the most efficient use
of disk space, specify the number of logical records (NOLR) on the input created with initial and
secondary allocation sizes of NOLR/B. Also, precreate the output file, specifying an initial allocation of NOLR and a secondary allocation of NOLR/B.

946252-9701

0-1/0-2

Alphabetical Index
Introduction
HOW TO USE INDEX

The index, table of contents, list of illustrations, and list of tables are used in conjunction to obtain the location of the desired subject. Once the subject or topic has been located in the index,
use the appropriate paragraph number, figure number, or table number to obtain the corresponding page number from the table of contents, list of illustrations, or list of tables.
INDEX ENTRIES

The following index lists key words and concepts from the subject material of the manual together
with the area(s) in the manual that supply major coverage of the listed concept. The numbers along
the right side of the listing reference the following manual are~s:
•

Sections - Reference to Sections of the manual appear as "Sections x" with the symbol x representing any numeric quantity.

•

Appendixes - Reference to Appendixes of the manual appear as "Appendix y" with the
symbol y representing any capital letter.

•

Paragraphs - Reference to paragraphs of the manual appear as a series of
alphanumeric or numeric characters punctuated with decimal points. Only the first
character of the string may be a letter; all subsequent characters are numbers. The first
character refers to the section or appendix of the manual in which the paragraph may be
found.

•

Tables - References to tables in the manual are represented by the capital letter T
followed immediately by another alphanumeric character (representing the section or
appendix of the manual containing the table). The second character is followed by a
dash (-) and a number.
Tx-yy

•

Figures - References to figures in the manual are represented by the capital letter F
followed immediately by another alphanumeric character (representing the section or
appendix of the manual containing the figure). The second character is followed by a
dash (-) and a number.
Fx-yy

•

946252·9701

Other entries in the Index - References to other entries in the index preceded by the
word "See" followed by the referenced entry.

Index-1

Index

Address·Only Sort (SORTA) ... 2.3,4.2.3, T4·1
Alternate:
Collating Sequence
Specification ... 4.2.6,6.2.4, Appendix B
Pairs ............................ TB·1
Sequence:
ALTSEO ........................ B.1
Command Statement ............ 4.2.6
Header Specification ............ 4.2.6
Sequence Keyword,
AS ................. 4.2.6, T4·1, TB·1
AND Continuation Line ............... T6·1
AS - Alternate Sequence
Keyword ................. 2.6, T4·1, TB·1
Ascending Sequence ................ 4.2.5
ASCII. Character:
Codes ..................... AppendixC
Collating Sequence ............... 4.2.6
Portion, Digit and Zone ........ 6.2.4, T7·1
Signed ASCII Character .6.2.4,7.3.4.2, T7·1
Assembly Language:
CALL Statement .................... 9.2
Linking ........................... 9.2.6
Background Processing, SCI .......... B.2.3
BASIC:
CALL Statement .................... 9.2
Data Types ................. Append ix E
Example ......................... 9.3.4
I nferface ......................... 9.2.7
Batch:
Command, Execute Batch (XB) ..... . 3.5.B
Command, Execute Batch Sort/Merge
(XBSM) ....................... . 3.5.B
Command Statement:
BATCH ........................ T3·1
EBATCH ................... T3·1, TB-2
Format ........................ B.3.2
SM$ALT ....................... TB·1
SM$CLS ................... T3·1, TB·2
SM$HD ............... T3·1, TB·1, TB-2
SM$IN .................... T3·1, TB-1
SM$OUT .............. T3·1, TB·1, TB·2
SM$REF .............. T3·1, TB-1, TB-2
SM$SLC ................... T3·1, TB·2
SM$SMC .................. T3-1, TB·2
SM$WKF .............. T3·1, TB·1, TB·2
XBSM ..................... T3-1, TB·2
Control Fi Ie ........................ 3.2'
Control Stream
Examples ............ F10·9, Section 3
Keywords ......................... 3.2
Mode ............................ . B.3
Beginning:
Location, Keyword BL ......... 7.3.5, T7·1
Sign Unpacked Format .. 6.2.4,7.3.4.7, T7·1
BL - Beginning Location
Keyword .................... 7.3.5, T7·1
CALL Statements, Language ........... 9.2
CFN - Control File Name Keyword .... 3.3.7
Index-2

Character:
Keywords:
RC - Record Character ..... 7.3.6, T7·1
SC - Substitute Character ... 7.3.7, T7·1
Portion:
Digit ASCII ................ 6.2.4, T7·1
Signed ASCII ................... 6.2.4
Specification,
Keyword CP .... 7.3.4, T6·1, T7·1, TB·1
Zone ASCII ................ 6.2.4, T7·1
COBOL:
CALL Statement .................... 9.2
Data Types ................. Appendix E
Example ......................... 9.3.2
Linking .......................... 9.2.6
Codes:
ASCII Character ............. Appendix C
EBCDIC ................... Appendix 0
Collating Sequence:
Alternate ......... 4.2.6,6.2.4, Appendix B
ASCII ........................... 4.2.6
Normal and Opposite ............. 7.3.3.1
Column Summary:
Header Specification ............... T4·1
Input File Description .............. T5-3
Output File Description ............ T5·1
Record Selection Specification ...... T6·1
Reformatting Specification ......... T7·1
Work File Description .............. T5·2
Command:
XB, Execute Batch ................ 3.5.B
XBSM, Execute Batch
Sort/Merge ............ 3.5.B, T3-1, TB·2
---XSM, Execufe Background
Sort/Merge ..................... B.2.3
XSMF, Execute Sort/Merge
(Foreground) ................... B.2.3
Command Interpreter
Interface, SCI. ................ Section B
Command Statement:
ALTSEO ......................... 4.2.6
BATCH .......................... T3·1
Batch Stream ..................... B.3.1
EBATCH ..................... T3·1, TB·2
Format, Batch .................... B.3.2
SM$ALT ......................... T8·1
SM$CLS ..................... T3·1, TB-2
SM$HD ................. T3·1, TB-1, T8·2
SM$IN ...................... T3-1,TB-1
SM$OUT ................ T3·1, TB-1, T8·2
SM$REF ................ T3·1, T8-1, TB-2
SM$SLC ..................... T3-1, T8·2
SM$SMC .................... T3-1, TB·2
SM$WKF ................ T3·1, TB·1, T8·2
Comparison:
Digit and Zone .................... 6.2.4
Operand 1 and Operand 2 ........... 6.2.5
CON - Continuation
Line Keyword .. 6.2.3, 7.3.8, T6·1, T7·1, TB·1
Conditional Force ................. 7.3.3.2
Constant Keyword - FOC ... 6.2.7, T6-1, TB·1
946252-9701

Index

Continuation Line, Keyword
CON .......... 6.2.3, 7.3.B, T6-1, T7-1, TB-1
Control Field:
Definition ................... 2.2.1, 7.2.1
Drop Control Fields ...... 4.2.B, T4-1, TB-1
Floating Point ................... 7.3.4.4
Forced ......................... 7.3.3.2
Integer ......................... 7.3.4.3
Normal Sequence ............... 7.3.3.1
Opposite Sequence .............. 7.3.3.1
Packed and Unpacked
Numeric .... " .... 7.3.4.5,7.3.4.6,7.3.4.7
Signed ASCII ................... 7.3.4.2
Control Fi Ie, Batch .................... 3.2
Control File Name, Keyword CFN ...... 3.3.7
Control File Printout ................ F10-6
Control Statement Compiler
Module ......................... 11.2.1
Control Stream Example,
Batch .................. F10-9, Section 3
CP - Character Portion
Keyword ...... 6.2.4, 7.3.4, T6-1, T7 -1, TB-1
Cumulative File Example ............. 10.4
Data:
Field " ...................... 2.2.2, 7.2.1
Force .......................... 7.3.4.1
Summary Data Field ......... 2.3.2, 7.3.3.4
Types, Language ............ Appendix E
DCF - Drop Control Fields
Keyword ................ 4.2.B, T4-1, TB-1
Debug Aid ........................... 9.4
Decimal Format:
Signed Packed .............. 7.3.4.5, T7-1
Signed Unpacked ........... 7.3.4.5, T7-1
Descending Sequence ............... 4.2.5
Digit ASCII Character Portion ..... 6.2.4, T7-1
Drop Control Fields,
Keyword DCF ............ 4.2.B, T4-1, TB-1
EAP - Enter Alternate Pairs
Keyword .............. TB -1, Appendix B
EBATCH Batch Command
Statement ................... T3-1, TB-2
EBCDIC Code ................ Appendix D
EL - Ending Location Keyword ... 7.3.5, T7-1
Ending Location, Keyword EL ..... 7.3.5, T7-1
Enter Alternate Pai rs, Keyword EAP .... TB-1
EQ Relational Operator ............... T6-1
Error Messages ..................... TA-1
Execute Background Sort/Merge
Command, XSM ................... B.2.3
Execute Sort/Merge (Foreground)
Command, XSMF ................. B.2.3
External Interface Specification ... Section 9
Field:
Control ..................... 2.2.1, 7.2.1
Data ........................ 2.2.2, 7.2.1
Forced .................... 2.2.2, 7.3.3.2
Length Restriction .................. 7.2
946252·9701

Normal Sequence Control. ........ 7.3.3.1
Opposite Sequence Control ....... 7.3.3.1
or Constant, Keyword
FOC ................. 6.2.7, T6-1, TB-1
Record ............................ 2.2
Summary Data ............. 2.3.2, 7.3.3.4
Type, Keyword FT ............ 7.3.3., T7-1
File:
Control ....................... 3.2, TB-1
Description Specification ...... Section 5
I/O Error Messages ................ T A-3
Records in Input, Work, and Output
Files ......................... F10-3
Specification:
Input ........................... 5.4
Output .......................... 5.2
Work ........................... 5.3
Type, Keyword
FT ....... 5.2.1.2, 5.4.1.2, T5-1, T5-3, TB-1
Floating Point Format .. 7.3.4.4, E.3, E.4, T7-1
FOC - Field or Constant
Keyword ................ 6.2.7, T6-1, TB-1
Force:
Conditional ..................... 7.3.3.2
Data ........................... 7.3.4.1
Force-All ....................... 7.3.3.2
Unconditional ................... 7.3.3.2
Force-All Force .................... 7.3.3.2
Forced:
Control Field .................... 7.3.3.2
Data Field ...................... 7.3.3.3
Field ............................ 2.2.3
Foreground Processing, SCI .......... B.2.3
Foreground Sort/Merge
Command ................... See XSMF
Format:
Batch Command Statement ......... B.3.2
Beginning Sign Unpacked .... 7.3.4.7, T7-1
Floating Point .............. 7.3.4.4, T7-1
Leading Sign Unpacked ...... 7.3.4.6, T7-1
Negative:
Packed ....................... . 6.2.B
Unpacked ..................... . 6.2.B
Packed .......................... 6.2.4
Signed:
ASCII Character ........... 7.3.4.2, T7-1
Integer .................. 7.3.4.3, T7-1
Packed Decimal .......... 7.3.4.5, T7-1
Unpacked Decimal ........ 7.3.4.5, T7-1
Unpacked ........................ 6.2.4
FORTRAN:
CALL Statement .................... 9.2
Data Types ................. Appendix E
Examples ........................ 9.3.1
Flowchart ........................ F9-2
Linking .......................... 9.2.6
FP - Input File Pathname
Keyword .............. 5.4.1.3, T5-3, TB-1
FP - Output File Pathname
Keyword .............. 5.2.1.3, T5-1, TB-1
FT Keyword:
Index-3

Index

Field Type ................... 7.3.3, T7-1
Input FileType ......... 5.2.1.2, T5-3, T8-1
Output Fi Ie Type ........ 5.2.1.2, T5-1, T8-1
GE Relational Operator ............... T6-1
GT Relational Operator ............... T6-1
Header Specification ............ Section 4
Column Summary ................. T4-1
Include-All Line ................... 6.2.2.2
Include and Omit Sets .............. 6.2.2.4
Include Line ...................... 6.2.2.1
Include Sets .................... T6-2, T6-4
Indicator:
Character Portion ................ 6.2.4.1
Overflow Field ................... 7.3.10
Signed ASCII ................... 6.2.4.2
Information Messages ............... TA-2
Initialization Subroutine,
SRTINT ..................... 9.1.1,9.2.1
Input File:
Column Specification Summary .. 5.4, T5-3
File Type, Keyword FT ... 5.4.1.2, T5-3, T8-1
Pathname, Keyword FP .. 5.4.1.3, T5-3, T8-1
Specification ...................... 5.4
Interactive:
SCI Prompt and Response
Sequence ................ F8-6, F10-8
SCI Prompting .................... 8.2.5
Example Using ALTSEQ .......... FA-2
Interface:
Language Library Subroutines ...... 9.2.6
SpeCification, External ......... Section 9
System Command Interpreter ... Section 8
Intertask:
Communication .................. 9.1.4
Subprograms ..................... 9.1.1
Sysgen Requirements ............... 9.5
I/O Error Messages .................. TA-3
Key (Control) Field .................. 7.2.1
Keyword:
AS - Alternate Sequence .. 4.2.6, T4-1 T8-1
BL - Beginning Location ...... 7.3.5, T7-1
CFN - Control File Name .......... 3.3.7
CON - Continuation
Li ne ........ 6.2.3, 7.3.8, T6-1, T7 -1, T8-1
CP - Character
Portion ........... 7.3.4, T6-1, T7-1, T8-1
DCF - Drop Control
Fields ................ 4.2.8, T4-1, T8-1
EAP - Enter Alternate Pairs ........ T8-1
EL - Ending Location ......... 7.3.5, T7-1
FOC - Field or Constant .. 6.2.7, T6-1, T8-1
FP:
Input File Pathname ... 5.4.1.3, T5-3, T8-1
Output File
Pathname .......... 5.2.1.3, T5-1, T8-1
FT:
Field Type ................. 7.3.3, T7-1
Index-4

Input File Type ....... 5.4.1.2, T5-3, T8-1
Output Fi Ie Type ...... 5.2.1.2, T5-1, T8-1
LDN - Listing Device Name ........ 3.3.7
LRL:
Input File Logical Record
Length ............ 5.4.2.2, T5-3, T8-1
Output File Logical Record
Length ............ 5.2.2.2, T5-1, T8-1
MS - Memory Size ...... 4.2.12, T4-1, T8-1
NOLR:
Input File Number of Logical
Records ........... 5.4.2.3, T5-3 T8-1
Output File Number of Logical
Records ........... 5.2.2.3, T5-1, T8-1
ORL - Output Record
Length ............... 4.2.9, T4-1, T8-1
OVF - Overflow ............. 7.3.9, T7-1
01 B - Operand 1
Beginning ............ 6.2.5, T6-1, T8-1
01 E - Operand 1 Ending .. 6.2.5, T6-1, T8-1
02B - Operand 2
Beginning ............ 6.2.8, T6-1, T8-1
02C - Operand 2
Constant .......... " .6.2.8, T6-1, T8-1
02E - Operand 2
Ending ............... 6.2.8, T6-1, T8-1
PO - Print Option ....... 4.2.7, T4-1, T8-1
PRL - Physical Record
Length .............. 5.2.2.3, T5-1, T8-1
RC - Record Character ....... 7.3.6, T7-1
REL - Relational
Operator .............. 6.2.6, T6-1, T8-1
RST - Record Selection Type ...... 6.2.2,
T6-1 T8-1
SC - Substitute Character ..... 7.3.7', T7-1
SMS - Sort/Merge
Sequence ............. 4.2.5, T4-1, T8-1
SMT - Sort/Merge Type .. 4.2.3, T4-1, T8-1
TCL - Total Control
Length ............... 4.2.4, T4-1, T8-1
VAR - Variable Length
Records ............. 4.2.10, T4-1, T8-1
VO - Verify Option ..... 4.2.11, T4-1, T8-1
WFT - Work File Type .... 5.3.2, T5-2, T8-1
WFV - Work File
Volume ............... 5.3.3, T5-2, T8-1
Keywords, Batch ..................... 3.2
Language:
CALL Statements ................... 9.2
Data Types ................. Appendix E
Interface Library Subroutines ....... 9.2.6
Programs, Linking ................. 9.2.6
Subroutines ............ See Subroutines
LDN - Listing Device Name Keyword .. 3.3.7
LE Relational Operator ............... T6-1
Leading Sign Unpacked
Format .................... 7.3.4.6, T7-1
Library Subroutines, Language
Interface ......................... 9.2.6
Line Numbers on Specifications
946252·9701

Index

Worksheet ....................... 4.2.1
Linking Language Programs .......... 9.2.6
Listing Device Name, Keyword LON .... 3.3.7
Logical Record Length,
Keyword LRL .... 5.2.2.2,5.4.2.2, T5·1, T5·3
Logical Records, Number of ........... TB·1
LRL - Logical Record Length
Keyword ........ 5.2.2.2, 5.4.2.2, T5·1, T5·3
LT Relational Operator ............... T6·1
Memory Size Recommendation ........ 3.3.2
Memory Size, Keyword MS .. 4.2.12, T4·1, TB·1
Merge, Normal (MERGE) and Summary
(MERGES) .................... 2.4, T4-1
Messages:
Error ............................ TA-1
Fi Ie 1/0 Error ...................... T A-3
Information ...................... TA-2
Warning ......................... TA-1
Mode:
Batch ............................ . B.3
SCI Record-Oriented and VDT Modes .. B.2
Module:
Control Statement Compiler ....... 11.2.1
Record Merge ................... 11.2.5
Record Selection and
Reformatting .................. 11.2.2
Sort ............................ 11.2.3
String Merge .................... 11.2.4
Summary ....................... 11.2.6
MS - Memory Size
Keyword ............... 4.2.12, T4-1, TB-1
N E Relational Operator ............... T6-1
Negative:
Packed Format ................... 6.2.B
Unpacked Format ................ . 6.2.B
NOLR - Number of Logical Records
Keyword ... 5.2.2.4, 5.4.2.3, T5-1, T5-3, TB-1
Normal Merge (MERGE) ........... 2.4, T4-1
Normal Sequence Control Field ...... 7.3.3.1
Number of Logical Records, Keyword
NOLR ...... 5.2.2.4,5.4.2.3, T5-1, T5-3, TB-1
Omit:
Li nes ........ , ................. 6.2.2.3
Sets ..............., ......... T6-3, T6-5
Incl ude and. , ................. 6.2.2.4
Operand 1:
Beginning, Keyword 01 B .. 6.2.5, T6-1, TB-1
Ending, Keyword 01E ..... 6.2.5, T6-1, TB-1
Operand 2:
Beginning, Keyword 02B . . 6.2.B, T6-1, TB-1
Constant, Keyword 02C ... 6.2.B, T6-1, TB-1
Ending, Keyword 02E .... . 6.2.B, T6-1, TB-1
Operators, Relational ................ T6-1
Opposite Sequence Control Field .... 7.3.3.1
OR Continuation Line ................ T6-1
Order of Control and Data Fields ....... . 2.B
Order of Merge Specifications ......... F2-7
Order of Sort Specifications ........... F2-6
946252·9701

Order of Specifications .............. 2.7.5
ORL - Output Record Length
Keyword ................ 4.2.9, T 4·1, TB·1
Output File:
Column Summary ................. T5-1
Pathname, Keyword FP .. 5.2.1.3, T5·1, TB-1
Specification ...................... 5.2
Type, Keyword FT ...... 5.2.1.2, T5·1, TB-1
Output Record Length,
Keyword ORL ............ 4.2.9, T4-1, TB·1
Overflow Indicator Field ............. 7.3.10
OVF - Overflow Keyword ....... 7.3.9, T7·1
01 B - Operand 1 Beginning
Keyword ................ 6.2.5, T6-1, TB·1
01E - Operand 1 Ending
Keyword ................ 6.2.5, T6·1, TB-1
02B - Operand 2 Beginning
Keyword ................ 6.2.B, T6-1, TB-1
02C - Operand 2 Constant
Keyword ................ 6.2.B, T6·1, TB·1
02E - Operand 2 Ending
Keyword ................ 6.2.B, T6-1, TB-1
Packed:
Decimal Format, Signed ...... 7.3.4.5, T7-1
Format .......................... 6.2.4
Negative Format ................. . 6.2.B
Page Numbers on Specifications
Worksheet ....................... 4.2.1
Pascal:
CALL Statement .................... 9.2
Data Types ................. Appendix E
Example ......................... 9.3.3
Linking .......................... 9.2.6
Pathname:
Control File ............. 3.3.1, B.2.4, T3-1
Input File .............. 5.4.1.3, T5·3, TB-1
Output File ............ 5.2.1.3, T5-1, TB·1
@PROC@ ....................... 9.1.2
Physical Record Length, Keyword
PRL ....................... 5.2.2.3, T5·1
PO - Print Option
Keyword ................ 4.2.7, T 4-1, TB-1
Print Option, Keyword PO ... 4.2.7, T4-1, TB-1
PRL - Physical Record Length
Keyword ................... 5.2.2.3, T5-1
Prompt and Response
Sequence, SCI. ........ . B.2.5, FB·6, F10·B
RC - Record Character
Keyword .................... 7.3.6, T7-1
RCVREC, Receive Records
Subroutine .................. 9.1.1,9.2.3
Record:
Character, Keyword RC ........ 7.3.6, T7-1
Field ............................. 2.2
Length ................. " ......... TB-1
Merge Module ................... 11.2.5
Selection and Reformatting
Module ....................... 11.2.2
Column Summary ....... , ......... T6-1
Specification ................. Section 6
Index-5

Index

Type, Keyword RST ....... 6.2.2, T6-1, TB-1
Record-Oriented Mode, SCI ............ B.2
Reformatting Specification ....... Section 7
Column Summary ................. T7-1
REL - Relational Operator
Keyword ................ 6.2.6, T6-1, TB-1
Relational Operators:
EO, GE, GT, LE, LT, NE ............. T6-1
RST - Record Selection Type
Keyword ................ 6.2.2, T6-1, TB-1
SC -- Substitute Character
Keyword .................... 7.3.7, T7-1
SCI:
Background Processing ............ B.2.3
Foreground Processing ............ B.2.3
Interactive:
Prompt and Response
Sequence .............. FB-6, F10-B
Prompting ..................... B.2.5
Record-Oriented Mode .............. B.2
System Command Interpreter
Interface ................... Section B
VOT Mode ......................... B.2
Selection Specification (Record
Selection) .................... Section 6
SENREC, Send Records
Su brouti ne .................. 9.1.1, 9.2.2
Sequence:
Alternate
Collating ....... 4.2.6,6.2.4, Appendix B
Ascending ....................... 4.2.5
ASCII Collating " ................. 4.2.6
Control Field, Normal and Opposite 7.3.3.1
Descend i ng ...................... 4.2.5
Sequence Header Specification,
Alternate ........................ 4.2.6
Sequence Keywords:
AS - Alternate .......... 4.2.6, T4-1, T8-1
SMS - Sort/Merge ....... 4.2.5, T4-1, TB-1
SETDLV, Set Time Delay Count
Subrouti ne .................. 9.1.1, 9.2.5
Signed:
ASCII Character
Form8.t ............. 6.2.4, 7.3.4.2, T7-1
Beginning Sign Unpacked
Format .................. 7.3.4.7, T7-1
Integer Format .............. 7.3.4.3, T7-1
Leading Sign Unpacked
Format .................. 7.3.4.6, T7-1
Packed Decimal Format ...... 7.3.4.5, T7-1
Unpacked Decimal Format .... 7.3.4.5, T7-1
SMS - Sort/Merge Sequence
Keyword ................ 4.2.5, T4-1, TB-1
SMSTAT, Status Subroutine ...... 9.1.1,9.24
SMT - Sort/Merge Type
Keyword ................ 4.2.3, T4-1, TB-1
SM$ALT Batch Command Statement ... TB-1
SM$CLS Batch Command
Statement ................... T3-1, TB-2
SM$HD Batch Command
Index-6

Statement ............... T3-1, TB-1, TB-2
SM$IN Batch Command
Statement ................... T3-1, TB-1
SM$OUT Batch Command
Statement ............... T3-1, TB-1, TB-2
SM$REF Batch Command
Statement ............... T3-1, TB-1, TB-2
SM$SLC Batch Command
Statement ................... T3-1, TB-2
SM$SMC Batch Command
Statement ................... T3-1, TB-2
SM$WKF Batch Command
Statement ............... T3-1, TB-1, TB-2
Sort:
Address-Only (SORTA) .......... 2.3, T4-1
Module ......................... 11.2.3
Summary Tag-Along
(SORTRS) .............. 2.3,2.3.2, T4-1
Tag-Along (SORTR) ........ 2.3,2.3.1, T4-1
Sort/Merge:
Sequence, Keyword SMS .. 4.2.5, T4-1, TB-1
Type, Keyword SMT ...... 4.2.3, T4-1, TB-1
Utility Internal Structure ....... Section 11
Specification:
External Interface ............. Section 9
File Description .............. Section 5
Header ...................... Section 4
Input File .......................... 5.4
Output Fi Ie ........................ 5.2
Record Selection ............. Section 6
Reformatting ................. Section 7
Work Fi Ie .......................... 5.3
SRTINT, Initialization
Subroutine .................. 9.1.1,9.2.1
Status Subroutine, SMSTAT ..... 9.1.1,9.2.4
String Merge Module ............... 11.2.4
Subroutine:
RCVREC Receive Records ..... 9.1.1,9.2.3
SENREC Send Records ....... 9.1.1,9.2.2
SETDLV Set Time Delay
Count .................... 9.1.1,9.2.5
SMSTAT Status .............. 9.1.1, 9.2.4
SRTINT Initialization .......... 9.1.1,9.2.1
Subroutines, Language Interface
Library .......................... 9.2.6
Substitute Character,
Keyword SC ................. 7.3.7, T7-1
Summary Data Field ........... 2.3.2, 7.3.3.4
Summary Merge (MERGES) ........ 2.4, T4·1
Summary Module .................. 11.2.6
Summary Tag-Along Sort
(SORTRS) ................ 2.3,2.3.2, T4-1
Synonyms ......................... 9.1.2
Sysgen Requirements ................. 9.5
System Command Interpreter
Interface ..................... Section B
System Generation Requirements ....... 9.5
Tag-Along Sort(SORTR) ...... 2.3,2.3.1, T4-1
TCL - Total Control Length
Keyword ................ 4.2.4, T4-1, TB-1
946252·9701

Index

Total Control length,
Keyword TCl ............ 4.2.4, T4-1, TB-1
Unpacked:
Decimal Format, Signed ...... 7.3.4.5, T7-1
Format .......................... 6.2.4
Beginning Sign ........... 7.3.4.7, T7-1
leading Sign ............. 7.3.4.6, T7-1
Negative ...................... . 6.2.B
VAR - Variable length Records
Keyword ............... 4.2.10, T4-1, TB-1
Variable length Records, Keyword
VAR ... " ................. 4.2.10, T4-1, TB-1
VDT Mode, SCI ....................... B.2
Verify Option, Keyword VO .. 4.2.11, T4-1 TB-1
VO - Verify Option
Keyword ............... 4.2.11, T4-1 TB-1
Warning Messages .................. TA-1
WFT - Work File Type

946252·9701

Keyword ................ 5.3.2, T5-2 TB-1
WFV - Work File Volume
'
Keyword ................ 5.3.3, T5-2 TB-1
Work File:
'
File Description, Column Summary ... T5-2
File Specification ................... 5.3
File Type, Keyword WFT ... 5.3.2, T5-2, TB-1
File Volume, Keyword
WFV ................. 5.3.3, T5-2, TB-1
XB - Execute Batch Command ....... 3.5.B
XBSM - Execute Batch Sort/Merge
Command ............. . 3.5.B, T3-1, TB-2
XSM - Execute Background
Sort/Merge Command .... " ........ B.2.3
XSM F - Execute Sort/Merge
(Foreground) Command ............ B.2.3
Zone ASCII Character Portion ..... 6.2.4, T7-1
@PROC@ Pathname ................ 9.1.2

Index-7/Index-8

USER'S RESPONSE SHEET

Manual Title:

Model 990 Computer OX Sort/Merge User's Guide
(946252-9701 )

Manual Date:

_1_5_D_e_c_e_m_b_e_r_19_8_0_ _ _ _ _ __ Date of This Letter: _ _ _ _ _ __

User's Name: _ _ _ _ _ _ _ _ _ _ _ _ __

Telephone: _ _ _ _ _ _ _ __

Company: _ _ _ _ _ _ _ _ _ _ _ _ _ __

Office/Department: _ _ _ _ _ __

Street Address: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __
City/State/Zip Code: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __

Please list any discrepancy found in this manual by page, paragraph, figure, or table number in the
following space. If there are any other suggestions that you wish to make, feel free to include
them. Thank you.
w

z

:::i

Location In Manual

Comment/Suggestion

CJ

z
c

o....
....
~

u

NO POSTAGE NECESSARY IF MAILED IN U.S.A.
FOLD ON TWO LINES (LOCATED ON REVERSE SIDE), TAPE AND MAIL

FOLD

111111

:~~~~E~E~IT~;~!-Y D~I; J
POSTAGE Will BE PAID BY ADDRESSEE

TEXAS INSTRUMENTS INCORPORATED
DIGITAL SYSTEMS GROUP

ATTN: TECHNICAL PUBLICATIONS
P.O. Box 2909 MIS 2146

Austin, Texas 78769

FOLD

NO POSTAGE
NECESSARY
IF MAILED
IN THE
UNITED STATES

Texas Instruments U.S. District Sales and Service Offices
(A complete listing of U. S. offices is available from the
district office nearest your location)
Illinois
515 West Algonquin Road
Arlington Heights, Illinois 60005
(312) 640-2900
(800) 942-0609*

California
831 S. Douglas Street
EI Segundo, California 90245
(213) 973-.2571
100 California Street
Suite 480
San Francisco, California 94111
(415) 781-~9470

Massachusetts
504 Totten Pond Road
Waltham, Massachusetts 02154
(617) 890-7400

776 Palomar Avenue
P.O. Box 9064
SunnyvalE!, California 94086
(408) 732-1840*

Michigan
24293 Telegraph Road
Southfield, Michigan 48034
(313) 353-0830
(800) 572-8740*

3186 Airway
Suite J
Costa Mesa, California 92626
(714) 540-7311

Minnesota
7625 Parklawn Avenue
Minneapolis, Minnesota 55435
(612) 830-1600

Colorado
9725 East Hampden Avenue
Suite 301
Denver, Colorado 80231
(303) 751-1780

Missouri
2368 Schuetz
St. Louis, Missouri 63141
(314) 569-0801 *
New Jersey
1245 Westfield Avenue
Clark, New Jersey 07066
(.201) 574-9800

Florida
1850 Lee Hoad
Suite 115
Winter Park, Florida 32789
(305) 644-:3535

Ohio
4124 Linden Avenue
Dayton, Ohio 45432
(513) .258-3877

Georgia
3300 Northeast Expressway
Building 9
Atlanta, Georgia 30341
(404) 458-7791

Pennsylvania
420 Rouser Road
Coraopolis, Pennsylvania 15108
(41.2) 771-8550

*Service telephone number

Texas
8001 Stem mons Expressway
P.O. Box 226080
MIS 3108
Dallas, Texas 75266
(214) 689-4460
13510 North Central Expressway
P.O. Box 225214
MIS 393
Dallas, Texas 75265
(214) 238-3881
9000 Southwest Freeway, Suite 400
Houston, Texas 77074
(713) 776-6577
8585 Commerce Drive, Suite 518
Houston, Texas 77036
(713) 776-6531
(713) 776-6553*

Virginia
1745 Jefferson Davis Highway
Crystal Square 4, Suite 600
Arlington, Virginia 22202
(703) 553-2200
Wisconsin
205 Bishops Way
Suite 214
Brookfield, Wisconsin 53005
(414) 784-1323

TI-CARE*
Centralized Dispatch Telephone Numbers
for Requesting Service

201-574-9800
New Jersey
North of
Princeton

oGl

808-95~2617

C>CS~

(Hawa;;ao "'aod,)

0

*Service mark of Texas Instruments

Installation for Computer Systems
800-231-2807
713-937-1200 (Texas only, collect)

Ext. 553 or 554
Dallas Customers214-238-3881

The TI Customer Support Line is available to answer our customers' complex
technical questions. The extensive experience of a selected group of TI senior
engineers and systems analysts is made available directly to our customers. The TI
Customer Support Line telephone number is (512) 250-7407.

TEXAS INSTRUMENTS
INCORPORATED
DIGITAL SYSTEMS GROUP
POST OFFICE BOX 2909
AUSTIN, TEXAS



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.3
Linearized                      : No
XMP Toolkit                     : Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:56:37
Create Date                     : 2011:09:15 10:30:23-08:00
Modify Date                     : 2011:09:16 00:17:34-07:00
Metadata Date                   : 2011:09:16 00:17:34-07:00
Producer                        : Adobe Acrobat 9.45 Paper Capture Plug-in
Format                          : application/pdf
Document ID                     : uuid:84ccf200-9f84-426b-ba1d-6339e8edfe10
Instance ID                     : uuid:0b8e1254-1c06-407f-a03d-1832ae49a267
Page Layout                     : SinglePage
Page Mode                       : UseNone
Page Count                      : 244
EXIF Metadata provided by EXIF.tools

Navigation menu