Sort_Merge_Ver_5_Ref_Man_60484800D_Sep86 Sort Merge Ver 5 Ref Man 60484800D Sep86

Sort_Merge_Ver_5_Ref_Man_60484800D_Sep86 Sort_Merge_Ver_5_Ref_Man_60484800D_Sep86

User Manual: Pdf Sort_Merge_Ver_5_Ref_Man_60484800D_Sep86

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

DownloadSort_Merge_Ver_5_Ref_Man_60484800D_Sep86 Sort Merge Ver 5 Ref Man 60484800D Sep86
Open PDF In BrowserView PDF
60484800

'-"" CONTRPL DATA

SORT/MERGE
VERSION 5
REFERENCE MANUAL

CDC®OPERATING SYSTEMS:
NOS 2
NOS/BE 1

REVISION RECORD

Revision

Description

A (11/20/81)

Original release under NOS/BE 1 at PSR level 552.

B (02/26/82)

This manual is revised to reflect the support of NOS 2 at PSR level 552. Various
technical and editorial changes have been made. This is a complete reprint.

C (02/20/84)

This manual is revised to reflect the support of NOS/BE 1.5 at PSR level 601. Various
technical and editorial changes have been made.

D (09/05/86)

This manual is revised at PSR level 664 to document support of the CYBER 170 800 series
models and the CYBER 180 Computer Systems and support of overlapping keys. Various
technical and editorial changes have been made.

REVISION LETTERS I, 0, Q, AND X ARE NOT USED

©COPYRIGHT CONTROL DATA CORPORATION 1981, 1982, 1984, 1986
All Rights Reserved
Printed in the United States of America

ii

Address comments concerning this manual to:
CONTROL DATA CORPORATION
Technology and Publications Division
P. 0. Box 3492
SUNNYVALE, CALIFORNIA 94088-3492
or use Comment Sheet in the back of this manual

60484800 D

LIST OF EFFECTIVE PAGES

New features, as well as changes, deletions, and additions to information in this manual are indicated by bars
in the margins or by a dot near the page number if the entire page is affected. A bar by the page number
indicates pagination rather than content has changed.

Page

Revision

Front Cover
Inside Front Cover
Title Page

i i

iii/iv
v/vi

vii

viii

ix
1-1
1-2
1-3
1-4
2-1
2-2
2-3
2-4
2-5
3-1
3-2 thru 3-5

3-6
3-7
3-8 thru 3-11

4-1
4-2 thru 4-4
4-4.1/4-4.2

4-5
5-1
5-2 thru 5-7

6-1
7-1
7-2
7-3
7-4
8-1
8-2
8-3
A-l
B-l
C-l

thru
thru
thru
thru

8-9
A-13
B-10
C-4

D-l
D-2
E-l
E-2 thru E-5

F-l
Index-1 thru -4
Comment Sheet/Mailer
Back Cover

60484800 D

iii/iv •

PREFACE

This manual describes CONTROL DATA® Sort/Merge
Ve r s i o n 5 . 0 , a g e n e r a l i z e d s o r t i n g a n d m e r g i n g
u t i l i t y. A s d e s c r i b e d i n t h i s p u b l i c a t i o n , S o r t /
M e r g e Ve r s i o n 5 . 0 o p e r a t e s u n d e r c o n t r o l o f t h e
NOS 2 and the NOS/BE 1 operating systems for the
CDC® CYBER 170 and CYBER 180 Computer Systems.
This manual is written for the application program
mer. You are assumed to be familiar with the CDC
operating system installed at your site and, if you
are using procedure calls to Sort/Merge, with the
calling language.
Yo u c a n fi n d r e l a t e d i n f o r m a t i o n i n t h e p u b l i c a
tions listed below; the publications are listed

within groupings that indicate relative importance
to you.
The NOS manual abstracts and the NOS/BE manual
abstracts are pocket-sized manuals containing brief
descriptions of the contents and intended audience
of all NOS and NOS product set manuals and NOS/BE
and NOS/BE product set manuals, respectively. The
manual abstracts can be useful in determining which
manuals are of greatest interest to you. The
Software Publications Release History serves as a
guide in determining which revision level of
software documentation corresponds to the
Programming System Report (PSR) level of software
installed at your site.

The following manuals are of primary interest:

0F*^

Publication

Publication
Number

COBOL Version 5 Reference Manual

60497100

CYBER Record Manager
Basic Access Methods Version 1.5
Reference Manual

60495700

FORTRAN Version 5 Reference Manual

60481300

SORT/MERGE Version 5 Instant

60484900

NOS

NOS/BE 1

NOS 2

NOS/BE 1

The following manuals are of secondary interest:

J^**\

Publication

Publication
Number

INTERCOM Version 5 Reference Manual

60455010

Network Products
Remote Batch Facility Version 1
Reference Manual

60499600

NOS Version 2 Manual Abstracts

60485500

NOS Version 2 Reference Set, Volume 1
Introduction to Interactive Usage

60459660

NOS Version 2 Reference Set, Volume 3
System Commands

60459680

NOS/BE Version 1 Manual Abstracts

84000470

NOS/BE Version 1 Reference Manual

60493800

Software Publications Release History

60481000

CDC manuals can be ordered from Control Data Corporation, Literature and
Distribution Services, 308 North Dale Street, St. Paul, Minnesota 55103.
This product is intended for use only as described in this
document. Control Data cannot be responsible for the proper
functioning of undescribed features or parameters.

60484800 D

v/vi

CONTENTS

yims.

NOTATIONS

ix

1. GENERAL DESCRIPTION

1-1

Functions and Features
Configuration and Software Relationships
Job Flow

1-1
1-2
1-2

2. SORT KEYS

2-1

D e fi n i t i o n
Describing Sort Keys
Key Length and Position
Key Type
Collating Sequences
Numeric Data Formats
Sort Order

2-1
2-1
2-1
2-1
2-2
2-2
2-5

3. CONTROL STATEMENT SORTS OR MERGES

3-1

S0RT5 Control Statement
MERGE Control Statement
Directive Files
Sort/Merge Parameters
FROM
TO
KEY
DIR
L
E
EL
DIALOG
ENR
OWNF
OWNFL
OWNMRL
OWNn
RETAIN
SEQx
STATUS
SUM
VERIFY
FASTIO
Specifying Parameters by Position
FILE Control Statement
Specifying Maximum Record Length
Field Length Requirements
Listings

3-1
3-1
3-1
3-2
3-2
3-2
3-2
3-3
3-3
3-4
3-4
3-4
3-4
3-4
3-5
3-5
3-5
3-5
3-5
3-7
3-8
3-9
3-9
3-9
3-10
3-11
3-11
3-11

4. INTERACTIVE USE

4-1

APPENDIXES

Terminal Access to Sort/Merge
Logging in Under NOS
Logging in Under NOS/BE
Interactive Dialog
Interactive Commands
HELP
RESTART
QUIT
Specifying Parameters Interactively
Logging Out

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

A Character Data Input, Output, and
Central Memory Representation
B
Diagnostics
C
Glossary
D Sort/Merge Parameter Summary
E
Interactive
Dialog
F Sort/Merge 5, Sort/Merge 4 Comparison

60484800 D

5. PROCEDURE CALLS

5-1

SM5S0RT
SM5MERG
SM5FR0M
SM5TO
SM5KEY
SM5E
SM5EL
SM5ENR
SM5FAST
SM5N0DA
SM50FL
SM50MRL
SM50WNn
SM5RETA
SMSSEQx
SM5ST
SM5SUM
SM5END

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

b. COBOL INTERFACE

6-1

COBOL5 Control Statement Option
Direct Calls

b-1
b-1

7. OWNCODE ROUTINES

7-1

Specifying Owncode Routines
Owncode Routine Parameters
Owncode 1: Processing Input Records
Owncode 2: Processing Input Files
Owncode 3: Processing Output Records
Owncode 4: Processing Output Files
Owncode 5: Processing Records With
Equal Keys

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

8. EXAMPLES

8-1

Control Statement Sort on One Key
S o r t S p e c i fi c a t i o n U s i n g I n t e r a c t i v e D i a l o g
Control Statement Sort on Multiple Keys
Control Statement Merge
Creating and Using a Directive File
SUM Parameter Use
A Sort Using Procedure Calls

8-1
8-1
8-3
8-3
8-4
8-4
8-7

7-4

A-l
B-l
C-l
D-l
E-l
F-l

INDEX

vii

FIGURES
1-1
1-2
2-1
3-1
3-2
3-3
3-4
3-5
3-6
3-7
3-8
3-9
3-10
3-11
3-12
3-13
3-14
3-15
3-16
3-17
3-18
3-19
3-20
3-21

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

viii

Batch Job Flow
Interactive Job Flow
Internal Representation of Character
and Noncharacter Data
FROM Parameter Format
TO Parameter Format
KEY Parameter Format
DIR Parameter Format
L Parameter Format
E Parameter Format
EL Parameter Format
DIALOG Parameter Format
ENR Parameter Format
OWNF Parameter Format
OWNFL Parameter Format
OWNMRL Parameter Format
OWNn Parameter Format
RETAIN Parameter Format
SEQx Parameter Formats
STATUS Parameter Format
SUM Parameter Format
SUM Parameter Example
VERIFY Parameter Format
FASTIO Parameter Format
FILE Control Statement Format
NOS Login Example
NOS/BE Login Example
Incorrect Response Example
Output File Disposition Example
Interactive Command Example
I n t e r a c t i v e P a r a m e t e r S p e c i fi c a t i o n
Example
SM5S0RT Format
SM5MERG Format
SM5FR0M Format
SM5T0 Format
SM5KEY Format
SM5E Format
SM5EL Format
SM5ENR Format
SM5FAST Format
SM5N0DA
SM50FL Format
SM50MRL Format
SM50WNn Format
SM5RETA Format
SM5SEQx Formats
SM5ST Format
SM5SUM Format
SM5SUM Procedure Call Example

1-3
1-4
2-2
3-2
3-2
3-3
3-3
3-3
3-4
3-4
3-4
3-4
3-4
3-5
3-5
3-5
3-5
3-5
3-7
3-8
3-9
3-9
3-9
3-10

4-1
4-2
4-3
4-4
4-4.1

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

5-19 SM5END Format
6-1 C0B0L5 Control Statement Example
7-1 Owncode Routine Call and Subroutine
Statement Formats
7-2 Owncode Routine Record Flow
8-1 File UNIVER Record Layout
8-2 File UNIVER
8-3 Job Structure for Sorting File UNIVER
on Last Name
8-4 File UNIVER Sorted on Last Name
8-5 Interactive Dialog Example
8-6 Job Structure for Control Statement
Sort on Multiple Keys
8-7 File UNIVER Sorted on Multiple Keys
8-8 Input Files for Control Statement Merge
8-9 Job Structure for Control Statement
Merge
8-10 Merged File NEWU
8 - 11 C r e a t i n g a D i r e c t i v e F i l e
8-12 Using a Directive File (NOS)
8-13 File NUMFIL
8-14 Output From Sort Using a Directive File
8-15 File GRADES Record Layout
8-16 File GRADES
8 - 1 7 I n t e r a c t i v e P a r a m e t e r S p e c i fi c a t i o n
for SUM Example
8-18 Output From SUM Example
8-19 Job Structure for Sort Called From a
FORTRAN Program
8-20 FORTRAN Program With Sort/Merge
Procedure Calls
8-21 Owncode Routine
8-22 Output From FORTRAN Program

5-7
6-1
7-1
7-3
8-1
8-1
8-2
8-2
8-2
8-3
8-3
8-3

8-4
8-4
8-5
8-5
8-6
8-b
8-6
8-6
8-7
8-7

/^vPfLrS

8-8
8-8
8-9
8-y

TABLES
""^^IS

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

Data in Sort Key Fields
Predefined Collating Sequences
Numeric Data Formats
Sign Overpunch Representation
$CHAR(n) Character Numbers
SEQS Parameter Summary
Error Level Codes, STATUS Parameter
Parameter Positional Order
File Characteristics
Result Array Format
E r r o r L e v e l S p e c i fi c a t i o n
Error Level Codes, SM5ST Call
Owncode Routine Summary

2-2
2-3
2-4
2-5
3-b
3-7
3-8

3-10
3-11
5-1
5-3
5-b
7-2

60484800 D

'*^%.

Jp^V

NOTATIONS

U n l e s s o t h e r w i s e s p e c i fi e d , t h e c o n v e n t i o n s d e
scribed in the following paragraphs are used
throughout this manual in parameter and procedure
call formats, examples, and diagnostic messages.

[1

UPPERCASE Uppercase letters indicate words,
acronyms, or mnemonics required as
input by Sort/Merge or produced as
output by Sort/Merge. Parameter
keywords and interactive commands
are included in this category.
lowercase Lowercase letters indicate words
or symbols that you must supply.
...

0^S

Ellipsis in a parameter or pro
cedure call format indicates that
omitted portions of the format can
be repeated.

60484800 A

B r a c k e t s i n d i c a t e a n o p ti o n a l p o r
tion of a parameter or procedure
call format.
Two periods in a parameter format
indicate a range of letters or
digits.
Delta indicates a space (blank).

nm

Boxes indicate character positions
in storage.

Unless otherwise indicated, all numbers in text are
decimal values.

ix

GENERAL DESCRIPTION

S o r t / M e r g e Ve r s i o n 5 i s a s e t o f p o w e r f u l a n d
e f fi c i e n t r o u t i n e s t h a t p r o v i d e s h i g h - s p e e d s o r t i n g
o r me rg i n g o f r e c o r d s w i t h a s i n g l e c o n t r o l s t a t e
ment* This section introduces the features of
Sort/Merge and provides you with an overview of the
Sort/Merge relationship with system software.

FUNCTIONS AND FEATURES
The purpose of sorting is to arrange items in
order; the purpose of merging is to combine two or
more sets of preordered items. Using Sort/Merge,
records are rearranged in the order you specify, or
t w o o r m o r e s o r t e d fi l e s a r e c o m b i n e d i n t o o n e
fi l e . S o r t / M e r g e o f f e r s t h e f o l l o w i n g f e a t u r e s :
• A sort or merge specification with a single
control statement
• An optional directive file for sort or merge
s p e c i fi c a t i o n
• The capability of sorting or merging records
f r o m a s m a n y a s 1 0 0 fi l e s w i t h o n e c a l l t o
Sort /Merge
• Character and noncharacter sort key types
• Five predefined collating sequences
• User-defined collating sequences
• Summing of numeric fields
• Sorting of any CYBER Record Manager (CRM)
sequential file and any record type (except U)
• A tutorial dialog for interactive sort or merge
s p e c i fi c a t i o n
• A set of procedures for sort or merge proc
essing from within a program written in FORTRAN
or some other language
• Interface with COBOL programs through a C0B0L5
control statement option or direct calls
• O w n c o d e r o u t i n e s t o i n s e r t , s u b s t i t u t e , m o d i f y,
or delete records during Sort/Merge processing
T h e s e f e a t u r e s a r e d e s c r i b e d b r i e fl y i n t h e f o l
lowing paragraphs.
Sorts are initiated with the S0RT5 control state
ment; merges are initiated with the MERGE control
statement. You specify processing requirements for
the sort or merge with parameters in the respective
c o n t r o l s t a t e m e n t . M e r g e p r o c e s s i n g r e q u i r e s fi l e s
that have already been sorted. Sort/Merge gener
ates code based on the parameters and parameter
values that you include in the S0RT5 or MERGE
control statement.

60484800 B

The S0RT5 or the MERGE control statement can be up
to 240 characters in length. You can specify more
c o m p l e x s o r t s o r m e r g e s b y u s i n g a d i r e c t i v e fi l e
for additional parameters. Sort/Merge reads the
p a r a m e t e r s i n a d i r e c t i v e fi l e a f t e r a l l o f t h e
parameters in the control statement have been
read. Using a single control statement to specify
your sort or merge provides simplicity and elimi
nates the necessity of creating, saving, and
s u b s e q u e n t l y r e t r i e v i n g d i r e c t i v e fi l e s . D i r e c t i v e
fi l e s , o n t h e o t h e r h a n d , p r o v i d e s t a n d a r d i z a t i o n
of installation parameters and collating sequences.
R e c o r d s a r e s o r t e d o r m e r g e d o n fi e l d s o f d a t a
w i t h i n e a c h i n p u t r e c o r d ; t h e fi e l d s a r e c a l l e d
sort keys. Sort keys can be 6-bit character data,
s i g n e d o r u n s i g n e d b i n a r y i n t e g e r s , o r fl o a t i n g
point numbers. Data can be sorted or merged
a c c o r d i n g t o a p r e d e fi n e d o r u s e r - d e fi n e d c o l l a t i n g
sequence for character data, or according to
numeric value for numeric data. Numeric data can
be signed or unsigned.
Records with equal sort key fields can be combined
into one new record. You can specify that numeric
fi e l d s b e a d d e d t o t h e c o r r e s p o n d i n g fi e l d s i n t h e
other records with equal keys. The one resultant
r e c o r d c o n t a i n s t h e k e y fi e l d s a n d t h e n u m e r i c
fi e l d s t h a t a r e t h e s u m s o f t h e s p e c i fi e d n u m e r i c
fi e l d s i n a l l t h e r e c o r d s w i t h e q u a l k e y s ; d a t a
fi e l d s t h a t a r e n o t k e y o r s u m fi e l d s a r e s e t t o
the corresponding fields in one of the old records.
S o r t / M e r g e u s e s C R M fi l e p r o c e s s i n g a n d i n p u t /
output capabilities. Any of the CRM sequential
fi l e s o r r e c o r d t y p e s ( e x c e p t U ) c a n b e s o r t e d o r
m e r g e d ; t h i s i n c l u d e s b o t h fi x e d a n d v a r i a b l e
length records. Because Sort/Merge uses CRM, the
c h a r a c t e r i s t i c s o f fi l e s i n p u t t o S o r t / M e r g e a n d
fi l e s o u t p u t f r o m S o r t / M e r g e m u s t b e d e s c r i b e d t o
CRM with FILE control statements unless default
c h a r a c t e r i s t i c s a p p l y.
You can specify any sort or merge from your termi
nal by entering the S0RT5 or MERGE control state
ment and processing parameters. An interactive
dialog is also available to guide you, step by
s t e p , t h r o u g h y o u r s o r t o r m e r g e s p e c i fi c a t i o n .
The processing options are presented, and you
choose the option you want as well as identify your
fi l e s a n d s o r t k e y fi e l d s t o S o r t / M e r g e . S e v e r a l
interactive commands are available to control the
use of the interactive dialog. During the dialog,
you can obtain an explanation of Sort /Merge usage
by entering HELP at your terminal.
A set of procedures exists that allows you to
initiate a sort or merge from within your program
w r i t t e n i n F O RT R A N o r s o m e o t h e r l a n q u a g e . T h e
same processing options are available using calls
to the procedures as are available using the S0RT5
or the MERGE control statement; the procedure calls
closely correspond to the Sort/Merge parameters.

1-1

A COBOL5 control statement option exists that
allows you to use Sort/Merge 5. If you specify
S0RT5 in your C0B0L5 control statement, Sort/
Merge 5 is used when the COBOL SORT or MERGE state
ment in your program executes.
You can write routines, called owncode routines, to
i n s e r t , s u b s t i t u t e , m o d i f y, o r d e l e t e r e c o r d s
during Sort/Merge processing. Owncode routines are
subroutines written in FORTRAN or some other
l a n g u a g e . Th e r o u ti n e s m u s t b e c o m p i l e d ; t h e fi l e
containing the compiled routines is loaded during
your sort or merge. Depending on the exit number
y o u s p e c i f y, o w n c o d e r o u t i n e s a r e e x e c u t e d t o
process input records, output records, or records
with equal keys. You can use owncode routines with
control statement sorts or merges, or with proce
dure calls to Sort/Merge.

CONFIGURATION AND SOFTWARE
RELATIONSHIPS
The hardware configuration needed to support Sort/
Merge Version 5 is the same as the minimum config
uration required for the NOS or NOS/BE operating
| system. One CDC CYBER 170 or 180 series host
computer, together with peripheral processing units
and dis k subsystem i s n e c e s s a r y. F o r i n s t a l l a t i o n ,
o n e t a p e u n i t i s n e e d e d . A d d i t i o n a l l y, t h e i n t e r
active feature of Sort/Merge requires one 255x
series communication subsystem.
S o r t / M e r g e Ve r s i o n 5 r e s i d e s i n a l i b r a r y n a m e d
SRT5LIB on the NOS or NOS/BE operating system.
Sort/Merge requires only the basic NOS or NOS/BE
software. Sort/Merge interfaces with CYBER Record
M a n a g e r, w h i c h i s o n e o f t h e s t a n d a r d p r o d u c t s
released as part of both operating systems.

1-2

Interactive use of Sort/Merge requires the Inter
a c t i v e F a c i l i t y ( I A F ) Ve r s i o n 1 u n d e r N O S o r
I N T E R C O M Ve r s i o n 5 u n d e r N O S / B E . I A F i n t u r n
interfaces with the network software Network Access
Method (NAM). The NOS Version 2 Reference Set,
Volume 1 (for NOS users) or the INTERCOM reference
manual (for NOS/BE users) contains information
concerning terminal requirements.

JOB FLOW
Yo u c a n u s e S o r t / M e r g e f o r b a t c h p r o c e s s i n g o r
i n t e r a c t i v e l y. F o r b a t c h s o r t j o b s , r e c o r d s t o b e
sorted can be in permanent files, input in the same
job with your SORT5 control statement and param
eters, or supplied by an owncode routine* For
merge processing, records must be in presorted
files assigned to the job and named in the MERGE
control statement. Sort/Merge uses CYBER Record
Manager for input and output. Sorted or merged
r e c o r d s c a n b e w r i t t e n t o a fi l e a n d s a v e d , l i s t e d
by a printer, or processed by an owncode routine.
F i g u r e 1 - 1 i l l u s t r a t e s b a t c h j o b fl o w.
I n t e r a c t i v e l y, r e c o r d s t o b e s o r t e d o r m e r g e d c a n
b e i n l o c a l fi l e s o r i n p e r m a n e n t fi l e s y o u a s s i g n
to your job; records to be sorted can also be
supplied by an owncode routine. You can enter the
SORT 5 or MERGE control statement and processing
parameters from your terminal, or you can use the
interactive dialog to specify your sort or merge.
At the end of the sort or merge, records are in a
l o c a l fi l e t h a t c a n b e d i s p l a y e d a t y o u r t e r m i n a l ,
s a v e d a s a p e r m a n e n t fi l e , o r l i s te d b y a p r i nter;
output records can also be processed by an owncode
routine. Figure 1-2 illustrates interactive
j o b fl o w.

60484800 D

A. Sort
Records supplied
by an owncode

routine

I
•

CYBER
Record
Manager

|
.

Permanent
file to be
sorted

Sort
Parameters

Sort/Merge
Sorted file
saved as a
permanent file
INPUT
file to be

sorted
Sorted file
printed out

jSfiSfF^^S,

Sorted records
processed by an
owncode routine

B. Merge
1 CYBER
|
Sorted files

Record
|
Manager .

to be
merged

0ms.

Sort/Merge
Merged file
saved as a
permanent file
Merge
Parameters

Merged file
printed out

Merged records
processed by an
owncode routine

Figure 1-1. Batch Job Flow

^ms
60484800 A

1-3

A. Sort
Records supplied
by an owncode
routine
Permanent
file to be
sorted

Interactive
sort specification

.s:

I

I

INTERCOM

I

1

CYBER

'

|
Record
. Manager

|

Sort/Merge
Sorted file
saved as a
permanent file

I

Sorted records
processed by an
owncode routine

Sorted file
printed out

B. Merge

Interactive
I merge specification

I

CYBER

|

Record
|
Manager .

I

Sort/Merge

I

Merged file
saved as a
permanent file

I

Merged file
printed out

Merged records
processed by an
owncode routine

Figure 1-2. Interactive Job Flow

1-4

60484800 B

^S^v

SORT KEYS

All sort or merge operations are based on the
ordering of values assigned to the data to be
sorted or merged, which are called sort keys. This
section includes an explanation of sort keys and a
discussion of the information you must supply to
describe sort keys to Sort/Merge.

DEFINITION

r
j^ss-

0m*s

A sort key is a field of data within each record in
a n i n p u t fi l e t o b e s o r t e d o r i n a p r e s o r t e d fi l e
t o b e m e r g e d w i t h o n e o r m o r e o t h e r fi l e s . T h e
field is used by Sort/Merge to determine the order
i n w h i c h r e c o r d s a r e o u t p u t . A fi l e c a n b e s o r t e d
o r m e r g e d o n m o r e t h a n o n e fi e l d o f d a t a ; k e y
fields must occur in the same position and be the
same length in each record, and the total number of
key characters must be less than 256 (if you also
s p e c i f y s u m fi e l d s , t h e t o t a l n u m b e r o f c h a r a c t e r s
i n t h e k e y a n d s u m fi e l d s t o g e t h e r m u s t b e l e s s
t h a n 2 5 6 ) . S o r t k e y s i n fi l e s w i t h v a r i a b l e l e n g t h
records cannot extend beyond the length of the
s h o r t e s t r e c o r d i n t h e fi l e ; t h e s o r t k e y fi e l d
must be present in every record. For example, if
the records range from a minimum of 25 characters
to a maximum of 80 characters, all sort keys must
be in the first 25 characters.
The first key you specify is the most important key
a n d i s c a l l e d a m a j o r s o r t k e y. T h e k e y s y o u
s p e c i f y a f t e r t h e fi r s t k e y a r e o f l e s s e r
importance and are called minor sort keys. Each
s o r t k e y d e s c r i b e s t h e l e n g t h o f t h e fi e l d , t h e
p o s i t i o n o f t h e fi e l d w i t h i n e a c h r e c o r d , t h e t y p e
o f d a t a e x p e c t e d i n t h a t fi e l d , a n d t h e e f f e c t o f
t h a t d a t a o n t h e s o r t o r d e r. W h e n y o u s p e c i f y
m u l t i p l e s o r t k e y s , t h e k e y s c a n d i ff e r a s t o t y p e
o f d a t a , c o l l a t i n g s e q u e n c e , a n d s o r t o r d e r. T h e
alignment of data in sort keys is important.
C h a r a c t e r d a t a m u s t b e l e f t - j u s t i fi e d i n t h e fi e l d ;
n u m b e r s m u s t b e r i g h t - j u s t i fi e d i n t h e fi e l d .
A n e x a m p l e o f a fi l e w i t h m u l t i p l e s o r t k e y s i s a
u n i v e r s i t y s t u d e n t fi l e w i t h a r e c o r d f o r e a c h
student. Each record includes the last name and
fi r s t a n d m i d d l e i n i t i a l s , t h e s t u d e n t n u m b e r, t h e
d a t e o f b i r t h , t h e fi e l d o f s t u d y, t h e g r a d e p o i n t
average, and a code representing class (freshman,
s o p h o m o r e , j u n i o r , s e n i o r ) ; a l l t h e fi e l d s a r e
w r i t t e n w i t h c h a r a c t e r d a t a . T h e fi l e c o u l d b e
maintained with the student number as the major
key - reco r d s a r e n o r m a l l y r e t r i e v e d b y s p e c i f y i n g
the student number. The file can be sorted by the
name in standard alphabetic order when a list of
student names is needed*

ym^s

When a university department needs to know which
s t u d e n t s a r e m a j o r i n g i n fi e l d s w i t h i n t h e
d e p a r t m e n t , t h e fi l e c a n b e s o r t e d o n t h e fi e l d o f
s t u d y. T h e s a m e s o r t c a n s p e c i f y t h e n a m e a s a
m i n o r k e y s o t h a t r e c o r d s w i t h t h e s a m e fi e l d o f
study are also sorted in alphabetic order by the
name. The file can be sorted by the class code as
th e ma j o r k e y, a n d b y t h e g r a d e p o i n t a v e r a g e i n
descending numeric order as a minor key to give a

60484800 D

list by class with the students having the highest
grade point average at the beginning of the list.

DESCRIBING SORT KEYS
You must describe to Sort/Merge every field of data
t h a t y o u w a n t u s e d a s a s o r t k e y. S o r t k e y
descriptions include the following information:
• Starting location of the key within the record
• Key length
• Ty p e o f d a t a i n t h e k e y f i e l d
• Sort order
Yo u d e s c r i b e s o r t k e y s w i t h e i t h e r t h e K E Y
p a r a m e t e r i n a c o n t r o l s t a t e m e n t o r d i r e c t i v e fi l e ,
or with the SM5KEY procedure call. The options and
defaults for describing sort keys are discussed in
the following paragraphs.

KEY LENGTH AND POSITION
Y o u d e fi n e k e y fi e l d l e n g t h a n d p o s i t i o n b y
s p e c i f y i n g t h e fi r s t b y t e o r b i t o f t h e fi e l d a n d
e i t h e r t h e n u m b e r o f b y t e s o r b i t s i n t h e fi e l d
( l e n g t h o f t h e fi e l d ) , o r t h e l a s t b y t e o r b i t o f
t h e fi e l d . T h e l e f t m o s t b y t e a n d t h e l e f t m o s t b i t
in a record are counted as number 1. For character
data, each character is six bits and occupies one
byte. For example, if you want to specify the name
o f t h e u n i v e r s i t y s t u d e n t fi l e a s a s o r t k e y, a n d
t h e n a m e fi e l d i s t h e l e f t m o s t fi e l d i n t h e r e c o r d ,
y o u s p e c i f y t h e fi r s t b y t e a s 1 . I f t h e n a m e fi e l d
is 20 characters long, you specify length as 20.
Sort/Merge interprets the integers you specify for
key length and position as bit numbers when the key
t y p e ( d i s c u s s e d l a t e r i n t h i s s e c t i o n ) s p e c i fi e s
bits; otherwise, byte numbers are assumed. Unless
the SEOA parameter or SM5SEQA procedure is used,
k e y fi e l d s c a n o v e r l a p o n e a n o t h e r . N o d e f a u l t
exists for the starting location of a key within a
record; you must specify the starting location. If
y o u d o n o t s p e c i f y t h e l e n g t h o f a k e y, l e n g t h
defaults to 1.

KEY TYPE
Yo u s p e c i f y t h e t y p e o f d a t a i n a k e y fi e l d w i t h
the name of a collating sequence or with the name
o f a n u m e r i c d a t a f o r m a t . T h e d a t a i n a ke y fie l d
c a n b e c h a r a c t e r o r n o n c h a r a c t e r. C h a r a c t e r d a t a
is represented in the computer as display code
v a l u e s . To i n d i c a t e t h e k e y t y p e f o r c h a r a c t e r
data, you specify the name of a collating sequence
o r, f o r n u m e r i c c h a r a c t e r d a t a , t h e n a m e o f a
numeric data format. Noncharacter data is
r e p r e s e n t e d i n t h e c o m p u t e r a s b i n a r y v a l u e s . To
indicate the key type for noncharacter data, you
specify the name of a numeric data format.

2-1

Figure 2-1 illustrates the difference between the
internal representation of character and nonchar
a c t e r d a t a . Ta b l e 2 - 1 s u m m a r i z e s c h a r a c t e r a n d
noncharacter data types and the associated sort
key type.

The collating sequences and numeric data formats
you can specify are discussed in the following
paragraphs.

Collating Sequences
A. Character data

—

A collating sequence determines the precedence
given to each character in relation to the other
c h a r a c t e r s . Yo u s p e c i f y a c o l l a t i n g s e q u e n c e f o r
c h a r a c t e r d a t a t o d e t e r m i n e t h e s o r t o r d e r. T h e
data must be display code characters.

1

F i v e p r e d e fi n e d c o l l a t i n g s e q u e n c e s a r e a v a i l a b l e
to you as a Sort/Merge user: ASCII6, C0B0L6,
D I S P L AY, E B C D I C 6 , a n d I N T B C D . T h e d e f a u l t co l
l a t i n g s e q u e n c e i s A S C I I 6 . Ta b l e 2 - 2 s h o w s t h e
predefined collating sequences.

Octal equivalent of display code character
29
t

24

18

12

6

0

46 34 35 36 37

I f n o n e o f t h e p r e d e fi n e d c o l l a t i n g s e q u e n c e s
o r d e r s d a t a a s y o u w o u l d l i k e , y o u c a n d e fi n e a
nonstandard collating sequence. If you are using
c o n t r o l s t a t e m e n t c a l l s t o S o r t / M e r g e , y o u d e fi n e
your own collating sequence with SEQx parameters in
the S0RT5 or MERGE control statement. If you are
u s i n g t h e p r o c e d u r e c a l l s , y o u d e fi n e y o u r o w n
collating sequence with SM5SEQx procedure calls.

B. N oncharacter data

-1234

Numeric Data Formats
Octal equivalent of binary value
59

N u m e r i c d a t a c a n a p p e a r i n a k e y fi e l d i n o n e o f
the formats listed in table 2-3. Numeric data can
be signed or unsigned. For character numeric data
that is signed, the sign can be a floating sign, an
overpunch representation over the leading (left
most) digit, a leading separate character, an overpunch representation over the trailing (rightmost)
d i g i t , o r a t r a i l i n g s e p a r a t e c h a r a c t e r.

0

77...775455
Figure 2-1. Internal Representation of Character
and Noncharacter Data
I f a s o r t k e y fi e l d c o n t a i n s a n y c h a r a c t e r s t h a t
are not meaningful for the key type you specify (an
a l p h a b e t i c c h a r a c t e r i n a fi e l d d e fi n e d a s a
numeric key for example), the sort order for that
k e y fi e l d i n t h a t r e c o r d i s u n d e fi n e d . I n t h e
o u t p u t fi l e , t h e d a t a f o r t h a t k e y fi e l d i n t h a t
r e c o r d i s a l s o u n d e fi n e d . T h e r e c o r d i s s t i l l
sorted according to any other sort keys you have
s p e c i fi e d .

A floating sign is a negative sign embedded between
leading blanks and the numeric characters; leading
zeros must be converted to blanks. Positive values
in this format are not signed. The following
examples are valid floating sign formats:
AA
A A
A A
12

A
A
3

1
1
0
4

0*™*W$$\

TABLE 2-1. DATA IN SORT KEY FIELDS

Type

Internal
Representation

Data
in Field

Alphabetic

Character

Display code
Numeric

Type
Specified by

Data Ordered
According to

Name of a collating
sequence

S p e c i fi e d
collating
sequence

Name of a collating
sequence

S p e c i fi e d
collating
sequence

Name of a numeric
data format

Numeric
value

Name of a numeric
data format

Numeric
value

' " ^ y

Noncharacter

2-2

Binary value

Numeric

60484800 A

TABLE 2-2. PREDEFINED COLLATING SEQUENCES

Collating
Sequence
Decimal

ym^s

00
01
02
03
04
05
06
07
08
09
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

Octal

00
01
02
03
04
05
06
07
10
11
12
13
14
15
16
17
20
21
22
23
24
25
26
27
30
31
32
33
34
35
36
37
40
41
42
43
44
45
46
47
50
51
52
53
54
55
56
57
60
61
62
63
64
65
66
67
70
71
72
73
74
75
76
11

ASCI16

Graphics

blank
ii

It

:t

S S

C0B0L6

DISPLAY

Display
Code

Graphics

Display
Code

Graphics

55
66
64
60
53.
63?
67
70
51
52
47
45
56
46
57
50
33
34
35
36
37
40
41
42
43
44
00
11
11
54
73
71
74
01
02
03
04
05
06
07
10
11
12
13
14
15
16
17
20
21
22
23
24
25
26
27
30
31
32
61
75
62
76
65

blank

55

:t

xt
-*
A\

—
1

no.

63t
61
65
60
67
70
71
73
75
76
57
52
77
45
53
47
46
50
56
51
54
64
72
01
02
03
04
05
06
07
10
11
66
12
13
14
15
16
17
20
21
22
62
23
24
25
26
27
30
31
32
00
33
34
35
36
37
40
41
42
43
44

blank

]+

xt
-»
A \

—1

Display
Code

00
01
02
03
04
05
06
07
10
11
12
13
14
15
16
17
20
21
22
23
24
25
26
27
30
31
32
33
34
35
36
37
40
41
42
43
44
45
46
47
50
51
52
53
54
55
56
57
60
61
62*
63t
64
65
66
67
70
71
72
73
74
75
76
11

+
' I n i n s t a l l a t ions using a 63-gra phic set, the X grap hie does not exist.

60484800 A

EBCDIC6

Graphics

blank

- i

xt

a<
it

none

INTBCD

Display Graphics
Code

55
57
72
51
45
66
67
53
47
52
11
76
46
50
56.
63t
65
73
71
00
60
74
70
54
64
61
01
02
03
04
05
06
07
10
11
62
12
13
14
15
16
17
20
21
22
75
23
24
25
26
27
30
31
32
33
34
35
36
37
40
41
42
43
44

- i

blank

A \

CDC
INTBCO
Code

00
01
02
03
04
05
06
07
10
11
12
13
14
15
16
17
20
21
22
23
24
25
26
27
30
31
32
33
34
35
36
37
40
41
42
43
44
45
46
47
50
51
52
53
54
55
56
57
60
61
62
63
64
65
66
67
70
71
72
73
74
75
76
11

The : graphic is display code 63.

2-3

TABLE 2-3. NUMERIC DATA FORMATS
Name

Data Type

Sign

Comments

NUMERIC_LO

Numeric characters

Leading overpunch

All characters are decimal digits except the
leading character, which indicates a sign by
an overpunch. Data is ordered according to
numeric value with negative zero ordered
before positive zero.

NUMERIC_LS

Numeric characters

Leading separate

All characters are decimal digits except the
leading character, which is a negative or
p o s i t i v e s i g n . S p e c i f y i n g a fi e l d t h a t i s
not at least two characters in length causes
a f a t a l e r r o r. D a t a i s o r d e r e d a c c o r d i n g t o
numeric value with negative zero ordered
before positive zero.

NUMERIC_TO

Numeric characters

Trailing overpunch

All characters are decimal digits except the
trailing character, which indicates a sign by
an overpunch. Data is ordered according to
numeric value with negative zero ordered
before positive zero.

NUMERICJTS

Numeric characters

Tr a i l i n g s e p a r a t e

All characters are decimal digits except the
t r a i l i n g c h a r a c t e r, w h i c h i s a n e g a t i v e o r
p o s i t i v e s i g n . S p e c i f y i n g a fi e l d t h a t i s
not at least two characters in length causes
a f a t a l e r r o r. D a t a i s o r d e r e d a c c o r d i n g t o
numeric value with negative zero ordered
before positive zero.

NUMERIC_NS

Numeric characters

None

All characters are decimal digits. Data is
ordered according to numeric value.

NUMERICJFS

Leading blanks,
numeric characters

- sign for negative

The field contains leading blanks (leading
zeros must be converted to blanks); if the
value is negative, the right-most leading
blank must be converted to a minus sign. If
the field contains no leading blanks, the
value must be positive. This format is
equivalent to the FORTRAN I format. Data is
ordered according to numeric value with
negative zero ordered before positive zero.

BINARY

Binary integer

None

The field starts and ends on character bound
aries. Data is ordered according to numeric
value.

BINARYJBITS

Binary integer

None

The field does not start or end on character
boundaries. Data is ordered according to
numeric value.

INTEGER

One's complement
binary integer

Positive if leftmost
bit is 0; negative if
leftmost bit is 1

The field starts and ends on character bound
aries. Data is ordered according to numeric
value with negative zero ordered before posi
tive zero.

INTEGERJBITS

One's complement
binary integer

Positive if leftmost
bit is 0; negative if
leftmost bit is 1

The field does not start or end on character
boundaries. Data is ordered according to
numeric value with negative zero ordered
before positive zero.

REAL

Normalized binary
r e a l o r fl o a t i n g
point number

Signed

The field occupies a full computer word and
is aligned on word boundaries. Data is
ordered according to numeric value with all
forms of zero ordered equally. The order of
i n d e fi n i t e v a l u e s i s u n d e fi n e d .

2-4

values; a + character
is not allowed

60484800 C

T h e f o l l o w i n g e x a m p l e s a r e n o t v a l i d fl o a t i n g s i g n
formats:
A A 0
A - 0
+12 3
AAAA

1 Leading
1 Leading
Positive
All blank

zero not allowed
zero not allowed
sign not allowed
fi e l d n o t a l l o w e d

t h e c o l l a t i n g s e q u e n c e y o u s p e c i f y. F o r n u m e r i c
keys sorted in descending order, the record having
the key with the lowest value is written last on
t h e o u t p u t fi l e . D e s c e n d i n g c h a r a c t e r k e y s a r e
sorted in reverse order of the collating sequence
you specify. The default sort order is ascending.
TABLE 2-4. SIGN OVERPUNCH REPRESENTATION

A negative sign overpunch is equivalent to
overstriking a digit with a - , which is a punch in
row 11. A positive sign overpunch is equivalent to
overstriking a digit with a + , which is a punch in
row 12. When a signed overpunch digit is received
as input, the digit is punched as indicated in the
second column of table 2-4. When a signed
overpunch digit is displayed as output, the digit
appears as indicated in the third column of
table 2-4. Noncharacter numeric data can be signed
or unsigned binary integers or normalized floating
point numbers.
Yo u d e fi n e n u m e r i c k e y fi e l d s b y s p e c i f y i n g t h e
fi r s t b y t e o f t h e fi e l d a n d e i t h e r t h e l e n g t h o f
t h e fi e l d o r t h e l a s t b y t e o f t h e fi e l d . F o r t y p e s
BINARYJBITS and INTEGER_BITS, you specify the first
b i t p o s i t i o n o f t h e fi e l d a n d e i t h e r t h e l e n g t h o f
t h e fi e l d i n b i t s o r t h e l a s t b i t o f t h e fi e l d .

SORT ORDER
The order for sorting keys is ascending or
descending. For numeric keys sorted in ascending
o r d e r, t h e r e c o r d h a v i n g t h e k e y w i t h t h e h i g h e s t
v a l u e i s w r i t t e n l a s t o n t h e o u t p u t fi l e .
Ascending character keys are sorted according to

Sign and
Digit

Input
Punch

+9
+8
+7
+6
+5
+4
+3
+2
+1
+0
-0
-1
-2
-3
-4
-5
-6
-7
-8
-9

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

Output
Representation

A.

[t
]t

tvalid on NOS with 029 keypunches. See
appendix A, table A-2, for NOS/BE repre
sentations of +0 and -0.

^^*^-

60484800 B

2-5

CONTROL STATEMENT SORTS OR MERGES

r
This section
through control
that can appear
statement are
d i r e c t i v e fi l e s ,
requirements for
are explained.

describes Sort/Merge processing
statement calls. The parameters
in a S0RT5 or in a MERGE control
discussed, along with optional
The CYBER Record Manager (CRM)
control statement sorts or merges

SORT5 CONTROL STATEMENT

y^$S

Sort/Merge sort capabilities are available through
the S0RT5 control statement. Sort/Merge generates
code based on the parameters you specify in the
S 0 R T 5 c o n t r o l s t a t e m e n t ( a n d d i r e c t i v e fi l e s , i f
used) or on default values. Sort/Merge generates
t h e c o d e t o m a k e e f fi c i e n t u s e o f m e m o r y, m a s s
storage, and the central processor.
The control statement begins with the word S0RT5,
which must be followed by a period. The control
statement can appear in one of the following forms:
S0RT5.pl,p2,...,pn
S 0 RT 5 . p l A p 2 A . . . A p n
In the preceding control statement examples, p
represents a processing parameter. Parameters must
be separated by commas or spaces; commas and spaces
can be used interchangeably.

0^s

The S0RT5 control statement can be processed in a
batch job or entered interactively from a ter
minal. The control statement must be CRM block
type C (BT=C) and record type Z (RT=Z) format (see
the CRM Basic Access Methods reference manual for
information on block types and record types). Each
line of the control statement can be up to 100
characters in length; however, characters in excess
of 80 are ignored.
In interactive mode, control statements cannot be
continued on more than one line. Instead, you can
e i t h e r c r e a t e a d i r e c t i v e fi l e o r u s e a p r o c e d u r e
fi l e s o y o u c a n u s e a t e x t e d i t o r t o v e r i f y o r
change complex sort specifications.
In batch mode, you can continue a control statement
on more than one line by terminating the line with
two or more periods and beginning the new line with
one period.
NOTE
Continuation is not allowed for ranges
(indicated by two periods); ranges must be
started and completed on the same line.
You can continue a control statement on any number
of lines up to a maximum of 240 characters; periods
used as continuation symbols are not included in
the character count.

60484800 C

MERGE CONTROL STATEMENT
Sort/Merge merge capabilities are available through
the MERGE control statement. The input files for a
m e r g e m u s t b e p r e s o r t e d . I n p u t fi l e s f o r a m e r g e
with summing must be presorted and presummed. When
called with the MERGE control statement, Sort/Merge
generates code based on the parameters you specify
i n t h e c o n t r o l s t a t e m e n t ( a n d d i r e c t i v e fi l e s , i f
used) or on default values. Sort/Merge generates
code to make efficient use of memory, mass storage,
and the central processor.
The control statement begins with the word MERGE,
which must be followed by a period. The control
statement can appear in one of the following forms:
MERGE.pl,p2,...,pn
MERGE.pl A p2 A ...Apn
In the preceding control statement examples, p
represents a processing parameter. Parameters must
be separated by commas or spaces; commas and spaces
can be used interchangeably.
The MERGE control statement can be processed in a
batch job or entered interactively from a ter
minal. The control statement must be CRM BT-C and
RT=Z format. Each line of the control statement
c a n b e u p t o 1 0 0 c h a r a c t e r s i n l e n g t h ; h o w e v e r,
characters in excess of 80 are ignored.
In interactive mode, control statements cannot be
continued on more than one line. Instead, you can
e i t h e r c r e a t e a d i r e c t i v e fi l e o r u s e a p r o c e d u r e
fi l e s o y o u c a n u s e a t e x t e d i t o r t o v e r i f y o r
change complex sort specifications.
In batch mode, you can continue a control statement
on more than one line by terminating the line with
two or more periods and beginning the new line with
o n e p e r i o d . Yo u c a n c o n t i n u e a c o n t r o l s t a t e m e n t
on any number of lines up to a maximum of 240 char
acters; periods used as continuation symbols are
not included in the character count.

DIRECTIVE FILES
A control statement sort or merge can use optional
d i r e c t i v e fi l e s t h a t c o n t a i n p r o c e s s i n g p a r a m e t e r s
in addition to the parameters in the S0RT5 or the
M E R G E c o n t r o l s t a t e m e n t . U s e o f d i r e c t i v e fi l e s
a l l o w s s p e c i fi c a t i o n o f m o r e c o m p l e x s o r t s o r
m e r g e s ( s p e c i fi c a t i o n s t h a t c o u l d b e l o n g e r t h a n
allowed in a control statement) and permits stan
dardization of installation parameters and collat
ing sequences.
Y o u c a n s p e c i f y m u l t i p l e d i r e c t i v e fi l e s f o r a
single control statement sort or merge. All
d i r e c t i v e fi l e s m u s t b e C R M s e q u e n t i a l fi l e s o f
block type C (BT=C) and record type Z (RT=Z) with
record length (FL) of 100 characters or less;
however, characters in excess of 80 are ignored.

3-1

I n a d i r e c t i v e fi l e , e a c h s t a t e m e n t c a n b e u p t o
240 characters in length. Each statement must
begin with the word SORT or with the word MERGE
followed immediately by a comma or a space, and
then followed by processing parameters, which are
separated by commas or spaces. The following
e x a m p l e s i l l u s t r a t e d i r e c t i v e fi l e f o r m a t s :

OLD (unless an owncode routine supplies records).
A n e m p t y F R O M fi l e r e s u l t s i n a n u l l s o r t . T h e i
FROM file cannot be the same as the TO file.

FROM=lfn
FROM=(lfn1,lfn2,...)

S 0 R T, p l , p 2 , . . . , p n
FROM=$NULL
MERGE plAp2A...Apn
You can continue a directive file statement on more
than one line by terminating the line with two or
more periods. The new line must not begin with a
period but can begin with one or more spaces. You
s p e c i f y d i r e c t i v e fi l e s i n t h e S 0 R T 5 o r M E R G E
control statement with the DIR parameter, discussed
in the Sort/Merge Parameters subsection.

SORT/MERGE PARAMETERS
You specify various parameters in the S0RT5 or the
MERGE control statement, or in a directive file, to
direct Sort/Merge processing. Most parameters can
appear either in a control statement or in a direc
tive file. The DIALOG parameter cannot appear in a
d i r e c t i v e fi l e . U n l e s s s t a t e d o t h e r w i s e , a p a r a m
eter can appear only once in your sort or merge
s p e c i fi c a t i o n ; a f a t a l e r r o r r e s u l t s i f y o u s p e c i f y
d u p l i c a t e p a r a m e t e r s . Yo u c a n s p e c i f y p a r a m e t e r s
with keywords or by position in the control state
m e n t o r d i r e c t i v e fi l e . W h e n s p e c i fi e d w i t h
keywords, parameters take one of the following
forms, depending on the parameter:
keyword=((value-set)[,(value-set)]...)
keyword=value
Spaces can appear anywhere in a parameter except
within a name, a number, or a range indicator. The
order for specifying parameters by position follows
the descriptions of the individual parameters.
Refer to section 7 for information on owncode
routines, which are mentioned in the descriptions
of several of the parameters.

FROM
The FROM parameter (figure 3-1) specifies the input
files from which the records to be sorted or merged
a r e r e a d * A s m a n y a s 1 0 0 fi l e s c a n b e s o r t e d o r
merged in one job step. The files are read in the
o r d e r t h a t , y o u s p e c i f y t h e m ; a fi l e c a n n o t b e
s p e c i fi e d m o r e t h a n o n c e f o r a m e r g e . T h e fi l e s
are read past end-of-record marks; reading termi
n a t e s w h e n e n d - o f - fi l e o r e n d - o f - i n f o r m a t i o n i s
encountered (see the CRM Basic Access Methods
r e f e r e n c e m a n u a l ) . T h e fi l e s a r e r e w o u n d b e f o r e
and after use unless the name of the file is INPUT
o r a F I L E c o n t r o l s t a t e m e n t p a r a m e t e r s p e c i fi e s
o t h e r w i s e . I f a fi l e i s o p e n w h e n S o r t / M e r g e i s
called, it is not rewound after use because the CF
value in the FIT is undetermined.
If you specify the file $NULL with the FROM param
eter, records to be sorted are not read from a file;
records must be supplied by an owncode routine.
You can specify the FROM parameter more than once
i n a d i r e c t i v e fi l e . I f y o u o m i t t h e F R O M p a r a m
e t e r, r e c o r d s t o b e s o r t e d a r e r e a d f r o m t h e fi l e

3-2

l f n L o g i c a l fi l e n a m e ; 1 to
beginning with a letter.

letters or digits.

Figure 3-1. FROM Parameter Format

TO
The TO parameter (figure 3-2) specifies the file to
which sorted or merged records are written (unless
an owncode routine processes all records). The file
is not rewound before or after use unless a FILE
control statement parameter specifies otherwise.
TO=lfn
TO=$NULL
lfn

Logical file name; 1 to 7 letters or digits,
beginning with a letter.
Figure 3-2. TO Parameter Format

If you specify the file $NULL with the TO param
eter, sorted or merged records are not written to a
file; you must supply an owncode routine to process
all records. If you omit the TO parameter, records
are written to the file NEW (unless an owncode
routine processes all records). The TO file cannot
be the same as the FROM file.

KEY
T h e K E Y p a r a m e t e r ( fi g u r e 3 - 3 ) s p e c i fi e s t h e k e y
fields that determine the sorted or merged order of
output records. You can specify the KEY parameter
more than once in a directive file on separate com
m a n d l i n e s . A m a x i m u m o f 1 0 0 k e y fi e l d s c a n b e
s p e c i fi e d .
E a c h k e y _ d e f d e fi n e s a s e p a r a t e k e y. T h e y a r e
defined in the order of precedence, from major key
t o m i n o r k e y, r e a d l e f t t o r i g h t . A k e y _ d e f m a y
c o n s i s t o f a r a n g e . A r a n g e c o n s i s t s o f t h e fi r s t
and last byte of the key, separated by two periods.
A single integer may be considered as a special
c a s e o f a r a n g e i n w h i c h t h e fi r s t a n d l a s t b y t e
are the same. If a key_def consists of anything
more than a range, it must be enclosed within
parentheses, or else it will be processed as a
multiple key sort.
T h e k e y p o s i t i o n a n d l e n g t h a r e t h e fi r s t b y t e o f
the field and either the number of bytes or bits in
t h e fi e l d ( l e n g t h o f t h e fi e l d ) o r t h e l a s t b y t e o r
b i t o f t h e fi e l d . Yo u s p e c i f y fi r s t a n d l e n g t h ( o r
last) as integers; the leftmost byte and the
leftmost bit in a record are counted as number 1.
For character data, each character is six bits and
o c c u p i e s o n e b y t e . F o r a l l t y p e s o f d a t a , fi r s t

60484800 D

The following command defines the same sort key:
KEY = "(key_def [,key_def] ...)1
range
J
key_def

[range
"1
(range [.type [,ad] ])
L{first,length[,type[,ad] ]) J

range

[ fi r s t
]
[first.. last J

first

First byte or bit of the key field.

last

Last byte or bit of the key field.

length

Number of bytes or bits in the key field;
default is 1.

type

Name of a numeric data format or
collating sequence; default is ASCI 16.

ad

Order: A for ascending, D for descend
ing; default is ascending.
Figure 3-3. KEY Parameter Format

and length (or last) refer to bytes except for the
formats BINARYJBITS and INTEGER_BITS. You must
s p e c i f y t h e fi r s t b y t e o r b i t o f a k e y fi e l d . I f
you do not specify otherwise in the KEY parameter,
the key length is assumed to be 1.
T h e k e y t y p e i s t h e n a m e o f a p r e d e fi n e d o r
u s e r - d e fi n e d c o l l a t i n g s e q u e n c e o r t h e n a m e o f a
numeric data format. If you do not specify a key
type, the type is assumed to be the ASCII6
collating sequence. See section 2 for a list of
p r e d e fi n e d c o l l a t i n g s e q u e n c e s a n d n u m e r i c d a t a
formats.
Sort order is either ascending or descending, and
y o u s p e c i f y A o r D , r e s p e c t i v e l y. I f y o u s p e c i f y
neither, the sort order is assumed to be
ascending. For numeric keys sorted in ascending
o r d e r, t h e r e c o r d h a v i n g t h e k e y w i t h t h e h i g h e s t
v a l u e i s w r i t t e n l a s t o n t h e o u t p u t fi l e .
Ascending character keys are sorted according to
t h e c o l l a t i n g s e q u e n c e y o u s p e c i f y. F o r n u m e r i c
keys sorted in descending order, the record having
the key with the lowest value is written last on
t h e o u t p u t fi l e . D e s c e n d i n g c h a r a c t e r k e y s a r e
sorted in reverse order of the collating sequence
you specify.
Records are first sorted according to the key field
described by the leftmost key_def. Records with
e q u a l v a l u e s f o r t h e m a j o r k e y fi e l d a r e s o r t e d
a c c o r d i n g t o t h e fi e l d d e s c r i b e d b y t h e n e x t
key_def, and so on. A fatal error occurs if key
fields overlap one another and the SEQA parameter
i s s p e c i fi e d . A f a t a l e r r o r a l s o o c c u r s i f t h e
total number of key characters is more than 255.
( I f y o u a l s o s p e c i f y s u m fi e l d s , t h e t o t a l n u m b e r
o f c h a r a c t e r s i n t h e k e y a n d s u m fi e l d s t o g e t h e r
must be less than 256.)
Yo u m u s t b e c a r e f u l w h e n d e fi n i n g a s o r t w i t h a
single key. The following command defines a single
key that is 20 bytes long, starting in byte 6:
S0RT5. KEY=6..25

S0RT5. KEY=((6,20))
The following command defines a sort on two single
byte keys where byte 6 is the major key and byte 20
is the minor key:
S0RT5. KEY=(6,20)
I f y o u o m i t t h e K E Y p a r a m e t e r, t h e f o l l o w i n g
assumptions are made: KEY=1.. (minimum record
length), the record length is the smallest MNR in
t h e F I L E c o n t r o l s t a t e m e n t s f o r i n p u t fi l e s ( o r t h e
smallest FL for F and Z records), the key type is
the ASCII6 collating sequence, and the sort order
is ascending.

DR
I
T h e D I R p a r a m e t e r ( fi g u r e 3 - 4 ) s p e c i fi e s a d i r e c
t i v e fi l e o r fi l e s f r o m w h i c h s o r t o r m e r g e p a r a m
e t e r s a r e r e a d . P a r a m e t e r s i n a d i r e c t i v e fi l e a r e
read only after all of the control statement param
e t e r s h a v e b e e n r e a d . T h e fi l e s a r e r e a d i n t h e
order that you specify them. The files are rewound
before and after use unless the name of the file is
INPUT or a FILE control statement parameter speci
fi e s o t h e r w i s e .

DIR=lfn
DIR=(lfn1,lfn2 )
lfn Logical file name; 1 to 7 letters or digits,
beginning with a letter.
Figure 3-4. DIR Parameter Format
You can specify the DIR parameter more than once in
a d i r e c t i v e fi l e . I f y o u o m i t t h e D I R p a r a m e t e r,
n o p a r a m e t e r s a r e r e a d f r o m a d i r e c t i v e fi l e ; t h e
sort or merge is completely specified in the SORTS
or the MERGE control statement.

T h e L p a r a m e t e r ( fi g u r e 3 - 5 ) s p e c i fi e s t h e fi l e t o
which listing information is written. The listing
fi l e i s w r i t t e n i n C R M B T = C , R T = Z f o r m a t w i t h a
default full length of 132. Listing information
i n c l u d e s t h e S o r t / M e r g e v e r s i o n n u m b e r, d i r e c t i v e
fi l e s t a t e m e n t s , t h e t i m e a n d d a t e , a n d d i a g n o s t i c
messages, if any.

L=lfn
L=$NULL
lfn

Logical file name; 1 to 7 letters or digits,
beginning with a letter.
Figure 3-5. L Parameter Format

0ms
60484800 D

3-3

The listing file is not rewound before or after use
unless a FILE control statement parameter specifies
r e w i n d . I f y o u s p e c i f y t h e fi l e $ N U L L w i t h t h e L
p a r a m e t e r, l i s t i n g i n f o r m a t i o n i s n o t w r i t t e n . I f
y o u o m i t t h e L p a r a m e t e r, l i s t i n g i n f o r m a t i o n i s
written to the file OUTPUT.

o t h e r p a r a m e t e r s ( e x c e p t t h e S TAT U S p a r a m e t e r )
s p e c i fi e d i n a c o n t r o l s t a t e m e n t a l o n g w i t h t h e
DIALOG parameter do not affect sort or merge proc
essing; the sort or merge is performed solely on
the basis of your dialog responses. Interactive
use of the dialog is described in section 4, and
the text of the dialog is included in appendix E.

/■^"^■fek

DIALOG=YES (or DIA=Y)

T h e E p a r a m e t e r ( fi g u r e 3 - 6 ) s p e c i fi e s t h e fi l e t o
which diagnostic messages are written. The error
fi l e i s w r i t t e n i n C R M B T = C , R T = Z , a n d F L = 7 2
f o r m a t * T h e fi l e i s n o t r e w o u n d b e f o r e o r a f t e r
use unless a FILE control statement parameter
specifies to rewind.

DIALOG=NO (or DIA=N)

Figure 3-8. DIALOG Parameter Format
NOTE

E=lfn
E=$NULL
lfn

Logical file name; 1 to 7 letters or digits,
beginning with a letter.
Figure 3-6. E Parameter Format

I f y o u s p e c i f y a l i s t i n g fi l e w i t h a fi l e n a m e
d i f f e r e n t f r o m t h e e r r o r fi l e n a m e , d i a g n o s t i c
messages are written to the listing file and to the
e r r o r fi l e . I f y o u s p e c i f y t h e fi l e $ N U L L w i t h t h e
E parameter, diagnostic messages are not written.
I f y o u o m i t t h e E p a r a m e t e r, d i a g n o s t i c m e s s a g e s
a r e w r i t t e n t o t h e l i s t i n g fi l e .

E
L
T h e E L p a r a m e t e r ( fi g u r e 3 - 7 ) s p e c i fi e s t h e e r r o r
l e v e l t o b e r e p o r t e d . . I f E L = T, a l l t r i v i a l e r r o r s ,
plus all errors of levels W, F, and C, are reported.
I f E L = W, a l l w a r n i n g e r r o r s , p l u s a l l e r r o r s o f
l e v e l s F a n d C , a r e r e p o r t e d . I f E L = F, a l l f a t a l
errors, plus all errors of level C, are reported.
If EL^C, all catastrophic errors are reported.
Omitting the EL parameter is equivalent to EL=W.

Before entering a S0RT5 or MERGE command
w i t h t h e D I A L O G p a r a m e t e r, e n s u r e t h a t
your terminal is in normal mode by enter
ing the NORMAL terminal command. If your
terminal is in ASCII mode during the
interactive dialogue, Sort/Merge cannot
recognize your responses unless you enter
them using uppercase letters only.
If you are already in the dialog, and need
to change the terminal mode, enter a
control-T to return to the system.

ENR
The ENR parameter (figure 3-9) specifies the esti
m a t e d n u m b e r o f r e c o r d s t o b e s o r t e d o r m e rged.
Yo u s p e c i f y e i t h e r a s i n g l e v a l u e o r a r a n g e o f
values, and decimal integers (from 0 through
1000000000) or the CYBER Control Language (CCL)
variables Rl, R2, R3, RIG, EF, or EFG. If ENR is
specified as less than 1500, Sort/Merge uses less
memory for the initial sort phase. This causes
noticeably less memory required for the entire sort
if the actual number of records is a low number.

ENR=expr
EL=T

ENR=expr . . expr

EL=W

expr

Expression that is a decimal integer, or CCL
variable R1,R2,R3,R1G,EF, or EFG.

EL=F
EL=C

Figure 3-7. EL Parameter Format
E r r o r s a r e w r i t t e n t o t h e e r r o r fi l e o r , i f n o
e r r o r fi l e i s s p e c i fi e d , t o t h e l i s t i n g fi l e . S e e
appendix B for an explanation of the four levels of
errors.

DIALOG
The DIALOG parameter (figure 3-8) invokes an inter
active dialog between you and Sort/Merge. The
DIALOG parameter can appear only in a control
statement. If DIALOGUES, the dialog is invoked;
if DIALOG=NO, the dialog is not invoked. Omitting
the DIALOG parameter is equivalent to DIALOG=NO.
The DIALOG parameter can be abbreviated as DIA, and
Y or N can be specified instead of YES or NO. Any
3-4

Figure 3-9. ENR Parameter Format

OWNF
The OWNF parameter (figure 3-10) specifies the file
t h a t i s t h e s o u r c e o f o w n c o d e r o u t i n e s ; t h e fi l e ,
which must contain relocatable object modules, is
loaded by Sort/Merge by means of the user call
l o a d e r. T h e l o a d m a p fr o m l o a d i n g th e r o u ti n es is
written to file ZZZZZLM.

OWNF=lfn
lfn Logical file name; 1 to 7 letters or digits,
beginning with a letter.
Figure 3-10. OWNF Parameter Format
60484800 D

■^ ^ \

#

^

OWNFL
T h e O W N F L p a r a m e t e r ( fi g u r e 3 - 11 ) s p e c i fi e s t h e
exact number of characters in any record from an
owncode routine. The integer you specify can be
from 1 to 5000. The OWNFL parameter can be
abbreviated as OFL. See the discussion of the
OWNMRL parameter for default values.

OWNn=proc
n

1,

2,

3,

4,

or

5

proc Procedure-name; 1 to 31 letters, digits or
the special characters ? # @ _. Only 7
characters are significant and the first must
be a letter.

OWNFL=integer

Figure 3-13. OWNn Parameter Format

OFL=integer
Figure 3-11. OWNFL Parameter Format

OWNMRL

0jm*s

The OWNMRL parameter (figure 3-12) specifies the
maximum length in characters of any record from an
owncode routine. The integer you specify can be
from 1 to 5000. The OWNMRL parameter can be
abbreviated as OMRL. You do not need to specify
the OWNMRL parameter if the sort or merge has an
i n p u t o r o u t p u t fi l e w i t h a m a x i m u m r e c o r d l e n g t h
at least as long as the longest record supplied by
an owncode routine.

RETAIN
T h e R E TA I N p a r a m e t e r ( fi g u r e 3 - 1 4 ) d i r e c t s S o r t /
Merge to output records with equal sort keys in the
same order as the records are input (RETAIN=YES).
If RETAIN=N0, or if you omit the RETAIN parameter,
records with equal sort keys might not be output in
the same order as they are input. If RETAIN=YES
and you specify more than one sort or merge input
fi l e w i t h t h e F R O M p a r a m e t e r, t h e o r d e r i n w h i c h
you specify the files is the order in which records
with equal keys are output. The RETAIN parameter
can be abbreviated as RET, and Y or N can be speci
fied instead of YES or NO.

RETAIN=YES {or RET=Y)
OWNMRL=integer

RETAIN=NO (or RET=N)

OMRL=integer
Figure 3-14. RETAIN Parameter Format
Figure 3-12. OWNMRL Parameter Format
If you omit both the OWNMRL and the OWNFL param
e t e r s , t h e r e c o r d l e n g t h s p e c i fi c a t i o n o f r e c o r d s
I from an owncode routine depends on the length
s p e c i fi c a t i o n s o f t h e i n p u t a n d o u t p u t fi l e s . I f
a l l i n p u t a n d o u t p u t fi l e s h a v e fi x e d l e n g t h
records of the same length, this length is used as
a default OWNFL value; otherwise, the largest MRL
o r F L f r o m a n y i n p u t o r o u t p u t fi l e i s u s e d a s a
default OWNMRL value.
I f t h e s o r t h a s n o i n p u t o r o u t p u t fi l e s ( r e c o r d s
to be sorted are supplied by an owncode routine and
sorted records are processed by an owncode rou
tine), you must specify either OWNFL or OWNMRL;
o t h e r w i s e , a f a t a l e r r o r r e s u l t s . Yo u c a n n o t
specify both the OWNFL and OWNMRL parameters for
the same sort. Use of OWNFL rather than OWNMRL can
increase performance.

OWNn

J ^ S

The OWNn parameter (figure 3-13) specifies the name
of an owncode routine that is executed each time
point n is reached during the sort or merge; n must
be 1, 2, 3, 4, or 5* Owncode routines named by the
O W N n p a r a m e t e r m u s t b e i n t h e O W N F fi l e . A l l
owncode routines are loaded before the sort or
merge is started. If you omit the OWNn parameter,
no owncode routine is executed.

60484800 D

You cannot specify both the RETAIN and the SUM
parameters in the same sort or merge. If you do
specify both, a catastrophic error occurs.

SEQx
The SEQx parameters (figure 3-15) define your own
collating sequence. The SEQN parameter signals the
s t a r t o f y o u r c o l l a t i n g s e q u e n c e d e fi n i t i o n a n d
names the sequence; name is used as the key type in
the KEY parameter when records are sorted according
to your collating sequence. Specifying a name that
is the same as the name of one of the predefined
c o l l a t i n g s e q u e n c e s r e s u l t s i n a f a t a l e r r o r.
SEQN=name
SEQS=('char',

, 'char')

[SEQR=YES or SEQR=Y]
[SEQA=YES or SEQA=Y]
Collating sequence name; 1 to 31 letters,
digits, or the special characters ? # @ _.
Only 10 characters are significant and the
first must be a letter.
char

Character in the collating sequence.

Figure 3-15. SEQx Parameter Formats

3-5

Collating positions are assigned to the characters
in your collating sequence by SEQS parameters; each
SEQS parameter specifies either a single value step
or a range of value steps in the sequence. A value
step consists of one or more characters, and
characters specified in the same value step collate
e q u a l l y. T h e fi r s t S E Q S p a r a m e t e r s p e c i fi e s t h e
first value step or range of steps, the second SEQS
parameter specifies the second value step or range
of steps, and so on until your collating sequence
i s c o m p l e t e l y d e fi n e d . T h e f o l l o w i n g p a r a g r a p h s
describe how to specify steps in your collating
sequence with SEQS parameters.
You can specify a single value step consisting of a
single character by a graphic character (see
appendix A) enclosed in apostrophes as in the
following example:
SEQS='A'
You can also specify a single value step consisting
of a single character by $CHAR(n) where n is the
number of the character in the character set at
your site (see table 3-1). The following example
specifies a step consisting of the character number
08 in the character set, which is the letter H:

SEQS=$CHAR(08)
Yo u c a n s p e c i f y a s i n g l e v a l u e s t e p c o n s i s t i n g o f
several characters by a single character enclosed
in apostrophes, followed by one or more characters
and/or ranges of characters. The characters are
e n c l o s e d i n a p o s t r o p h e s . A l l c h a r a c t e r s s p e c i fi e d
o r i m p l i e d i n s u c h a s t e p c o l l a t e e q u a l l y. T h e
f o l l o w i n g e x a m p l e s p e c i fi e s a s t e p c o n s i s t i n g o f
the blank and the digits 0, 1, 2, and 3, all of
which collate equally:
SEQS=(' ','0','1','2','3')
The following example specifies the same value step
a s a r a n g e o f c h a r a c t e r s w h e r e ' 0 ' . . ' 3 ' s p e c i fi e s
the range of digits from 0 through 3:
SEQS=(' ','0'..'3')
You can specify several value steps, each consist
i n g o f o n e c h a r a c t e r, w i t h o n e v a l u e t h a t i s a
range of characters. The characters are enclosed
i n a p o s t r o p h e s . T h e f o l l o w i n g e x a m p l e s p e c i fi e s a
four-step collating sequence consisting of the
digits 0, 1, 2, and 3, with 0 assigned the lowest
collating value:
SEQS=('0'..'3')

TABLE 3-1. $CHAR(n) CHARACTER NUMBERS

Character
Number
(decimal)

00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

CDC Graphic
(64-Charac
ter Set)t

ASCII Graphic
(64 Charac
ter Set)t

Octal
6-Bit
D i sp l a y
Code

00
01
02
03
04
05
06
07
10
11
12
13
14
15
16
17
20
21
22
23
24
25
26
27
30
31
32
33
34
35
36
37

Character
Number
(decimal)

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

CDC Graphic
(64-Charac
ter Set)t

ASCII Graphic
(64 Charac
ter Set)t

£3

blank

blank

//

—,

Octal
6-Bit
D i splay
Code

40
41
42
43
44
45
46
47
50
51
52
53
54
55
56
57
60
61
62
63
64
65
66
67
70
71
72
73
74
75
76
77

'For 63-chaicacter set differences, see the subsection entitled Charac.ter Set Anomal Les in appendix A

3-6

60484800 C

-/r^l\

The preceding example is the same as specifying the
following:
SEQS='0'
SEQS='l'
SEQS='2'
SEQS='3'
You can specify several value steps, each of which
consists of more than one character, as ranges of
characters where each range has the same number of
characters. One value step in the collating
sequence results for each character implied by the
range. The characters are enclosed in apostro
phes. A diagnostic message is issued if each range
does not consist of the same number of characters.
T h e f o l l o w i n g e x a m p l e s p e c i fi e s a t h r e e - s t e p
collating sequence where the first step consists of
1 and A (which are assigned the lowest collating
value); the second step is 2 and B; the third step
is 3 and C:

SEQS=('0'..'9')
SEQR=YES
SEQS=('A'..'Z')
Yo u c a n s p e c i f y o n e S E Q A p a r a m e t e r t o a l t e r i n
output records characters in the same value step to
the first character in the step; either YES or Y is
allowed. The following example alters all aster
isks and ampersands to slashes:
SEQS=(7\ '*','&')
SEQA=YES
Yo u r c o l l a t i n g s e q u e n c e s p e c i fi c a t i o n i s t e r m i n a t e d
by any parameter other than SEQS, SEQR, or SEQA.
You can define as many as 100 collating sequences
by specifying a separate series of SEQx parameters
for each collating sequence. The name of each
user-defined collating sequence in a sort or merge
must be unique. If you omit the SEQx parameters, a
nonstandard collating sequence is not defined.

SEQS=('1'..'3','A'..'C)
The preceding example is the same as specifying the
following:
SEQS=('1','A')
SEQS=('2','B')
SEQS=('3','C)
A n y S E Q S p a r a m e t e r t h a t s p e c i fi e s a r a n g e o f
characters followed by a single character results
i n a f a t a l e r r o r. A n a p o s t r o p h e i s s p e c i fi e d i n a
SEQS parameter by four apostrophes (""). You can
specify the SEQS parameter more than once in a
d i r e c t i v e fi l e . S E Q S p a r a m e t e r u s e i s s u m m a r i z e d
in table 3 - 2 .
You can use one SEQR parameter to define a special
value step that consists of all characters not
e x p l i c i t l y o r i m p l i c i t l y s p e c i fi e d w i t h S E Q S p a r a m
eters; either YES or Y is allowed. The following
e x a m p l e d e fi n e s a s e q u e n c e i n w h i c h t h e d i g i t s
c o l l a t e i n n u m e r i c o r d e r, t h e n a l l s p e c i a l c h a r
acters (such as periods, commas, slashes) collate
e q u a l l y, a n d t h e n l e t t e r s c o l l a t e i n a l p h a b e t i c
order:

STATUS
The STATUS parameter (figure 3-16) specifies that a
CYBER Control Language (CCL) variable be set to a
value representing the highest level of error that
occurred during the sort or merge. The CCL vari
ables Rl, R2, R3, RIG, EF, or EFG can be used for
t h i s p u r p o s e . Ta b l e 3 - 3 s h o w s v a l u e s t h a t c a n b e
r e t u r n e d i n t h e s p e c i fi e d v a r i a b l e . F o r e x a m p l e ,
i f y o u s p e c i f y S TAT U S = R 1 a n d R l s u b s e q u e n t l y
contains 20, a trivial error occurred.

STATUS=variable (or ST=variable)
variable CCL variable R1, R2, R3, RIG, EF, or EFG.

Figure 3-16. STATUS Parameter Format
If you include the STATUS parameter in your sort or
merge specification, Sort/Merge does not abort if a
catastrophic error occurs before any data records
a r e i n p u t . H o w e v e r, i f S o r t / M e r g e c a l l s a n o t h e r

TABLE 3-2. SEQS PARAMETER SUMMARY

j4f$P*,\

Number of Value
Steps Specified by
One SEQS Parameter

Number of Characters
in Each Value Step

How Specified

Example

1 step

1 character

Graphic character or $CHAR(n)
where n is the number of the char
acter in your character set.

SEQS='H' or
SEQS=$CHAR(08)

1 step

More than one
character

Each character in the step is
enclosed in apostrophes and sepa
rated by commas, or a single char
acter is followed by one or more
ranges of characters.

SEQS=('I','0','X') or
SEQS=(':','0'..'9')

More than one step

1 character

One range of characters.

SEQS=('0'..'9')

More than one step

More than one
character

Ranges of characters where each
range has the same number of char
acters.

SEQS=('A'..'E',/V'..'Z')

00^\
60484800 C

3-7

A*ms
TABLE 3-3. ERROR LEVEL CODES, STATUS PARAMETER
Error Level

Code

No errors
Trivial

20

Warning

30

Fa ta l

40

Catastrophic

50

product and an unrecoverable error results, an
a b n o r m a l j o b t e r m i n a t i o n w i l l o c c u r. F o r e x a m p l e ,
if Sort/Merge called a product, such as Common
Memory Manager (CMM), and CMM processing results in
a n e r r o r, a t e r m i n a t i o n w i l l o c c u r. I f y o u o m i t
the STATUS parameter, no error status variable is
set, and Sort/Merge aborts if a catastrophic error
occurs. The STATUS parameter can be abbreviated as
ST.

SUM
T h e S U M p a r a m e t e r ( fi g u r e 3 - 1 7 ) s p e c i fi e s t h e
fields that are to be summed in records with equal
k e y v a l u e s . I n p u t fi l e s f o r a m e r g e w i t h s u m m i n g
must be presorted and pre summed. As many as 255
bytes can be summed. The records with all key
fields equal are combined into one new record, and
the other records with equal keys are deleted. The
o n e r e s u l t a n t r e c o r d c o n t a i n s t h e k e y fi e l d s a n d
t h e fi e l d s t h a t a r e t h e s u m s o f t h e s p e c i fi e d
fields from all the records with equal keys; a data
fi e l d t h a t i s n o t a k e y fi e l d o r a s u m fi e l d i s s e t
t o t h e c o r r e s p o n d i n g fi e l d f r o m o n e o f t h e o l d
records.

SUM = ((sum_def)[,(sum_def)] ...)
sum_def j (first.length [,type[,rep] ]) 1
[(range[,type[,rep]]) J
range

[ " fi r s t
1
[first., last J

first

First byte or bit of the sum field.

last

Last byte or bit of the sum field.

length

Number of bytes or bits in the sum field;
default is 1.

type

Name of a numeric data format (except
REAL); default is INTEGER.

rep

Number of fields to be summed; default
is 1.

Figure 3-17. SUM Parameter Format

3-8

A l l t h e fi e l d s t o b e s u m m e d m u s t c o n t a i n n u m e r i c
data; otherwise, the contents of the new fields are
u n d e fi n e d . T h e fi e l d s d e s c r i b e d a s s u m fi e l d s
cannot also be key fields.
I n fi g u r e 3 - 1 7 , a s u m _ d e f d e s c r i b e s a fi e l d t o b e I
summed by specifying the field length and position,
a numeric data format, and the number of fields to
b e s u m m e d . T h e fi e l d l e n g t h a n d p o s i t i o n a r e t h e
fi r s t b y t e o r b i t o f t h e fi e l d , a n d e i t h e r t h e
number of bytes or bits in the field (length of the
fi e l d ) , o r t h e l a s t b y t e o r b i t o f t h e fi e l d . Yo u
s p e c i f y fi r s t a n d l e n g t h ( o r l a s t ) a s i n t e g e r s ; t h e
leftmost byte and the leftmost bit in a record are
counted as number 1. First and length (or last)
refer to bytes except for formats BINARY_BITS and
I N T E G E R _ B I T S . Yo u m u s t s p e c i f y t h e fi r s t b y t e o r
b i t o f t h e s u m fi e l d . I f y o u d o n o t s p e c i f y o t h e r
w i s e i n t h e S U M p a r a m e t e r, t h e s u m l e n g t h i s
assumed to be I; sum length can be a maximum of 17 I

bytes.

I

Sum field type is the name of a numeric data format
except REAL; fields containing data in REAL format
cannot be summed. You must specify the sum field
type; no default exists. See section 2 for a list
o f n u m e r i c d a t a f o r m a t s . T h e n u m b e r o f fi e l d s t o
b e s u m m e d i s s p e c i fi e d a s a n i n t e g e r ; t h e d e fa u l t
i s 1 . I f y o u s p e c i f y m u l t i p l e fi e l d s w i t h o n e S U M
parameter, the fields must be consecutive, must be
the same length, and must contain the same type of
n u m e r i c d a t a * S u m fi e l d s c a n n o t o v e r l a p o n e
another. If a sum field contains no data because a
r e c o r d i s s h o r t , t h e s u m f o r t h a t fi e l d i s u n d e
fi n e d . I f y o u d o n o t s p e c i f y a s u m t y p e , t h e t y p e
is assumed to be INTEGER.

Figure 3-18 shows an example of a SUM parameter.
P a r t A o f fi g u r e 3 - 1 8 s h o w s t h e l a y o u t o f t h e
record containing the fields to be summed. Part B
shows three SUM parameters, each describing one
fi e l d t o b e s u m m e d . P a r t C s h o w s o n e e q u i v a l e n t
SUM parameter that describes the three consecutive
fields to be summed. Note that when you specify a
single value-set, two sets of parentheses are still
required.
I f t h e s u m m i n g o f t h e s p e c i fi e d fi e l d s r e s u l t s i n
n e w n u m e r i c v a l u e s t h a t d o n o t fi t i n t o t h e s u m
fi e l d s , a f a t a l e r r o r r e s u l t s . O n e o f t h e r e c o r d s
t h a t c a u s e d t h e o v e r fl o w i s d e l e t e d a s u s u a l , b u t
the sum field contents in the remaining record are
u n d e fi n e d . A d i a g n o s t i c m e s s a g e i n d i c a t i n g w h i c h
fi e l d c a u s e d t h e o v e r fl o w i s i s s u e d , a n d t h e j o b
step is terminated at the end of the sort (unless
you include the STATUS parameter).
You can specify the SUM parameter more than once in
a d i r e c t i v e fi l e . I f y o u o m i t t h e S U M p a r a m e t e r,
records with equal key values are not automatically
c o m b i n e d i n t o s i n g l e r e c o r d s . Yo u c a n n o t s p e c i f y
both the SUM parameter and an owncode 5 routine for
t h e s a m e s o r t o r m e r g e . Yo u c a n n o t s p e c i f y b o t h
the RETAIN parameter and the SUM parameter in the
same sort or merge. If you do specify both, a
catastrophic error occurs.

60484800 U

A&$S

■*mts

A. Record Layout
1

j0ms

10

15

Student number
(sort key)

20

Number of
units registered

Number of
units completed

25
Grade points

B. SUM Parameters
SUM=((11,5.INTEGER))
SUM=((16,5,INTEGER))
SUM=((21,5,INTEGER))
C. SUM Parameter
SUM=((11,5,INTEGER,3))
Figure 3-18. SUM Parameter Example

0^^s

VERIFY
T h e V E R I F Y p a r a m e t e r ( fi g u r e 3 - 1 9 ) d i r e c t s S o r t /
Merge to check merge input records for correct
o r d e r. T h i s p a r a m e t e r a p p l i e s o n l y i f y o u a r e
performing a merge. If a merge input record is out
of order when you have specified VERIFY=YES, the
m e r g e i s t e r m i n a t e d ( r e g a r d l e s s o f t h e S TAT U S
parameter) and a diagnostic message is issued. If
VERIFY=N0, merge input records are not checked for
c o r r e c t o r d e r. O m i t t i n g t h e V E R I F Y p a r a m e t e r i s
e q u i v a l e n t t o V E R I F Y = N 0 . Yo u c a n s p e c i f y V E R
instead of VERIFY, and Y or N instead of YES or
NO. The VERIFY parameter is ignored if you are
performing a sort.
VERIFY=YES

(or VER=Y)

VERIFY=NO

(or VER=N)

Figure 3-19. VERIFY Parameter Format

FASTIO
T h e FA S T I O p a r a m e t e r ( fi g u r e 3 - 2 0 ) s p e c i fi e s t h a t
I certain sort input and output records are to be
read and written directly by Sort/Merge rather than
by means of CYBER Record Manager (CRM). The FASTIO
parameter is ignored during a merge. Files
processed by the FASTIO parameter must reside on
m a s s s t o r a g e . T h e r e c o r d s i n t h e s e fi l e s m u s t b e
block type C and record type F, or block type I and
record type W (see the CRM Basic Access Methods
reference manual for detailed information). All
i n p u t fi l e s m u s t h a v e i d e n t i c a l r e c o r d t y p e s a n d
r e c o r d l e n g t h s . I f t h e fi l e r e s i d e s o n t a p e , o r i f
the records are not ail the same type and length, a
warning diagnostic is issued and the FASTIO option
i s c a n c e l e d . T h e fi l e s a r e t h e n p r o c e s s e d u s i n g
CRM. Sort/Merge obtains block and record type
i n f o r m a t i o n f r o m t h e fi l e i n f o r m a t i o n t a b l e ( F I T ) ;
a FILE control statement is not ignored.
S p e c i f y i n g t h e FA S T I O p a r a m e t e r r e s u l t s i n
increased speed, but not all errors are diagnosed;
use this parameter when you are sure your files are
correctly written and described.

60484800 D

FASTIO=YES

(or FASTIO=Y)

FASTIO=NO

(or FASTIO=N)

Figure 3-20. FASTI O Parameter Format
If FASTI0=YES, all sort input and output files with |
block type C and record type F, or block type 1 and
r e c o r d ty p e W, a r e r e a d d i r e c tl y by Sort/Merge. If
F A S T I 0 = N 0 , a l l s o r t i n p u t a n d o u t p u t fi l e s a r e |
processed using CRM. Omitting the FASTIO parameter
is equivalent to FASTI0=N0. You can specify Y or N
instead of YES or NO.

SPECIFYING PARAMETERS
BY POSITION
You can specify any of the Sort/Merge parameters in
a c o n t r o l s t a t e m e n t o r i n a d i r e c t i v e fi l e w i t h o u t
a keyword by supplying a value in the position
a s s i g n e d t o t h a t p a r t i c u l a r k e y w o r d . Ta b l e 3 - 4
lists the parameter keywords and the position
assigned to each. Omitted parameters are replaced
by commas. For example, the following control
statements are equivalent:
S0RT5.INFL,0UTFL,5..9,,,,F
SORTS.FR0M=INFL,T0=0UTFL,KEY=5..9,EL=F
The two preceding control statements specify that
r e c o r d s t o b e s o r t e d a r e i n t h e fi l e 1 N F L , a n d
s o r t e d r e c o r d s a r e t o b e w r i t t e n t o fi l e O U T F L .
T h e s o r t k e y fi e l d b e g i n s w i t h t h e fi f t h c h a r a c t e r
of each record, and the last character of the key
fi e l d i s t h e n i n t h c h a r a c t e r o f t h e r e c o r d . F a t a l
and catastrophic errors are to be reported.
Yo u c a n m i x k e y w o r d s p e c i fi c a t i o n a n d p o s i t i o n a l
s p e c i fi c a t i o n o f p a r a m e t e r s i n t h e s a m e c o n t r o l
s t a t e m e n t o r d i r e c t i v e fi l e . w h e n e v e r y o u s p e c i f y
a parameter with a keyword, the parameter retains
its position number (table 3-4). Any positional
parameters you specify after a keyword parameter
are numbered according to the position number of

3-9

TABLE 3-4. PARAMETER POSITIONAL ORDER
Parameter
Keyword

Position
Number

t h e l a s t k e y w o r d p a r a m e t e r y o u s p e c i fi e d . T h e
following example illustrates mixing keyword and
positional parameters:
/^^%V

S0RT5.DIR=DIRFIL,,,,,,6000,RET=Y,,,,,EFG
The DIR parameter is position number 4. Commas
replace parameters 5 through 9. The estimated
number of records (6000) is position number 10.
Numbering begins again with a keyword parameter
(RETAIN number 22). Commas replace parameters 23
through 26. The positional value EFG is the status
variable (STATUS number 27).

FROM

TO
KEY
DIR
L

FILE CONTROL STATEMENT

Reserved for
future use

U n l e s s d e f a u l t c h a r a c t e r i s t i c s a p p l y f o r a fi l e ,
you must specify the characteristics of all input
and output data files named in a S0RT5 or a MERGE
c o n t r o l s t a t e m e n t , o r i n a d i r e c t i v e fi l e , w i t h a
CYBER Record Manager (CRM) FILE control statement.
FILE control statements must precede the S0RT5 or
the MERGE control statement. The format of the
FILE control statement is shown in figure 3-21.

E
EL
DIALOG

3-10

ENR

10

Reserved for
future use

11

FILE{rm[,keyword=option] . . . )

Reserved for
future use

12

l f n L o g i c a l fi l e n a m e ; 1 t o 7 l e t t e r s o r
digits, beginning with a letter.

OWNF

13

OWNFL

14

OWNMRL

15

Figure 3-21. FILE Control Statement Format

Reserved for
future use

16

0WN1

17

0WN2

18

0WN3

19

0WN4

20

0WN5

21

RETAIN

22

T h e fi l e i n f o r m a t i o n t a b l e ( F I T ) i s a t a b l e t h r o u g h
which file characteristics are communicated to CRM
Basic Access Methods; the FIT contains information
t h a t d e s c r i b e s t h e fi l e a n d s p e c i fi e s h o w t h e fi l e
i s a c c e s s e d . Yo u s e t F I T fi e l d s b y s p e c i f y i n g t h e
s y m b o l i c n a m e o f t h e fi e l d i n t h e F I L E c o n t r o l
statement and selecting one of the options associ
a t e d w i t h t h a t fi e l d . S e v e r a l F I T fi e l d s i m p o r t a n t
to Sort/Merge processing are discussed in the
following paragraphs. The CRM Basic Access Methods
reference manual contains a complete list of all
F I T fi e l d s a n d o p t i o n s t h a t y o u c a n s e l e c t . N o t e
t h a t s p e c i fi c a t i o n o f c e r t a i n F I T fi e l d s c a n
r e q u i r e s e t t i n g o f a d d i t i o n a l F I T fi e l d s .

SEQA

23

SEQN

24

SEQR

25

SEQS

26

STATUS

27

SUM

28

Reserved for
future use

29

VERIFY

30

FASTIO

31

keyword-option Symbolic name of the file information
table (FIT) field and the option
selected.

I n p u t fi l e s t o b e s o r t e d o r m e r g e d , a n d o u t p u t
fi l e s t o w h i c h s o r t e d o r m e r g e d r e c o r d s a r e w r i t
ten, must be sequential files (records are read and
w r i t t e n i n o r d e r o n e a f t e r t h e o t h e r ) . T h e fi l e
o r g a n i z a t i o n ( F O ) F I T fi e l d c a n b e i n c l u d e d i n the
FILE control statement and sequential organization
specified (F0=SQ); you can omit this parameter and
sequential organization is assumed.
S e q u e n t i a l fi l e s a r e o r g a n i z e d i n t o g r o u p s o f
r e c o r d s c a l l e d b l o c k s . B l o c k t y p e i s s p e c i fi e d
w i t h t h e b l o c k t y p e ( B T ) F I T fi e l d . T h e d e f a u l t i s
B T = C . C R M a l s o o ff e r s s e v e r a l r e c o r d t y p e s , a n d
any of these record types except U can be sorted or
m e r g e d . R e c o r d t y p e i s s p e c i fi e d w i t h t h e r e c o r d
t y p e ( R T ) F I T fi e l d . T h e d e f a u l t i s R T = Z . T h e
full length (FL) or maximum record length (MRL) FIT
field must be set to establish the number of char
acters in a record. The default is FL=150 or

60484800 D

/^^%.

MRL=150. The default is also a satisfactory
description for records of less than 150 char
a c t e r s . I f y o u h a v e a n y fi l e s o f c o n s i d e r a b l y l e s s
than 150 characters (25 characters for example),
S o r t / M e r g e c a n p e r f o r m m o r e e f fi c i e n t l y i f y o u
include a FILE control statement.
D e f a u l t C R M c h a r a c t e r i s t i c s a p p l y f o r t h e fi l e s
INPUT, OUTPUT, and PUNCH. You do not need to
include FILE control statements for these files.
Ta b l e 3 - 5 s u m m a r i z e s t h e
tics for Sort/Merge input
d i r e c t i v e fi l e s , t h e e r r o r
the files INPUT, OUTPUT, and

d e f a u l t fi l e c h a r a c t e r i s
a n d o u t p u t d a t a fi l e s ,
a n d l i s t i n g fi l e s , a n d
PUNCH.

SPECIFYING MAXIMUM
RECORD LENGTH
U n l e s s d e f a u l t c h a r a c t e r i s t i c s a p p l y f o r a fi l e ,
Sort/Merge requires that you specify maximum record
l e n g t h f o r i n p u t a n d o u t p u t d a t a fi l e s . Y o u
specify maximum record length by setting the FL or
M R L F I T fi e l d i n t h e F I L E c o n t r o l s t a t e m e n t . S e t
the FL FIT field for F or Z type records to specify
t h e l e n g t h o f e a c h r e c o r d ( i f RT = F ) , o r t h e u p p e r
limit of characters in a record (if RT=Z). For all
o t h e r r e c o r d t y p e s , s e t t h e M R L F I T fi e l d t o
specify the maximum length of a record.

FIELD LENGTH REQUIREMENTS
Large sort or merge operations can require
additional central memory. The memory needed for a
merge is directly proportional to the number of the
i n p u t fi l e s y o u h a v e , b e c a u s e a l l fi l e s a r e s i m u l -

r

60484800 D

t a n e o u s l y o p e n . T h e d e f a u l t fi l e b u ff e r s i z e ( B F S )
i s 2 0 0 1 g w o r d s . Yo u c a n c h a n g e t h i s v a l u e w i t h
FILE control statement to save memory.
TABLE 3-5. FILE CHARACTERISTICS
>w
FIT
^sField
File

BT

RT

FL

^"s.

FROM files

FL<150

T O fi l e

FL<150

D I R fi l e s

FLO00

L fi l e

FL=132

E fi l e

FL=72*

INPUT

FL=80

OUTPUT

FL=»140

PUNCH

FL=80

' I f E = 0 U T P U T, F L = 1 4 0 i s u s e d .

LISTINGS
If an error occurs during the sort or merge, the
message S0RT5 - USER ERROR, JOB ABORTED is sent to
y o u r j o b d a y fi l e . O t h e r w i s e , w h e n t h e s o r t o r
merge is complete, a message indicating the number
of records sorted or merged is sent to the dayfile.

3-11

INTERACTIVE USE

Sort/Merge capabilities are available interac
tively; you can specify any of the Sort/Merge
parameters from your terminal. Sort/Merge also
provides a tutorial dialog to aid in specifying
parameters. This section describes the use of this
dialog, Sort/Merge interactive commands, and login
and logout processes. The complete text of the
dialog is included in appendix E.
In interactive mode, control statements cannot be
continued on more than one line. Instead, you can
e i t h e r c r e a t e a d i r e c t i v e fi l e o r u s e a p r o c e d u r e
fi l e s o y o u c a n u s e a t e x t e d i t o r t o v e r i f y o r
change complex sort specifications.

PASSWORD:
Enter the 4- to 7-character password
assigned to you to provide access security;
some terminals overtype to preserve privacy.
termnam-APPLICATION:
E n t e r I A F ( f o r I n t e r a c t i v e F a c i l i t y, t h e
network software that provides you with the
time-sharing capabilities of NOS); termnam
r e p r e s e n t s t h e t e r m i n a l i d e n t i fi c a t i o n .
JSN: zzzz, NAMIAF
CHARGE NUMBER:
JSN: zzzz, NAMIAF
READY.

TERMINAL ACCESS TO
SORT/MERGE
To access Sort/Merge from your terminal, you first
establish the physical connection between the
t e r m i n a l a n d t h e c o m p u t e r. T h e m e t h o d o f e s t a b
lishing the connection varies depending on the type
of terminal and the coupling between the terminal
and computer. Consult the NOS Version 2 Reference
S e t , Vo l u m e 1 ( f o r N O S u s e r s ) o r t h e I N T E R C O M
reference manual (for NOS/BE users) for information
on connection methods.
Connecting your terminal to the computer initiates
the login process. The operating system, either
N O S o r N O S / B E , i d e n t i fi e s i t s e l f t o y o u , a n d y o u
must supply information that indicates you are a
valid system user.

yms

If a charge number is requested, enter your
assigned charge number and project number.
The system will then respond with READY.
T h e l o g i n p r o c e d u r e i s n o w c o m p l e t e . Yo u
can then enter the batch subsystem. Do not
change to ASCII mode since Sort/Merge does
not process data in this mode.
Figure 4-1 shows an example of a NOS login. You
are now ready to perform sort or merge operations
as described later in this section.
82/01/08. 10.42.16. T143A
CDC NOS 2
FAMILY:
USER NAME: xxxxxxx
PASSWORD: xxxx
T143A - APPLICATION: iaf
JSN: AADI, NAMIAF
CHARGE NUMBER:

? $X*&£@ftK

LOGGING IN UNDER NOS

PROJECT NUMBER:

The login procedure to NOS begins with initial
information from the system (including date, time,
terminal name, installation name, and operating
system version). The second line of this informa
t i o n i s d e p e n d e n t o n t h e i n s t a l l a t i o n . Yo u a r e
then prompted to enter information to indicate you
are a valid system user. The prompts and required
responses are as follows:

READY,
/batch
RFL,0.

/

Figure 4-1. NOS Login Example

FAMILY:
Enter the family name of
device that contains your
Some installations do not
name; the family name is
for the system.

the mass storage
p e r m a n e n t fi l e s .
request a family
the default family

USER NAME:

00"*S

Enter the user name assigned to you by your
system administrator.

60484800 B

LOGGING IN UNDER NOS/BE
As soon as your terminal is connected to the
system, the system responds with a message indi
cating date, time, and the INTERCOM version number
(INTERCOM is the software that directs the flow of
data between your terminal and the central site
computer). The system requests the following:
PLEASE LOGIN

4-1

Enter LOGIN. You are then prompted for validation
information. The prompts and required responses
are as follows:
ENTER USER NAMEEnter the user name assigned to you by your
system administrator.
J3GSmQQQQCKX ENTER PASSWORDEnter the password (up to 10 letters and
digits) assigned to you to provide access
security; some terminals overtype to pre
serve privacy.
When the user number and password are accepted, a
2-character user code and the login time, followed
by the equipment number and port number, are dis
played or printed at your terminal. The message
COMMAND- appears, indicating the login process is
complete. Figure 4-2 shows an example of NOS/BE
login. You are now ready to perform sort or merge
operations as described in the following subsection.
CONTROL DATA INTERCOM 5.0
D AT E 0 1 / 2 3 / 8 1
TIME 09.35.50.
PLEASE LOGIN
Login
ENTER USER NAME-sort
HtiMftttfcnr ENTER PASSWORD-

01/23/81 LOGGED IN AT 09.36.23.
WITH USER-ID OK
EQUIP/PORT 63/076
LOGIN CREATED 01/21/81 TODAY is 01/23/81
C0MMANDFigure 4-2. NOS/BE Login Example

INTERACTIVE DIALOG
Sort/Merge provides an interactive dialog to aid In
specifying parameters. The tutorial dialog is
designed to guide you, step by step, through your
s o r t o r m e r g e s p e c i fi c a t i o n . Yo u c a n s p e c i f y a n y
control statement sort or merge, including a sort
or merge with owncode routines and a nonstandard
collating sequence, using the interactive dialog.
After login is complete, and before beginning the
dialog, you must assign any files used in your sort
o r m e r g e ( fi l e s c o n t a i n i n g i n p u t r e c o r d s t o b e
s o r t e d , o w n c o d e r o u t i n e s , o r p r e s o r t e d fi l e s t o b e
merged) to your terminal with an ATTACH command or
the equivalent. You must enter CYBER Record Man
ager (CRM) FILE control statements for any of your
fi l e s t h a t a r e n o t w r i t t e n i n s t a n d a r d u n i t r e c o r d
f o r m a t . S t a n d a r d u n i t r e c o r d f o r m a t fi l e s i n c l u d e
fi l e s c r e a t e d b y p u n c h e d c a r d s i n a b a t c h j o b o r

4-2

l i n e s e n t e r e d a t a t e r m i n a l , a n d t h e s p e c i a l fi l e s
INPUT, OUTPUT, and PUNCH. CRM defines these files
as block type C (BT=C) and record type Z (RT=Z).
Sort/Merge assumes each record contains 150 char
a c t e r s o r l e s s . I f y o u h a v e a n y fi l e s o f c o n s i d e r
ably less than 150 characters (25 characters for
e x a m p l e ) , S o r t / M e r g e c a n p e r f o r m m o r e e f fi c i e n t l y
if you enter a FILE control statement. See your
operating system reference manual for information
about retrieving permanent files and the CRM Basic
Access Methods reference manual for information
about FILE control statements.
For NOS/BE users, Sort/Merge automatically connects
and disconnects files INPUT and OUTPUT; Sort/Merge
writes the dialog to OUTPUT, which is displayed or
p r i n t e d a t y o u r t e r m i n a l . Yo u r d i a l o g r e s p o n s e s
are read from INPUT.
NOTE
Before entering a S0RT5 or MERGE command
w i t h t h e D I A L O G p a r a m e t e r, e n s u r e t h a t
your terminal is in normal mode by enter
ing the NORMAL terminal command. If your
terminal is in ASCII mode during the
interactive dialogue, Sort/Merge cannot
recognize your responses unless you enter
them using uppercase letters only.
If you are already in the dialog, and need
to change the terminal mode, enter a
control-T to return to the system.
The interactive dialog begins when you type
S0RT5.DIAL0G=YES or MERGE. DIALOG=YES. Any other
p a r a m e t e r s ( e x c e p t S TAT U S ) t h a t y o u e n t e r a l o n g
with DIALOG are ignored. During the dialog, Sort/
Merge asks various questions, one at a time, and
your response to each question determines the next
question. For example, Sort/Merge asks if you have
just one input file and no 0WN1 or 0WN2 subrou
tines. If you enter YES, the next question requests
t h e n a m e o f y o u r i n p u t fi l e . I f y o u e n t e r N O , t h e
next question asks if you have an 0WN1 subroutine.
The expected response to each question is evident
from the question. For example, one question asks
how many key fields you have; you enter a number.
For questions requiring yes or no answers, you can
type YES or Y, or NO or N. If you make a mistake
(misspell the word yes, for example), Sort/Merge
gives you an explanation of the expected answer and
a s k s th e q u e s ti o n a g a i n . If y o u e n te r a n i n c o rrect
answer a second time, Sort/Merge asks you if you
want help. If you type YES, an explanation of
Sort/Merge usage is displayed or printed at your
terminal. If you do not want help and type NO, the
original question is repeated. Figure 4-3 shows an
example of this sequence.
The last question Sort/Merge asks is how many
records are to be sorted or merged. After you
e n t e r t h e a p p r o p r i a t e n u m b e r, S o r t / M e r g e i n f o r m s
y o u t h a t t h e s o r t o r m e r g e y o u h a v e s p e c i fi e d i s
beginning. When the sort or merge is complete,
control of your terminal is returned to the oper
ating system; the operating system prompt for input
appears (/ under NOS, COMMAND- under NOS/BE).

60484800 D

/<^K

/sort5.dialog=yes-*
IS YOUR TERMINAL ALREADY SET TO NORMAL MODE OR UPPERCASE
ASCIII MODE. ALSO, ARE YOU SURE THAT ALL YOUR FILES (IF ANY)
ARE EITHER STANDARD UNIT RECORD FORMAT OR HAVE HAD FILE
CONTROL STATEMENTS SPECIFIED FOR THEM
? yes
DO YOU HAVE JUST ONE INPUT FILE AND NO OWN1 OR OWN2 SUBROUTINES
? no
DO YOU HAVE AN OUN1 SUBROUTINE
?

yg«»

ti

Incorrect response.
Question asked again.
Second incorrect response.

.

DO YOU HAVE AN OWN1 SUBROUTINE ** .
?

yse -* .
DO YOU WANT HELP
? y

>^*v

Begin interactive dialog.

SINCE YOU DID NOT SAY "NO" YOU ARE GOING TO BE HELPED. **
Help after second incorrect response.
■Y» IS THE SAME AS 'YES' AND 'N' IS THE SAME AS 'NO'.
TYPE 'RESTART' TO GO BACK TO THE BEGINNING.
TYPE 'QUIT' TO STOP RUN.
THE OWN1 ROUTINE CAN BE USED TO PROCESS INPUT RECORDS. A DETAILED DESCRIPTION
OF THIS OWNCODE ROUTINE IS IN THE SORT/MERGE REFERENCE MANUAL.
DO YOU HAVE AN OWN1 SUBROUTINE^ .
- Question asked again.
? yse
DO YOU HAVE AN OWN1 SUBROUTINE
? yse
DO YOU WANT HELP
? no
DO YOU HAVE AN OWN1 SUBROUTINE-*
No help after second incorrect
? yes
response; question asked again.
Figure 4-3. Incorrect Response Example

I f s o r t e d o r m e r g e d r e c o r d s a r e w r i t t e n t o a fi l e
(not processed by an owncode routine), Sort/Merge
c r e a t e s a l o c a l fi l e a n d g i v e s t h i s fi l e t h e n a m e
you entered in response to the question "What is
the name of your output file?" Upon completion of
the sort or merge, you can display or print this
fi l e a t y o u r t e r m i n a l , o r r o u t e t h e fi l e t o a
p r i n t e r t o b e l i s t e d . I f y o u w a n t t o u s e t h e fi l e
at a later time, you must save it as a permanent
fi l e b e f o r e l o g g i n g o u t ; o t h e r w i s e , t h e fi l e i s
l o s t . F i g u r e 4 - 4 s h o w s a n e x a m p l e o f o u t p u t fi l e
disposition.

After the explanation, the question Sort/Merge
asked you immediately before you entered the HELP
command is asked again, resuming the dialog.

INTERACTIVE COMMANDS

QUIT

Several c o m m a n d s e x i s t t o c o n t r o l th e u s e o f t h e
i n t e r a c t i v e d i a l o g . T h e s e c o m m a n d s a r e H E L P,
RESTART, and QUIT. A command can be entered at any
time during the dialog, but HELP, RESTART, and QUIT
cannot be the names of user-supplied entities such
a s fi l e s a n d c o l l a t i n g s e q u e n c e s . U s e o f t h e
commands is described in the following paragraphs.
HELP

I f y o u t y p e Q U I T, t h e i n t e r a c t i v e d i a l o g i s t e r
minated. The sort or merge is not performed, and
control of your terminal is returned to the oper
a t i n g s y s t e m . Yo u c a n t h e n p e r f o r m o t h e r t e r m i n a l
o p e r a t i o n s o r l o g o u t . I f p e r m a n e n t fi l e s c o n
taining input records to be sorted or merged, or
owncode routines have been assigned to your job,
you should release these files by using the RETURN
command (see your operating system reference
manual)*

I f y o u t y p e H E L P, a n e x p l a n a t i o n o f S o r t / M e r g e
usage is displayed or printed at your terminal.

Figure 4-5 shows an example of interactive command
use*

60484800 D

RESTART
I f y o u t y p e R E S TA R T, t h e i n t e r a c t i v e d i a l o g i s
started over at the beginning. All. previous
a n s w e r s t o q u e s t i o n s a r e d i s c a r d e d . Yo u c a n u s e
this command if you give Sort/Merge incorrect
information such as the wrong number of key fields.

4-3

/sort5.dialog=yes

Begin interactive dialog.

WHAT IS THE NAME OF YOUR OUTPUT FILE
? srtout «

Local file created for sorted output.

THANK YOU SORT/MERGE NOW BEGINS.
S O RT 5 . d i a L o g = Y E S —
/copysbf,srtout,output -*1REYES
S L 100246031558ANTHRO
MAYER
M I 100991122359ANTHR0
CHARLES
S H 101418032459ANTHR0
MARTIN
R C 100955082157ART
NEECE
M L 9 9 9 111 2 1 3 5 8 A R T

Dialog completion; sort begins.
NOS repeats control statement (up to 48 characters)
D i s p l a y o r p r i n t s o r t e d fi l e .

3341
2382
2453
2891
2291

File SRTOUT.
L A S E U R P T 100678042256PSYCH
SUGARMAN B T 100528070457SOC
S M I T H F R 101062120758SOC
DOUGLAS M L 101325071558UNDEC
O K A D A N A 100103111750UNDEC
EOI ENCOUNTERED,
/rewind,srtout
REWIND,SRTOUT.
/ c o p y s b f , s r t o u t , m y fi I
EOI ENCOUNTERED,
/route,myf i L,dc=pr -*ROUTE COMPLETE,
/save,srtout —

2233
3501
2913
2585
2225

Copy sorted file to be listed by printer.
Route copy of sorted file to printer.
Make sorted file a permanent file.

Figure 4-4. Output File Disposition Example

I *-*

60484800 D

jm&s

/sort5.dia Log=yes
Begin interactive dialog.
IS YOUR TERMINAL ALREADY SET TO NORMAL MODE OR UPPERCASE
ASCII MODE. ALSO, ARE YOU SURE THAT ALL YOUR FILES (IF ANY)
ARE EITHER STANDARD UNIT RECORD FORMAT OR HAVE HAD FILE
CONTROL STATEMENTS SPECIFIED FOR THEM
? y
YOU HAVE JUST ONE INPUT FILE AND NO OWN1 OR 0WN2 SUBROUTINES
? n
DO YOU HAVE AN OWN1 SUBROUTINE
? y
WHAT IS THE NAME OF THE FILE CONTAINING YOUR OWNCODE SUBROUTINE(S)
? myrthns
WHAT IS THE NAME OF YOUR OWN1 SUBROUTINE
?
restart-*
Command
entered.
IN RESPONSE TO YOUR REQUEST RESTART HAS BEEN INITIATED.
IS YOUR TERMINAL ALREADY SET TO NORMAL MODE OR UPPERCASE )
ASCII MODE. ALSO, ARE YOU SURE THAT ALL YOUR FILES (IF ANY)
Dialog started over
ARE EITHER STANDARD UNIT RECORD FORMAT OR HAVE HAD FILE
at beginning.
CONTROL STATEMENTS SPECIFIED FOR THEM
? y
DO YOU HAVE JUST ONE INPUT FILE AND NO OWN1 OR OWN2 SUBROUTINES
? n
DO YOU HAVE AN OWN1 SUBROUTINE
? y
WHAT IS THE NAME OF THE FILE CONTAINING YOUR OWNCODE SUBROUTINE(S)
? ownsrtn
WHAT IS THE NAME OF YOUR OWN1 SUBROUTINE
? myrtn
DO YOU HAVE AN 0WN2 SUBROUTINE
?
help
—■
Command
entered.
*Y' IS THE SAME AS 'YES' AND 'N' IS THE SAME AS 'NO'. ^
TYPE
' R E S TA RT '
TO
GO
BACK
TO
THE
BEGINNING.
J
„
TYPE
'QUIT'
TO
STOP
RUN.
>
USa9e
..
THE OWN2 ROUTINE CAN BE USED TO PROCESS INPUT FILES. A DETAILED DESCRIPTION 1 exPlanar,on
OF THIS OWNCODE ROUTINE IS IN THE SORT/MERGE REFERENCE MANUAL. /
DO YOU HAVE AN 0WN2 SUBROUTINE
?
quit-*
Conmand
entered.
sort/merge
is
quitting.-*
Sort/Merge
terminated.
Figure 4-5. Interactive Command Example

r

60484800 D

4-4.1/4-4.2

SPECIFYING PARAMETERS
INTERACTIVELY
Yo u c a n s p e c i f y a n y o f t h e S o r t / M e r g e p a r a m e t e r s
f r o m y o u r t e r m i n a l i n a S 0 RT 5 o r M E R G E c o n t r o l
statement. After you login, assign all necessary
fi l e s ( i n c l u d i n g d i r e c t i v e fi l e s ) t o y o u r j o b , a n d
t y p e i n F I L E c o n t r o l s t a t e m e n t s f o r fi l e s w i t h
o t h e r t h a n d e f a u l t c h a r a c t e r i s t i c s . Yo u e n t e r
S0RT5 or MERGE followed by parameters In one of the
following forms:
S0RT5.pl,p2,...,pn
MERGE.plA p2A ...A pn
In the preceding example, p represents a processing
parameter. Parameters must be separated by commas

0^S

or spaces; commas and spaces can be used inter
c h a n g e a b l y. Yo u c a n e n t e r t h e c o n t r o l s t a t e m e n t
and parameters in input line character positions 1
t h r o u g h 8 0 . I f y o u r s o r t o r m e r g e s p e c i fi c a t i o n I s
longer than 80 characters, you must use a directive
fi l e f o r t h e a d d i t i o n a l p a r a m e t e r s .
Figure 4-6 shows an example of specifying param
e t e r s i n t e r a c t i v e l y.

LOGGING OUT
To end your terminal session, you type GOODBYE,
BYE, or LOGOUT if you are using the Interactive
Facility of NOS. If you are using INTERCOM under
NOS/BE, you type LOGOUT. Under either system, a
message indicating that you are logged out is dis
played or printed at your terminal.

/attach,univer -*
/ fi l e ( u n i v e r , b t = c , r t = z , fl = 3 8 )
F I L E ( U N I V E R , B T = C , RT = Z , F L = 3 8 )
/ fi l e ( o o u t , b t = c , r t = z , f 1 = 3 8 ) \
F I L E ( 0 0 U T, B T = C , R T = Z , F L = 3 8 ) ;
/ s o r t 5 . f r o m = u n i v e r , t o = o o u t , k e y = ( ( 3 5 , 3 , a s c i i 6 , d ) ) - *■
S 0 R T 5 . F R 0 M = U N I V E R , T 0 = 0 0 U T, K E Y = ( ( 3 5 , 3 , A S C I 1 6 , D ) ) —

Input file assigned to the job.
FILE control statements for input
and output files because records
are only 35 characters in length.
-- S0RT5 control statement entered.
— NOS repeats control statement
to 48
characters).
— (up
Control
returns
to NOS operating system.

Figure 4-6. Interactive Parameter Specification Example

i0&s.

60484800 B

4-5

r%

PROCEDURE CALLS

Sort/Merge also exists as a set of procedures; a
sort or merge can be invoked from within a program
by a sequence of procedure calls. The procedures
can be called from FORTRAN or by a program in any
l a n g u a g e t h a t u s e s t h e s t a n d a r d F O RT R A N c a l l i n g
sequence. The same type of Sort/Merge processing
is available through the procedures as is available
through the S0RT5 or the MERGE control statement;
the procedure calls closely correspond to the
Sort/Merge parameters. This section describes the
procedure calls; COBOL programmers should see
section 6 for information on calling the procedures.

0?*^.

All conventions for coding FORTRAN statements must
be observed in procedure calls (see the FORTRAN 5
reference manual). You must assign any permanent
files named in procedure calls to your job with an
ATTACH command (or the equivalent) in the control
statement section of the job. The procedures
cannot be used in a static memory management
environment. A merge could require twice as much
m a s s s t o r a g e f o r i n t e r m e d i a t e m e r g e fi l e s a s i s
r e q u i r e d f o r t h e m e r g e i n p u t fi l e s .
A l l fi l e s t o b e s o r t e d , o r p r e s o r t e d fi l e s t o b e
m e r g e d , m u s t b e s e q u e n t i a l fi l e s . T h e d e f a u l t fi l e
characteristics are block type C, record type Z,
and full length of 150 characters or less. For
fi l e s w i t h o t h e r b l o c k t y p e s a n d r e c o r d t y p e s , y o u
must include CYBER Record Manager (CRM) FILE
control sta te m e n ts i n th e c o n tr o l s ta te m e n t s e c ti o n
of your job. See the CRM Basic Access Methods
reference manual for information on block types and
record types.
The procedures can be called in any order with two
exceptions: SM5S0RT or SM5MERG must be the first
procedure called, and SM5END must be the last
procedure called. Sort/Merge collects processing
information until SM5END is called; the sort or
merge is t h e n p e r f o r m e d . U n l e s s s t a t e d o t h e r w i s e ,
a procedure can be called only once during a sort
or merge. Refer to section 7 for information on
owncode routines, which are mentioned in the
descriptions of several of the procedures.

SM5SORT
Execution of the SM5S0RT procedure signals the
b e g i n n i n g o f a s o r t s p e c i fi c a t i o n . T h e S M 5 S 0 R T
procedure must be the first procedure called for a
sort. The format of the SM5S0RT call is shown in
fi g u r e 5 - 1 .
CALL SM5SORT(option)
option Result array name (1 to 7 letters or digits,
beginning with a letter) or the integer 0.
Figure 5-1. SM5SORT Format
The array associated with the SM5S0RT procedure is
a 16-element integer array that returns sort

60484800 A

statistics and results to your program when the
s o r t i s c o m p l e t e d . Yo u s e t t h e fi r s t e l e m e n t o f
the result array to the number of elements (as many
as 15) in which you want to receive information.
I f y o u s e t t h e fi r s t e l e m e n t t o 0 o r s p e c i f y C A L L
S M 5 S O RT ( 0 ) , n o s t a t i s t i c s o r r e s u l t s a r e r e t u r n e d .
The type of result that is returned in each element
is shown in table 5-1.
TABLE 5-1. RESULT ARRAY FORMAT
Array
Element
Number

Contents

1

Number of elements of results
you want returned (0 through
15)

2

Number of records read from
sort or merge input files

3

Number of records deleted by
an owncode 1 routine

4

Number of records inserted by
an owncode 1 routine

5

Number of records inserted by
an owncode 2 routine

6

Number of records sorted or
merged

7

Number of records deleted by
an owncode 3 routine

8

Number of records inserted by
an owncode 3 routine

9

Number of records inserted by
an owncode 4 routine

10

Reserved

11

Number of records deleted by
an owncode 5 routine

12

Number of records combined by
summing

13

Number of records written to
o u t p u t fi l e

14

Minimum record length in
characters

15

Average record length in
characters

16

Maximum record length in
characters

5-1

SM5MERG
Execution of the SM5MERG procedure signals the
beginning of a merge specification. The SM5MERG
procedure must be the first procedure called for a
merge. The format of the SM5MERG call is shown in
figure 5-2.

e n d - o f - r e c o r d o r e n d - o f - fi l e m a r k s ( s e e t h e C R M
Basic Access Methods reference manual).
If the SM5FR0M procedure is not called, records to
b e s o r t e d a r e r e a d f r o m t h e fi l e O L D ( u n l e s s a n
owncode routine supplies records). An empty
SM5FR0M file results in a null sort. The SM5FR0M
file cannot be the same as the SM5T0 file.

CALL SM5MERG(option)

SM5TO

option Result array name (1 to 7 letters or digits,
beginning with a letter) or the integer 0.

Execution of the SM5T0 procedure specifies the file
to which sorted or merged records are written
(unless an owncode routine processes all records).
The format of the SM5T0 call is shown in figure 5-4.

Figure 5-2. SM5MERG Format
T h e i n p u t fi l e s f o r a m e r g e m u s t b e p r e s o r t e d .
I n p u t fi l e s f o r a m e r g e w i t h s u m m i n g m u s t b e
presorted and presummed.
The array asociated with the SM5MERG procedure is a
16-element integer array that returns merge statis
tics and results to your program when the merge is
c o m p l e t e d . Yo u s e t t h e fi r s t e l e m e n t o f t h e r e s u l t
array to the number of elements (as many as 15) in
which you want to receive information. If you set
the first element to 0 or specify CALL SM5MERG(0),
no statistics or results are returned. The type of
result that is returned in each element is shown in
table 5-1. Note that the array is not set by Sort/
Merge until the end of the merge.

SM5FROM
Execution of the SM5FR0M procedure specifies the
input files from which the records to be sorted or
merged are read. The format of the SM5FR0M call is
shown in figure 5-3.

CALL SMSFROMCfilel'I/file?:
'file'

File name; 1 to 7 letters or digits, beginning
with a letter.

CALL SM5TOCfile')
'file'

File name; 1 to 7 letters or digits, beginning
with a letter.
Figure 5-4. SM5TO Format

The file is not rewound before or after use unless
the name of the file is OUTPUT or a FILE control
s t a t e m e n t p a r a m e t e r s p e c i fi e s o t h e r w i s e . S o r t /
M e r g e a s s u m e s t h a t t h e fi l e y o u s p e c i f y w i t h t h e
SM5T0 procedure is CRM block type C and record type
Z with FL of 150 characters or less. If you
s p e c i f y a fi l e w i t h d i f f e r e n t c h a r a c t e r i s t i c s , y o u
must describe the file to Sort/Merge by including a
FILE control statement in the control statement
s e c t i o n o f y o u r j o b . Yo u s h o u l d o p e n t h e T O fi l e
before doing a sort or merge to be sure that
Sort/Merge gets passed the correct file attributes.
S o r t / M e r g e w r i t e s t h e fi l e d i r e c t l y, a n d t h e fi l e
is closed when the sort or merge is completed
u n l e s s t h e n a m e o f t h e fi l e i s I N P U T. I f y o u r
p r o g r a m a l s o r e a d s o r w r i t e s t h e fi l e , y o u m u s t
include an OPEN or REWIND statement in your program
a f t e r c a l l i n g t h e p r o c e d u r e s . I f t h e S M 5 TO p r o c e
d u r e i s n o t c a l l e d , r e c o r d s a r e w r i t t e n t o t h e fi l e
NEW (unless an owncode routine processes all
records). The SM5T0 file cannot be the same as the
SM5FR0M file.

Figure 5-3. SM5FROM Format
Yo u c a n s p e c i f y a s m a n y a s 1 0 0 fi l e s w i t h o n e
SM5FR0M procedure, or you can call the SM5FR0M
procedure as many as 100 times. The files are read
i n t h e o r d e r t h a t y o u s p e c i f y t h e m ; a fi l e c a n n o t
be specified more than once for a merge. The files
are rewound before and after use unless the name of
t h e fi l e i s I N P U T o r a F I L E c o n t r o l s t a t e m e n t
p a r a m e t e r s p e c i fi e s o t h e r w i s e . I f a fi l e i s o p e n
when Sort/Merge is called, it is not rewound after
use because the CF value in the FIT is undetermined.
Sort/Merge assumes that the files you specify with
the SM5FR0M procedure are CRM block type C and
record type Z with FL of 150 characters or less.
I f y o u s p e c i f y fi l e s t h a t h a v e d i ff e r e n t c h a r a c t e r
istics, you must describe these files to Sort/Merge
by including FILE control statements in the control
statement section of your job. You should open the
FROM files before doing a sort or merge to be sure
t h a t S o r t / M e r g e g e t s p a s s e d t h e c o r r e c t fi l e
a t t r i b u t e s . T h e fi l e s a r e n o t r e a d p a s t e m b e d d e d

5-2

SM5KEY
E x e c u t i o n o f t h e S M 5 K E Y p r o c e d u r e s p e c i fi e s a
s i n g l e k e y fi e l d f o r t h e s o r t o r m e r g e . T h e f o r m a t
of the SM5KEY call is shown in figure 5-5.

CALL SMSKEYffirst.length.'typeVad')
first

First byte or bit of the key field.

length

Number of bytes or bits in the key field.

'type'

Name of a numeric data format or collating
sequence.

'ad'

Order, either 'A' for ascending or 'D' for
descending.
Figure 5-5. SM5KEY Format

60484800 D

In the SM5KEY procedure call, you specify the first
byte or bit of the key field, the length of the
field in bytes or bits, the key type (the name of a
collating sequence or a numeric data format), and
the sort order. You must specify the key charac
teristics in the order shown.
Yo u s p e c i f y fi r s t a n d l e n g t h a s i n t e g e r s ; t h e
leftmost byte or bit in a record is counted as
number 1. For character data, each character is
six bits and occupies one byte. For numeric data,
first and length refer to bytes except for formats
BINARY_BITS and INTEGER_BITS. You must specify the
first byte or bit of a key field. If you do not
specify the length, length defaults to 1.
The key type is the name of a predefined collating
sequence or your own collating sequence defined by
SM5SEQx procedures, or the name of a numeric data
format. The name must be enclosed in apostrophes.
The default type is the ASCII6 collating sequence.
See section 2 for a list of predefined collating
sequences and numeric data formats.
J0&S

The sort order is either ascending or descending,
a n d y o u s p e c i f y ' A ' o r ' D ' , r e s p e c t i v e l y. T h e
default order is ascending. For numeric keys
sorted in ascending order, the record having the
key with the highest value is written last on the
output file. Ascending character keys are sorted
according to the collating sequence you specify.
For numeric keys sorted in descending order, the
record having the key with the lowest value is
w r i t t e n l a s t o n t h e o u t p u t fi l e . D e s c e n d i n g
character keys are sorted in reverse order of the
collating sequence you specify.
You can call the SM5KEY procedure as many as 100
times during a sort or merge to specify multiple
sort keys. Output records are sorted or merged
according to the key field described by the first
SM5KEY procedure called, then according to the key
field described by the second SM5KEY procedure
called, and so on. The total number of key char
acters must be less than 256 (if you also specify
sum fields, the total number of characters in the
key and sum fields together must be less than
256). Unless the SM5SEQA procedure is used, key
fields can overlap one another. If the SM5KEY
procedure is not called, the entire record is used
as a character key field, and the default key type
and sort order are used.

SM5E
Execution of the SM5E procedure specifies the file
to which diagnostic messages are written. The
format of the SM5E call is shown in figure 5-6.

c a l l e d , d i a g n o s t i c m e s s a g e s a r e w r i t t e n t o t h e fi l e
O U T P U T. I f y o u s p e c i f y t h e fi l e $ N U L L w i t h t h e
SM5E procedure, diagnostic messages are not written.

SM5EL
E x e c u t i o n o f t h e S M 5 E L p r o c e d u r e s p e c i fi e s t h e
error level to be reported. The format of the
SM5EL call is shown in figure 5-7.

CALL SM5EL(error-level)
error-level Alphabetic character enclosed in apostrophes
or integer (see table 5-2).

Figure 5-7. SM5EL Format
The error levels that you can select are shown in
t a b l e 5 - 2 . Yo u c a n s p e c i f y t h e a l p h a b e t i c c h a r a c
t e r e n c l o s e d i n a p o s t r o p h e s o r t h e i n t e g e r. F o r
example if you specify 'W' or 2, any warning,
fatal, and catastrophic error messages are re
p o r t e d . E r r o r s a r e w r i t t e n t o t h e fi l e s p e c i fi e d
by the SM5E procedure or, if the SM5E procedure is
n o t c a l l e d , t o t h e fi l e O U T P U T. I f t h e S M 5 E L
p r o c e d u r e i s n o t c a l l e d , e r r o r s o f l e v e l s T, W, F,
and C are reported. See appendix B for an explana
tion of the four levels of errors.
TABLE 5-2. ERROR LEVEL SPECIFICATION

Error Level

Errors Reported

'T' or 1

T, W, F, C

'W or 2

W, F, C

'F' or 3

F, C

'C or 4

C

SM5ENR
E x e c u t i o n o f t h e S M 5 E N R p r o c e d u r e s p e c i fi e s t h e
estimated number of records to be sorted or
merged. The format of the SM5ENR call is shown in
fi g u r e 5 - 8 .

CALL SM5ENR(integer)
CALL SM5E('file')
'file'

integer

Number of records to be sorted or merged;
0 to 1000000000.

File name; 1 to 7 letters or digits, beginning
with a letter.
Figure 5-8. SM5ENR Format
Figure 5-6. SM5E Format

The file is written in
f o r m a t . T h e fi l e i s
use unless a FILE
s p e c i fi e s r e w i n d . I f

60484800 D

CRM BT=C, RT=Z, and FL=72
not rewound before or after
control statement parameter
the SM5E procedure is not

The integer you specify is the approximate number
of records to be sorted or merged. If SM5ENR is
s p e c i fi e d a s l e s s t h a n 1 5 0 0 , S o r t / M e r g e u s e s l e s s
memory for the initial sort phase. This causes
noticeably less memory required for the entire sort
if the actual number of records is a low number.

5-3

SM5FAST
Execution of the SM5FAST procedure can specify that
certain sort input and output records are to be
read and written directly by Sort/Merge rather than
by means of CYBER Record Manager (CRM). The
SM5FAST procedure is ignored during a merge. The
format of the SM5FAST call is shown in figure 5-9.

The integer you specify is the exact number of
characters in each record; a catastrophic error
results if a record from an owncode routine does
not have the exact number of characters. If the
SM50FL procedure is not called, records from an
owncode routine can be no longer than the longest
a l l o w e d i n p u t o r o u t p u t r e c o r d . Yo u c a n n o t c a l l
both the SM50FL procedure and the SM50MRL procedure
in the same sort or merge.

CALL SM5FAST(option)
option

'YES' or 'Y'
IN©' or 'N'

Figure 5-9. SM5FAST Format

SM50MRL
Execution of the SM50MRL procedure specifies the
maximum length of any record from an owncode
routine. The format of the SM50MRL call is shown
in figure 5-12.

The option can be 'YES' or 'NO' (or 'Y' or 'N').
| If the option is 'YES', certain sort input and
output records are read and written directly by
Sort/Merge. If the option is 'NO', CRM is used.
F i l e s p r o c e s s e d b y t h e S M 5 FA S T p r o c e d u r e m u s t
reside on mass storage. The records in these files
must be block type C and record type F, or block
type I and record type W (see the CRM Basic Access
Methods reference manual for detailed infor
m a t i o n ) . A l l i n p u t fi l e s m u s t h a v e a n i d e n t i c a l
r e c o r d t y p e a n d r e c o r d l e n g t h . I f t h e fi l e r e s i d e s
on tape, or if the records are not all the same
type and length, a warning diagnostic is issued and
the SM5FAST option is canceled. The files are then
processed using CRM. Sort/Merge obtains block and
r e c o r d t y p e i n f o r m a t i o n f r o m t h e fi l e i n f o r m a t i o n
table (FIT); a FILE control statement is not
ignored. Calling the SM5FAST procedure with 'YES'
results in increased speed, but not all errors are
diagnosed; use this procedure when you are sure
your files are correctly written and described.

SM5NODA
Execution of the SM5N0DA procedure specifies that
Sort/Merge dayfile messages are to be suppressed.
The format of the SM5N0DA call is shown in figure
5-10.

CALL SM50MRLIinteger)
Figure 5-12. SM50MRL Format
The integer you specify is the maximum record
length in characters. (The SM50FL procedure is
recommended if all records from an owncode routine |
are the same length.) The SM50MRL procedure need
not be called if the sort or merge has an input or
o u t p u t fi l e w i t h a m a x i m u m r e c o r d l e n g t h a t l e a s t
a s l o n g a s t h e r e c o r d l e n g t h s p e c i fi e d b y t h i s
procedure. If the SM50MRL procedure is not called,
records from an owncode routine can be no longer |
than the longest allowed input or output record.
You cannot call both the SM50MRL procedure and the
SM50FL procedure in the same sort or merge. |

SMSOWNn
Execution of the SMSOWNn procedure specifies an
owncode routine that is executed each time a
certain point is reached during the sort or merge.
The format of the SM50WNn call is shown in figure
5-13.

CALL SM50WNn(proc)
CALL SM5NODA

Figure 5-10. SM5NODA Format

n

1, 2, 3, 4, or 5

proc

Owncode routine name; 1 to 7 letters o r digits.
beginning with a letter.

SM50FL

Figure 5-13. SM50WNn Format

Execution of the SM50FL procedure specifies the
number of characters In fixed length records from
an owncode routine. The format of the SM50FL call
is shown in figure 5-11.

The procedure you specify is the name (address) of
the owncode routine; in a FORTRAN program, the name
must be declared in an EXTERNAL statement. The n
associated with the SM50WNn call must be 1, 2, 3,
4, or 5. If the SM50WNn procedure is not called,
no owncode routine is executed.

CALL SM50FL(integer)

SM5RETA
Figure 5-11. SM50FL Format

5-4

Execution of the SM5RETA procedure can specify that
records with equal sort keys are output in the same

60484800 D

|

order as they are input. The format of the SM5RETA
call is shown in figure 5-14.

CALL SM5RETA(option
option

'YES' or 'Y'
'NO' or 'N'

c h a r a c t e r s s p e c i fi e d w i t h t h e s e c o n d S M 5 S E Q S
procedure called collate second, and so on. The
following paragraphs describe how to specify steps
in your collating sequence with SM5SEQS procedures.
Yo u c a n s p e c i f y a v a l u e s t e p c o n s i s t i n g o f o n e
c h a r a c t e r b y a g r a p h i c c h a r a c t e r (see appendix A)
enclosed in apostrophes as in the following example:
CALL SM5SEQS('A')

|

Figure

5-14.

S M 5 R E TA

Format

The option can be 'YES' or 'NO' (or 'Y' or 'N').
If the option is 'YES', records with equal keys
retain their original order. If the option is
'NO', records with equal keys might not retain
t h e i r o r i g i n a l o r d e r.
If RETAIN=YES and you specify more than one sort or
merge input file with the SM5FROM procedure, the
o r d e r i n w h i c h y o u s p e c i f y t h e i n p u t fi l e s i s t h e
order in which records with equal keys are output.
I f t h e S M 5 R E TA p r o c e d u r e i s n o t c a l l e d , r e c o r d s
with equal keys might not be output in the same
order as they are input.
the SM5SUM
procedure
theSM5RETA
same sortprocedure
or merge.and
If
I You
cannot specify
both inthe
you do specify both, a catastrophic error occurs.

SM5SEQx
Execution of a series of SM5SEQx procedures
s p e c i fi e s a u s e r - d e fi n e d c o l l a t i n g s e q u e n c e t h a t i s
referenced by the SM5KEY procedure. The formats of
the SM5SEQx calls are shown in figure 5-15.

You can specify a value step consisting of several
characters by single characters enclosed in
apostrophes and separated by commas. Tne following
e x a m p l e s p e c i fi e s a s t e p c o n s i s t i n g o f t h e b l a n k
and the digits 0, 1, 2, and 3, all of which collate
equally:
CALL SM5SEQSC ' ,'0','1','2','3')
If the SM5SEQR procedure is called, equal collating
position is assigned to any characters not
specified by SM5SEQS procedures. For example, if
y o u d e fi n e a c o l l a t i n g s e q u e n c e t h a t i n c l u d e s
digits and letters but not any of the special
characters (such as commas, periods, slashes), a
call to SM5SEQR includes the special characters in
your collating sequence. The special characters
a l l c o l l a t e e q u a l l y. T h e S M 5 S E Q R p r o c e d u r e c a n
only be called once for each call to SM5SEQN; the
SM5SEQR procedure can be called anywhere in the
SM5SEQx series.
If the SM5SEQA procedure is called, characters in
the same value step are altered on output to the
fi r s t c h a r a c t e r i n t h e s t e p . T h e f o l l o w i n g e x a m p l e
alters all asterisks and ampersands to slashes:
CALL SM5SEQS('/','*','&')
CALL SM5SEQA('YES')

CALL SM5S EQN ('name')
CALL SM5SEQS('char* 'char')

[CALL SM5SEQRCYES') or CALL SM5SEQR{'Y')
[CALL SM5SEQA('YES') or CALL SM5SEQA('Y')
'name' Collating sequence name; 1 to 31 letters,
digits, or the special characters ? # @ —.
Only 10 characters are significant and the
first must be a letter.
'char'

The SM5SEQA procedure can only be called once for
each call to SM5SEQN; the SM5SEQA procedure can be
called anywhere in the SM5SEQx series.
Yo u r c o l l a t i n g s e q u e n c e s p e c i fi c a t i o n i s t e r m i n a t e d
by any procedure call other than SM5SEQS, SM5SEQR,
or SM5SEQA. You can define more than one collating
sequence by calling a separate series of SM5SEQx
procedures for each collating sequence. The name
of each collating sequence must be unique. If no
SM5SEQx procedures are called, a nonstandard
collating sequence is not defined.

Character in the collating sequence.

Figure 5-15. SM5SEQx Formats
The SM5SEQN procedure names your collating sequence.
The name is a literal enclosed in apostrophes; the
name cannot be the same as the name of one of the
predefined collating sequences. The SM5SEQN proce
d u r e m u s t b e t h e fi r s t c a l l e d i n t h e s e r i e s o f
SM5SEQx procedures.
Collating positions are assigned to the characters
in your collating sequence by the SM5SEQS proce
dure, which can be called more than once. Each
SM5SEQS p r o c e d u r e s p e c i fi e s a v a l ue s t e p i n t h e
sequence. A value step consists of one or more
c h a r a c t e r s , a n d c h a r a c t e r s s p e c i fi e d i n t h e s a m e
s t e p c o l l a t e e q u a l l y . C h a r a c t e r s s p e c i fi e d w i t h
t h e fi r s t S M 5 S E Q S p r o c e d u r e c a l l e d c o l l a t e fi r s t ,

SM5ST
E x e c u t i o n o f t h e S M 5 S T p r o c e d u r e s p e c i fi e s a n
integer variable that is set to a value represent
ing the highest level of error that occurred during
the sort or merge. The format of the SM5ST call is
shown
in
fi g u r e
5-16.
|

CALL SM5ST(variable)
variable Symbolic name of an integer variable; 1 to
7 letters or digits, beginning with a letter.

Figure 5-16. SM5ST Format

0ms,
60484800 D

5-5

The error level that is represented by the value
returned to the SM5ST procedure is shown in table
5-3. For example if a 3 is returned to the SM5ST
procedure, a fatal error occurred during the sort
or merge. If you call t h e S M 5 S T p r o c e d u r e , S o r t /
Merge does not abort if a catastrophic error occurs
b e f o r e a n y d a t a r e c o r d s a r e i n p u t . H o w e v e r, i f
Sort/Merge calls another product and an unrecover
able error results, an abnormal job termination
w i l l o c c u r. F o r e x a m p l e , i f S o r t / M e r g e c a l l s a
product, such as Common Memory Manager (CMM), and
C M M p r o c e s s i n g r e s u l t s i n a n e r r o r, a t e r m i n a t i o n
w i l l o c c u r.
TABLE 5-3. ERROR LEVEL CODES, SM5ST CALL
Error Level

Code

No errors
Trivial

10

Warning

20

Fatal

30

Catastrophic

40

SM5SUM
Execution of the SM5SUM procedure specifies fields
that are to be summed in records with equal key
values. Input files for a merge with summing must
be presorted and pre summed. As many as 255 bytes
c a n b e s u m m e d . T h e r e c o r d s w i t h a l l k e y fi e l d s
equal are combined into one new record, and the
other records with equal keys are deleted. The one
r e s u l t a n t r e c o r d c o n t a i n s t h e k e y fi e l d s a n d t h e
fi e l d s t h a t a r e t h e s u m s o f t h e s p e c i fi e d fi e l d s
f r o m a l l t h e r e c o r d s w i t h e q u a l k e y s ; a d a t a fi e l d
t h a t i s n o t a k e y fi e l d o r a s u m fi e l d i s s e t t o
the corresponding field from one of the old records.
The format of the SM5SUM call is shown in figure
5-17.

A l l t h e fi e l d s t o b e s u m m e d m u s t c o n t a i n n u m e r i c
d a t a ; o t h e r w i s e , t h e c o n t e n t s o f t h e n e w fi e l d a r e
u n d e fi n e d . T h e fi e l d s d e s c r i b e d a s s u m fi e l d s
cannot also be key fields.

The SM5SUM procedure call specifies the first byte
o r b i t o f t h e s u m fi e l d , t h e l e n g t h o f t h e s u m
field in bytes or bits (length can be a maximum of
1 7 b y t e s ) , t h e t y p e o f d a t a i n t h e s u m fi e l d ( t h e
name of a numeric data format except REAL), and the
number of fields to be summed. See section 2 for a
list of numeric data formats.

I f y o u s p e c i f y m u l t i p l e fi e l d s w i t h o n e S M 5 S U M
p r o c e d u r e , t h e fi e l d s m u s t b e c o n s e c u t i v e , b e t h e
same length, and contain the same type of numeric
d a t a . S u m fi e l d s c a n n o t o v e r l a p o n e a n o t h e r. I f a
s u m fi e l d c o n t a i n s n o d a t a b e c a u s e a r e c o r d i s
short, the sum for that field is undefined.

Figure 5-18 shows an example of an SM5SUM procedure I
c a l l . P a r t A o f fi g u r e 5 - 1 8 s h o w s t h e l a y o u t o f |
the record containing fields to be summed. Part B
shows three SM5SUM procedure calls, each describing
one field to be summed. Part C shows one equiva
lent SM5SUM procedure call that describes the three
consecutive fields to be summed.

I f t h e s u m m i n g o f t h e s p e c i fi e d fi e l d s r e s u l t s i n
n e w n u m e r i c v a l u e s t h a t d o n o t fi t i n t o t h e s u m
fi e l d s , a f a t a l e r r o r r e s u l t s . O n e o f t h e r e c o r d s
t h a t c a u s e d t h e o v e r fl o w i s d e l e t e d a s u s u a l , b u t
the sum field contents in the remaining record are
u n d e fi n e d . A d i a g n o s t i c m e s s a g e i n d i c a t i n g w h i c h
field caused the overflow is issued, and the job is
terminated at the end of the sort (unless you call
the SM5ST procedure).

A&^^S

CALL SM5SUM(first,length,'type',rep)
fi r s t F i r s t b y t e o r b i t o f t h e s u m fi e l d .
length Number of bytes or bits in the sum field.

You can call the SM5SUM procedure as many as 100
times during a sort or merge to specify different
sum fields. If the SM5SUM procedure is not called,
records with equal key values are not automatically
combined into single records. You cannot call both
the SM5SUM procedure and the SM50WN5 procedure in
the same sort or merge.

'type* Name of a numeric data format.
r e p N u m b e r o f fi e l d s t o b e s u m m e d .
Figure 5-17. SM5SUM Format

5-6

You cannot specify both the SM5RETA and the SM5SUM
procedure in the same sort or merge. If you do
specify both, a catastrophic error occurs.

60484800 D

A. Record Layout
10
Student number
(sort key)

15
Number of
units registered

20
Number of
units completed

25
Grade points

B. SM5SUM Procedure Calls
CALL SM5SUM(11,5,'INTEGER',1)
CALL SM5SUM(16.5,'INTEGER', D
CALL SM5SUM(21,5,'INTEGER', 1)
C. SM5SUM Procedure Call
CALL SM5SUM(11,5,'INTEGER', 3)

Figure 5-18. SM5SUM Procedure Call Example

/$*S

SM5END
Execution of the SM5END procedure terminates your
s o r t o r m e r g e s p e c i fi c a t i o n a n d i n i t i a t e s S o r t /
Merge processing. The format of the SM5END call Is
shown in figure 5-19. The SM5END procedure must be
the last called for any one sort or merge.

CALL SM5END
Figure 5-19. SM5END Format

yims.

60484800 D

5-7

COBOL INTERFACE
/f^v

Tw o o p t i o n s a r e a v a i l a b l e f o r u s i n g S o r t / M e r g e 5
from COBOL 5: a control statement option when you
use the COBOL SORT or MERGE statement and direct
calls. This section describes these two options.

COBOL5 CONTROL STATEMENT
OPTION
Sort/Merge is used by COBOL when the COBOL SORT or
MERGE statement is included in your program. You
can select Sort/Merge 5 by means of a C0B0L5
c o n t r o l s t a t e m e n t o p t i o n . I f y o u s p e c i f y S 0 RT 5 i n
your C0B0L5 control statement, Sort/Merge 5 is used
when the SORT or MERGE statement in your program
executes. Figure 6-1 shows a sample C0B0L5 control
statement that includes the SORTS option. See the
COBOL 5 reference manual for information on coding
the SORT or MERGE statement in a program.

COBOL5,l=PROGA,SORT5,L=REPTO.
Figure 6-1. COBOL5 Control Statement
Example

DIRECT CALLS
Direct calls from a COBOL 5 program to the Sort/
Merge procedures described in section 5 can be made
with ENTER FTN5 SM5xxx statements. Calls to the
procedures cannot be mixed with the SORT or MERGE
statement; the procedures cannot be called in a
COBOL input or output procedure, and the SORT or
MERGE statement cannot be executed in a series of
direct calls (before SM5END is called). See the
COBOL 5 reference manual for information on coding
ENTER statements.

All files to be sorted or merged must be sequential
fi l e s . T h e d e f a u l t fi l e c h a r a c t e r i s t i c s a r e b l o c k
type C, record type Z, and full length of 150
c h a r a c t e r s o r l e s s . F o r fi l e s w i t h o t h e r b l o c k
types and record types, you must include CYBER
Record Manager (CRM) FILE control statements in the
control statement section of your job (see the CRM
Basic Access Methods reference manual).

r

r

60484800 A

6-1

0ms

OWNCODE ROUTINES

Yo u c a n w r i t e a r o u t i n e t o i n s e r t , s u b s t i t u t e ,
m o d i f y, o r d e l e t e i n p u t a n d o u t p u t r e c o r d s d u r i n g
S o r t / M e r g e p r o c e s s i n g . Yo u r r o u t i n e , c a l l e d a n
owncode routine, is executed each time the sort or
merge reaches a certain point. Sort/Merge passes a
record to the owncode routine, which processes the
record. When the record is returned to Sort/Merge
from the owncode routine, Sort/Merge processes the
r e c o r d a c c o r d i n g t o a n o p t i o n s p e c i fi e d b y t h e
owncode routine. Owncode routines can also supply
the records to be sorted; when Sort/Merge is ready
for a record, the owncode routine passes a record
to Sort/Merge.

p o i n t i n p r o c e s s i n g a t w h i c h y o u r owncode routine
is executed. Figure 7-1 shows the format for
naming an owncode routine in a control statement
and in a procedure call, and the subroutine state
ment format, which is a standard FORTRAN subroutine
statement.

Owncode routines are routines written in FORTRAN
(subroutine subprograms) or some other language
that have been compiled and saved in relocatable
b i n a r y f o r m . T h e fi l e c o n t a i n i n g y o u r o w n c o d e
routines is automatically loaded during Sort/Merge
processing. This section describes specifying
owncode routines and the available processing
options.

Figure 7-1. Owncode Routine Call and Subroutine
Statement Formats

SPECIFYING OWNCODE ROUTINES
To s p e c i f y o w n c o d e r o u t i n e s w h e n y o u a r e u s i n g
control statement calls to Sort/Merge, you use the
OWNF parameter. The OWNF parameter gives Sort/
Merge the name of the file containing your owncode
routines; the file is loaded by Sort/Merge by means
of the user call loader so that the routines are
available during Sort/Merge processing. The names
o f y o u r o w n c o d e r o u t i n e s a r e s p e c i fi e d w i t h t h e
OWNn parameter; n is an integer from 1 through 5
that tells Sort/Merge at which point in processing
t h e r o u t i n e i s e x e c u t e d . Yo u m u s t s u p p l y a s e p a
rate subroutine for each OWNn specified.
When you are using procedure calls to Sort/Merge,
you call SM50WNn to specify the name of an owncode
routine and to indicate at which point in process
ing the routine is executed. Owncode routines must
be loaded along with the Sort/Merge procedures.
Yo u c a n n o t u s e A A M t o p r o c e s s fi l e s w i t h i n a n
owncode routine when executing a control card
Sort/Merge. In a FORTRAN program, you must name
the owncode routines in an EXTERNAL statement. You
cannot call SMSOWNn from a COBOL program because
there is no way (other than CALL or ENTER) to tell
COBOL the name of an external subroutine. You can
write a subroutine in FORTRAN or some other
language to call the owncode routine.
Ow n c o d e e x i t s 1 a n d 2 c a n b e t a k e n f r o m a s o r t
only; exits 3, 4, and 5 can be taken from a sort or
merge.

OWNCODE ROUTINE PARAMETERS
Owncode routines are called with parameters. Up to
five parameters are passed between Sort/Merge and
your owncode routine. Parameters are passed at the

60484800 D

OWNn=proc CALL SM50WNn(proc)
SUBROUTINE proc(retum_code,reca,rla[,recb,rlb])

If you specify an owncode 1, owncode 2, owncode 3,
or owncode 4 routine, the return_code, reca, and
rla parameters are passed by Sort/Merge. If you
specify an owncode 5 routine, the recb and rib
parameters are passed in addition to the other
t h r e e p a r a m e t e r s . T h e p a r a m e t e r s are described in
the following paragraphs.
The return_code parameter is passed by Sort/Merge
to an owncode routine as an integer with value 0.
The return_code parameter can be altered by the
owncode routine to the integer value 1, 2, or 3.
The value returned to Sort/Merge by this parameter
i n d i c a t e s a s p e c i fi c a c t i o n t o b e t a k e n b y S o r t /
M e r g e . A r e t u r n _ c o d e v a l u e t h a t i s n o t d e fi n e d
c a u s e s a c a t a s t r o p h i c e r r o r. T h e m e a n i n g s o f t h e
various return_codes are discussed later in this
section.
The reca parameter is an otherwise empty array or
string variable that is used to pass the current
record; except for the current record, the contents
of reca are undefined. The rla parameter passes a
value that is the number of characters in the
current record being sorted or merged.
The recb and rib parameters are used when proc
essing two records with equal keys. The recb
parameter passes the second record; the rib
parameter passes a value that is the number of
characters in the second record.
The allowed length of records passed to an owncode
routi ne depends on how you have specified record
length. If you have specified the OWNFL parameter
or have called the SM50FL procedure, the number of
characters in the current record must be the same
as the OWNFL or SM50FL value. Otherwise, the
maximum record length is determined as the largest
MRL or FL FIT field in a CYBER Record Manager FILE
control statement, or the largest value from the
OWNMRL parameter or the SM50MRL procedure; all
records must contain between one and this maximum
record length number of characters, inclusive. An
rla or rib parameter value that does not correspond
t o a r e c o r d s p e c i fi c a t i o n c a u s e s a c a t a s t r o p h i c
e r r o r.

7-1

The reca, rla, recb, and rib parameters can be
altered by an owncode routine; the routine can pass
a d i ff e r e n t r e c o r d b a c k t o S o r t / M e r g e i n r e c a o r
recb, and the number of characters in the record
c a n b e d i ff e r e n t . T h e p a r a m e t e r s m u s t b e p a s s e d
from an owncode routine in order: return_code,
reca, rla, recb, and rib. The arrays reca and recb
can be any type of array.

processing of the record, control returns to
Sort/Merge, which processes the record passed back
in reca according to the return_code value set by
the owncode 1 routine (the record passed back to
Sort/Merge in reca can be different from the record
passed to the routine). The return_code value and
the associated processing performed by Sort/Merge
can be as follows:

Table 7-1 summarizes the owncode routines and the
parameters passed. Figure 7-2 illustrates record
movement from Sort/Merge to an owncode routine and
back to Sort/Merge.

0 The record passed back to Sort/Merge in
r e c a i s s o r te d .
1 The record passed back to Sort/Merge in
reca is deleted.

OWNCODE 1: PROCESSING
INPUT RECORDS
The 0WN1 parameter or the SM50WN1 procedure call
names an owncode 1 routine that is executed in one
of two instances.

2 An additional record is inserted into the
sort. The record in reca is entered into
the sort, and the owncode 1 routine is
executed again with reca and rla set to the
record that just entered the sort.

I f y o u h a v e s p e c i fi e d i n p u t fi l e s w i t h t h e F R O M
parameter or the SM5FR0M procedure call, the
owncode 1 routine is executed after reading each
record. The return_code, reca, and rla parameters
are passed to the routine by Sort/Merge. The
return_code is 0, reca contains the record, and rla
is the record length in characters. After owncode

3 I n p u t f r o m t h e c u r r e n t fi l e i s t e r m i n a t e d .
The record in reca and remaining records in
t h e fi l e a r e n o t s o r t e d . I f m o r e i n p u t
fi l e s a r e s p e c i fi e d , r e c o r d s a r e r e a d f r o m
t h e n e x t i n p u t fi l e . T h e o w n c o d e 1 r o u t i n e
i s e x e c u t e d a f t e r r e a d i n g e a c h r e c o r d fro m
t h i s n e x t fi l e .

TABLE 7-1. OWNCODE ROUTINE SUMMARY
Parameters Passed

Routine
Type

Processing

Owncode 1

Input records

Returnjcode

reca

rla

recb

rib

Return__code Value

0 Sort current record.
1 Delete current record.
2 Insert new record.
3 Te r m i n a t e i n p u t f r o m
c u r r e n t fi l e .

Owncode 2

I n p u t fi l e s

0 Begin processing next
i n p u t fi l e .
1 Insert new record.

Owncode 3

Output records

0 Modify current record.
1 Delete current record.
2 Create new record.
3 Te r m i n a t e o u t p u t .

Owncode 4

O u t p u t fi l e s

0 Sort or merge is complete.
1 Insert new record.

Owncode 5

Equal keys

0 Retain both records.
1 Replace both records with
new record.

7-2

60484800 A

0 P r o c e s s i n g o f t h e n e x t i n p u t fi l e , i f a n y ,
begins.
Record
^s

y

Owncode
Routine

Sort/Merge

V
"s^

Record

"*"~~

Figure 7-2. Owncode Routine Record Flow

1 An additional record is inserted into the
sort after the last record. The record
i n s e r t e d i s t h e fi r s t r l a c h a r a c t e r s i n
reca, which have been provided by the
routine. The owncode 2 routine is executed
again.
I f y o u h a v e n o t s p e c i fi e d a n y i n p u t fi l e s , t h e
owncode 2 routine is executed after an owncode 1
routine has terminated input. The return_code,
reca, and rla parameters are passed to the routine
by Sort/Merge. The return_code is 0, and reca and
rla are passed as a null record. When control is
returned to Sort/Merge from the owncode 2 routine,
the return_code value and the associated processing
performed by Sort/Merge can be as follows:
0 Signals the end of input.

I f y o u h a v e n o t s p e c i fi e d a n y i n p u t fi l e s , t h e
owncode 1 routine is executed when Sort/Merge
is ready for another record to process. The
return_code, reca, and rla parameters are passed to
the routine by Sort/Merge. The return_code is 0,
reca is an empty array with room for the largest
record, and rla is 0. When control is returned
to Sort/Merge from the owncode 1 routine, the
return_code value and the associated processing
performed by Sort/Merge can be as follows:
0 The record passed back to Sort/Merge in
reca is sorted.
2 An additional record is inserted into the
sort. The record in reca is entered into
the sort, and the owncode 1 routine is
executed again with reca and rla set to the
record that just entered the sort.
3 Input is terminated.

OWNCODE 2: PROCESSING
INPUT FILES
The 0WN2 parameter or the SM50WN2 procedure call
names an owncode 2 routine that is executed in one
of two instances.
I f y o u h a v e s p e c i fi e d i n p u t fi l e s w i t h t h e F R O M
parameter or the SM5FR0M procedure call, the
owncode 2 routine is executed after input from a
fi l e h a s t e r m i n a t e d ( i n p u t t e r m i n a t e s w h e n e n d o f - s e c t i o n i s f o u n d o n fi l e I N P U T, w h e n e n d - o f - fi l e
is found on any other file, or when an owncode 1
routine passes a return_code value of 3 to Sort/
Merge). Th e r e tu r n _ c o d e , r e c a , a n d r l a p a r a m e te r s
are passed to the routine by Sort/Merge. The
return__code is 0, and reca and rla are passed as a
n u l l r e c o r d ; r e c a i s a n e m p t y a r r a y, a n d r e c o r d
length is 0. When control is returned to Sort/
Merge from the owncode 2 routine, the return_code
value and the associated processing performed by
Sort/Merge can be as follows:

60484800 C

1 An additional record is inserted into the
sort after the last record. The record
i n s e r t e d i s t h e fi r s t r l a c h a r a c t e r s i n
reca, which have been provided by the
routine. The owncode 2 routine is executed
again.

OWNCODE 3: PROCESSING
OUTPUT RECORDS
The 0WN3 parameter or the SM50WN3 procedure call
names an owncode 3 routine that is executed in one
of two instances.
I f y o u h a v e s p e c i fi e d a n o u t p u t fi l e w i t h t h e T O
parameter or the SM5T0 procedure call, the owncode 3 routine is executed before writing a record
t o t h e o u t p u t fi l e . T h e r e t u r n _ c o d e , r e c a , a n d r l a
parameters are passed to the routine by Sort/
Merge. The return_code is 0, reca is the record,
and rla is the record length in characters. After
owncode processing of the record, control returns
to Sort/Merge, which processes the record passed
back in reca according to the return_code value set
by the owncode 3 routine. The return_code value
and the associated processing performed by Sort/
Merge can be as follows:
0 The record passed back to Sort/Merge in
r e c a i s w r i t t e n t o t h e o u t p u t fi l e .
1 The record passed back to Sort/Merge in
reca is deleted.
2 An additional record is written to the
o u t p u t fi l e . T h e r e c o r d i n r e c a i s w r i t t e n
out, and the owncode 3 routine is executed
again with reca and rla set to the original
record.
3 O u t p u t f r o m t h e c u r r e n t fi l e i s t e r m i
nated. The record in reca is not written
o u t . I f a n o w n c o d e 4 r o u t i n e i s s p e c i fi e d ,
it is executed; otherwise, the sort or
merge is terminated.

7-3

I f y o u h a v e n o t s p e c i fi e d a n o u t p u t fi l e , t h e
owncode 3 routine is executed when a record is
ready for output; sorted or merged records are
processed by the routine. The return_code, reca,
and rla parameters are passed to the routine by
Sort/Merge. The return_code is 0, reca is the
record, and rla is the record length in char
acters. When control is returned to Sort/Merge
from the owncode 3 routine, the return_code value
and the associated processing performed by Sort/
Merge can be as follows:
1 The record passed back to Sort/Merge in
reca is deleted.
3 Output is terminated. If an owncode 4
r o u t i n e i s s p e c i fi e d , i t i s e x e c u t e d ;
otherwise, the sort or merge is terminated.

OWNCODE 4: PROCESSING
OUTPUT FILES
The OWN4 parameter or the SM50WN4 procedure call
names an owncode 4 routine that is executed in one
of two instances.
I f y o u h a v e s p e c i fi e d a n o u t p u t fi l e w i t h t h e T O
parameter or the SMSTO procedure call, the owncode
4 routine is executed after the last record has
b e e n w r i t t e n t o t h e o u t p u t fi l e . T h e r e t u r n _ c o d e ,
reca, and rla parameters are passed to the routine
by Sort/Merge. The return_code is 0, and reca and
rla are passed as a null record. When control is
returned to Sort/Merge from the owncode 4 routine,
the return_code value and the associated processing
performed by Sort/Merge can be as follows:
0 The sort or merge is completed.

0 The sort or merge is completed.
1 This value is not allowed since no output
fi l e h a s b e e n s p e c i fi e d .

OWNCODE 5: PROCESSING
RECORDS WITH EQUAL KEYS
The 0WN5 parameter or the SM50WN5 procedure call
names an owncode 5 routine that is executed when
two records with equal key values are encountered
during a sort or merge (when you have defined your
own collating sequence, key values can be equal
even if key characters are not identical). The key
fi e l d s m u s t n o t b e m o d i fi e d o r e l s e t h e s o r t i n g
o r d e r i s u n d e fi n e d . T h e r e t u r n _ _ c o d e , r e c a , r l a ,
recb, and rib parameters are passed to the routine
by Sort/Merge. The return_code is 0; reca and recb
c o n t a i n t h e fi r s t a n d s e c o n d r e c o r d s , r e s p e c t i v e l y,
and rla and rib contain the record lengths in
c h a r a c t e r s o f t h e fi r s t a n d s e c o n d r e c o r d s ,
r e s p e c t i v e l y. A f t e r o w n c o d e 5 r o u t i n e p r o c e s s i n g
of the two records, control is returned to
Sort/Merge, which processes the records according
to the return_code value set by the owncode 5
routine. The return_code value and the associated
processing performed by Sort/ Merge can be as
follows:
0 T h e fi r s t r l a c h a r a c t e r s o f r e c a a r e
a c c e p t e d a s t h e fi r s t r e c o r d ; t h e fi r s t r i b
characters of recb are accepted as the
second record (the records and record
lengths passed back to Sort/Merge can be
different from the records and record
lengths passed to the owncode routine).

An additional record is inserted after the
last record. The record inserted is the
fi r s t r l a c h a r a c t e r s i n r e c a . T h e o w n c o d e
4 routine is executed again.

One duplicate record is deleted. The other
r e c o r d i s r e p l a c e d w i t h t h e fi r s t r l a c h a r
acters of reca.

I f y o u h a v e n o t s p e c i fi e d a n o u t p u t fi l e , a n
owncode 4 routine is executed after the last call
to an owncode 3 routine indicating that the sort
has been completed. If output is terminated by an
owncode 3 routine, an owncode 4 routine is called
i m m e d i a t e l y. T h e r e t u r n _ c o d e , r e c a , a n d r l a
parameters are passed to the routine by Sort/Merge.
The return_code is 0, and reca and rla are passed
as a null record. When control is returned to
Sort/Merge from the owncode 4 routine, the
return_code value and the associated processing
performed by Sort/Merge can be as follows:

I f y o u s p e c i f y R E TA I N = Y E S o r c a l l t h e S M 5 R E TA
procedure in a sort with an owncode 5 routine, the
record that entered the sort first is passed to the
owncode routine as reca; otherwise, either of the
two records with equal keys could be passed to the
routine as reca. The owncode 5 routine can control
the order in which the two records are returned to
Sort/Merge. The record returned to Sort/Merge as
reca is entered into the sort before the record
returned as recb. An owncode 5 routine cannot be
specified in the same sort as a SUM parameter or
SM5SUM procedure.

7-4

60484800 D

X^iffijJV

EXAMPLES

This section contains examples of sorts and
m e r g e s . T h e fi r s t e x a m p l e i s a s i m p l e c o n t r o l
statement sort on one key. The same sort is illus
trated using the interactive dialog. A control
statement sort on multiple keys, a control state
m e n t m e r g e , d i r e c t i v e fi l e c r e a t i o n a n d u s e , S U M
parameter use, and a FORTRAN program with Sort/
Merge procedure calls and an owncode routine are
also included.

CONTROL STATEMENT SORT ON
ONE KEY
Figure 8-1 shows the record layout in a university
s t u d e n t fi l e n a m e d U N I V E R . E a c h r e c o r d i n c l u d e s
t h e l a s t n a m e a n d fi r s t a n d m i d d l e i n i t i a l s , t h e
s t u d e n t n u m b e r , t h e d a t e o f b i r t h , t h e fi e l d o f
study, the grade point average, and a code repre
s e n t i n g c l a s s ( f r e s h m a n , s o p h o m o r e , j u n i o r,
s e n i o r ) ; a l l fi e l d s a r e w r i t t e n w i t h c h a r a c t e r
d a t a . T h e fi l e i s m a i n t a i n e d w i t h t h e s t u d e n t
n u m b e r a s t h e m a j o r k e y. R e c o r d s a r e n o r m a l l y
ordered in ascending order according to the student
number as shown in figure 8-2 with file UNIVER.

11
LAST NAME

FIRST

13

15

INITIAL

2861
2253
3011
2291
3861
2225
3341
3501
2 11 2
1981

WARNES
CARLSON
FUHRMAN
MCMAHON
JUNG
P0P0VICH
JONES
PEAKE
BRISCOE
HORNE

1 0 2 11 6 0 6 0 8 6 1 P 0 L I S C I
102126022355ENGIR
102212111859CHEM
102223061260ENG
102301052561PHYSED
1 0 2 3 111 0 0 9 6 1 B U S
102318081555EDU
1 0 2 3 2 6 111 9 6 0 J 0 U R N
1 0 2 3 4 3 1 2 11 5 7 E N V I R 0
102377070861COMPSCI

2814
3454
3204
2784
2214
2434
2844
3024
2544
3894

SORT SPECIFICATION USING
INTERACTIVE DIALOG
Figure 8-5 shows the interactive dialog used to
s p e c i f y t h e s a m e s o r t o f fi l e U N I V E R o n t h e l a s t
n a m e . T h e i n p u t fi l e i s a s s i g n e d t o t h e j o b w i t h
an ATTACH command under NOS or a FETCH command
under NOS/BE. CRM FILE control statements are
e n t e r e d f o r t h e i n p u t a n d o u t p u t fi l e s . T h e d i a l o g
is invoked by typing DIAL0G=»YES. Sorted records
a r e w r i t t e n t o fi l e S O R T O U T, w h i c h S o r t / M e r g e
c r e a t e s a s a l o c a l fi l e . F i l e S O R T O U T c a n b e
printed or displayed at the terminal; SORTOUT can
also be routed to a printer or saved as a permanent
fi l e .

21

STUDENT
NO.

8 7 3 6 6 11 0 2 5 5 E N G I R
90248063051HATH
99855022858BUS
9 9 9 111 2 1 3 5 8 A RT
99998040356ENG
100103111750UNDEC
100246031558ANTHR0
100528070457S0C
1 0 0 5 3 11 2 11 5 8 E D U
100532010353P0LISCI

Figure 8-2. File UNIVER

Figure 8-3 shows the job structures for sorting
fi l e U N I V E R t o g i v e a n a l p h a b e t i c l i s t o f
students. Under both NOS and NOS/BE operating
systems, the job statements and accounting infor
mation are followed by ATTACH commands to assign
the file to the job. CYBER Record Manager (CRM)
FILE control statements are included, because the
input and output records contain only 38 characters
each, considerably less than the default of 150.
The S0RT5 control statement calls for records from
UNIVER to be sorted on a key that occupies charac
ter positions 1 through 10 in each record according
to the default ASCII6 collating sequence in ascend
i n g o r d e r . S o r t e d r e c o r d s a r e w r i t t e n t o fi l e
SRTOUT, which is created as a local file during the
s o r t . F i l e S RTO U T i s t h e n c o p i e d t o fi l e O U T P U T
w i t h a r i g h t s h i f t , b e c a u s e t h e fi r s t c h a r a c t e r i n
the print line is reserved for carriage control.
Figure 8-4 shows the output from the job.

1

WALLACE
JOHNSON
SANDERS
NEECE
TERRELL
OKADA
REYES
SUGARMAN
PHILLIPS
KRUTZ
•

DOB

MIDDLE

27

35

STUDY

INITIAL

38

GPA

CQDE

Figure 8-1. File UNIVER Record Layout

60484800 B

8-1

NOS Operating System
Job statement
USER statement
CHARGE statement
ATTACH,UNIVER.
FILE(UNIVER,BT=C,RT=Z,FL=38)
FILE(SRTOUT,BT=C,RT=Z,FL=38)
SORT5.FROM=UNIVER,TO=SRTOUT,KEY=1. .10
COPYSBF,SRTOUT,OUTPUT.
EOI
NOS/BE Operating System
Job statement
ACCOUNT statement
ATTACH,UNIVER,ID=PUBS.
FILE(UNIVER,BT=C,RT=Z,FL=38)
FILE(SRTOUT,BT=C,RT=Z,FL=38)
SORT5.FROM=UNIVER,TO=SRTOUT,KEY=1. .10
COPYSBF,SRTOUT,OUTPUT.
EOI
Figure 8-3. Job Structure for Sorting File
UNIVER on Last Name

BARTLETT
BILLINGS
BRISCOE
CARLSON
CHARLES
CLARK
CLARK
COCHRAN
DAVIES
DAVIS
•
•
•
WALLIN
WARNES
WILSON
WONG
WOO
WOODSTOCK
YEH
YOST
ZEITZ
ZIMMERS

100800100957ART
101579111855MUS
102343121157ENVIR0
102126022355ENGIR
101418032459ANTHRO
101400102954EC0N
101023101956ENG
100725111857BI0
100812080656JOURN
100972071650ENG

2735
2965
2544
3454
2453
3782
2083
3011
2031
3541

101056041659P0LISCI
102116060861P0LISCI
101967010261MATH
101001012755PSYCH
101315100159BUS
101497030160CHEM
102005120645ART
100880111158ENG
100963111858MATH
101075063059MATH

3151
2814
3454
2152
3223
3483
2764
2582
2612
2992

Figure 8-4. File UNIVER Sorted on Last Name

/attach,univer
t i i l e ( u n i v e r, b t = c , r t = z , f 1 = 3 8 )
FILE?aABCDEFGHIJKLMNOPQRSTUVWXYZC\3',
DO ALL OF YOUR KEYS CONSIST OF CHARACTER DATA TO BE SORTED
ACCORDING TO THE ASCII6 COLLATING SEQUENCE
? yes
ASCENDING ORDER OF THE ASCII6 COLLATING SEQUENCE MEANS THE
NORMAL ORDER.
!«•#$%&•()*+,-./0123456789:;<=>?aABCDEFGHIJKLMNOPQRSTUVWXYZC\D*
DESCENDING ORDER MEANS THE REVERSE ORDER.
_*3\CZYXWVUTSRQP0NMLKJIHGFEDCBA3?>=<;:9876543210/.-,+*)C8%$#"!
DO YOU WANT ALL YOUR KEYS SORTED IN ASCENDING ORDER
? yes
HOW MANY KEY FIELDS DO YOU HAVE
?1
THE LEFT-MOST CHARACTER OF A RECORD IS NUMBER 1.
FOR THE MOST IMPORTANT KEY FIELD, WHAT IS THE NUMBER
OF THE LEFT MOST CHARACTER
? 1
HOW MANY CHARACTERS ARE IN THE MOST IMPORTANT KEY FIELD
? 10
DO YOU WANT RECORDS WITH EQUIVALENT KEY VALUES TO BE WRITTEN
IN THE SAME ORDER THEY ARE READ
? no
GIVE AN ESTIMATE OF THE MAXIMUM NUMBER OF RECORDS TO BE SORTED
? 75
THANK YOU. SORT/MERGE NOW BEGINS.
S0RT5.DIAL0G=YES
/

8-2

/"^S

Figure 8-5. Interactive Dialog Example

/*s%

s*^S

60484800 D

CONTROL STATEMENT SORT ON
MULTIPLE KEYS
Figure 8-6 shows the job structures for sorting
fi l e U N I V E R o n t h r e e k e y s . U n d e r b o t h N O S a n d
NOS/BE, the job statements and accounting informa
tion are followed by ATTACH commands to assign the
fi l e t o t h e j o b . C R M F I L E c o n t r o l s t a t e m e n t s f o r
the input and output files are included. The S0RT5
c o n t r o l s t a t e m e n t c a l l s f o r r e c o r d s t o b e fi r s t
s o r t e d o n t h e fi e l d o f s t u d y, w h i c h o c c u p i e s c h a r
acter positions 27 through 34 in each record.
Records with equal keys for the major key are then
sorted on the class code, which is a 1-character
fi e l d i n p o s i t i o n 3 8 . T h e t h i r d k e y s o r t s s t u d e n t s
with the same field of study and class by the last
name.
NOS Operating System

Aj^^S

Job statement
USER statement
CHARGE statement
ATTACH,UNIVER.
Fl LE(UNIVER,BT=C,RT=Z,FL=38)
FILE(SRTOUT,BT=C,RT=Z,FL=38)
SORT5.FROM=UNIVER,TO=SRTOUT,
.KEY=((27. .34),(38,1),(1. .10))
COPYSBF,SRTOUT,OUTPUT.
EOI
NOS/BE Operating System
Job statement
ACCOUNT statement
ATTACH,UNIVER,ID=PUBS.
Fl LE(UNI VER,BT=C,RT=Z,FL=38)
FILE(SRTOUT,BT=C,RT=Z,FL=38)
SORT5.FROM=UNIVER,TO=SRTOUT,
.KEY=((27. .34),(38,1),(1. .10))
COPYSBF,SRTOUT,OUTPUT.
EOI

Figure 8-6. Job Structure for Control Statement
Sort on Multiple Keys

0jm*B\,

F i g u r e 8 - 6 i l l u s t r a t e s c o n t i n u i n g t h e S 0 RT 5 c o n t r o l
s t a t e m e n t b e y o n d o n e l i n e . T h e fi r s t l i n e o f t h e
control statement is terminated with three periods;
the second line begins with one period. Sorted
r e c o r d s a r e w r i t t e n t o t h e fi l e S R T O U T, w h i c h i s
t h e n c o p i e d t o fi l e O U T P U T w i t h a r i g h t s h i f t ,
b e c a u s e t h e fi r s t c h a r a c t e r i n t h e p r i n t l i n e i s
reserved for carriage control. Figure 8-7 shows
the output from the job.

CONTROL STATEMENT MERGE
Figure 8-8 shows two files (UNIVER, ADDSTU) ordered
according to the student number. The two files can
be merged because they are sorted on the same key.
Figure 8-9 shows the job structures to merge the
t w o fi l e s . U n d e r b o t h N O S a n d N O S / B E , t h e t w o
fi l e s a r e a t t a c h e d . A n e w fi l e ( N E W U ) i s c r e a t e d
a s a p e r m a n e n t fi l e t o w h i c h m e r g e d r e c o r d s a r e
written; under NOS, the DEFINE command creates an
empty direct access permanent file. Under NOS/BE,
the REQUEST command assigns NEWU to a permanent
file device; the CATALOG command then makes the
fi l e p e r m a n e n t . C R M F I L E c o n t r o l s t a t e m e n t s f o r
the input files and the merged file are included.
60484800 B

REYES
MAYER
CHARLES
MARTIN
NEECE
NAKAMURA

YEH
BARTLETT
COCHRAN
H0Y0
•
•
KRUTZ
WALLIN
WARNES
WONG
LANGDON
LASEUR
SUGARMAN
SMITH
DOUGLAS
OKADA

100246031558ANTHRO
100991122359ANTHR0
101418032459ANTHRO
1 0 0 9 5 5 0 8 2 1 5 7 A RT
9 9 9 111 2 1 3 5 8 A R T
1 0 1 5 2 9 0 5 1 2 6 0 A RT
1 0 2 0 0 5 1 2 0 6 4 5 A RT
1 0 0 8 0 0 1 0 0 9 5 7 A RT
1 0 0 7 2 5 111 8 5 7 B I 0
101925103060BI0

3341
2882
2453
2891
2291
2594
2764
2735
3011
3014

100532010353P0LISCI
101056041659P0LISCI
1 0 2 11 6 0 6 0 8 6 1 P 0 L I S C I
101001012755PSYCH
101754080549PSYCH
100678042256PSYCH
100528070457S0C
101062120758SOC
101325071558UNDEC
100103111750UNDEC

1981
3151
2814
2152
2013
2233
3501
2913
2585
2225

Figure 8-7. File UNIVER Sorted on Multiple Keys

A. File UNIVER
WALLACE
JOHNSON
SANDERS
NEECE
TERRELL
OKADA
REYES
SUGARMAN
PHILLIPS
KRUTZ
•
•
•
WARNES
CARLSON
FUHRMAN
MCMAHON
JUNG
P0P0VICH
JONES
PEAKE
BRISCOE
H0RNE

8 7 3 6 6 11 0 2 5 5 E N G I R
90248063051MATH
99855022858BUS
9 9 9 111 2 1 3 5 8 A R T
99998040356ENG
100103111750UNDEC
100246031558ANTHR0
100528070457SOC
100531121158EDU
100532010353P0LISCI

2861
2253
3011
2291
3861
2225
3341
3501
2112
1981

1 0 2 11 6 0 6 0 8 6 1 P 0 L I S C I
102126022355ENGIR
102212111859CHEM
102223061260ENG
102301052561PHYSED
1 0 2 3 111 0 0 9 6 1 B U S
102318081555EDU
1 0 2 3 2 6 111 9 6 0 J 0 U R N
1 0 2 3 4 3 1 2 11 5 7 E N V I R 0
102377070861COMPSCI

2814
3454
3204
2784
2214
2434
2844
3024
2544
3894

90154101253BI0
1 0 0 0 1 2 0 9 0 8 4 8 BU S
1 0 0 4 7 8 0 4 2 8 5 5 J0 U R N
100933120356PHYSED
100987051260ENGIR
101728070160MATH
1 0 1 7 5 0 111 8 5 5 E N G
102056012561LNGUIS
102168101961EDU
102308032160P0LISCI
102320061158BUS
102379Q22260COMPSCI

3451
2431
2121
3012
2762
2012
3943
3854
2264
2544
3014
2984

B. File ADDSTU
QUINTERA
KING
ANDRUS
UNGERMAN
KLEIN
GIBSON
I RV I N G
ALLEN
GREENWOOD
ANDERSEN
EBERHARD
GOMEZ

Figure 8-8. Input Files for Control Statement Merge

8-3

CREATING AND USING A
DIRECTIVE FILE

NOS Operating System
Job statement
USER statement
CHARGE statement
ATTACH,UNIVER,ADDSTU.
DEFINE,NEWU.
Fl LE(UNI VER,BT=C,RT=Z,FL=38)
FILE(ADDSTU,BT=C,RT=Z,FL=38)
FILE(NEWU,BT=C,RT=Z,FL=38)
MERGE.FROM=(UNIVER,ADDSTU),TO=NEWU,KEY=15. .20
COPYSBF,NEWU,OUTPUT.
EOI
NOS/BE Operating System
Job statement
ACCOUNT statement
ATTACH,UNIVER,ID=PUBS.
ATTACH,ADDSTU,ID=PUBS.
REQUEST,NEWU,*PF.
FILE(UNIVER,BT=C,RT=Z,FL=38)
Fl LE(ADDSTU,BT=C,RT=Z,FL=38)
FILE(NEWU,BT=C,RT=Z,FL=38)
MERGE.FROM=(UNIVER,ADDSTU),TO=NEWU,KEY=15. .20
CATALOG,NEWU,ID=PUBS,XR=CHNG.
COPYSBF,NEWU,OUTPUT.
EOI
Figure 8-9. Job Structure for Control Statement Merge

The MERGE control statement names the two input
files and the new output file. The key on which
the files are merged is the student number (the
fi e l d o n w h i c h t h e fi l e s a r e p r e s o r t e d ) . T h e
merged file is copied to file OUTPUT with a right
shift, because the first character In the print
line is reserved for carriage control. Figure 8-10
shows the output from the job.

WALLACE
QUINTERA
JOHNSON
SANDERS
NEECE
TERRELL
KING
OKADA
REYES
ANDRUS
•
•
MCMAHON
JUNG
ANDERSEN
P0P0VICH
JONES
EBERHARD
PEAKE
BRISCOE
HORNE
GOMEZ

87366110255ENGIR
90154101253BI0
90248063051MATH
99855022858BUS
9 9 9 111 2 1 3 5 8 A RT
99998040356ENG
100012090848BUS
100103111750UNDEC
100246031558ANTHR0
100478042855J0URN

2861
3451
2253
3 0 11
2291
3861
2431
2225
3341
2121

102223061260ENG
102301052561PHYSED
102308032160P0LISCI
1 0 2 3 111 0 0 9 6 1 B U S
102318081555EDU
1 0 2 3 2 0 0 6 11 5 8 9 U S
1 0 2 3 2 6 111 9 6 0 J 0 U R N
1 0 2 3 4 3 1 2 11 5 7 E N V I R 0
102377070861COMPSCI
102379022260C0MPSCI

2784
2214
2544
2434
2844
3014
3024
2544
3894
2984

Figure 8-10. Merged File NEWU

8-4

F i g u r e 8 - 11 s h o w s a p o r t i o n o f a t e r m i n a l s e s sion
i n w h i c h a d i r e c t i v e fi l e i s c r e a t e d . I n t h e fi r s t
p a r t o f fi g u r e 8 - 11 , t h e d i r e c t i v e fi l e i s c r e a t e d
using XEDIT under NOS; (cr) denotes carriage
r e t u r n . I n t h e s e c o n d p a r t o f t h e fi g u r e , t h e
directive file is created using EDITOR under NOS/BE.
U n d e r N O S , X E D I T i s e n t e r e d a f t e r l o g i n , a n d the
d i r e c t i v e fi l e t o b e c r e a t e d i s g i v e n t h e n a m e
D I R F I L . T h e d i r e c t i v e fi l e s t a t e m e n t s b e g i n w i t h
the word SORT followed by a comma. The statements
s p e c i f y a u s e r - d e fi n e d c o l l a t i n g s e q u e n c e n a m e d
M Y S E Q . T h e fi r s t S E Q S p a r a m e t e r s p e c i fi e s t e n
steps from 0 to 9; the other SEQS parameter speci
fi e s o n e s t e p c o n s i s t i n g o f h y p h e n s , b l a n k s , a n d
slashes. The SEQA parameter specifies that blanks
and slashes are to be output as hyphens. The
d i r e c t i v e fi l e i s t h e n r e v i e w e d ( s t i l l u s i n g X E D I T )
t o m a k e s u r e t h e fi l e i s a c c u r a t e . T h e fi l e D I R FIL
is saved as an indirect access permanent file.
Under NOS/BE, EDITOR is entered after login. The
s t a t e m e n t s o f t h e d i r e c t i v e fi l e a r e i d e n t i c a l t o
the statements entered under NOS, and the directive
fi l e i s t h e n r e v i e w e d u s i n g t h e L I S T c o m m a n d .
Using the SAVE command, DIRFIL Is made a local file
without sequence numbers; the CATALOG command saves
the file as a permanent file.
Figure 8-12 shows a portion of a NOS terminal ses
sion in which a file named NUMFIL (figure 8-13) is
sorted according to the MYSEQ collating sequence.
T h e d i r e c t i v e fi l e a n d t h e i n p u t fi l e a r e a s s i g n e d
to the job with GET commands for indirect access
p e r m a n e n t fi l e s . C R M F I L E c o n t r o l s t a t e m e n t s a r e
entered for the input and output files.
The S0RT5 control statement is then entered naming
t h e i n p u t a n d o u t p u t fi l e s , t h e k e y fi e l d , a n d t h e
d i r e c t i v e fi l e ; t h e n a m e o f t h e u s e r - d e fi n e d
collating sequence is the key type. After Sort/
M e r g e r e a d s t h e d i r e c t i v e fi l e , a n i m a g e o f t h i s
fi l e i s p r i n t e d o r d i s p l a y e d a t t h e t e r m i n a l ( t h e L
parameter default is OUTPUT). When the sort is
complete, the S0RT5 control statement is printed or
displayed at the terminal (note that NOS repeats
only 48 characters of the control statement).
Control is then returned to the operating system.
Figure 8-14 shows the output from the job using the
d i r e c t i v e fi l e w i t h t h e M Y S E Q c o l l a t i n g s e q u e n c e .
The records are in numeric order, and the separa
tors in the number have been standardized as
hyphens in all records

SUM PARAMETER USE
Figure 8-15 shows the record layout in a file named
GRADES. Each record includes three numeric fields:
number of units attempted, number of units com
p l e t e d , a n d g r a d e p o i n t s . F i g u r e 8 - 1 6 s h o w s fi l e
GRADES with multiple records for each student.
Records are to be sorted according to student
number and, using the SUM parameter, records with
the same student number are to be combined into one
r e c o r d b y a d d i n g t o g e t h e r t h e n u m e r i c fi e l d s t o
give the total number of units attempted, units
completed, and the total number of grade points.

60484800 B

^ %

NOS Operating System

/xedi t,di rf i L,c -*XEDIT 3.1.00

Enter XEDIT in create mode; DIRFIL is the name
given the file to be created.

INPUT -*sort,seqn=myseq
sort,seqs=('0'.. 9')
/')!
sort,seqs=('-','
sort,seqa=yes
? —
EDIT -.
?? top -m
?? print*-*
SORT,SEQN=MYSEQ
S 0 R T, S E Q S = ( , 0 , . . ' 9 ' )
S 0 R T, S E Q S = ( , - , , , ' , ' /
S0RT,SEQA=YES
END OF FILE
? ? e n d , d i r fi L , r e p l a c e
DIRFIL REPLACED

Enter XEDIT input mode.

t o

0^s

Directive file statements.
Enter XEDIT edit mode.
Move pointer to the beginning of the file.
Print the entire file.
Directive file statements.
Leave XEDIT and save DIRFIL as an indirect access
permanent file.

NOS/BE Operating System

COMMAND- editor —
..1=sort,seqn=myseq
2=sort,seqs=('0'..'9')
3 = s o r t , s e q s = ( , - , , , ■, ' / ' )
4=sort,seqa=yes
list,a,sup «

Enter EDITOR.
Directive file statements.
List the entire file.

SORT,SEQN=MYSEQ
S 0 R T, S E Q S = ( , 0 ' . . , 9 ' ) I
S 0 R T, S E Q S = ( , - , , , , , * / , ) l
SORT,SEQA=YES
.. save,di rf i I ,n -«
..end -«
C O M M A N D - c a t a l o g , d i r fi l , i d = p u b s

Directive file statements.
Make edit file a local file without sequence numbers.
Leave EDITOR.
Save file as a permanent file named DIRFIL.

Figure 8-11. Creating a Directive File

/ g e t , d i r fi I
/ g e t , n u m fi I
/ fi l e ( n u m fi l , b t = c , r t = z , f 1 = 3 5 )
FILE(NUMFIL,BT=C,RT=Z,FL=35)
/file(seqfi l,bt = c,rt = z,f1=35)
FILE(SEQFIL,BT=C,RT=Z,FL=35)
/ s o r t 5 . f r o m = n u m fi l , t o = s e q fi l , k e y = ( ( 2 5 , 1 1 , m y s e q ) ) , d i r = d i r fi l
1
SORT/MERGE 5.0 * LISTING OF DIRECTIVE FILE - DIRFIL
12/04. 16.45.45.
1 . S O RT, S E Q N = M Y S E Q
2 . S 0 R T, S E Q S = ( ' 0 , . . , 9 ' )
3 . S 0 R T, S E Q S = ( , - , , , • , ' /■)
4 . S O R T, S E Q A = Y E S
SORT/MERGE 5 18 RECORDS SORTED
/
Figure 8-12. Using a Directive File (NOS)

60484800 B

8-5

DOE
THOMPSON
GORDON
WATSON
ANDERSON
HALL
SMITH
NORTH
ROLLINS
SHARP
LYNCH
SMITH
NOE
BROWN
HARRIS
JONES
CARTER
HENDERS

CHERYL
LOUISE
ROBERT
JOSEPH
PETER
MARY
JOHN
PATRICIA
SARAH
DANIEL
DENNIS
CATHERINE
JANE
WILLIAM
JEAN
CHRISTOPHER
BARBARA
GERALD

GREENWOOD
IRVING
IRVING
GREENWOOD
ANDRUS
ANDRUS
ALLEN
KLEIN
QUINTERA
IRVING
ANDRUS
ANDRUS
KING
ALLEN
ALLEN
ALLEN
ALLEN
KING
EBERHARD
EBERHARD
EBERHARD
KLEIN
EBERHARD
GIBSON
KLEIN
KLEIN
ANDERSEN
ANDERSEN
QUINTERA
UNGERMAN
ANDERSEN
UNGERMAN
UNGERMAN
KING
KING
ANDRUS
GREENWOOD
GREENWOOD
IRVING
GIBSON
GIBSON
QUINTERA
GOMEZ
GOMEZ
GOMEZ
GREENWOOD
QUINTERA

706-87-5430
819 95 6445
176/81/0013
091-15-1938
778 21 2847
029-55-1789
555-70-6351
234-58-3190
770-25-8147
447/46/0043
549-22-6741
387 14 9998
880-25-3058
120 59 4049
229-80-7776
6 6 7 /2 6 /2 5 1 4
114 48 5112
998-72-6203

Figure 8-13. File NUMFIL

HALL
WATSON
CARTER
BROWN
GORDON
HARRIS
NORTH
SMITH
SHARP
LYNCH
SMITH
JONES
DOE
ROLLINS
ANDERSON
THOMPSON
NOE
HENDERS

MARY
JOSEPH
BARBARA
WILLIAM
ROBERT
JEAN
PATRICIA
CATHERINE
DANIEL
DENNIS
JOHN
CHRISTOPHER
CHERYL
SARAH
PETER
LOUISE
JANE
GERALD

029-55-1789
091-15-1938
114-48-5112
120-59-4049
176-81-0013
229-80-7776
234-58-3190
387-14-9998
447-46-0043
549-22-6741
555-70-6351
667-26-2514
706-87-5430
770-25-8147
778-21-2847
819-95-6445
880-25-3058
998-72-6203

Figure 8-14. Output From Sort Using a Directive File

11

13

15

102168101961EDU
101750111855ENG
101750111855ENG
102168101961EDU
100478042855J0URN
100478042855JOURN
102056012561LNGUIS
100987051260ENGIR
90154101253BI0
101750111855ENG
100478042855J0URN
100478042855J0URN
100012090848BUS
102056012561LNGUIS
102056012561LNGUIS
102056012561LNGUIS
102056012561LNGUIS
100012090848BUS
102320061158BUS
102320061158BUS
102320061158BUS
100987051260ENGIR
102320061158BUS
101728070160MATH
100987051260ENGIR
100987051260ENGIR
102308032160P0LISCI
102308032160P0LISCI
90154101253810
100933120356PHYSED
102308032160P0LISCI
100933120356PHYSED
100933120356PHYSED
100012090848BUS
100012090848BUS
100478042855J0URN
102168101961EDU
102168101961EDU
101750111855ENG
101728070160MATH
101728070160MATH
90154101253BI0
102379022260C0MPSCI
102379022260C0MPSCI
102379022260C0MPSCI
102168101961EDU
90154101253BIO

002002000
004004016
098095375
003003009
005005010
004000000
003003012
003003006
003000000
003003012
190173371
003003009
005005015
005000000
025020077
004004012
005005020
004004016
005005015
001001000
004004016
005005015
003003006
003000000
003003006
135135373
005005015
003003009
180176607
150148445
005005010
003003012
003003009
002002006
178174423
001001000
003003006
030030068
003003009
145143290
005005010
005005010
003003009
005005010
002002008
005005020
004004012

Figure 8-16. File GRADES

21

LAST NAME

STUDENT
NO.

FIRST INITIAL

MIDDLE INITIAL

DOB

27

36 39 42 45
STUDY

UNITS
ATTEMPTED

GRADE POINTS

UNITS COMPLETED

Figure 8-15. File GRADES Record Layout

8-6

60484800 B

of 3.50 or better are written to an intermediate
fi l e ( I N T 1 ) . S o r t / M e r g e i s c a l l e d t o s o r t t h e fi l e
on grade point average in descending order (highest
grade point average to lowest grade point aver
age). The SM5S0RT call names a result array that
is dimensioned as a 16-element integer array and
the first element set to 15 to receive the maximum
number of sort results and statistics.

Figure 8-17 shows the S0RT5 control statement with
the SUM parameter. The input and output files are
named, and the student number (character positions
1 5 t h r o u g h 2 0 ) i s s p e c i fi e d a s t h e s o r t k e y. T h e
SUM parameter specifies that a 3-character numeric
field of type NUMERIC_NS begins in position 36 in
e a c h r e c o r d . T h e r e p e t i t i o n i n d i c a t o r 3 s p e c i fi e s
t h a t t h r e e c o n t i g u o u s fi e l d s a r e t o b e s u m m e d .
Figure 8-18 shows the output from the job. The
o u t p u t fi l e c o n t a i n s o n e r e c o r d f o r e a c h s t u d e n t .
T h e n u m e r i c fi e l d s a r e t h e t o t a l s o f t h e u n i t s
attempted, units completed, and grade points.

T h e S M 5 0 W N 1 c a l l s p e c i fi e s t h a t a n o w n c o d e 1
routine named CCODE is to be executed after Sort/
Merge reads each record from INT1. Records are
passed to the routine by Sort/Merge. Figure 8-21
shows the routine, which is a FORTRAN subroutine.
The SUBROUTINE statement names the routine and the
parameters passed by Sort/Merge. Parameter RETCODE
is the return_code passed as 0, REC is an array
containing the record, and RL is the record length
i n ch a ra cte rs. Th e ro u ti n e co n ve rts the class code
in each record to the class name. The records are
returned to Sort/Merge in array REC. The
return_code value is left as 0 because each record
in this example is to be sorted. Sort/Merge then
s o r t s t h e r e c o r d s t o fi l e I N T 2 . T h e s o r t e d fi l e i s
returned to the FORTRAN program to be written out
in a formatted report. Figure 8-22 shows the
output from the job, which includes the report and
the contents of the result array.

A SORT USING PROCEDURE CALLS
Figure 8-19 shows the job structures for performing
a sort from within a FORTRAN program. Under both
NOS and NOS/BE, the job statements and accounting
i n f o r m a t i o n a r e f o l l o w e d b y AT TA C H c o m m a n d s t o
a s s i g n t h e i n p u t d a t a fi l e ( U N I V E R ) a n d t h e fi l e
containing the FORTRAN source program to the job.
The FORTRAN 5 compiler is called, and the program
is compiled. The program is then executed (LGO).
Figure 8-20 shows the FORTRAN program containing
the Sort/Merge procedure calls. File UNIVER is
read, and student records with grade point average

'get,grades
/ fi l e ( g r a d e s , b t = c , r t = z , f 1 = 4 4 )
F I L E ( G R A D E S , B T = C , RT = Z , F L = 4 4 )
/ fi l e ( s u m e x , b t = c , r t = z , fl = 4 4 )
F I L E ( S U M E X , B T = C , RT = Z , F L = 4 4 )
/sortS.f rom=grades,to=sumex,key=15..20,sum=( (36,3,numeri c__ns,3))
SORT/MERGE 5 - 47 RECORDS SORTED
/
Figure 8-17. Interactive Parameter Specification for SUM Example

Total units completed
Total units attempted
I

QUINTERA
KING
ANDRUS
UNGERMAN
KLEIN
GIBSON
IRVING
ALLEN
GREENWOOD
ANDERSEN
EBERHARD
GOMEZ

090154101253BI0
100012090848BUS
100478042855J0URN
100933120356PHYSED
100987051260ENGIR
101728070160MATH
101750111855ENG
102056012561LNGUIS
102168101961EDU
102308032160P0LISCI
102320061158BUS
102379022260C0MPSCI

Total grade points
1

Ji.

19218 5629
189185460
203182390
156154466
146146400
153148300
108105412
042032121
043043103
013013034
013013037
010010027

Figure 8-18. Output From SUM Example

60484800 B

8-7

NOS Operating System

Job statement
USER statement
CHARGE statement
ATTACH,UNIVER,SM5EX.
FILE(UNIVER,BT=C,RT=Z,FL=38)
FTN5,l=SM5EX,L=OUTEX.
LGO.
COPY,OUTEX,OUTPUT.
EOI
NOS/BE Operating System
Job statement
ACCOUNT statement
ATTACH,UNIVER,ID=PUBS.
ATTACH,SM5EX,ID=F.
FILE(UNIVER,BT=C,RT=Z,FL=38)
FTN5,l=SM5EX,L=OUTEX.
LGO.
COPY,OUTEX,OUTPUT.
EOI
Figure 8-19. Job Structure for Sort Called From a FORTRAN Program

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

C

PROGRAM DLIST
INTEGER GPA
CHARACTER SNAME*14, MAJ0R*8, C0DE*1, CLASS*12
DIMENSION IARAY(16)
COMMON /C0MN/ CODE, CLASS
EXTERNAL CC0DE
1 READ(L"UNIVER",100,END=10) SNAME, MAJOR, GPA, CODE
IF (GPA .GE. 350) WRITE(L"INT1",200) SNAME, MAJOR, GPA, CODE
GO TO 1
10 IARAY(1)=15
CALL SM5S0RTUARAY)
CALL SM50FL(80)
CALL SM5FR0M('INT1')
CALL SMSKEY^^'ASCIU'^D')
CALL SM50WNKCC0DE)
CALL SM5TO(,INT2,)
CALL SM5END
REWIND(L"INT2")
PRINT *, IARAY
WRITECL"0UTEX",400)
15 READ(L,,INT2",300,END=20) SNAME, MAJOR, GPA, CLASS
WRITE(LMOUTEX",500) SNAME, MAJOR, CLASS, GPA
GO TO 15
100
200
300
400

FORMAT  g r t r. t h a n
a coml. at
\ r e v. s l a n t
■*■ circumflex

? question
< less than
> g r t r. t h a n

; semicolon

; semicolon
3 comI. at

\ r e v. s l a n t

Octal
6-Bit
Display
Code

00"
01
02
03
04
05
06
07
10
11
12
13
14
15
16
17
20
21
22
23
24
25
26
27
30
31
32
33
34
35
36
37
40
41
42
43
44
45
46
47
50
51
52
53
54
55
56
57
60
61
62
63"
64
65
66
67
70
71
72
73
74
75
76
77

Octal
6/12-Bit
Display
Code*

Octal
12-Bit
ASCII
Code

01
02
03
04
05
06
07
10
11
12
13
14
15
16
17
20
21
22
23
24
25
26
27
30
31
32
33
34
35
36
37
40
41
42
43
44
45
46
47
50
51
52
53
54
55
56
57
60
61
62
63"
64
65
66
67
70
71
72
73

0101
0102
0103
0104
0105
0106
0107
0110
0111
0112
0113
0114
0115
0116
0117
0120
0121
0122
0123
0124
0125
0126
0127
0130
0131
0132
0060
0061
0062
0063
0064
0065
0066
0067
0070
0071
0053
0055
0052
0057
0050
0051
0044
0075
0040
0054
0056
0043
0133
0135
0045
0042
0137
0041
0046
0047
0077
0074
0076

75

0134

77

0073
0100

ASCII
Graphic
(64-Char
acter Set)

ASCII
Character
(128-Character Set)
**" circumflex

7401

: colon"
* grave accent

a
r

■C left brace
| vert, line
> right brace
" tilde

NUL
SOH
STX
ETX
EOT
ENQ
ACK
BEL
BS
HT
LF
VT
FF
CR
SO
SI
DEL
DLE
DC1
DC2
DC3
DC4
NAK
SYN
ETB
CAN
EM
SUB
ESC
FS
G
S
RS
US

Octal
6-Bit
Display
Code

Octal
6/12-Bit
Display
Codet
7402
7404tt
7407
7601
7602
7603
7604
7605
7606
7607
7610
7611
7612
7613
7614
7615
7616
7617
7620
7621
7622
7623
7624
7625
7626
7627
7630
7631
7632
7633
7634
7635
7636
7640
7641
7642
7643
7644
7645
7646
7647
7650
7651
7652
7653
7654
7655
7656
7657
7637
7660
7661
7662
7663
7664
7665
7666
7667
7670
7671
7672
7673
7674
7675
7676
7677

Octal
12-Bit
ASCII
Code
0136
0072
0140
0141
0142
0143
0144
0145
0146
1047
0150
0151
0152
0153
0154
0155
0156
0157
0160
0161
0162
0163
0164
0165
0166
0167
0170
0171
0172
0173
0174
0175
0176
4000
0001
0002
0003
0004
0005
0006
0007
0010
0011
0012
0013
0014
0015
0016
0017
0177
0020
0021
0022
0023
0024
0025
0026
0027
0030
0031
0032
0033
0034
0035
0036
0037

^Generally a v a i l a b l e o n l y on NOS, or through BASIC on NOS/BE.
" T h e i n t e r p re t a t i o n o f t h i s charac ter or coc e d e p e n d s o n i t s c o n t e x t . R e f e r t o C h a r a c t e r S e t A n o m a l i es in
the text.

60484800 B

A-3

TABLE A-2. LOCAL BATCH DEVICE CHARACTER SETS
CDC
Graphic
(64-Character
Set)

ASCII
Graphic
(64-Character
Set)

ASCII
Graphic
(95-Character
Set)

Octal
6-Bit
Display
Code

Octal
6/12-Bit
Display
Codet

Octal
12-Bit
ASCII
Code

: colon"
A
B
C
D
E
F
G

: colon"
A
B
C
D
E
F
G

A
B
C
D
E
F
G

00"
01
02
03
04
05
06
07

01
02
03
04
05
06
07

H
I
J
K
L
M
N
0

H
I
J
K
L
M
N
0

H
I
J
K
L
M
N
0

10
11
12
13
14
15
16
17

P
Q
R
S
T
U
V

P
Q
R
S
T
U
V

u

P
Q
R
S
T
U
V
W

X
Y
0
1
2
3
4

X
Y
Z
0
1
2
3
4

5
6
7
8
9
+ plus
- minus
* asterisk

Card Keypunch Code
026

029

0101
0102
0103
0104
0105
0106
0107

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

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

10
11
12
13
14
15
16
17

0110
0111
0112
0113
0114
0115
0116
0117

12-8
12-9
11-1
11-2
11-3
11 - 4
11 - 5
11 - 6

12-8
12-9
11-1
11-2
11-3
11-4
11-5
11-6

20
21
22
23
24
25
26
27

20
21
22
23
24
25
26
27

0120
0121
0122
0123
0124
0125
0126
0127

11-7
11-8
11 - 9
0-2
0-3
0-4
0-5
0-6

11-7
11-8
11-9
0-2
0-3
0-4
0-5
0-6

X
Y
Z
0
1
2
3
4

30
31
32
33
34
35
36
37

30
31
32
33
34
35
36
37

0130
0131
0132
0060
0061
0062
0063
0064

0-7
0-8
0-9

0-7
0-8
0-9

5
6
7
8
9
+ plus
- minus
* asterisk

5
6
7
8
9
+ plus
- minus
* asterisk

40
41
42
43
44
45
46
47

40
41
42
43
44
45
46
47

0065
0066
0067
0070
0071
0053
0055
0052

12
11
11 - 8 - 4

12-8-6
11
11 - 8 - 4

/
(
>
$
=

slash
Left paren.
right paren.
dollar
equal to
space
, comma
. period

/
(
)
$
=

slash
left paren.
right paren.
dollar
equal to
space
, comma
. period

/
(
)
$
=

slash
left paren.
right paren.
dollar
equal to
space
, comma
. period

50
51
52
53
54
55
56
57

50
51
52
53
54
55
56
57

0057
0050
0051
0044
0075
0040
0054
0056

0-1
0-8-4
12-8-4
11 - 8 - 3
8-3
no punch
0-8-3
12-8-3

0-1
12-8-5
11-8-5
11-8-3
8-6
no punch
0-8-3
12-8-3

= equivalence
Z left bracket

# number
C left bracket

# number
C I. bracket

60
61

60
61

0043
0133

0-8-6
8-7

1 right bracket

1 right bracket

] r. b r a c k e t

62

62

0135

0-8-2

% percent"

X percent"

X percent"

63"

63"

0045

8-6

u
z

A-4

8-3
12-8-2
or 12-Ot"
11-8-2
o r 11 - 0 " t
0-8-4

60484800 B

TABLE A-2. LOCAL BATCH DEVICE CHARACTER SETS (Contd)
CDC
Graphic
(64-Character

Set)

ASCII
Graphic
(64-Character
Set)

t* not equal
r*concat.

quote
underline

ASCII
Graphic
(95-Character
Set)
" quote

Octal
6-Bit
Display
Code

Octal
6/12-Bit
D i sp l a y
Codet

Octal
12-Bit
ASCII
Code

64
65

64
65

0042
0137

8-4
0-8-5
11-o§
or
11 - 8 - 2
0-8-7
11-8-5
11 - 8 - 6
12-0
11-8-7
8-5
12-8-5
12-8-6

! exclamation

! exclamation

66

66

0041

A
t
I
<
>

& ampersand
' apostrophe

&
'
?
<
>

67
70
71
72
73
74
75
76

67
70
71
72
73

0046
0047
0077
0074
0076

75

0134

77

a
b

77
7401
7402
7404
7407
7601
7602

0073
0100
0136
0072
0140
0141
0142

c
d
e
f
g
h
i
j

7603
7604
7605
7606
7607
7610
7611
7612

0143
0144
0145
0146
0147
0150
0151
0152

k
I
m
n
o
P
q
r

7613
7614
7615
7616
7617
7620
7621
7622

0153
0154
0155
0156
0157
0160
0161
0162

s
t
u

7623
7624
7625
7626
7627
7630
7631
7632

0163
0164
0165
0166
0167
0170
0171
0172

7633
7634
7635
7636

0173
0174
0175
0176

£ Less/equal
>^ greater/equal
—i logical NOT
; semicolon

?
<
>
3
\

question
less than
greater than
commercial at
reverse slant
c i r c u m fl e x
semicolon

0m*s

026

underline

V logical OR
logical AND
superscript
subscript
less than
greater than

Card Keypunch Code

ampersand
apostrophe
question
less than
greater than

\ r e v. s l a n t
; semicolon
S com I. at
-*• circumflex
: colon
' grave accent

V

w
X

y
z
•C left brace
| vert, line
>
" tright
i l d e brace

12-8-7

029

8_7R

0-8-5§
or
11 - 0
12-8-7
12
8-5
0-8-7
12-8-4
0-8-6
8-4
0-8-2
11-8-7
11-8-6

tGenerally available only on NOS, or through BASIC on NOS/BE.

t t The interpretation of this character or code depends on its context. Refer to Character Set Anomalies
in the text.
"t Available for input only, on NOS.
§ Available for input only, on NOS/BE.

60484800 B

A-5

Local Batch Users
Ta b l e A - 2 l i s t s t h e C D C g r a p h i c 6 4 - c h a r a c t e r s e t ,
the ASCII graphic 64-character set, and the ASCII
graphic 95-character set. This table also lists
the code sets and card keypunch codes (026 and 029)
that represent the characters.
The 64-character sets use display code as their
code set; the 95-character set uses 12-bit ASCII
code. The 95-character set is composed of all the
characters in the ASCII 128-character set that can
be printed at a line printer (refer to Line Printer
O u t p u t ) . O n l y 1 2 - b i t A S C I I c o d e fi l e s c a n b e
printed using the ASCII graphic 95-character set.
To p r i n t a 6 / 1 2 - b i t d i s p l a y c o d e fi l e ( u s u a l l y
created in IAF ASCII mode), you must convert the
fi l e t o 1 2 - b i t A S C I I c o d e . To d o t h i s , t h e N O S
FCOPY control statement must be issued. The
95-character set Is represented by the 12-bit ASCII
codes 00408 through 01768.

Line Printer Output
The batch character set printed depends on the
print train used on the line printer to which the
fi l e i s s e n t . T h e f o l l o w i n g a r e t h e p r i n t t r a i n s
corresponding to each of the batch character sets:
Character Set

Print
Tr a i n

CDC graphic 64-character set

596-1

ASCII graphic 64-character set

596-5

ASCII graphic 95-character set

596-6

The characters of the default 596-1 print train are
listed in the table A-2 column labeled CDC Graphic
(64-Character); the 596-5 print train characters
are listed in the table A-2 column labeled ASCII
Graphic (64-Character); and the 596-6 print train
characters are listed in the table A-2 column
labeled ASCII Graphic (95-Character).
If a transmission error occurs during the printing
of a line, NOS prints the line again. The CDC
graphic print train prints a concatenation symbol
( r * ) i n t h e fi r s t p r i n t a b l e c o l u m n o f a l i n e
containing errors. The ASCII print trains print an
underline instead of the concatenation symbol.
If an unprintable character exists in a line (that
is, a 12-bit ASCII code outside of the range
00408 through 01768), the number sign (i?)
a p p e a r s i n t h e fi r s t p r i n t a b l e c o l u m n o f a p r i n t
line and a space replaces the unprintable character.
Punched Card Input and Output
Under NOS, coded character data is exchanged with
local batch card readers or card punches according
to the translations shown in table A-2. As indi
cated in the table, additional card keypunch codes
are available for input of the ASCII and CDC char
acters [ and ]. The 95-character set cannot be
read or punched as coded character data.

A-6

Depending on an installation or deadstart option,
NOS assumes an input deck has been punched either
In 026 or 029 keypunch code (regardless of the
character set in use). The alternate keypunch
codes can be specified by a 26 or 29 punched in
columns 79 and 80 of any job card, 6/7/9 card, or
7 / 8 / 9 c a r d . T h e s p e c i fi e d c o d e t r a n s l a t i o n r e m a i n s
i n e ff e c t t h r o u g h o u t t h e j o b u n l e s s i t i s r e s e t b y
s p e c i fi c a t i o n o f t h e a l t e r n a t e c o d e t r a n s l a t i o n o n
a subsequent 6/7/9 card or 7/8/9 card.
NOS keypunch code translation can also be changed
by a card containing a 5/7/9 punch in column 1. A
blank (no punch) in column 2 indicates 026 conver
sion mode; a 9 punch in column 2 indicates 029
conversion mode. The conversion change remains in
effect until another change card is encountered or
the job ends.
The 5/7/9 card also allows literal input when
4/5/6/7/8/9 is punched in column 2. Literal input
can be used to read 80-column binary character data
within a punched card deck of coded character data.
Literal cards are stored with each column in a
12-bit byte (a row 12 punch is represented by a 1
i n b i t 11 , r o w 11 b y b i t 1 0 , r o w 0 b y b i t 9 , a n d
rows 1 through 9 by bits 8 through 0 of the byte),
16 central memory words per card. Literal input
cards are read until a card identical to the pre
vious 5/7/9 card (4/5/6/7/8/9 in column 2) is
read. The next card can specify a new conversion
mode.
Under NOS/BE, coded character data is exchanged
with local batch card readers or card punches
according to the translations shown in table A-2.
As indicated in the table, additional card keypunch
codes are available for input of the CDC characters
V and < or their ASCII equivalents ! and <. The
95-character set cannot be read or punched as coded
character data.
Depending on an installation option, NOS/BE assumes
an input deck has been punched either in 026 or in
029 keypunch code (regardless of the character set
in use). The alternate keypunch codes can be
specified by a 26 or 29 punched in columns 79 and
80 of the job statement or In columns 79 and 80 of
a n y 7 / 8 / 9 c a r d . T h e s p e c i fi e d c o d e t r a n s l a t i o n
remains in effect throughout the job unless it is
r e s e t b y s p e c i fi c a t i o n o f t h e a l t e r n a t e c o d e
translation on a subsequent 7/8/9 card.
Under NOS/BE, a card with all of column 1 punched
(that is, 12 punches in column 1) and all of one
other column punched can be followed by 80-column
cards of free-form binary data. These binary data
cards are read or punched as described for NOS
literal data until another card with 12 punches in
column 1 and in one other column occurs, or until
the job ends. The next card is interpreted as
coded data.

Remote Batch Users
When card decks are read from remote batch devices,
the ability to select alternate keypunch code
translations depends upon the remote terminal
equipment.

60484800 B

■<-/^\

NOS Usage

user must assign the tape in binary mode and then
convert the binary character data.

R e m o t e b a t c h t e r m i n a l l i n e p r i n t e r, p u n c h e d c a r d ,
and plotter character set support is described in
the Remote Batch Facility (RBF) reference manual.
RBF suppo r t s o n l y c h a r a c t e r m o d e t r a n s m i s s i o n t o
and from consoles through the network. Character
mode Is described under Network Access Method
Terminal Transmission Code Sets in this appendix.
NOS/BE Usage
T h e r e m o t e b a t c h t e r m i n a l l i n e p r i n t e r, p u n c h e d
card, and plotter character set support is de
scribed in the INTERCOM reference manual.

Magnetic Tape Users
Coded character data to be copied from mass storage
to magnetic tape is assumed to be represented in
display code. NOS converts the data to external
BCD code when writing a coded 7-track tape and to
A S C I I o r E B C D I C c o d e ( a s s p e c i fi e d o n t h e t a p e
assignment statement) when writing a coded 9-track
tape.
Because only 63 characters can be represented in
7-track even parity, one of the 64 display codes is
lost in conversion to and from external BCD code.
Figure A-l shows the differences in conversion that
depend on which character set (63 or 64) the system
u s e s . T h e A S C I I c h a r a c t e r f o r t h e s p e c i fi e d c h a r
acter code is shown in parentheses. The output
arrow shows how the display code changes when it is
written on tape in external BCD. The input arrow
shows how the external BCD code changes when the
tape is read and converted to display code.
63-Character Set
Display Code
00
33(0)
63(:)

External BCD
16(%)
Output 12(0)
12(0)

Display Code
00
Input 33(0)
33(0)

64-Character Set
Display Code
00(:)
33(0)
63(%)

External BCD
12(0)
Output 12(0)
16(%)

Display Code
33(0)
Input 33(0)
63(%)

Figure A-1. Magnetic Tape Code Conversions
Tables A-3 and A-4 show the character set conver
s i o n s f o r 9 - t r a c k t a p e s . Ta b l e A - 3 l i s t s t h e
conversions to and from 7-bit ASCII character code
a n d 6 - b i t d i s p l a y c o d e . Ta b l e A - 4 l i s t s t h e
conversions between 8-bit EBCDIC character code and
6 - b i t d i s p l a y c o d e . Ta b l e A - 5 s h o w s t h e c h a r a c t e r
set conversions between 6-bit external BCD and
6-bit display code for 7-track tapes.
If a lowercase ASCII or EBCDIC code is read from a
9-track coded tape, it is converted to its upper
c a s e 6 - b i t d i s p l a y c o d e e q u i v a l e n t . To r e a d a n d
write lowercase ASCII or EBCDIC characters, the

60484800 B

During binary character data transfers to or from
9-track magnetic tape, the 7-bit ASCII codes shown
in table A-6 are read or written unchanged; the
8-bit hexadecimal EBCDIC codes shown in table A-7
also can be read or written unchanged. ASCII and
EBCDIC codes cannot be read or written to 7-track
magnetic tape as binary character data.
Two CDC utility products, FORM and the 8-Bit Sub
routines, can be used to convert to and from EBCDIC
d a t a . Ta b l e A - 7 c o n t a i n s t h e o c t a l v a l u e s o f e a c h
E B C D I C c o d e r i g h t - j u s t i fi e d i n a 1 2 - b i t b y t e w i t h
z e r o fi l l . T h i s 1 2 - b i t E B C D I C c o d e c a n a l s o b e
produced using FORM and the 8-Bit Subroutines.

NETWORK ACCESS METHOD TERMINAL
TRANSMISSION CODE SETS
There are two modes in which coded character data
can be exchanged with a network terminal console.
T h e s e t w o m o d e s , c h a r a c t e r m o d e and transparent
mode, correspond to the type of character code
editing and translation performed by the network
software during input and output operations. The
transmission mode used by the network software for
i n p u t c a n b e s e l e c t e d b y t h e t e r m i n a l o p e r a t o r,
u s i n g a Te r m i n a l I n t e r f a c e P r o g r a m c o m m a n d
( s o m e t i m e s r e f e r r e d t o a s a t e r m i n a l d e fi n i t i o n
command). The transmission mode used by the
network software for output can be selected by the
application program providing the terminal facility
service.

Character Mode Transmissions
Character mode is the initial and default mode used
for both input and output transmissions. When the
network software services the terminal in character
mode, it translates input characters from the
transmission code used by the terminal into the
ASCII code shown in table A-6. The translation of
a s p e c i fi c t r a n s m i s s i o n c o d e t o a s p e c i fi c A S C I I
code depends on the terminal class the network
software associates with the terminal. In char
acter mode input, the parity of the terminal
transmission code is not preserved in the corres
ponding ASCII code; the ASCII code received by the
terminal-servicing facility program always has its
eighth bit set to zero.
Character mode output is translated in a similar
m a n n e r. T h e n e t w o r k s o f t w a r e p r o v i d e s t h e p a r i t y
bit setting appropriate for the terminal being
serviced, even though translating from ASCII char
acters with zero parity bit settings.
The general case for code translations of character
mode data is summarized in the following para
graphs. This generalized description permits use
o f o n l y t a b l e A - 6 t o e x p l a i n a l l s p e c i fi c c a s e s .
Yo u c a n l o g i c a l l y e x t e n d t h i s g e n e r a l i z e d d e s c r i p
tion to allow use of tables A-l through A-5 as
descriptions of character set mapping for various
f u n c t i o n s i n i t i a t e d f r o m a t e r m i n a l . Ta b l e s A - l
through A-5 are provided for your use while coding
an application program to run under the operating
system. They do not describe character trans
missions between an application program and the
network.

A-7

TABLE A-3. ASCII 9-TRACK CODED TAPE CONVERSION
ASCII

ASCII
Code
Conversion*
Code
(Hex)

20
21
22
23
24
25
25
26
27
28
29
2A
2B
2C
2D
2E
2F
30
31
32
33
34
35
36
37
38
39
3A

Char

space
ii

D i sp l a y
Codet"

Character and
Code Conversion"
Code
(Hex)

00
7D
02
03
04
05
05
06
07
08
09
0A
O
B
O
C
0D
0E
OF
10
11
12
13
14
15
16
17
18
19
1A

Code
Conversion'

Char

ASCII
Char

Code
(Octal)

Code
(Hex)

NUL

space

STX
ETX
EOT
ENQ
ENQ
ACK
BEL
BS
HT
LF
VT
FF
C
R
S
O
SI
DLE
DC1
DC2
DC3
DC4
NAK
SYN
ETB
CAN
EM
SUB

ii

55
66
64
60
53
63
55
67
70
51
52
47
45
56
46
57
50
33
34
35
36
37
40
41
42
43
44
00

40
41
42
43
44
45
46
47
48
49
4A
4B
4C
4D
4E
4F
50
51
52
53
54
55
56
57
58
59
5A
5B
5C
5D
5E
5F

tt
space

Display code 00 is undefined at sites using the
63-character set.

3A
3B
3C
3D
3E
3F

1A
1B
7B
1D
1E
1F

SUB
ESC
G
S
RS
US

63
77
72
54
73
71

Char

J<

Character and
Code Conversion"
Code
(Hex)

60
61
62
63
64
65
66
67
68
69
6A
6B
6C
6D
6E
6F
70
71
72
73
74
75
76
77
78
79
7A
1C
7C
01
7E
7F

Char

FS

D i sp l a y
Code"t
ASCII
Char

.r

SOH
AU

DEL

Code
(Octal)

74
01
02
03
04
05
06
07
10
11
12
13
14
15
16
17
20
21
22
23
24
25
26
27
30
31
32
61
75
62
76
65

twhen these characters are copied from or to a tape, the characters remain the same and the code changes
from/to ASCII to/from display code.
ttThese characters do not exist in display code. Whe n the characters are copied from a tape, each ASCII
character is changed to an alternate display code c laracter. The corresponding codes are also changed.
Example: When the system copies a lowercase a, 61<| 5, from tape, it writes an uppercase A, 018.
'"A display code space always translates to an ASCII space.

Ta b l e A - 6 c o n t a i n s t h e A S C I I 1 2 8 - c h a r a c t e r s e t
supported by the Network Access Method. A 96character subset consists of the rightmost six
columns and . includes the 95-character graphic
subset referenced previously in this appendix; the
deletion character (DEL) is not a graphic char
a c t e r. A 6 4 - c h a r a c t e r s u b s e t c o n s i s t s o f t h e
middle four columns. Note that 6-bit display code
equivalents exist for the characters in this 64character subset only.

A-8

Although the network supports the 128-character
set, some terminals restrict output to a smaller
subset. This restriction is supported by replacing
the control characters in columns 0 and 1 of table
A-6 with blanks to produce the 96-character subset,
a n d , a d d i t i o n a l l y, r e p l a c i n g t h e c h a r a c t e r s i n
columns 6 and 7 with the corresponding characters
from columns 4 and 5, respectively, to produce the
64-character subset.

60484800 B

TABLE A-4. EBCDIC 9-TRACK CODED TAPE CONVERSION
EBCDIC
Code
Conversiont
Code
(Hex)

40
4A
4B
4C
4D
4E
4F
50
5A
5B
5C
5D
5E
5F
60
61
6B
6C
6C
6D
6E
6F
7A

Char

space

—
«

EBCDIC
D i sp l a y
Codet"

Character and
Code Conversion"
Code
(Hex)

00
1C
0E
C
O
16
0B
D
O
2E
01
37
25
05
27
A1
0D
OF
O
C
2D
2D
07
1E
1F
3F

Char

NUL
IFS
S
O

ASCII
Char
space

{.

BS
VT
ACK
SOH
EOT
LF
HT
E
*SC
C
R
SI
FF
ENQ
ENQ
DEL
IRS
IUS
SUB

space

>"

Code
(Octal)

55
61
57
72
51
45
66
67
62
53
47
52
77
76
46
50
56
63
55
65
73
71
00

:•
Display code 00 is undefined at sites using the
63-character set.

7A
7B
7C
7D
7E
7F
C1
C2
C3
C4
C5

0ms

ti

3F
03
79
2F
1D
02
81
82
83
84
85

SUB
ETX
BEL
IGS
STX

tt

ii

63
60
74
70
54
64
01
02
03
04
05

Code
Conversiont
Code
(Hex)

Char

C6
C7
C8
C9
D1
D2
D3
D4
D5
D6
D7
D8
D9
E0
E2
E3
E4
E5
E6
E7
E8
E9
FO
F1
F2
F3
F4
F5
F6
F7
F8
F9

'All EBCDIC codes not listed translate to display code 558 (space).
translates to an EBCDIC space.

Display
Codet"

Character and
Code Conversion^
Code
(Hex)

86
87
88
89
91
92
93
94
95
96
97
98
99
6A
A2
A3
A4
A5
A6
A7
A8
A9
10
11
12
13
3C
3D
32
26
18
19

Char

ASCII
Char

DLE
DC1
DC2
T
M
DC4
NAK
SYN
ETB
CAN
E
M

Code
(Octal)

06
07
10
11
12
13
14
15
16
17
20
21
22
75
23
24
25
26
27
30
31
32
33
34
35
36
37
40
41
42
43
44

A display code space always

"These characters do not exist in display code. When the characters are copied from a tape, each EBCDIC
character is changed to an alternate display code character. The corresponding codes are also changed.
Example: When the system copies a lowercase a, 81<|£, from tape, it writes an uppercase A / 018.
"•When these characters are copied from or to a tape, the characters remain the same (except EBCDIC codes
*A16r 4F"16/ 5A-|6, and 5F<|0) and the code changes from/to EBCDIC to/f rom display code.

Similarly, input from a device may be limited to a
smaller subset by the device itself because the
device cannot produce the full 128-character set.
A character input from a device using a character
set other than ASCII is converted to an equivalent
ASCII character; characters without ASCII character
equivalents are replaced by the ASCII blank char
a c t e r.

60484800 B

An application can also cause character replacement
(as described previously for output) as well as
character conversion, by requesting display-coded
input from the network.
The 7-bit hexadecimal code value for each character
consists of the character's column number in the
table, followed by its row number. For example, N
is in row E of column 4, so its value is 4Ejg.

A-9

TABLE A-5. 7-TRACK CODED TAPE CONVERSIONS

External
BCD

01
02
03
04
05
06
07
10
11
12t
13
14
15
16t
17
20
21
22
23
24
25
26
27
30
31
32
33
34
35
36
37

ASCII
Character

•i

space

Octal Display
Code

External

34
35
36
37
40
41
42
43
44
33
54
64
74
63
61
55
50
23
24
25
26
27
30
31
32
62
56
51
65
60
67

40
41
42
43
44
45
46
47
50
51
52
53
54
55
56
57
60
61
62
63
64
65
66
67
70
71
72
73
74
75
76
77

BCD

ASCII
Character

AU.

Octal Display
Code

46
12
13
14
15
16
17
20
21
22
66
53
47
70
71
73
45
01
02
03
04
05
06
07
10
11
72
57
52
75
76
77

tAs explained in the text of this appendix, conversion of these codes depends on whether the tape is
being read or written.

Transparent Mode Transmissions
Tr a n s p a r e n t m o d e i s s e l e c t e d s e p a r a t e l y f o r i n p u t
and output transmissions. During transparent mode
input, the parity bit is stripped from each ter
minal transmission code (unless the N parity option
has been selected by a Terminal Interface Program
command), and the transmission code is placed in an
8-bit byte without translation to 7-bit ASCII
code. Line transmission protocol characters are
deleted from a mode 4C terminal input stream.
When the 8-bit bytes arrive in the host computer, a
terminal servicing facility program such as the
Interactive Facility can right-justify the bytes

within a 12-bit byte. Upon transmission of 12-bit
b y t e s f r o m t h e h o s t c o m p u t e r, t h e l e f t m o s t 4 b i t s
(bits 11 through 8) are discarded.
During transparent mode output, processing similar
to that performed for input occurs. The code in
each 8-bit byte received by the network software
from the terminal servicing facility program is not
translated. The parity bit appropriate for the
terminal class being used is altered as indicated
by the parity option in effect for the terminal.
The codes are then output in transmission bytes
appropriate for the codes associated with the
terminal class being used. Line transmission
protocol characters are inserted into a mode 4C
terminal output stream.

■*ms
A-10

60484800 B

//ms
TABLE A-6. FULL ASCII CHARACTER SET

•128-Character Set
•96-Character Subset
-64-Character Subset-

Bits

b4

b3

b2

b1

0

0

0

0

0
0
0

J ^ N

0
0
0

0
1
1

1
0
1

Column
Row

NUL
000

DLE
020

SP
040

060

100

120

140

160

SOH
001

DC1
021

1
061

A
101

Q

121

a
141

q

041

STX
002

DC2
022

042

2
062

B
102

R
122

b
142

r
162

ETX
003

DC3
023

#
043

3
063

C
103

S
123

c
143

s
163

it

161

0

1

0

0

EOT
004

DC4
024

$
044

4
064

D
104

T
124

d
144

t
164

0

1

0

1

ENQ
005

NAK
025

%
045

5
065

E
105

U
125

e
145

u
165

0

1

1

0

ACK
006

SYN
026

&
046

6
066

F
106

V
126

f
146

v
166

BEL
007

ETB
027

7
067

G
107

W
127

g

047

147

w
167

0

1

1

1

0

0

0

BS
010

CAN
030

(
050

8
070

H
110

X
130

h
150

x
170

0

0

1

HT
011

EM
031

)
051

9
071

I
111

Y
131

i
151

y
171

LF
012

SUB
032

*
052

072

J
112

Z
132

j
152

z
172

VT
013

ESC
033

+
053

073

K
113

C
133

k
153

C■
173

FF
014

FS
034

074

L
114

\

054

134

I
154

174

CR
015

GS
035

055

075

M
11 5

1
135

m
155

>
175

SO
016

RS
036

056

>
076

N
11 6

136

n
156

176

SI
017

US
037

/
057

077

0
11 7

137

o
157

DEL
177

0
0
1
1
1
1

1
1
0
0
1
1

0
1
0
1
0
1

<

LEGEND:
Numbers under characters are the octal values for the 7-bit character codes used within the network.

60484800 B

A-ll

TABLE A-7. FULL EBCDIC CHARACTER SET

Hexa
decimal
EBCDIC
Code

Octal
12-Bit
EBCDIC
Code

00
01
02
03
04
05
06
07
08
09
OA
OB
O
C
OD
O
E
OF
10
11
12
13
14
15
16
17
18
19
1A
1B
1C
1D
1E
1F
20
21
22
23
24
25
26
27
28
29
2A
2B
2C
2D
2E
2F
30
31
32
33
34
35
36
37
38
39
3A
3B
3C
3D
3E
3F
40

OOOO
0001
0002
0003
0004
0005
0006
0007
0010
0011
0012
0013
0014
0015
0016
0017
0020
0021
0022
0023
0024
0025
0026
0027
0030
0031
0032
0033
0034
0035
0036
0037
0040
0041
0042
0043
0044
0045
0046
0047
0050
0051
0052
0053
0054
0055
0056
0057
0060
0061
0062
0063
0064
0065
0066
0067
0070
0071
0072
0073
0074
0075
0076
0077
0100

A-12

EBCDIC
Graphic
Charactert

EBCDIC
Control
Character

NUL
SOH
STX
ETX
PF
HT
LC
DEL

undefined
undefined

SMM
VT
FF
C
R
S
O
SI
DLE
DC1
DC2
TM
RES
NL
BS
IL
CAN
EM
C
C
CU1
IFS
IGS
IRS
IUS
DS
SOS
FS

Octal
12-Bit
EBCDIC
Code

41

0101
thru
0111
0112
0113
0114
0115
0116
0117
0120
0121
thru
0131
0132
0133
0134
0135
0136
0137
0140
0141
0142
thru
0151
0152
0153
0154
0155
0156
0157
0160
thru
0170
0171
0172
0173
0174
0175
0176
0177
0200
0201
0202
0203
0204
0205
0206
0207
0210
0211
0212
thru
0220
0221
0222
0223
0224
0225
0226
0227
0230
0231
0232
thru
0240

thru

49
4A
4B
4C
4D
4E
4F
50
51

thru

59
5A
5B
5C
5D
5E
5F
60
61
62
thru

69
6A
6B
6C
6D
6E
6F
70
thru

SYN

78
79
7A
7B
7C
7D
7E
7F
80
81
82
83
84
85
86
87
88
89
8A

undefined

thru

PN
RS
U
C
EOT

90
91
92
93
94
95
96
97
98
99
9A

undefined

BYP
LF
ETB or EOB
ESC or PRE
undefined
undefined
SM .

CU2
undefined

ENQ
ACK
BEL
undefined
undefined

undefined
undefined
undefined

CU3
DC4
NAK

undefined

SUB
space

Hexa
decimal
EBCDIC
Code

thru

AO

EBCDIC
Graphic
Charactert

EBCDIC
Control
Character
undefined

undefined

—
\
undefined

undefined

•
u n d e fi n e d

undefined

u n d e fi n e d

60484800 B

TABLE A-7. FULL EBCDIC CHARACTER SET (Contd)
Hexa
decimal
EBCDIC
Code

A1
A2
A3
A4
A5
A6
A7
A8
A9
A
A

thru

Jpfe..

BF
C
O
C
1
C2
C3
C4
C5
C6
C7
C8
C9
C
A
C
B
C
C
D
C
E
C
F
D
O
D
1
D2
D3
D4
D5
D6

Octal
12-Bit
EBCDIC
Code

0241
0242
0243
0244
0245
0246
0247
0250
0251
0252
thru
0277
0300
0301
0302
0303
0304
0305
0306
0307
0310
0311
0312
0313
0314
0315
0316
0317
0320
0321
0322
0323
0324
0325
0326

EBCDIC
Graphic
Charactert

EBCDIC
Control
Character

Hexa
decimal
EBCDIC
Code

D7
D8
D9
D
A
thru

undefined

D
F
E
O
E
1
E2
E3
E4
E5
E6
E7
E8
E9
EA
E
B
E
C
E
D

thru
undefined
undefined
undefined
undefined

EF
F
O
F1
F2
F3
F4
F5
F6
F7
F8
F9
FA
FB

thru

FF

Octal
12-Bit
EBCDIC
Code
0327
0330
0331
0332
thru
0337
0340
0341
0342
0343
0344
0345
0346
0347
0350
0351
0352
0353
0354
0355
thru
0357
0360
0361
0362
0363
0364
0365
0366
0367
0370
0371
0372
0373
thru
0377

EBCDIC
Graphic
Charactert

EBCDIC
Control
Character

undefined

undefined

undefined
undefined
undefined

undefined

Graphic characters shown are those used on the IBM System/370 standard (PN) print train. Other devi<
support subsets or variations of this character graphic set.

0ms
60484800 B

A-13

DIAGNOSTICS

Diagnostic messages that can be issued by Sort/
Merge are listed in table B-l. If an error occurs,
the error level and the error number are written on
t h e e r r o r fi l e o r t h e l i s t i n g fi l e . T h e d i a g n o s t i c
message is written on the next line. For errors
numbered 1 through 40, the parameter statement that
Is in error is written on another line, and a
pointer indicates the position of the error in the
parameter statement.

but from which Sort/Merge has been able to
recover by making an assumption about what
was intended.

An error can be one of the following levels:

Catastrophic; a catastrophic error causes
immediate Sort/Merge termination.

T Trivial; a trivial diagnostic results from
a usage that is syntactically correct but
questionable.
W Wa r n i n g ; a w a r n i n g d i a g n o s t i c r e s u l t s f r o m
a usage that is syntactically incorrect,

Fatal; a fatal diagnostic results when
Sort/Merge cannot resolve a syntactic or
s e m a n t i c e r r o r. T h e r e m a i n i n g p a r a m e t e r
statements are read, but no Sort/Merge
processing occurs.

S p e c i f y i n g t h e S TAT U S p a r a m e t e r o r c a l l i n g t h e
SM5ST procedure prevents job step termination after
any data records are input; the status variable
indicates the highest level of error that occurred.

TABLE B-l. SORT/MERGE DIAGNOSTICS
Error
Number

Error
Level

Message

S i g n i fi c a n c e

Action

A SPACE OR , EXPECTED

A space or a comma must sep
arate parameters in a control
s t a t e m e n t o r d i r e c t i v e fi l e . A
space or a comma must also sep
arate values in a set of values
specified for a parameter.

Insert a space or a comma
between each parameter and
between values specified
for a parameter.

CHARACTERS USED OUTSIDE
A STRING OR NAME MUST
BE A LETTER DIGIT ) =
( ' , OR SPACE

Unless in a literal string or
in the name of a user—supplied
entity, only alphabetic and
numeric characters and the
special characters ) = ( ' ,
and space are valid in a con
trol statement or directive
fi l e .

Replace invalid characters
with valid characters.

A VALUE SHOULD FOLLOW
THIS KEYWORD

At least one value must be
s p e c i fi e d f o l l o w i n g a
parameter keyword.

Insert a value following
the parameter keyword.

UNDEFINED COLLATING
SEQUENCE

The name of a key type in a KEY
parameter is not a predefined
collating sequence or a se
quence you have defined with
SEQx parameters.

Change the name of the key
type to one of the prede
fined collating sequences
or a sequence you have
d e fi n e d .

CHARACTER AFTER KEYWORD
MUST BE SPACE OR =

A parameter keyword must be
separated from its value by an
= or space.

Insert an = after the
parameter keyword.

INVALID KEYWORD
DETECTED

The indicated keyword is not a
valid procedure call keyword.

Determine valid procedure
call keywords.

UNLESS IN A STRING, =
SHOULD FOLLOW ONLY A
KEYWORD

Unless an - is in a literal
string, = is only valid immedi
ately following a parameter
keyword.

Replace the invalid = with
a v a l i d c h a r a c t e r.

DUPLICATE COLLATING
SEQUENCE NAME FOUND.

Collating sequence names must
be unique.

Eliminate the duplicate
name.

J^1

0ms
60484800 D

B-l

TABLE B-l. SORT/MERGE DIAGNOSTICS (Contd)

Error
Number

Message

S i g n i fi c a n c e

Action

( ) MUST ENCLOSE A
VALUE

Parentheses in a control state
ment or directive file must
enclose a parameter value.

Place a parameter value
between the parentheses*

10

CHARACTER AFTER = MUST
BE LETTER, DIGIT ( $ *
OR SPACE

Only an alphabetic or numeric
character or one of the special
characters ( $ ' or space can
follow an =.

Replace the character fol
lowing the a with a valid
c h a r a c t e r.

11

THIS VALUE SHOULD BE A
STRING (DELIMITED WITH
'S)

The indicated value must be a
literal string enclosed in
apostrophes.

Enclose the indicated value
in apostrophes.

13

THIS COMMA SHOULD BE
FOLLOWED BY A LETTER,
DIGIT, SPACE , OR (

The indicated comma must be
followed by an alphabetic or
numeric character or one of the
special characters , ( or
space.

Replace the character fol
lowing the indicated comma
w i t h a v a l i d c h a r a c t e r.

14

THIS CHARACTER MUST BE
A LETTER, DIGIT ( '
OR ,

The indicated
an alphabetic
acter or one
characters (

Replace the indicated char
acter with a valid
c h a r a c t e r.

15

TOO MANY PARAMETER
POSITIONS HAVE BEEN
SPECIFIED

When specifying parameters by
position rather than by key
word, a maximum of 31 positions
is allowed; you have probably
included too many commas.

Check your control state
ment for excess commas.

17

CHARACTER AFTER ) MUST
BE SPACE ) OR ,

A right parenthesis can only be
followed by another right
parenthesis, a comma, or a
space.

Replace the invalid char
acter after the right
parenthesis with a valid
c h a r a c t e r.

18

CHARACTER AFTER ( MUST
BE A LETTER, DIGIT $ '
( OR SPACE

A left parenthesis can only be
followed by an alphabetic or
numeric character, another left
parenthesis, a $ ' or space.

Replace the invalid char
acter after the left
parenthesis with a valid
c h a r a c t e r.

19

THE HIGH AND LOW VALUES
OF THIS RANGE MUST BE
AN INTEGER, Rl, R2, R3,
RIG, EF OR EFG

If a range of values is speci
fied for the KEY, SUM, or ENR
parameter, the high and low
values of the range must be
integers or the CCL variables
Rl, R2, R3, RIG, EF, or EFG.

Replace the invalid range
value with an integer, Rl,
R2, R3, RIG, EF, or EFG.

20

THE HIGH AND LOW VALUES
OF THIS RANGE MUST BE A
STRING

If the SEQS parameter specifies
a range of values, the high and
low values of the range must be
literal strings enclosed in
apostrophes.

Replace the invalid range
with a literal string
enclosed in apostrophes.

21

CHARACTER FOLLOWING AN
INTEGER MUST BE ) .. ,
SPACE OR LETTER

Only a ) .. (indicating a
range of values), a comma, a
space, or a letter can follow
an integer.

Replace the invalid char
acter following the integer
w i t h a v a l i d c h a r a c t e r.

22

POSITIONAL VALUES ARE
NOT ALLOWED IN A VALUESET

In a KEY or SUM parameter
value-set, key or sum field
characteristics must be speci
fied in the order shown in the
parameter formats; values
cannot be omitted and replaced
by commas.

In a KEY parameter, specify
fi e l d p o s i t i o n , l e n g t h a n d
type if you specify order;
s p e c i f y fi e l d p o s i t i o n a n d
length if you specify type.
In a SUM parameter, specify
fi e l d p o s i t i o n , l e n g t h a n d
type if you specify repeti
tions .

9

B-2

Error
Level

F

character must be
or numeric char
of the special
* or ,.

60484800 D

/■*S3tv

TABLE B-l. SORT/MERGE DIAGNOSTICS (Contd)

Error
Number

Error
Level

Message

S i g n i fi c a n c e

Action

23

A PERIOD CANNOT BE USED
IN A PARAMETER-LIST

A period is not a valid sepa
rator in a parameter list.

Replace the invalid period
with a valid separator;
refer to the parameter
syntax to determine valid
separators.

24

A RANGE IS ONLY ALLOWED
AS A VALUE FOR ENR, KEY
OR SUM PARAMETERS

A range of values can be speci
fied only for the ENR, KEY, or
SUM parameters; single values
must be specified for other
parameters.

Replace the invalid range
with a single value.

25

UNLESS $CHAR(N) IS
USED, ONLY ONE SET OF
NESTED PARENTHESES IS
ALLOWED

More than two parentheses can
appear together only when
$CHAR(n) is used in a SEQS
parameter to specify steps in a
collating sequence.

Delete the extra
parentheses.

26

UNLESS WITHIN A STRING,
NEITHER . NOR = IS
ALLOWED WITHIN A VALUE
SET

A set of values specified for a
parameter can contain a period
or an = only in a literal
string.

Correct the syntax for the
indicated values.

27

THIS VALUE SHOULD BE A
FILE OR PROC NAME

The indicated value must be the
name of a file or procedure.

Use a file or procedure
name for the indicated
value.

29

PARENTHESES MUST BE
MATCHED IN THE
PARAMETER-LIST

If a right or left parenthesis
appears in a parameter list, it
must be matched in the list by
its opposite.

Insert the missing
parenthesis.

30

TOO FEW SETS GIVEN FOR
THE KEYWORD ENDED HERE

The indicated keyword must have
a specific set of values speci
fi e d f o r i t ; a v a l u e o r v a l u e s
are missing.

Insert the values that must
be specified for the
indicated keyword.

31

TOO MANY VALUE-SETS
GIVEN FOR THIS KEYWORDVALUE-LIST

The indicated keyword must have
a specific set of values
s p e c i fi e d f o r i t ; t o o m a n y
values have been specified.

Determine the values that
can be specified for the
indicated keyword.

32

THIS VALUE SHOULD BE AN
INTEGER

The indicated value must be an
i n t e g e r.

Replace the invalid value
with an integer value.

33

TOO MANY VALUES
SPECIFIED IN THIS
VALUE-SET

Too many values have been
s p e c i fi e d f o r t h e i n d i c a t e d s e t
of values in a list of
parameter values.

Determine the values that
can be specified in the
indicated set of values.

34

TOO FEW VALUES
SPECIFIED IN THIS
VALUE-SET

Too few values have been speci
fi e d f o r t h e i n d i c a t e d s e t o f
values in a list of parameter
values.

Determine the values that
can be specified in the
indicated set of values.

35

ONLY A , ) .. OR SPACE
CAN FOLLOW A PARAMETER
VALUE

Parameter values must be
followed by a , ) .. or space.

Replace the invalid
character following the
parameter value with a
v a l i d c h a r a c t e r.

37

THIS PARAMETER VALUE
MUST BE A SET OR A
RANGE

The indicated parameter value
cannot be a single value; the
value must be a set of values
or a range of values.

Replace the indicated
parameter value with a
valid set or range of
values*

0^S

Jp>s

60484800 D

B-3

TABLE B-l. SORT/MERGE DIAGNOSTICS (Contd)

Error
Number

1

1

B-4

Error
Level

Message

S i g n i fi c a n c e

Action

50

DIALOG PARAMETER CAN
ONLY BE SPECIFIED IN A
CONTROL STATEMENT

The DIALOG parameter cannot be
i n a d i r e c t i v e fi l e .

Specify the DIALOG parame
ter in a control statement.

51

ONLY 3 VALUES CAN BE
GIVEN IN KEY/SUM VALUESET IF F..L FORMAT IS
USED

Values in a KEY or SUM parame
ter value-set are separated by
commas or spaces. If you use
t h e fi r s t . . l a s t f o r m t o s p e c i f y
key or sum field position and
length, a maximum of two other
values (separated by commas or
spaces) is allowed.

Correct the KEY or SUM
parameter so that no more
than three values are
s p e c i fi e d *

52

FILE, PROC, AND COL-SEQ
NAMES MUST BEGIN WITH A
LETTER

A letter (A-Z) must be the
fi r s t c h a r a c t e r i n a fi l e n a m e ,
procedure name, or the name of
a collating sequence you have
d e fi n e d .

Begin each file name, pro
cedure name, and collating
sequence name with a
l e t t e r.

53

VALUES ALLOWED FOR THE
FASTIO PARAMETER ARE
YES AND NO

Valid values for the FASTIO
parameter are YES or NO, which
can be specified as Y or N.

Specify a valid value for
the FASTIO parameter.

54

MORE THAN 100 INPUT
FILES GIVEN, ONLY THE
FIRST 100 SORTED

No more than 100 files can be
sorted in any one job step;
fi l e s s p e c i fi e d i n e x c e s s o f
100 are ignored.

The files in excess of 100
can be sorted in a separate
job step.

56

IF THE FIRST VALUE OF A
SEQS IS A RANGE THEN
ALL OTHER VALUES OF
THAT SEQS MUST BE
RANGES OF THE SAME
LENGTH

Single characters cannot follow
a range of characters in a SEQS
parameter.

Correct the SEQS parameter
so that it consists of
ranges of characters with
the same number of charac
ters in each range.

57

WHEN LOW*.HIGH IS USED
AS A VALUE FOR SEQS LOW
MUST BE LESS THAN HIGH

If a range of characters is
used in a SEQS parameter, the
first character in the range
must be of less value than the
last.

Correct the SEQS parameter
s o t h a t t h e fi r s t c h a r a c t e r
in the range is less than
the last*

58

ONLY SINGLE CHARACTER
STRINGS OR $CHAR CAN BE
USED AS VALUES FOR SEQS

Each character specified in a
SEQS parameter must be enclosed
in apostrophes and separated
from other characters by .. or
a comma; characters cannot be
grouped together. $CHAR(n)
must specify a single charac
t e r.

Correct the SEQS parameter.

59

FOR SCHAR(N), N MUST BE
A POSITIVE DECIMAL
INTEGER

If $CHAR(n) is used in a SEQS
parameter to specify a value
step consisting of one charac
ter, n must be a positive deci
mal integer that corresponds to
the number of the intended
character in your character
set.

Specify n as a positive
d e c i m a l i n t e g e r.

61

FILE NAMES MUST NOT
EXCEED 7 CHARACTERS IN
LENGTH

A file name can be no longer
than 7 characters.

Change the name of the file
to a name that is 7 charac
ters or fewer in length.

/=s^\

60484800 D

r^^B\

TABLE B-l. SORT/MERGE DIAGNOSTICS (Contd)

^ms.

yam^s

0^^

Error
Number

Error
Level

Message

S i g n i fi c a n c e

Action

62

THE MAXIMUM LENGTH OF A
LINE IS 240 CHARACTERS

The SORT5 or MERGE control
statement and its associated
parameter list can be no longer
than 240 characters (periods
used as continuation indicators
are not counted).

Parameters can be placed in
a d i r e c t i v e fi l e s o t h a t
the control statement is
240 characters or less.

63

VALUES ALLOWED FOR THE
DIALOG PARAMETER ARE
YES AND NO

Valid values for the DIALOG
parameter are YES or NO, which
can be specified as Y or N.

Specify a valid value for
the DIALOG parameter.

64

A SPACE OR , MUST
FOLLOW THE SORT OR
MERGE VERBS IN DIR.
FILE

I n a d i r e c t i v e fi l e , a n y s t a t e
ment that begins with SORT or
with MERGE must have a space or
a comma immediately following
SORT or MERGE.

Insert a space or a comma
immediately following SORT
or MERGE in your directive
fi l e .

65

A PERIOD MUST FOLLOW
SORT5 OR MERGE

In a control statement, the
word SORT5 or the word MERGE
must be immediately followed by
a period.

Insert a period immediately
following the word S0RT5 or
the word MERGE.

67

DIRECTIVE FILE NAMES
MUST BE UNIQUE

A directive file cannot have
the same name as any other
d i r e c t i v e fi l e u s e d i n t h e s o r t
or merge.

G i v e a l l d i r e c t i v e fi l e s
different names.

68

LINES CONTINUING THE
SORT5 OR MERGE
PARAMETER-LIST MUST
BEGIN WITH A PERIOD

Any line of a SORT5 or a MERGE
control statement that is con
t i n u e d b e y o n d t h e fi r s t l i n e
must begin with one period.

Begin each continuation
line with one period.

69

FILE NAMES CAN CONTAIN
ONLY LETTERS AND DIGITS

A file name cannot contain any
special characters.

Omit special characters
from the file name.

70

LENGTH MUST BE
SPECIFIED IF TYPE IS
SPECIFIED

If the key type is other than
the default ASCII6, or if
A S C I I 6 i s e x p l i c i t l y s p e c i fi e d ,
key length cannot be omitted.

Specify key length.

71

KEY LENGTH FOR KEYTYPE
REAL MUST BE 10

Keys declared to be of type
REAL must occupy a full compu
ter word and must be specified
as 10 bytes in length.

Specify length of REAL key
as 10.

72

ONLY THE VALUES A OR D
ARE ALLOWED AS VALUES
FOR KEY ORDER

Sort order can be specified as
ascending with A or as descend
ing with D.

Specify either A or D for
sort order; or omit speci
fi c a t i o n o f s o r t o r d e r a n d
ascending is assumed.

73

UNEQUAL FL FOR INPUT
AND OUTPUT FILES WITH
RT=F OR RT=Z

I f y o u s p e c i f y d i f f e r e n t fi x e d
length for input and output
files, Sort/Merge compresses or
expands records to fit into the
fi x e d l e n g t h .

For the most efficient pro
cessing, specify the same
FL for input and output
fi l e s .

74

VALUES ALLOWED FOR THE
EL PARAMETER ARE T, W,
F OR C

The only values that can be
specified for the EL parameter
are T, W, F, or C.

Specify T, W, F, or C as
the value of the EL
parameter.

75

VALUES ALLOWED FOR THE
LO PARAMETER ARE OFF, S
AND A

The only values that can be
specified for the L0 parameter
are OFF, S, or A.

Specify OFF, S, or A as the
value of the LO parameter.

J ^ S

60484800 D

B-5

jt^s.

TABLE B-l. SORT/MERGE DIAGNOSTICS (Contd)
Error
Number

B-6

Error
Level

Message

S i g n i fi c a n c e

Action

76

VALUES ALLOWED AS
EXPRESSIONS ARE
INTEGER, Rl, R2, R3,
RIG, EF OR EFG

The only values that can be
specified as expressions are
integers or the CCL variables
Rl, R2, R3, RIG, EF, or EFG.

Specify a valid expression.

77

SNULL SHOULD NOT BE
USED AS A VALUE WITHIN
A SET OF VALUES

SNULL is a reserved file name
s i g n i f y i n g a n u l l fi l e ; i t m u s t
not be specified in a list of
multiple files. $NULL can be
specified as a single value for
a parameter.

Delete $NULL from the list
of files, or specify $NULL
as the single parameter
value.

78

VALUES ALLOWED FOR THE
ST PARAMETER ARE Rl,
R2, R3, RIG, EF OR EFG

The only values that can be
specified for the STATUS param
eter are the CCL variables Rl,
R2, R3, RIG, EF, or EFG.

Specify a valid value for
the STATUS parameter.

79

VALUES ALLOWED FOR THE
RETAIN PARAMETER ARE
YES AND NO

The only values that can be
specified for the RETAIN param
eter are YES or NO, which can
be abbreviated as Y or N.

Specify a valid value for
the RETAIN parameter.

80

OWNMRL AND OWNFL SHOULD
NOT BOTH BE SPECIFIED
FOR THE SAME SORT

In a sort with owncode rou
tines, record length must be
s p e c i fi e d w i t h e i t h e r t h e
OWNMRL parameter or the OWNFL
parameter.

Specify record length with
the OWNFL parameter for F
or Z type records; specify
record length with the
OWNMRL parameter for all
other record types.

81

SUM AND KEY FIELDS MAY
NOT OVERLAP

The same characters in a record
cannot be included in a sum
field and a key field.

Correct SUM parameter and/
or KEY parameter so that
the same characters are not
i n c l u d e d i n b o t h fi e l d
descriptions.

82

LINES IN A DIRECTIVE
FILE MUST BE NO LONGER
THAN 100 CHARACTERS IN
LENGTH

A d i r e c t i v e fi l e s t a t e m e n t ,
beginning with SORT or MERGE,
can be 240 characters in
length, but each line in the
statement must contain no more
than 100 characters.

Use
your
each
than

83

REPETITION VALUE OF A
SUM FIELD MUST BE AN
INTEGER

In a SUM parameter, the number
of fields to be summed must be
expressed as an integer value.

Specify number of fields to
be summed as an integer.

84

VALUES ALLOWED FOR OWNT
PARAMETER ARE OLD AND
NEW

The only values that can be
specified for the OWNT param
eter are OLD or NEW.

Specify OLD or NEW as the
value for the OWNT param
e t e r.

85

IN A KEY/SUM VALUE-SET
USING FIRST..LAST,
LAST IS LESS THAN FIRST

In a KEY or SUM parameter, if
field length and position are
s p e c i fi e d a s t h e fi r s t a n d l a s t
bytes or bits of the field then
the first byte or bit must be
less than the last byte or bit
(the leftmost byte or bit in a
record is counted as number 1).

Correct the KEY or SUM
parameter.

86

NUMERIC KEY TYPES ARE
THE ONLY TYPES VALID
FOR SUM FIELDS

In a SUM parameter, sum field
type must be the name of a num
eric data format except REAL;
type cannot be a collating
sequence.

Correct the SUM parameter.

continuation lines in
d i r e c t i v e fi l e s o t h a t
line contains no more
100 characters.

60484800 D

j0ms

00s,

TABLE B-l. SORT/MERGE DIAGNOSTICS (Contd)
Error
Number

Error
Level

Message

S i g n i fi c a n c e

Action

87

LINES OF A DIR FILE
MUST BEGIN WITH SORT OR
MERGE VERB, OR BE A
CONTINUATION

I n a d i r e c t i v e fi l e , e a c h l i n e
must begin with the word SORT
or MERGE or, if the line is a
continuation line, with a char
acter of your parameter list or
one or more spaces.

C o r r e c t t h e d i r e c t i v e fi l e ;
determine the proper format
f o r d i r e c t i v e fi l e s .

88

BYTE/BIT POSITION OR
LENGTH OF A SUM/KEY
FIELD MUST BE AN
INTEGER

In a SUM or KEY parameter,
field length and position must
be specified as integers,
counting the leftmost byte or
bit in a record as number 1.

Correct the SUM or KEY
parameter. (Make sure two
sets of parentheses enclose
the value-set.)

89

SEQN VALUE MUST NOT BE
ONE OF THE PREDEFINED
KEY-TYPES

When you are defining your own
collating sequence with SEQx
parameters, the name of your
collating sequence cannot be
the same as the name of one of
t h e p r e d e fi n e d c o l l a t i n g
sequences.

Give your collating
sequence a unique name that
is not the same as one of
t h e p r e d e fi n e d c o l l a t i n g
sequences.

90

SEQR AND SEQA MAY BE
SPECIFIED ONLY ONCE FOR
EACH COLLATING SEQUENCE

When you are defining your own
collating sequence with SEQx
parameters, SEQR and SEQA must
not be specified more than
once.

Specify SEQR and SEQA only
once.

91

SEQN MUST BE SPECIFIED
BEFORE ANY OTHER SEQ
PARAMETER CAN BE GIVEN

When you are defining your own
collating sequence with SEQx
parameters, the SEQN parameter
naming your collating sequence
must be the first SEQx
parameter.

Specify SEQN before you
specify any other SEQx
parameter.

92

VALUES ALLOWED FOR SEQR
AND SEQA PARAMETERS ARE
YES AND NO

The only values that can be
specified for the SEQR and SEQA
parameters are YES or NO, which
can be abbreviated as Y or N.

Specify a valid value for
the SEQR and SEQA param
eters.

93

SEQN SHOULD NOT BE
GIVEN WITHOUT GIVING
SEQS OR SEQR BEFORE THE
NEXT SEQN

When you are defining your own
collating sequence with SEQx
parameters, you must specify
the characters in your col
lating sequence with SEQS and
SEQR parameters before naming
another collating sequence.

Correct the order of the
SEQx parameters.

94

VALUES ALLOWED FOR SEQS
PARAMETER ARE STRINGS
AND $CHAR(N)

When you are defining your own
collating sequence with SEQx
parameters, the only valid
values for SEQS parameters are
characters enclosed in apostro
phes or $CHAR(n) where n is the
number of the character in your
character set.

Correct the SEQS param
eters.

95

TWO RANGES OF
CHARACTERS USED IN THE
SAME SEQS MUST BE THE
SAME LENGTH

When you are defining your own
collating sequence with SEQx
parameters, the ranges in any
one SEQS parameter must all be
the same length.

Correct the SEQS parameter
so that it specifies ranges
that are all the same
length.

60484800 D

B-7

TABLE B-l. SORT/MERGE DIAGNOSTICS (Contd)
Error
Number

B-8

Error
Level

Message

,*"*S^.

Action

S i g n i fi c a n c e

96

VALUE GIVEN IN THE
$CHAR FUNCTION MUST BE
AN INTEGER

When you are defining your own
collating sequence with SEQx
parameters and are using
$CHAR(n) to specify the charac
ters in the sequence, n must be
a decimal integer corresponding
to the number of the intended
character in your character set.

Specify n of $CHAR(n) as a
d e c i m a l i n t e g e r.

97

CHARACTERS GIVEN IN A
SINGLE COLLATING
SEQUENCE MUST APPEAR
ONLY ONCE

When you are defining your own
collating sequence with SEQx
parameters, a character cannot
appear more than once in all
the SEQS parameters.

Specify each character only
once in a collating
sequence.

98

COL-SEQUENCE NAMES
LONGER THAN 10
CHARACTERS ARE
TRUNCATED

You can specify a collating
sequence name of up to 31 char
acters in length, but only the
first 10 characters are sig
n i fi c a n t .

None.

99

NUMBER OF KEY AND/OR
SUM CHARACTERS MUST BE
LESS THAN 256

A record cannot contain more
than 255 characters that are
defined as key or sum fields.

Specify the total number
of key and sum characters
together as 255 or less.

100

SIGNED NUMERIC CHARAC
TER FIELD IS TOO SHORT

A key field defined by a KEY
parameter or SM5KEY call as
one of the signed numeric data
formats is not long enough to
contain the data.

Redefine the key field as
long enough to contain all
the numeric characters and
the sign.

101

NO PARAMETER CAN BE
SPECIFIED MORE THAN
ONCE ON ONE LINE

Parameters that can be specified
more than once must be on separ
ate lines.

Inspect parameters and
correct error(s).

102

DUPLICATE PARAMETER
SPECIFIED

Some parameters can only be
specified once.

Inspect parameters and
correct error(s).

103

EITHER AN INPUT FILE,
OWN1 OR OWN2 MUST BE
GIVEN

No sort input file given.

S p e c i f y a s o r t i n p u t fi l e ,
or 0WN1 or 0WN2.

104

EITHER AN OUTPUT FILE,
OWN3 OR OWN4 MUST BE
GIVEN

No sort output file given.

S p e c i f y a s o r t o u t p u t fi l e ,
or OWN1 or OWN 2.

107

INCORRECT PARAMETER
VALUE

A value specified as a proce
dure call parameter is not a
valid value*

Check values that can be
specified for the procedure
c a l l p a r a m e t e r.

108

TOO FEW/MANY PARAMETERS

Either too few or too many
parameters have been specified
in a procedure call.

Determine parameters that
can be specified in the
procedure call*

UO

CALL OUT OF SEQUENCE

A call to a Sort/Merge FORTRAN
procedure is not in the proper
o r d e r.

Determine procedure call
o r d e r.

111

INVALID NAME GIVEN FOR
SM5SEQN

The name of a user-defined col
lating sequence specified with
the SM5SEQN call must begin
with a letter and consist of
letters, digits, and the
special characters ? # @ _.

Correct the name specified
with the SM5SEQN call;
enclose the name in apos
trophes.

60484800 D

TABLE B-l. SORT/MERGE DIAGNOSTICS (Contd)

r

Error
Number

Error
Level

Message

Action

112

ONLY SINGLE CHARACTER
LITERALS CAN BE USED AS
PARAMETERS OF SM5SEQS

Each character in a userdefined collating sequence
specified as parameters of
the SM5SEQS procedure must be
s p e c i fi e d s e p a r a t e l y, e n c l o s e d
in apostrophes, and separated
from other characters by
commas.

Specify each character in
your collating sequence as
a separate literal enclosed
in apostrophes.

113

RECORD LENGTH IS
GREATER THAN MAXIMUM
RL - 5000

Record length is set by the full
length (FL) or maximum record
l e n g t h ( M R L ) fi l e i n f o r m a t i o n
table (FIT). Also, the OWNFL
and OWNMRL parameters or SM50FL
and SM50MRL procedures specify
the length of a record. 5000
is the maximum record length
supported; records that exceed
5000 characters may generate
subsequent errors that may
abort the sort.

If subsequent errors abort
the sort, reduce the
number of characters per
record to 5000 or less.

114

SUM FIELDS MAY NOT
EVALUATE TO MORE THAN
60 BITS

Summing is handled with integer
arithmetic. Integer and binary
sum fields can be no more than
60 bits long.

C o r r e c t t h e s p e c i fi c a t i o n
of the sum field.

115

RETAIN AND SUMMING MAY
NOT BE SPECIFIED AT THE
SAME TIME

You cannot specify both the
RETAIN and the SUM parameter in
the same sort or merge.

Remove the RETAIN or SUM
parameter*

116

MRL/FL IS NOT LARGE
ENOUGH TO ACCOMMODATE
THE SPECIFIED KEYS

The record size (MRL or FL) is
not large enough to accommodate
the specified keys.

Change your key or file
description.

117

FASTIO PARAMETER
DISABLED FOR FILES NOT
ON MASS STORAGE

The FASTIO parameter cannot
process tapes.

None necessary.

118

FASTIO PARAMETER WAS
SPECIFIED BUT COULD NOT
BE PROCESSED

FASTIO files must have the
same record type and length,
and must reside on mass
storage.

Recheck file
s p e c i fi c a t i o n s .

119

FOR KEY AND SUM FIELDS,
THE BEGINNING POSITION
AND THE LENGTH MUST BE
NON-ZERO.

The beginning position and
length of key and sum fields
must be non-zero.

Correct the key/sum
s p e c i fi c a t i o n .

120

SUMMING OVERFLOW
OCCURRED - SEE DAYFILE
FOR DETAILS.

S u m fi e l d s i n t h e o u t p u t fi l e
have invalid data.

Check data and summing
s p e c i fi c a t i o n s .

121

UNABLE TO LOAD USER
OWNCODE - SORT DID
NOT COMPLETE.

A fatal loader error occurred.

Check your owncode files.

122

OWNCODE WAS SPECIFIED
BUT NO OWNF FILE WAS
GIVEN.

OWNF parameter was omitted.

Specify the OWNF parameter.

151

NOT SORT, MERGE OR
OUTPUT; 'SORT' ASSUMED

In the SMFILE call, file dis
position must be indicated as
SORT, MERGE, or OUTPUT.

None, or change SMFILE
call to indicate MERGE or
OUTPUT.

r
r

S i g n i fi c a n c e

60484800 D

B-9

TABLE B-l. SORT/MERGE DIAGNOSTICS (Contd)
Error
Niraber

Error
Level

Message

Action

S i g n i fi c a n c e

152

RETURNED FROM OWNCODE
WITHOUT CALLING SMRTN

Control has returned to Sort/
Merge from an owncode routine
without using a call to SMRTN;
processing terminates.

Determine the proper method
of calling SMRTN.

153

TOO MANY ERRORS FOUND.
PROCESSING TERMINATED.

The maximum number of errors
for one call to Sort/Merge have
occurred; processing terminates.

Correct errors and resubmit
job.

154

SMRTN CALL ILLEGAL WITH
SM5 PROCEDURES - RUN
ABORTED.

The Sort/Merge 4 compatible
routine SMRTN has been called
by a set of owncode procedures
using SM5xxx calls.

Change SMRTN to RETURN or
th e e q u i v a l e n t.

155

RETURN CODE MUST BE IN
RANGE 0-3

The return code from all owncode routines must be 0, 1, 2,
or 3.

Change the value of the
return code.

156

AN INPUT RECORD WAS
READ WHICH WAS TOO
SHORT TO HOLD THE
KEY/SUM FIELDS
SPECIFIED FOR THIS
SORT/MERGE.

The order of the records is
undefined if the key fields
are not within the record.

Change your key
description

157

NEITHER SORT NOR MERGE
HAS BEEN SPECIFIED

You have omitted a call to
SM5SORT or SM5MERGE.

Call SM5SORT or
SM5MERGE before any
other SMS procedures.

158

FILE NAMES FOR A MERGE
MUST BE UNIQUE.

Duplicate file names exist for
TO/FROM parameters.

Eliminate the duplicate
fi l e n a m e s .

159

KEY FIELDS OVERLAP
OTHER KEY FIELDS.

The same characters in a record
are included in two or more key
fi e l d s .

None.

160

ALTER OPTION CANNOT
BE USED FOR OVERLAPPING
KEY FIELDS.

When you define your own col
lating sequence use the SEQA
parameter or the SM5SEQA proc
edure, you cannot have over
l a p p i n g k e y fi e l d s .

Redefine the key fields
so they do not overtop.

161

SUM FIELDS CANNOT OVER
LAP OTHER SUM FIELDS

The same characters in a record
cannot be included in more than
one sum field.

Redefine the sum fields
so that they do not
overlap.

• B-10

60484800 D

GLOSSARY

This glossary defines terms unique to the descrip
tion of Sort/Merge; common terms that have special
connotatio n s w i t h i n t h e c o n t e x t o f t h i s m a n u a l a r e
also included.

d e t e r m i n e t h e s t a t u s o f fi l e s , i n i t i a t e t e s t s
and transfers within the control statement
section, and display results in your job
d a y fi l e .

Ascending The order of sorting keys so that the record
having the numeric key with the highest value
i s w r i t t e n l a s t o n t h e o u t p u t fi l e , a n d c h a r a c
t e r k e y s a r e s o r t e d a c c o r d i n g t o t h e s p e c i fi e d
collating sequence. See Sort Order.

CYBER Record Manager (CRM) A generic term relating to the common products
Advanced Access Methods and Basic Access
Methods that run under the NOS and NOS/BE
operating systems and that allow a variety of
r e c o r d t y p e s , b l o c k i n g t y p e s , a n d fi l e
organizations to be created and processed. The
execution time input/output of COBOL, FORTRAN,
Sort/ Merge, ALGOL, and the DMS-170 products is
implemented through CYBER Record Manager. The
input/output of the NOS and NOS/BE operating
system utilities such as COPY or SKIPF are not
implemented through CYBER Record Manager. All
CYBER Record Manager file processing requests
ultimately pass through the operating system
input/output routines.

ASCII American National Standard Code for Information
Interchange. An 8-bit code representing a
prescribed set of 128 characters. Control Data
operating systems use a 6-bit display code to
represent a subset (called ASCII6) of these
characters.
Basic Access Methods (BAM) A fi l e m a n a g e r t h a t p r o c e s s e s s e q u e n t i a l a n d
word addressable file organizations. See CYBER
Record Manager.
Beginning-of-information (BOI) T h e s t a r t o f y o u r fi r s t r e c o r d i n a fi l e .
System information, such as tape labels of
s e q u e n t i a l fi l e s , c a n a p p e a r b e f o r e b e g i n n i n g o f-informa 11on.
Block A logical or physical grouping of records.
CYBER Record Manager defines block types I, C,
K, and E for sequential files.
Byte A group of bits. In the body of this manual, a
byte is six bits that represents a single
c h a r a c t e r.
Character A l e t t e r, d i g i t , p u n c t u a t i o n m a r k , o r m a t h e
matical symbol forming part of one or more of
the standard character sets.

0ms

Default A value supplied by Sort/Merge when you omit a
s p e c i fi c a t i o n f r o m a p a r a m e t e r l i s t .
Descending The order of sorting keys so that the record
having the numeric key with the lowest value is
w r i t t e n l a s t o n t h e o u t p u t fi l e , a n d c h a r a c t e r
keys are sorted in reverse order of the speci
fied collating sequence. See Sort Order.
Dialog An interactive aid designed to guide an in
experienced user through a sort or merge
s p e c i fi c a t i o n .
Directive File A fi l e t h a t c a n b e u s e d i n a c o n t r o l s t a t e m e n t
sort or merge; contains processing parameters
i n a d d i t i o n t o t h e p a r a m e t e r s s p e c i fi e d i n t h e
S 0 R T 5 o r M E R G E c o n t r o l s t a t e m e n t . T h i s fi l e
m u s t b e a s e q u e n t i a l fi l e o f b l o c k t y p e C a n d
record type Z.

Collating Sequence A sequence in which the characters that are
acceptable to a computer are ordered for
purposes of sorting, merging, and comparing.

Display Code A 6-bit code representing a 63-character or
64-character computer character set.

Control Statement Section T h e fi r s t s e c t i o n o f a j o b ; c o n t a i n s t h e
s e q u e n c e o f c o n t r o l s t a t e m e n t s t h a t s p e c i fi e s
all steps for job execution.

EBCDIC The abbreviation for extended binary-coded
decimal interchange code. Control Data oper
ating systems use a 6-bit version (called
EBCDIC6) to represent this code.

Control Statement Sort A sort performed on the basis of parameters in
the S0RT5 control statement and in optional
d i r e c t i v e fi l e s .

End-of-information (EOI) CYBER Record Manager defines end-of-informat Ion
L n s e q u e n t i a l fi l e s I n t e r m s o f t h e fi l e r e s i
dence, as shown in table C-l.

CYBER Control Language (CCL) A language that allows you to insert a set of
statements into the control statement section
of your job; provides a means for you to

Entry Point A l o ca ti o n w i th i n a p ro g ra m th at can be refer
enced from other programs. Each entry point
ha8 a unique name with which it is associated.

60484800 B

C-l

TABLE C-l. END-OF-INFORMATION BOUNDARIES
File
Organization

File
Residence

Physical
Position

Sequential

Mass storage

After the last
user record*

Sequential

Labeled tape
in SI, I, S,
or L format

After the last
user record and
b e f o r e a n y fi l e
trailer labels.

Sequential

Unlabeled
tape in SI
or I format

After the last
user record and
b e f o r e a n y fi l e
trailer labels.

Sequential

Unlabeled
tape in S or
L format

Undefined.

File A collection of records treated as a unit;
r e p r e s e n t e d b y a l o g i c a l fi l e n a m e a n d d e l i m
ited by beginning-of-information and end-ofinformation.
FILE Control Statement A c o n t r o l s t a t e m e n t t h a t s u p p l i e s fi l e i n f o r m a
tion table (FIT) values after a source language
program is compiled or assembled but before the
p r o g r a m i s e x e c u t e d . B a s i c fi l e c h a r a c t e r i s
tics such as organization, record type, and
d e s c r i p t i o n c a n b e s p e c i fi e d i n t h e F I L E
control statement.
File Information Table (FIT) A table through which your program communicates
w i t h B A M . A l l fi l e p r o c e s s i n g e x e c u t e s o n t h e
b a s i s o f i n f o r m a t i o n i n t h e F I T. Yo u c a n s e t
F I T fi e l d s d i r e c t l y o r u s e p a r a m e t e r s i n a fi l e
a c c e s s c a l l t h a t s e t s t h e fi e l d s i n d i r e c t l y.
Floating-Point Number Numeric data stored internally as binary
values (corresponds to a FORTRAN REAL or COBOL
COMPUTATIONAL-2 number).
Graphic A character that can be printed or displayed.
Integer Numeric data stored internally as a binary
value rather than a character value; in a
parameter or procedure call format, a number
that does not include any character positions
to the right of the assumed decimal point and
is not signed.
Interactive Job processing in which you and the system
communciate with each other, rather than your
submitting a job and receiving output, having
no control over the job while processing occurs.

Interactive Facility (IAF) The network host software product that allows
you to enter commands and to communicate with
an executing program from a time-sharing
terminal; operates under NOS.
INTERCOM T h e s o f t w a r e t h a t d i r e c t s t h e fl o w o f i n f o r m a
tion and data between the central site computer
and a number of remote terminals; operates
under NOS/BE.
Job A set of control statements and the data and
directives used by those control statements. A
batch job begins with the job, USER, and CHARGE
statements on NOS and the job and ACCOUNT
statements on NOS/BE. An interactive job
begins with login to a terminal.
Key Type The name of a numeric data format or collating
sequence.
Keyword A part of a parameter that you enter exactly as
shown in the parameter format. It is not
changed by any information you supply.

r^^S

Library A collection of programs or routines that is
searched by the loader for entry points refer
enced by a program.
Literal A c o n s t a n t c o m p l e t e l y d e fi n e d b y i t s o w n
i d e n t i t y.
Local File A fi l e c u r r e n t l y a s s i g n e d t o a j o b , o r a
t e m p o r a r y fi l e o t h e r t h a n t h e p r i m a r y fi l e ;
often contains a copy of an indirect access
file or data from a magnetic tape.
Logical File Name (lfn) The one to seven coded letters or digits by
w h i c h t h e o p e r a t i n g s y s t e m r e c o g n i z e s a fi l e .
Every logical file name in a job must be unique
and begin with a letter.
Logical Record Under NOS, a data grouping that consists of one
or more PRUs terminated by a short PRU or
zero-length PRU. Equivalent to a systemlogical-record under NOS/BE.
Login The process used at a terminal to gain access
to the system.
Logout The process used to end a terminal session.
Major Sort Key A sort key that is considered to be the most
i m p o r t a n t a n d i s s p e c i fi e d fi r s t . S e e S o r t
Key, Minor Sort Key.
Mass Storage A disk pack or other rotating mass storage
device; not a magnetic tape.
,A*ms

C-2

60484800 B

0^S

Merge The process of combining two or more presorted
fi l e s .
Minor Sort Key A sort key that is considered of lesser impor
tance and is specified after the most important
sort key. See Sort Key, Major Sort Key.
Owncode Routine A subroutine you write that provides the capa
bility of inserting, substituting, modifying,
or deleting input and output records during
Sort/Merge processing.

TABLE C-2. PARTITION BOUNDARIES

Device

Record
Type
(RT)

Block
Type
(BT)

PRU
device

A short PRU of
l e v e l 0 containing
a one-word deleted
record pointing
back to the last I
block boundary,
followed by a con
trol word with a
fl a g i n d i c a t i n g a
p a r t i t i o n b o u n d a r y.

Parameter A variable identified by a keyword and assigned
specific values in the S0RT5 or MERGE control
s t a t e m e n t o r i n a d i r e c t i v e fi l e ; p a r a m e t e r s
a n d t h e i r s p e c i fi e d v a l u e s d i r e c t S o r t / M e r g e
processing.

A short PRU of
l e v e l 0 containing
a control word
w i t h a fl a g i n d i
cating a partition
boundary.

Partition CYBER Record Manager defines a partition as a
d i v i s i o n w i t h i n a fi l e w i t h s e q u e n t i a l o r g a
n i z a t i o n . G e n e r a l l y, a p a r t i t i o n c o n t a i n s
several records or sections. Implementation
o f a p a r t i t i o n b o u n d a r y i s a f f e c t e d b y fi l e
structure and residence, as shown in table C-2.

A short PRU of
level 0 followed by
a zero-length PRU
of level 17g.

D , F, R ,
T,U,Z

N o t i c e t h a t i n a fi l e w i t h W t y p e r e c o r d s , a
short physical record unit (PRU) of level 0
terminates both a section and a partition.
Physical Record Unit (PRU) Under NOS and NOS/BE, the amount of information
transmitted by a single physical operation of a
specified device. The size of a PRU depends on
the device, as shown in table C-3.

A zero-length PRU
of level number 17g.
S or L
format
tape

A separate tape
block containing as
many deleted rec
ords of record
length 0 as re
quired to exceed
noise record size,
followed by a de
leted one-word
record pointing
back to the last I
block boundary,
followed by a con
trol word with a
fl a g i n d i c a t i n g a
p a r t i t i o n b o u n d a r y.

A PRU that is not full of user data is called a
short P R U ; a P R U t h a t h a s a l e v e l t e r m i n a t o r
but no user data is called a zero-length PRU.
Procedure A subroutine that returns values through its
parameters; invoked when the name of the
procedure is referenced in a CALL or ENTER
statement.
Record C YBER R e c o r d M a n a g e r d e fi n e s a r e c o r d a s a
group of related characters. A record or a
portion thereof is the smallest collection of
information that can be passed between CRM and
your program. Eight different record types
e x i s t , a s d e fi n e d b y t h e R T fi e l d o f t h e fi l e
information table.

A separate tape
block containing as
many deleted rec
ords of record
length 0 as re
quired to exceed
noise record size,
followed by a con
trol word with a
fl a g i n d i c a t i n g a
p a r t i t i o n b o u n d a r y.

Record Type The term record type can have one of several
meanings, depending on the context. CYBER
R e c o r d M a n a g e r d e fi n e s e i g h t r e c o r d t y p e s
e s t a b l i s h e d b y a n R T fi e l d i n t h e fi l e i n f o r
m a t i o n t a b l e . Ta b l e s o u t p u t b y t h e l o a d e r
a r e c l a s s i fi e d a s r e c o r d t y p e s s u c h a s t e x t ,
relocatable, or absolute, depending on the
first few word8 of the tables.
Relocatable An object program that can reside in any part
of cent r a l m e m o r y. T h e a c t u a l s t a r t i n g a d d r e s s
is established at load time.

Physical Boundary

D , F, T,
R,U,Z

C,K,E

A tapemark.
A tapemark.

•Any
other
tape
format

Undefined.

y$mt.
60484800 B

C-3

TABLE C-3. PRU SIZES

Device

Mass storage.

TABLE C-4. SECTION BOUNDARIES

Size in Number
of 60-Bit Words

Device

Record
Type
(RT)

Block
Type
(BT)

64

PRU

Tape in SI format with
binary data (NOS/BE only).

512

Tape in I format (NOS only).

512

Tape in any other format.

Undefined.

A deleted one-word
record pointing
back to the last I
block boundary
followed by a con
trol word with
fl a g s i n d i c a t i n g a
section boundary.
At least the con
trol word is in
a short PRU of
level 0.

device

Result Array A means of passing statistics and results of a
sort or merge back to a calling procedure.

W

C

Rewind A n o p e r a t i o n t h a t p o s i t i o n s a fi l e a t t h e
beginning-of-information.
Section CYBER Record Manager defines a section as a
d i v i s i o n w i t h i n a fi l e w i t h s e q u e n t i a l o r g a
n i z a t i o n . G e n e r a l l y, a s e c t i o n c o n t a i n s m o r e
than one record and is a division within a
p a r t i t i o n o f a fi l e . A s e c t i o n t e r m i n a t e s
with a physical representation of a section
boundary, as shown in table C-4.
The NOS and NOS/BE operating systems equate a
section with a system-logical-record of level 0
through 16g.

S

-

S or L
format
tape

W

C

A separate tape
block containing
as many deleted
records of record
length 0 as re
quired to exceed
noise record size,
followed by a con
trol word with
fl a g s i n d i c a t i n g a
section boundary.

D,F,R,
T, U , Z

C,K,E

Undefined.

Sort Order The order for sorting keys, either ascending or
descending.
System-Logical-Record Under NOS/BE, a data grouping that consists
of one or more PRUs terminated by a short PRU
or zero-length PRU. These records can be
transferred between devices without loss of
structure. Equivalent to a logical record
under NOS.
Word A group of bits (or 6-bit characters) between
boundaries imposed by the computer system. A
word is 60 bits in length (10 characters).

S
Any

Undefined.
A separate tape
block containing
as many deleted
records of record
length 0 as re
quired to exceed
noise record size,
followed by a de
leted one-word
record pointing
back to the last I
block boundary,
followed by a con
trol word with
fl a g s i n d i c a t i n g a
section boundary.

Signed Numeric Data Integer data stored internally in display code;
sorted according to numeric order and sign of
the integer the display code represents.
Sort Key A fi e l d o f i n f o r m a t i o n w i t h i n e a c h r e c o r d i n a
sort or merge input file that is used to deter
mine the order in which records are written to
t h e o u t p u t fi l e .

A control word with
fl a g s i n d i c a t i n g a
section boundary.
The control word
is in a short PRU
of level 0.
A short PRU with a
level less than
"8.

D,F,R,
T,U,Z

Sequential File A fi l e w i t h r e c o r d s i n t h e p h y s i c a l o r d e r i n
which, they were written. No logical order
exists other than the relative physical record
position.

C-4

Physical
Representation

Undefined.
Undefined.

other
tape
format

60484800 B

SORT/MERGE PARAMETER SUMMARY
0&S.

T h e f o r m a t s p e c i fi c a t i o n s f o r a l l p a r a m e t e r s u s e d
in a S0RT5 or a MERGE control statement are sum
marized and listed in this appendix. Detailed
information for each parameter is referenced by
page number and appears in section 3 of this manual.
The following abbreviations are used in this
appendix:

r

char

character

expr

expression

lfn

l o g i c a l fi l e n a m e

proc

procedure name

rep

repetition

Page
FROM Parameter
FROM=lfn
FROM=(lfn1,lfn2,...)
FROM=$NULL

3-2

KEY Parameter
KEY= j(key_def[,key_def]
L range

..,-,

where:
Page

DIALOG Parameter

(ranget,type [,ad]])
[ r( fia rnsgt ,el e n g t h [ , t y p e [ , a d ] ] )" Jj

3-4

DIALOG=YES (or DIA=Y)

range

DIALOG=NO (or DIA=N)

r

3-2

DIR Parameter

3-3

L Parameter

DIR=lfn

L=lfn

DIR»(lfnlflfn2i...)

L=$NULL

E Parameter

= [ " fi r s t " J
| _ fi r s t . . l a s t j

3-4
OWNF Parameter

3-3

3-4

E=lfn
OWNF=lfn
E=$NULL
OWNFL Parameter
EL Parameter

3-4
OWNFL=integer

EL=T

0FL=integer
EL=W
EL=F

OWNMRL Parameter

EL=C
ENR Parameter
ENR=expr
ENR=expr .. expr
FASTIO Parameter

3-5

OWNMRL=integer

3-4

OMRL=integer
OWNn Parameter

3-5

OWNn=proc
3 - 9 R E TA I N P a r a m e t e r

FASTIO=YES (or FASTIO=Y)

RETAIN=YES (or RET=Y)

FASTIO=NO (or FASTIO=N)

RETAIN=NO (or RET=N)

60484800 C

3-5

3-5

D-l

Page
SEQx Parameters

3-5

SEQN=name
SEQS=('char',...,'char')

Page
where:
sum_def = T(first,length,type[ ,rep] )"]
L ( fi r s t . . l a s t , t y p e [ , r e p ] ) J
TO Paraaeter

[SEQR=YESOR
ORSEQA=Y]
SEQR-Y]
' [SEQA=YES

STATUS Parameter

3-2

TO=lfn

3-7

TO=$NULL

STATUS=variable (or ST=variable)
VERIFY Parameter
SUM Parameter
SUM=((sum_def)[,(sum_def)]...)

3-8

3-9

VERIFY=YES (or VER=Y)
VERIFY=NO (or VER=N)

■^S%s

^

^

A^^S

D-2

60484800 C

0^S

INTERACTIVE DIALOG

r
This appendix contains the text of the interactive
d i a l o g ( fi g u r e E - l ) t h a t i s i n v o k e d w h e n y o u s p e c
i f y D I A L O G U E S . ( Yo u r t e r m i n a l m u s t b e i n n o r m a l
mode; enter NORMAL before entering the S0RT5 or
MERGE command. If you are already in the dialogue,
enter a control-T to return to the operating
system). The questions asked by Sort/Merge are

indicated by uppercase letters. The answers you
supply are indicated by lowercase letters; "next"
or a number following an answer indicates the next
question that is asked by Sort/Merge. For
questions requiring yes or no answers, you can
abbreviate and use y or n.

IS YOUR TERMINAL ALREADY SET TO NORMAL MODE OR UPPERCASE ASCII MODE. ALSO, ARE YOU SURE THAT ALL YOUR
FILES (IF ANY) ARE EITHER STANDARD UNIT RECORD FORMAT OR HAVE HAD FILE CONTROL STATEMENTS SPECIFIED FOR
THEM
yes (1)
no (next)
UNLESS YOU SPECIFY OTHERWISE, ALL INPUT FILES AND THE OUTPUT FILE ARE ASSUMED TO HAVE STANDARD UNIT
RECORD FORMAT SUCH AS LINES TYPED FROM A TERMINAL, LINES IN A BATCH JOB, OR LINES TO BE PRINTED ON A
PRINTER OR TERMINAL. THESE ARE TECHNICALLY KNOWN AS BT=C, RT=Z, FL=N WITH N NO MORE THAN 150. DO YOU
HAVE ANY FILES THAT ARE NOT OF THIS FORMAT?
yes (next)
no (1)
FOR EACH FILE THAT IS NOT OF THIS FORMAT YOU MUST HAVE SPECIFIED A FILE CONTROL STATEMENT. SORT/MERGE
WILL QUIT NOW SO YOU MAY DO SO.
1. DO YOU HAVE JUST ONE INPUT FILE AND NO 0WN1 OR 0WN2 SUBROUTINES?
yes
(next)
no
(6)
2. WHAT IS THE NAME OF YOUR INPUT FILE?
fi l e - n a m e
3. DO YOU HAVE ANY OWN3 OR 0WN4 SUBROUTINES?
yes
(9)
no
(next)
4. WHAT IS THE NAME OF YOUR OUTPUT FILE?
fi l e - n a m e
5. THE STANDARD COLLATING SEQUENCE IS ASCII6. HERE IS THE WHOLE ASCII6 COLLATING SEQUENCE LISTED
."#$%&' ()*+,-./0123456789:;<=>?aABCDEFGHIJKLMN0PQRSTUVWXYZC\D^_
DO ALL OF YOUR KEYS CONSIST OF CHARACTER DATA TO BE SORTED ACCORDING TO THE ASCII6 COLLATING
SEQUENCE?
yes
(next)
no
(12)
ASCENDING ORDER OF THE ASCII6 COLLATING SEQUENCE MEANS THE NORMAL ORDER.
!"0$X&' ()*+,-./0123456789:;<=>?SABCDEFGHIJKLMN0PQRSTUVWXYZC\D^_
DESCENDING ORDER MEANS THE REVERSE ORDER.
_^J\CZYXWVUTSRQP0NMLKJIHGFEDCBAa?>=<;:9876543210/.-,+*)('8%$#,,l
DO YOU WANT ALL YOUR KEYS SORTED IN ASCENDING ORDER?
yes
(next)
no
(next)
33. HOW MANY KEY FIELDS DO YOU HAVE?
number
WHAT IS THE TYPE OF THE MOST IMPORTANT KEY FIELD?
key-type
THE LEFT-MOST CHARACTER OF A RECORD IS NUMBER 1. FOR THE MOST IMPORTANT KEY FIELD, WHAT IS THE
NUMBER OF THE LEFT-MOST CHARACTER?
number
HOW MANY CHARACTERS ARE IN THE MOST IMPORTANT KEY FIELD?
number

Figure E-1. Interactive Dialog (Sheet 1 of 5)
60484800 D

E-l

DO YOU WANT THIS KEY FIELD SORTED IN ASCENDING ORDER?1
yyes
es (next)
no
(next)
FOR THE SECONDttnOST IMPORTANT KEY FIELD, WHAT IS THE TYPE OF THE KEY?
key-type
FOR THE SECOND"^MOST IMPORTANT KEY FIELD, WHAT IS THE NUMBER OF THE LEFT-MOST CHARACTER?
number
HOW MANY CHARACTERS ARE IN THE SECOND+tHOST IMPORTANT KEY FIELD?
number
DO YOU WANT RECORDS WITH EQUIVALENT KEY VALUES TO BE WRITTEN IN THE SAME ORDER THEY ARE READ?
yes (next)
no
(next)
A SUM FIELD IS A SPECIAL FIELD IN A RECORD THAT IS CHANGED BY SORT/MERGE. IF SUM FIELDS ARE
SPECIFIED SUM FIELDS FROM RECORDS WITH EQUAL KEY VALUES WILL BE NUMERICALLY SUMMED AND PUT IN THE
SANE SUM FIELD IN A NEW RECORD. THE REMAINING KEY AND DATA FIELDS IN THE NEW RECORD WILL BE SET TO
THE CORRESPONDING FIELDS IN ONE OF THE OLD RECORDS. THE ORIGINAL RECORDS WILL BE DELETED. RECORDS
MAY HAVE MORE THAN ONE SUM FIELD, AND THEY WILL BE SORTED ACCORDING TO KEY VALUES. THEY TYPE OF A
SUM MAY BE ANY NUMERIC KEY TYPE EXCEPT REAL.
28. HOW MANY SUM FIELDS DO YOU HAVE?
number
WHAT IS THE TYPE OF THE FIRST^SUM FIELD?
sura-type
WHAT IS THE FIRST CHARACTER IN THE FIRSfftsUM FIELD?
number

•tt«SUM FIELD?
it LONG IS THE FIRST"
HOW MANY CHARACTERS*
number
GIVE AN ESTIMATE OF THE MAXIMUM NUMBER OF RECORDS TO BE SORTED,
number (end of dialog)
6. DO YOU HAVE AN OWN1 SUBROUTINE?
yes (next)
no
(7)
WHAT IS THE NAME OF THE FILE CONTAINING YOUR OWNCODE SUBROUTINE(S)?
f1le-name
WHAT IS THE NAME OF YOUR OWN1 SUBROUTINE?
entry-name
7. DO YOU HAVE AN OWN2 SUBROUTINE?
yes (next)
no
(8)
WHAT IS THE NAME OF THE FILE CONTAINING YOUR OWNCODE SUBROUTINE(S)?^
file-name
8. HOW MANY INPUT FILES DO YOU HAVE?
1
(2)
number (next)
WHAT IS THE NAME OF YOUR FIRST^t INPUT FILE?
file-name
9. WHAT IS THE NAME OF THE FILE CONTAINING YOUR OWNCODE SUBROUTINE(S)?**
file-name
DO YOU HAVE AN OWN3 SUBROUTINE?
yes (next)
no
(10)

Figure E-1. Interactive Dialog (Sheet 2 of 5)

E-2

60484800 A

yffi^s
WHAT IS THE NAME OF YOUR 0WN3 SUBROUTINE?
entry-name
DO YOU HAVE AN 0WN4 SUBROUTINE?
yes (next)
no
( 11 )
10. WHAT IS THE NAME OF YOUR 0WN4 SUBROUTINE?
entry-name
11. DO YOU HAVE AN OUTPUT FILE?
yes
(4)
no
(5)
12. DO YOU KNOW THE NAMES OF THE KEY TYPES YOU WANT TO USE?
yes
(33)
no
(next)
DO YOUR RECORDS CONSIST ENTIRELY OF CHARACTERS?
yes
(19)
no
(next)
NON-CHARACTER DATA MAY BE ORDERED ACCORDING TO ITS BINARY (SIGNED OR UNSIGNED) VALUE, OR REAL (I.E.
FLOATING POINT) VALUE.
A SIGNED BINARY KEY INTERPRETS THE BITS WITHIN THE KEY FIELD AS A ONE'S COMPLEMENT BINARY NUMBER.
IF THE LEFT-MOST BIT IS ZERO THEN THE NUMBER IS POSITIVE. IF THE LEFT-MOST BIT IS ONE THEN THE
NUMBER IS NEGATIVE AND THE MAGNITUDE OF THE NUMBER IS THAT WITH ALL BITS COMPLEMENTED. IF THE KEY
FIELD STARTS AND ENDS ON A CHARACTER BOUNDARY THEN THE KEY TYPE IS "INTEGER", OTHERWISE IT IS
"INTEGER_BITS".
AN UNSIGNED BINARY KEY INTERPRETS THE BITS WITHIN THE KEY FIELD AS A BINARY NUMBER. THE LEFT-MOST
BIT IN THE FIELD CONTRIBUTES TO THE NUMERIC VALUE JUST LIKE ANY OTHER BIT IN THE FIELD. IF THE KEY
FIELD STARTS AND ENDS ON A CHARACTER BOUNDARY THEN THE KEY TYPE IS "BINARY", OTHERWISE IT IS
"BINARY_BITS".
A REAL OR FLOATING POINT KEY INTERPRETS A 60-BIT VALUE AS A STANDARD FLOATING POINT NUMBER. THE KEY
TYPE IS "REAL".
13. IF YOU WANT MORE INFORMATION ABOUT A KEY TYPE, INCLUDING HOW TO SPECIFY IT, TYPE THE NAME OF THE KEY
TYPE. (OTHERWISE, TYPE A SPACE.)
binary (14)
binary_bits (15)
integer (16)
integer_bits (17)
real (18)
A
(19)

r

14. A BINARY KEY FIELD IS SPECIFIED BY NAMING THE FIRST CHARACTER POSITION AND THE LENGTH OF THE FIELD.
(THE FIRST CHARACTER POSITION IN THE RECORD IS 1.)
(13)
15. A BINARY BITS KEY FIELD IS SPECIFIED BY NAMING THE FIRST BIT POSITION AND THE LENGTH OF THE FIELD.
(THE FIRST BIT POSITION IN THE RECORD IS 1.)
(13)
16. AN INTEGER KEY FIELD IS SPECIFIED BY NAMING THE FIRST CHARACTER POSITION AND THE LENGTH OF THE
FIELD. (THE FIRST CHARACTER POSITION IN THE RECORD IS 1.)
(13)
17. AN INTEGERJ3ITS KEY FIELD IS SPECIFIED BY NAMING THE FIRST BIT POSITION AND THE BIT LENGTH OF THE
FIELD. (THE FIRST BIT POSITION IN THE RECORD IS 1.)
(13)
18. A REAL KEY FIELD IS SPECIFIED BY NAMING THE FIRST CHARACTER POSITION AND THE CHARACTER LENGTH OF THE
FIELD. SINCE REAL KEY FIELDS MUST BE FULL WORDS AND ALIGNED ON WORD BOUNDARIES, THE FIRST CHARACTER
POSITION MUST SPECIFY THE FIRST CHARACTER OF A WORD AND THE LENGTH MUST BE 10.
(13)

Figure E-1. Interactive Dialog (Sheet 3 of 5)

60484800 A

E-3

19. KEY FIELDS CONSISTING ONLY OF CHARACTERS MAY BE ORDERED ACCORDING TO A CHARACTER COLLATING SEQUENCE
OR ACCORDING TO A NUMERIC INTERPRETATION OF THE CHARACTERS.
DO YOU WANT ANY OF YOUR CHARACTER KEY FIELDS TO BE INTERPRETED NUMERICALLY?
yes (next)
no
(27)
THE KEY TYPE FOR NUMERIC CHARACTER KEYS IS "NUMERICJCX" WHERE XX INDICATES HOW THE SIGN (IF ANY) IS
TO BE EXTRACTED AND WHETHER LEADING BLANKS ARE ALLOWED. THE LEGAL NUMERIC CHARACTER KEY TYPES ARE:
NUMERICJJS ALL DIGITS, NO SIGN
NUMERIC_FS LEADING BLANKS, THEN OPTIONAL NEGATIVE SIGN, THEN DIGITS
NUMERICJ.S REQUIRED SIGN IS FIRST, THEN DIGITS
NUMERIC_TS DIGITS FOLLOWED BY REQUIRED SIGN
NUMERICJ.0 LEADING OVERPUNCHED DIGIT, THEN DIGITS
NUMERIC_TO DIGITS FOLLOWED BY TRAILING OVERPUNCHED DIGIT
20. IF YOU WANT MORE INFORMATION ABOUT ONE OF THE NUMERIC CHARACTER KEY TYPES, INCLUDING HOW TO SPECIFY
IT, TYPE THE NAME OF THE KEY TYPE. (OTHERWISE, TYPE A SPACE.)
nuraericjns (21)
numeric_fs (22)
numeric_ls (23)
nuraeric_ts (24)
numeric__lo (25)
numeric_to (26)
A
(27)
21. NUMERICJIS KEY FIELDS MUST CONTAIN ALL DECIMAL DIGIT CHARACTERS WITHOUT A SIGN. THE FIELD IS
SPECIFIED BY NAMING THE FIRST CHARACTER POSITION AND THE CHARACTER LENGTH OF THE FIELD.
(20)
22. NUMERIC_FS KEY FIELDS MUST BE NUMERIC CHARACTERS IN A FLOATING SIGN FORMAT. LEADING BLANKS ARE
REQUIRED FOR LEADING ZEROS, FOLLOWED BY AN OPTIONAL SIGN CONSISTING OF "-", FOLLOWED BY DECIMAL
DIGIT CHARACTERS. THIS IS THE SAME FORMAT AS IS PRODUCED BY WRITING ACCORDING TO THE DEFAULT
FORTRAN I FORMAT WITH NO MODIFIERS. THE FIELD IS SPECIFIED BY NAMING THE FIRST CHARACTER POSITION
AND THE CHARACTER LENGTH OF THE FIELD.
(20)
23. THE FIRST CHARACTER OF A NUMERICJ.S KEY FIELD MUST BE A "+" OR "-" CHARACTER. THE REMAINING
POSITIONS MUST CONSIST OF DECIMAL DIGIT CHARACTERS. THE FIELD IS SPECIFIED BY NAMING THE FIRST
CHARACTER POSITION AND THE CHARACTER LENGTH OF THE FIELD.
(20)
24. THE TRAILING (RIGHT-MOST) CHARACTER OF A NUMERIC_TS KEY FIELD MUST BE A "+" OR "-" CHARACTER. THE
REMAINING POSITIONS MUST CONSIST OF DECIMAL DIGIT CHARACTERS. THE FIELD IS SPECIFIED BY NAMING THE
FIRST CHARACTER POSITION AND THE CHARACTER LENGTH OF THE FIELD.
(20)
25. THE LEADING (LEFT-MOST) CHARACTER OF A NUMERICJ.0 KEY FIELD MUST BE AN OVERPUNCHED DIGIT. THE
OVERPUNCHED DIGIT DETERMINES BOTH THE SIGN OF THE ENTIRE NUMBER AND THE VALUE OF THE LEADING DIGIT.
CHARACTERS FROM "0" TO "9" MEAN THE SIGN IS POSITIVE AND THE LEADING DIGIT IS 0 TO 9. CHARACTERS
FROM "A" TO "I" MEAN THE SIGN IS POSITIVE AND THE LEADING DIGIT IS 1 to 9. CHARACTERS FROM "J" TO
"R" MEAN THE SIGN IS NEGATIVE AND THE LEADING DIGIT IS 1 TO 9. THE CHARACTER "<" MEANS THE SIGN IS
POSITIVE AND THE LEADING DIGIT IS 0. THE CHARACTER "!" MEANS THE SIGN IS NEGATIVE AND THE LEADING
DIGIT IS ZERO. THE REMAINING POSITIONS OF THE FIELD MUST CONTAIN DECIMAL DIGITS. THE FIELD IS
SPECIFIED BY NAMING THE FIRST CHARACTER POSITION AND THE CHARACTER LENGTH OF THE FIELD.
(20)
26. THE TRAILING (RIGHT-MOST) CHARACTER OF A NUMERIC_TO KEY FIELD MUST BE AN OVERPUNCHED DIGIT. THE
OVERPUNCHED DIGIT DETERMINES BOTH THE SIGN OF THE ENTIRE NUMBER AND THE VALUE OF THE TRAILING
DIGIT. CHARACTERS FROM "0" TO "9" MEAN THE SIGN IS POSITIVE AND THE TRAILING DIGIT IS 0 TO 9.
CHARACTERS FROM "A" TO "I" MEAN THE SIGN IS POSITIVE AND THE TRAILING DIGIT IS 1 TO 9. CHARACTERS
FROM "J" TO "R" MEAN THE SIGN IS NEGATIVE AND THE TRAILING DIGIT IS 1 TO 9. THE CHARACTER "<" MEANS
THE SIGN IS POSITIVE AND THE LEADING DIGIT IS 0. THE CHARACTER "!" MEANS THE SIGN IS NEGATIVE AND
THE TRAILING DIGIT IS ZERO. THE REMAINING POSITIONS OF THE FIELD MUST CONTAIN DECIMAL DIGITS. THE
FIELD IS SPECIFIED BY NAMING THE FIRST CHARACTER POSITION AND THE CHARACTER LENGTH OF THE FIELD.
(20)

Figure E-1. Interactive Dialog (Sheet 4 of 5)

E-4

60484800 A

27. DO YOU WANT ANY OF YOUR CHARACTER KEYS TO BE ORDERED ACCORDING TO A COLLATING SEQUENCE?
yes (next)
no
(32)
THE STANDARD COLLATING SEQUENCE IS ASCII6. HERE IS THE WHOLE ASCII6 COLLATING SEQUENCE LISTED
!"#$X8»()*+,-./0123456789:;<=>?aABCDEFGHIJKLMNOPQRSTUVWXYZC\D-^_
THE KEY TYPE OF A CHARACTER KEY FIELD ORDERED ACCORDING TO A COLLATING SEQUENCE IS THE NAME OF THE
COLLATING SEQUENCE. THE KEY FIELD IS SPECIFIED BY NAMING THE FIRST CHARACTER POSITION AND THE
LENGTH OF THE FIELD.
THERE ARE FIVE PRE-DEFINED COLLATING SEQUENCES: DISPLAY, C0B0L6, ASCII6, EBCDIC6 AND INTBCD. THERE
CAN BE FROM 0 TO 100 USER-DEFINED COLLATING SEQUENCES.
DO YOU WANT TO DEFINE YOUR OWN COLLATING SEQUENCE?
yes (next)
no
(32)
29. WHEN ASKED TO TYPE IN YOUR COLLATING SEQUENCE PLEASE TYPE IT IN AS C,C,C,C,C,C OR C,C,C,C,

cc

WHERE C IS A CHARACTER OR OCTAL VALUE.
C CAN BE A LETTER, A ONE-DIGIT NUMBER OR A SPECIAL CHARACTER SUCH AS ( ) + - *.
SORT/MERGE ASSUMES A TWO-DIGIT NUMBER IS AN OCTAL VALUE. (THE NUMBER SHOULD NOT BE FOLLOWED BY A
LETTER "B".) THE COMMA HAS TO BE SPECIFIED BY ITS OCTAL VALUE 56. HOW MANY COLLATING SEQUENCES DO
YOU WANT TO DEFINE?
number
30. WHAT IS THE NAME OF YOUR COLLATING SEQUENCE?
sequence-name
PLEASE TYPE IN YOUR COLLATING SEQUENCE.
C/C/ • ■ •
(30 if more to define)
(next if done defining)
DEFINING EQUATE MEANS SPECIFYING TWO OR MORE CHARACTERS ALREADY IN A COLLATING SEQUENCE AS EQUAL FOR
COMPARISON PURPOSES. MORE THAN ONE EQUATE COLLATING SEQUENCE MAY BE SPECIFIED FOR A COLLATING
SEQUENCE.
DO YOU WANT TO DEFINE EQUATES FOR YOUR COLLATING SEQUENCES?
yes (next)
no
(32)
WHEN ASKED TO TYPE IN YOUR EQUATE SEQUENCE(S), PLEASE ENTER IN THE FORM C,C,C,C,C,C WHERE C IS A
CHARACTER OR OCTAL VALUE AS EXPLAINED BEFORE.
HOW MANY EQUATE SEQUENCES DO YOU WANT TO DEFINE?
number
31. WHAT IS THE NAME OF THE COLLATING SEQUENCE FOR THIS EQUATE?
sequence-name
PLEASE TYPE IN YOUR EQUATE SEQUENCE.
(31 if more to define)
(next if done defining)
32. YOU SHOULD KNOW THE NAME(S) OF ALL KEY TYPES YOU WANT TO USE. IF YOU DO NOT KNOW, START OVER BY
TYPING "RESTART" INSTEAD OF THE NUMBER OF KEY FIELDS.
(33)
'Not asked if you answered "yes" to the previous question about sort order.
''Repeated with successive numbers until all have been specified.
t"BITS" if you specified sum type INTEGER_BITS or BINARY_BITS.
++Not asked if you gave the file name in response to question 6.

Figure E-1. Interactive Dialog (Sheet 5 of 5)

60484800 A

E-5

f^%

r*%

SORT/MERGE 5, SORT/MERGE 4 COMPARISON

Sort/Merge 5 is functionally equivalent to
Sort/Merge 4, but these versions of the product are
externally incompatible because the control state
ment for Sort/Merge 5 has been changed. Table F-l
shows a comparison of Sort/Merge 5 and Sort/Merge
4. As indicated in table F-l, the Sort /Merge 4
FORTRAN procedures can be called by Sort/ Merge 5
users, and the Sort/Merge 4 owncode exits can be
taken from FORTRAN 5.

Since Sort/Merge 5 procedures are compatible with
Sort/Merge 4 FORTRAN procedures, no changes are
needed to convert programs calling Sort/Merge 4
FORTRAN procedures FORTRAN compatible owncode
r o u t i n e s c a n b e c a l l e d b y S o r t / M e r g e 4 F O RT R A N
procedures or by Sort/Merge 5 without any changes
to the owncode routines. All these Sort/Merge 5
relocatable binaries can be run by including LDSET
(LIB=SRT5LIB) in the load sequence before program
execution.

TABLE F-l. SORT/MERGE 5, SORT/MERGE 4 COMPARISON
Feature

Sort/Merge 5

Sort/Merge 4

Control
Statement
Sort

Most sorts can be specified with the S0RT5
control statement and parameters alone.

A control statement sort requires a separate
d i r e c t i v e s s e c t i o n o f t h e i n p u t fi l e .

Merge

Merge-only processing is available.

Merge-only processing is available.

Key Types

Sort keys can be 6-bit display code charac
ters, signed or unsigned binary integers,
o r fl o a t i n g - p o i n t n u m b e r s .

Sort keys can be 6-bit characters written in
display code or internal BCD code, signed or
u n s i g n e d b i n a r y i n t e g e r s , o r fl o a t i n g - p o i n t
numbers.

Collating
Sequences

ASCII6 (default), C0B0L6, DISPLAY, EBCDIC6,
and INTBCD are predefined. User-defined is
also available.

ASCII6 (default if installation character
set is ASCII), C0B0L6 (default if installa
tion character set is CDC), DISPLAY, and
INTBCD are predefined. User-defined is
also available.

Record
Types

Any CYBER Record Manager sequential record
type except U can be sorted.

Any CYBER Record Manager sequential record
type except U can be sorted.

Tape Sorts

Tape files can be used as FROM and TO
files, but balanced and polyphase sorting
i s n o t p e r f o r m e d . Ta p e s c r a t c h fi l e s f o r
i n t e r m e d i a t e fi l e s i s n o t s u p p o r t e d .

A tape variant provides balanced and poly
phase tape sorting.

Checkpoint/
Restart

Not available.

A job abnormally terminated can be captured
on tape so that the job can be restarted
from the checkpoint, rather than from the
beginning.

Interactive
Usage

Interactive dialog and commands are avail
able to aid in sort or merge specification.

No interactive dialog or commands are
available.

Procedure
Calls

Sort or merge can be initiated from within
a program (FORTRAN or other language) by a
series of procedure calls.

Sort or merge can be initiated from within
a COMPASS or FORTRAN program by a series of
procedure calls. The Sort/Merge 4 FORTRAN
procedures can be called by Sort/Merge 5
users.

Owncode
Routines

Routines can be written to process input
records, output records, or records with
equal keys during Sort/Merge processing.

Routines can be written to process input
records, output records, records with equal
keys, or nonstandard labels during Sort/
Merge processing. The Sort/Merge 4 FORTRAN
owncode exits can be taken by Sort/Merge 5
users.

COBOL

C0B0L5 control statement option can specify
Sort/Merge 5 be used when COBOL SORT or
MERGE statement is executed, or direct
calls to the procedures can be made.

The interface is through the COBOL SORT or
MERGE statement; Sort/Merge 4 is the default
for sorts or merges from COBOL 5.

60484800 D

F-l

INDEX

Alter
SEQA parameter 3-7
SM5SEQA procedure 5-5
Ascending (see Sort order)
ASCII6 (see Collating sequence)
Basic Access Methods (BAM) 3-1, 3-10, C-l
Batch processing 1-2
Beginning-of-information (BOI) C-l
BINARY (see Numeric data formats)
BINARY_BITS (see Numeric data formats)
Bit 2-1
Blanks (see Spaces)
Block
D e fi n i t i o n C - l
Types 3 - 11
Byte 2-1, C-l

r

CALL statement 5-1
Character
Data 2-1
D e fi n i t i o n C - l
Sets A-l
COBOL
Control statement 1-2, 6-1
Sort/Merge procedures 6-1
C0B0L6 (see Collating sequence)
Collating sequence
ASCII6 2-2
C0B0L6 2-2
D e fi n i t i o n 1 - 1 , 2 - 2 , C - l
DISPLAY 2-2
EBCDIC6 2-2
INTBCD 2-2
User-defined
SEQx parameters 3-5
SM5SEQx procedures 5-4
Commas 3-1, 3-9, 4-5
C o n fi g u r a t i o n
Hardware 1-2
Software 1-2
Continuation lines 3-1
Control statement (see FILE control statement, MERGE
control statement, S0RT5 control statement)
CYBER Control Language (CCL)
D e fi n i t i o n C - l
ENR parameter 3-4
STATUS parameter 3-7
CYBER Record Manager (CRM) 1-1, C-l
Data alignment 2-1
Dayfile messages 5-4
Default
D e fi n i t i o n C - l
F i l e c h a r a c t e r i s t i c s 1 - 1 , 3 - 11
Descending (see Sort order)
DIA parameter (see DIALOG parameter)
Diagnostics B-l
Dialog (see Interactive dialog)

60484800 D

DIALOG parameter 3-2, 3-4, 4-2, D-l
DIR parameter 3-3, D-l
D i r e c t i v e fi l e s
Continuation 3-2
D e fi n i t i o n 1 - 1 , C - l
DIR parameter 3-3
Example 8-4
Format 3-1
Length 3-1
Use 1-1, 3-1, 8-4
DISPLAY (see Collating sequence)
Display code C-l
Duplicate parameters 3-2
E parameter 3-4, D-l
EBCDIC6 (see Collating sequence)
EL parameter 3-4, D-l
E n d - o f - fi l e 3 - 2 , 5 - 2
End-of-information (EOI) C-l
End-of-record 3-2, 5-2
ENR parameter 3-4, D-l
ENTER statement 6-1
Entry point C-l
Error
Codes
SM5ST procedure 5-5
STATUS parameter 3-7
Level 3-4, 5-3, B-l
Messages B-l
Status variable
SM5ST procedure 5-5, B-l
STATUS parameter 3-7, B-l
Equal keys
Owncode 5 7-4
RETAIN parameter 3-5
SM5RETA procedure 5-4
Summing
SM5SUM procedure 5-6
SUM parameter 3-8
Examples
Control statement merge 8-3
Control statement sort
Multiple keys 8-3
One key 8-1
D i r e c t i v e fi l e
Creation 8-4
Use 8-4
Interactive commands 4-4
Interactive dialog 8-1
I n t e r a c t i v e p a r a m e t e r s p e c i fi c a t i o n 4 - 5
NOS login 4-1
NOS/BE login 4-2
O u t p u t fi l e d i s p o s i t i o n 4 - 4
Owncode routine 8-9
Procedure calls 8-7
EXTERNAL statement 5-4, 7-1
FASTIO parameter 3-9, D-l
Features 1-1
F i e l d l e n g t h r e q u i r e m e n t s 3 - 11

Index-1

File
D e fi n i t i o n C - 2
Description 1-1, 3-10
Format
D a t a fi l e 3 - 2 , 5 - 2
D i r e c t i v e fi l e 3 - 1
E r r o r fi l e 3 - 4 , 5 - 3
L i s t i n g fi l e 3 - 3
Local C-2
Organization 3-10
FILE control statement
Description 1-1, 3-10, C-2
DIR parameter 3-3
FASTIO parameter 3-9
Format 3-10
FROM parameter 3-2
Interactive 4-3, 4-4
L parameter 3-3
Owncode routine 7-1
SM5E procedure 5-3
SM5FAST procedure 5-4
SM5FR0M procedure 5-2
SM5T0 procedure 5-2
TO parameter 3-2
File information table (FIT) 3-10, C-2
Floating-point numbers 2-5, C-2
FORTRAN programs 1-1, 5-1, 7-1
FROM parameter 3-2, D-l

Graphic A-l, C-2
HELP command 4-3

I n p u t fi l e s
FROM parameter 3-2
Owncode routine processing 7-3
SM5FR0M procedure 5-2
INTBCD (see Collating sequences)
Integer C-2
INTEGER (see Numeric data formats)
INTEGER_BITS (see Numeric data formats)
Interactive commands 4-3
Interactive dialog
Te x t E - l
Use 1-1, 4-2, 8-1
Interactive processing 1 -2 , 4 -1 , C -2
INTERCOM 1-2, C-2
Internal representation 2-2
Job

Definition C-2
Flow
Batch 1-3
Interactive 1-4
Structure
Control statement merge 8-3, 8-4
Control statement sort 8-3
D i r e c t i v e fi l e u s e 8 - 7
Procedure calls 8-7
KEY parameter
Keys (see Sort
Keyword
D e fi n i t i o n
Sort/Merge

Index-2

3-2, D-l
keys)
C-2
parameters 3-2

/*^%.

L parameter 3-3, D-l
Leading blanks 2-2
Library C-2
L i s t i n g fi l e 3 - 3
Literal C-2
Loading
Owncode routines 3 - 5 , 5 - 4
Procedures 5-1
L o g i c a l fi l e n a m e ( l f n ) C - 2
Logical record C-2
Login 4-1, C-2
Logout 4-5, C-2

Major sort key 2-1, C-2
Mass storage C-2
MERGE control statement
Continuation 3-1, 4-5
Format 3-1, 4-5
Length 3-1, 4-5
Punctuation 3-1, 4-5
Merge order 3-9
Merging
Control statement 3-1
D e fi n i t i o n C - 3
Initiation 1-1, 5-6
Procedure call 5-1
Purpose 1-1
Minor sort key 2-1, C-3
Multiple sort keys 2-1
Network Access Method (NAM) 1-2
Noncharacter data 2-1
NOS 1-2
NOS/BE 1-2
Notations ix
Numeric data formats
BINARY 2-4
BINARYJBITS 2-4
INTEGER 2-4
INTEGER_BITS 2-4
NUMERIC_FS 2-4 '
NUMERICJ.0 2-4
NUMERICJ.S 2-4
NUMERIC_NS 2-4
NUMERICJTO 2-4
NUMERICJTS 2-4
REAL 2-4
NUMERICJFS (see Numeric data formats)
NUMERICJLO (see Numeric data formats)
NUMERICJLS (see Numeric data formats)
NUMERIC_NS (see Numeric data formats)
NUMERICJTO (see Numeric data formats)
NUMERIC TS (see Numeric data formats)

r**E%

OFL parameter (see OWNFL parameter)
0MRL parameter (see OWNMRL parameter)
Order (see Sort order)
O u t p u t fi l e s
Owncode routine processing 7-4
SM5T0 procedure 5-2
TO parameter 3-2
Overflow
SM5SUM procedure 5-6
SUM parameter 3-8
Overpunch character representation 2-5

60484800 D

0^s

Owncode routines
Calling sequence 3-5
D e fi n i t i o n 1-2, 7-1, C-3
File 3-5
Loading 3--5, 7-1
Name 3-5, 5-4
Owncode 1 7-2
Owncode 2 7-3
Owncode 3 7-3
Owncode 4 7-4
Owncode 5 7-4
Parameters 7-1
Record length 3-5, 5-4
Summary 7-2
OWNF parameter 3-4, 7-1, D-l
OWNFL parameter 3-5, 7-1, D-l
OWNMRL parameter 3-5, D-l
OWNn parameter 3-5, 7-1, D-2
Parameter
D e fi n i t i o n C - 3
Owncode routine 7-1
Sort/Merge 3-2, D-l
Partition C-3
Periods 3-1
Physical record unit (PRU) C-3
Positional p a r a m e t e r s 3 - 2 , 3 - 1 0
Procedure calls
D e fi n i t i o n 1 - 1 , C - 3
Loading 5-1
Order 5-1
Owncode routines 7-1
Record length 5-1
Result array 5-1
Punctuation (see Commas, Periods, Spaces)

r

QUIT command 4-3
Range ix, 3-1, 3-7
REAL (see Numeric data formats)

n
__
7_lf
Reca „parameter

7_2

Recb parameter 7 - 1 , 7 - 2 *
Record
D e fi n i t i o n C - 3
Estimated number
ENR parameter 3-4
SM5ENR procedure 5-3
Length
Owncode routine 3-5, 5-4
S p e c i fi c a t i o n 3 - 11 , 5 - 1
Type 1-1, 3-11, C-3
Relocatable C-3
Resource map 3-3
RESTART command 4-3
Result array 5-1, C-4
RET parameter (see RETAIN parameter)
RETAIN parameter 3-5, D-2
Return_code parameter 7-1
Rewind C-4
REWIND statement 5-2
Rla parameter 7-1
Rib parameter 7-1

Section C-4
S e q u e n t i a l fi l e

3-11, C-4

SEQx parameters
SEQA parameter 3-7, D-2
SEQN parameter 3-5, D-2
SEQR parameter 3-7, D-2
SEQS parameter 3-6, D-2
Signed numeric data 2-2, C-4
SM5E procedure 5-3
SM5EL procedure 5-3
SM5END procedure 5-7
SM5ENR procedure 5-3
SM5FAST procedure 5-4
SM5FR0M procedure 5-2
SM5KEY procedure 5-2
SM5MERG procedure 5-2
SM5N0DA procedure 5-4
SM50FL procedure 5-4
SM50MRL procedure 5-4
SM50WNn procedure 5 - 4 , 7 - 1
SM5RETA procedure 5-4
SMSSEQx procedures
SM5SEQA procedure 5-5
SM5SEQN procedure 5-5
SM5SEQR procedure 5-5
SM5SEQS procedure 5-5
SMSSORT procedure 5-1
SM5ST procedure 5-5
SM5SUM procedure 5-6
SM5T0 procedure 5-2
Sort keys
D e fi n i t i o n 1 - 1 , 2 - 1 , C - 4
Key length
General 2-1
KEY parameter 3-2
SM5KEY procedure 5-2
Key position
General 2-1
KEY parameter 3-2
SM5KEY procedure 5-2
Key type
General 2-1, C-2
KEY parameter 3-2
SM5KEY procedure 5-2
Size 2-1
Sort/Merge 4 F-l
Sort order
Ascending
KEY parameter 3-2
SM5KEY procedure 5-2
D e fi n i t i o n 2 - 5 , C - 4
Descending
KEY parameter 3-2
SM5KEY procedure 5-2
Sorting
Control statement 3-1
Initiation 1-1, 5-6
Procedure call 5-1
Purpose 1-1
S0RT5 control statement
Continuation 3-1, 4-5
Format 3-1, 4-5
Length 3-1, 4-5
Punctuation 3-1, 4-5
Spaces 3-1, 4-5
ST parameter (see STATUS parame t e r )
STATUS parameter 3-7, D-2
Sum fields
Example 3-9, 5-6, 8-7
Number 3-8, 5-6
O v e r fl o w 3 - 8 , 5 - 6
Ty p e 3 - 8 , 5 - b

0ps

60484800 D

Index-3

I Summing 1-1, 3-8, 5-6
SUM parameter 3-8, D-2
System-logical-record C-4
Terminal
Access (see Login)
Connection 4-1
TO parameter 3-2, D-2
Unit record format 4 - 2
Unsigned numeric data 2-2
User-defined collating sequences
SEQx parameters 3-5
SM5SEQx procedures 5-5

Value-set
Description 3-2
KEY parameter 3-2
SUM parameter 3-8
Value step
SEQS parameter 3-6
SM5SEQS procedure 5-5
VER parameter (see VERIFY parameter)
VERIFY parameter 3-9, D-2
Word C-4

$CHAR(n) 3-b

A^tms
Index-4

60484800 D

MANUAL TITLE: Sort/Merge Version 5 Reference Manual
Ji^s

PUBLICATION NO.: 60484800
REVISION: D
This form is not intended to be used as an order blank. Control Data Corporation
welcomes your evaluation of this manual. Please indicate any errors, suggested
additions or deletions, or general comments on the back (please include page number
references).
Please reply

No reply necessary

FOLD

FOID

0ms
NO POSTAGE
NECESSARY
IF MAILED
IN THE
UNITED STATES!

BUSINESS REPLY MAIL
FIRST CLASS PERMIT NO. 8241 MINNEAPOLIS, MN.
POSTAGE WILL BE PAID BY ADDRESSEE

CONTRPL DATA
Technology and Publications Division
Mail Stop: SVL104
P.O. Box 3492
Sunnyvale, California 94088-3492

i!

FOLD

FOLD

NO POSTAGE STAMP NECESSARY IF MAILED IN U.S.A.
FOLD ON DOTTED LINES AND TAPE
NAME:
COMPANY:
STREET ADDRESS:
CITY/STATE/ZIP;

r
TAPE

TAPE

"^1



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.3
Linearized                      : No
Page Count                      : 108
Creator                         : ScanSnap Manager
Producer                        : Mac OS X 10.5.8 Quartz PDFContext
Create Date                     : 2009:10:24 13:19:59Z
Modify Date                     : 2009:10:24 13:19:59Z
EXIF Metadata provided by EXIF.tools

Navigation menu