Im 067310
Im 067310
Sort
User's Guide and Reference
Version 3
SC09-1826-00
Note!
Before using this information and the product it supports, be sure to read the general information under “Notices”
on page ix.
| This edition applies to the IBM AS/400 Operating System/400 licensed program (Program 5763-SS1), Version 3 Release 1, and to all
subsequent releases and modifications until otherwise indicated in new editions. Make sure you are using the proper edition for the
level of the product.
Order publications through your IBM representative or the IBM branch serving your locality. Publications are not stocked at the
address given below.
A form for readers’ comments is provided at the back of this publication. If the form has been removed, you may address your
comments to:
| You can also send your comments by facsimile (attention: RCF Coordinator), or you can send your comments electronically to IBM.
| See "Communicating your Comments to IBM" for a description of the methods. This page immediately precedes the Readers'
| Comment Form at the back of this publication.
When you send information to IBM, you grant IBM a non-exclusive right to use or distribute the information in any way it believes
| appropriate without incurring any obligation to you.
Chapter 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
General Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
How to Use Sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Entering the Sort Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Specifications Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Entering Specifications Interactively . . . . . . . . . . . . . . . . . . . . . . . 4
Contents of the Source File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Types of Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Sequencing the Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
The Purpose of Record and Field Specifications . . . . . . . . . . . . . . . . . 6
Record Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Selecting Control and Data Fields–Building the Output Record . . . . . . . 7
Building the Control Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
The Data Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Using FMTDTA to Process the Specifications . . . . . . . . . . . . . . . . . . . . 8
As a Line Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
From Screen Displays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
What Happens when You Use the FMTDTA Command . . . . . . . . . . . . . 9
Related Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Files and Work Areas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Input Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Output File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Work Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Source File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Print File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Input and Output Record Format . . . . . . . . . . . . . . . . . . . . . . . . . 12
Limitations on the Number of Records for Copy-Only Requests . . . . . . . 13
Limitations on the Number of Records for Sort Requests . . . . . . . . . . . 13
Tracking Any Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Message and Help Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Displaying and Printing Messages . . . . . . . . . . . . . . . . . . . . . . . . 15
Correcting the Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Control Language Command Help . . . . . . . . . . . . . . . . . . . . . . . . 16
Chapter 6. Copying and Merging Records from Several Files into One . 67
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Example 1. Copying a File with No Reformatting . . . . . . . . . . . . . . . . 68
Entering the Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Processing the Specifications . . . . . . . . . . . . . . . . . . . . . . . . . 70
Example 2. Copying/Merging Several Files to Produce a Reformatted Output
File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Entering the Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Processing These Specifications . . . . . . . . . . . . . . . . . . . . . . . . 72
Contents v
Columns 7 and 8 (Details) . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Columns 9 through 12 (Field Location Start Position) . . . . . . . . . . . 107
Columns 13 through 16 (Field Location End Position) . . . . . . . . . . 107
Column 17 (Conditionally Forced Character) . . . . . . . . . . . . . . . . 108
Column 17 (Summary Overflow Indicator) . . . . . . . . . . . . . . . . . 108
Column 18 (Forced Character) . . . . . . . . . . . . . . . . . . . . . . . . 108
Column 18 (Substitution Character) . . . . . . . . . . . . . . . . . . . . . 108
Column 19 (Continuation) . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Columns 20 through 22 (Overflow Field Length–Summary Sort) . . . . 109
Column 20 (Alternative Collating Sequence by Field) . . . . . . . . . . . 109
Columns 23 through 39 (Reserved) . . . . . . . . . . . . . . . . . . . . . 109
Columns 40 through 72 (Comments) . . . . . . . . . . . . . . . . . . . . 109
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Contents vii
viii Sort User's Guide and Reference
Notices
Any reference to an IBM* licensed program or other IBM product in this publication
is not intended to state or imply that only IBM’s program or other product may be
| used. Any functionally equivalent product, program, or service that does not
| infringe on any of IBM's intellectual property rights may be used instead of the IBM
| product, program, or service. Evaluation and verification of operation in conjunction
| with other products, except those expressly designated by IBM, is the user's
| responsibility.
IBM may have patents or pending patent applications covering subject matter in
this document. The furnishing of this document does not give you any license to
| these patents. You can send license inquiries, in writing, to the IBM Director of
| Licensing, IBM Corporation, 208 Harbor Drive, Stamford, Connecticut, USA
| 06904-2501.
Changes or additions to the text are indicated by a vertical line (|) to the left of the
addition or change.
This publication contains examples of data and reports used in daily business oper-
ations. To illustrate them as completely as possible, the examples include the
names of individuals, companies, brands, and products. All of these names are
fictitious and any similarity to the names and addresses used by an actual business
enterprise is entirely coincidental.
You may need to refer to other IBM manuals for more specific information about a
particular topic. The Publications Ordering, SC41-3000 manual provides informa-
tion on all the manuals in the AS/400 library.
Before you use this manual, you should be familiar with certain information:
| You should be familiar with your display station (also known as a work station)
| and its controls. Some elements of its display and certain keys on the key-
| board are standard regardless of the software system currently running at the
| display station or the hardware system the display station is connected to.
| Some of these keys are:
| – Cursor movement keys
| – Command keys
| – Field exit keys
| – Insert and delete keys
| – The Error Reset key.
| This information is contained in the System Operation for New Users,
| SC41-3200.
| You should know how to operate your display station when it is connected to
| the IBM AS/400 system and running AS/400 software. This means knowing
| about the OS/400 system and the Control Language (CL) to perform the tasks
| of:
| – Sign on and sign off of the AS/400 system
| – Interact with displays
| – Use Help
| – Enter control commands
| – Call utilities
| – Respond to messages.
| To find out more about control language, refer to these IBM AS/400
| publications:
| – CL Programming, SC41-3721
| – CL Reference, SC41-3722
The Sort utility provides a large range of sorting and reformatting possibilities; to
copy and merge files; or to add information, sum data, and reference existing
records in other files.
General Description
Use the Sort utility to sort and reformat records. You work with Control Language
(CL) commands to enter and then process the appropriate instructions. With Sort,
you can:
Sort records from one file (called the input file) and store the result in a
single physical output file. This output file is called a physical file because it
contains the actual records that were sorted. You can also divide the input
records into fields, and reformat (select and rearrange) those fields in the
output records.
See Chapter 2, “Sorting Records from a Single File,” for examples.
Sort records from several input files and store the result in a single phys-
ical output file. You can also divide the input records into fields and reformat
them in the output records.
See Chapter 3, “Sorting Records from Several Files,” for examples.
Sort records from a single input file and store the result in a single record
address (RA) output file. This output file does not contain the actual records
that were sorted; rather, it contains a sorted list of addresses of the records in
the original input file. This has the advantage of keeping the sorted result up to
date for changes to previously existing records. However, if you add or delete
records from the input file, the RA file does not have the addresses for the new
records, and will still contain the addresses of the old records.
See Chapter 4, “Sorting Records from a Single File to Produce a Record
Address File,” for examples.
Produce an output file containing totals, rather than sorted or reformatted
records.
See Chapter 5, “Sorting Records from a File and Producing Totals,” for exam-
ples.
Figure 1 shows these steps and also gives the order of the specifications in the
source file. Figure 2 on page 3 shows what happens when you use the FMTDTA
command to process a source file.
┌───────────────────────────────────┐
│ 1. (Optional) Enter │
│ Sort specifications │
│ onto preprinted forms. │
└─────────────────┬─────────────────┘
│
│
│
┌────────────────────────────────────┐
│ 2. Use SEU to enter specifi- │
│ cations into a source file: │
│ - header specification │
│ - ALTSEQ specifications │
│ - record specifications │
│ - field specifications │
│ - comment specifications. │
└─────────────────┬──────────────────┘
│
│
│
┌───────────────────────────────────┐
│ 3. Use FMTDTA to process │
│ the source file. │
└───────────────────────────────────┘
Specifications Forms
The three Sort specifications forms are shown in Figure 3 on page 4 and are fol-
lowed by a description of how to complete them.
Chapter 1. Introduction 3
HEADER SPECIFICATIONS
1 2 73 74 75 76 77 78 79 80
Page ┌──┬──┐ Program ┌──┬──┬──┬──┬──┬──┬──┬──┐
│ │ │ Identification │ │ │ │ │ │ │ │ │
└──┴──┘ └──┴──┴──┴──┴──┴──┴──┴──┘
┌───────────┬─────────────────┬─────┬────────┬──┬────────────────────┬──┬──┬──┬────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │ │ R │ │ S│ │A │ R│O │ │ / / │
├────────┬──┤ Output Type │ e │Maximum │ e│ │l │ e│u │ │ / / │
│ │T │ │ s │Control │ q│ │tC│ s│t │ │ / / │
│ │y │ SORTR │ e │Field │ u│ │ o│ e│p │ │ / / │
│ Number │p │ SORTRS │ r │Length │ e│ Reserved │Sl│ r│u │ Reserved │ Comments / / │
│ │e │ SORTA │ v │ │ n│ │e │ v│t │ │ / / │
│ │ │ │ e │(1─256) │ c│ │q │ e│ │ │ / / │
│ │ │ │ d │ │ e│ │ │ d│ │ │ / / │
│ │H │ │ │ │A │ │S │ │ │ │ / / │
│ │* │ │ │ │D │ │F │ │X │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┬──┬──┬──┬──┬──┼──┬──┼──┬──┬──┼──┼──┬──┬──┬──┬──┬──┬──┼──┼──┼──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
RECORD SPECIFICATIONS
┌───────────┬──┬──┬───────────────────────┬─────┬──┬───────────────────────────────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │C │D │ Factor 1 │Com- │F │B───────────────── Factor 2 Constant ───────────────────C│ / / │
├────────┬──┤o │a ├───────────┬───────────┤pari-│a │ • │ / / │
│ │T │n │t │ │ │son │c │B─── Factor 2 ───C• │ / / │
│ │y │t │aT│ │ │Oper-│t │ Keyword • │ / / │
│ Number │p │i │ y│ Start │ End │ator │o │ • │ Comments / / │
│ │e │n │ p│ Position │ Position │ │r │B────── Factor 2 ─────C• │ / / │
│ │ │u │ e│ │ │ │2 │ Field • │ / / │
│ │I │e │C │ │ │ │ │ • │ / / │
│ │O │ │Z │ │ │ │C │ Location • │ / / │
│ │* │A │D │ │ │EQ,NE│F │ │ • │ / / │
│ │ │O │P │ │ │LT,GT│K │ Start │ End • │ / / │
│ │ │* │U │ │ │LE,GE│S │ │ • │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┼──┼──┬──┬──┬──┼──┬──┬──┬──┼──┬──┼──┼──┬──┬──┬──┼──┬──┬──┬──•──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
FIELD SPECIFICATIONS
┌───────────┬──┬───┬───────────────────────┬────────┬────────┬──────────────────────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │F │D │ Field Location │ Forced │Overflow│ │ / / │
├────────┬──┤i │a ├───────────┬───────────┤ Charac-│Field │ │ / / │
│ │T │e │t T│ │ │ ters │Length │ │ / / │
│ │y │l │a y│ │ ├──┬──┬──┤ │ │ / / │
│ │p │d │ p│ │ │R │S │C │ │ │ / / │
│ │e │ │ e│ │ │e │u │o │... │ │ / / │
│ Number │ │ │ │ Start │ End │c │b │n │A . │ Reserved │ Comments / / │
│ │ │ │C,K│ │ │o │s │t │l . │ │ / / │
│ │ │ │Z,L│ │ │r │t │i │tS. │ │ / / │
│ │ │ │D,E│ │ │d │i │n │ e. │ │ / / │
│ │ │D │P,I│ │ │ │t │u │ q. │ │ / / │
│ │ │N │V,J│ │ │ │u │a │ . │ │ / / │
│ │ │O │U,R│ │ │ │t │t │ . │ │ / / │
│ │ │F │M,S│ │ │ │e │i │ . │ │ / / │
│ │F │S │H,T│ │ │ │ │o │ . │ │ / / │
│ │* │* │B │ │ │ │ │n │A . │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┼───┼──┬──┬──┬──┼──┬──┬──┬──┼──┼──┼──┼──.──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ . │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤ . ├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ . │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴───┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
When completing the fields in these specifications, all entries must be right-justified
in the spaces provided, unless otherwise indicated in the description. If you enter
anything that is not right-justified, the system pads your entry with zeros. Entering
a 1 that is not right-justified, for example, could be interpreted as a 10 or a 100,
depending on where you place it in the field.
SEU is accessed through the CL command STRSEU. The ADTS/400: Source Entry
Utility, SC09-1774 describes how to use the Source Entry Utility.
Types of Specifications
There are five types of Sort specifications you can use to describe what you want
sorted and how:
The header specification describes general information such as output file
type and collating sequence used. There must be only one for each sort job.
Chapter 8, “The Header Specification,” describes all the possible entries.
The ALTSEQ specifications are optional. If you want a collating sequence
other than the standard one, use these specifications to describe your alterna-
tive collating sequence. Appendix C, “Standard and Alternative Collating
Sequences” describes the standard EBCDIC collating sequences and how to
code ALTSEQ specifications.
The record specifications identify the input records you want to include or
exclude from the sort. Chapter 9, “Record Specifications,” describes all the
possible entries.
The field specifications identify the control fields and the data fields on the
input record that you want included in the output record. Chapter 10, “Field
Specifications,” describes all the possible entries.
The comment specification allows you to place comment entries throughout
your sort program to make its purpose and process clearer for yourself and
other users. There is no special form for a comment specification: entering an
asterisk into column 6 or 7 of any of the specifications automatically identifies
the specification as a comment. Chapter 11, “The Comment Specification,”
provides details.
Chapter 1. Introduction 5
┌──────────────────────────2
│
│ ┌───────────────────────────┐
│ │ │
│ │ The header specification │
│ │ │
│ └─────────────┬─────────────┘
│ │
├──────────────────────────2 │
│
│ ┌───────────────────────────┐
│ │ │
│ │ ALTSEQ specifications │
│ │ (see Appendix C) │
│ │ │
┌───────────────┴───────────┐ └─────────────┬─────────────┘
│ │ │
│ Comment specifications ├──────────────2 │ ┐
│ │ │
└───────────────┬───────────┘ ┌───────────────────────────┐ │
│ │ │ │
│ │ Record specifications to │ │
│ │ identify an input record │ │
│ │ type │ │
│ │ │ │
│ └─────────────┬─────────────┘ │
│ │ │ Repeated for
├──────────────────────────2 │ ├───── each input/output
│ │ record type
│ ┌───────────────────────────┐ │
│ │ │ │
│ │ Field specifications to │ │
│ │ identify the control │ │
│ │ field and data fields │ │
│ │ │ │
│ └───────────────────────────┘ │
│ │
└──────────────────────────2 ┘
Figure 4. Order in Which You Should Store Sort Specifications in the Source File. You may
insert comment specifications where they are most useful.
If all input records are to be sorted in the same way, no record specifications need
to be entered: the field specifications are entered by themselves and apply to all
input records. A sort program could thus consist of only two specifications: a
Record Types
Record specifications define which records are to be selected from an input file. At
least one record specification (each grouping is called a set) is needed to define a
type of record.
Entering the first of a series of record specifications signals the start of a new
record type. Any difference in the way an input record is to be selected or an
output record is to be organized is considered a new record type, and requires a
new set of record specifications. There are two main differences:
Input record type. Differences in the criteria by which input records are to be
selected. You enter a set of record specifications to identify each set of cri-
teria.
Output record type. Differences in the field specifications for an input record
type. You must precede each set of field specifications by the appropriate
record specifications, even if those record specifications are the same as the
set previously entered.
The order of the field specifications in the source file determines the order of the
fields in the output records. For example, to move a field from the end of the input
record to the beginning of the output record, place its field specification first in the
source file, before any other. This way, you can select any portion of the input
record, change it, and place its data anywhere in the output record.
Input Record
┌─────────┬──────────────┬────┬─────────┬─────────┬───────────────┬─────────┐
│ Field 1 │ Field 2 │ F3 │ Field 4 │ Field 5 │ Field 6 │ Field 7 │
└─────────┴──────────────┴────┴─────────┴─────────┴───────────────┴─────────┘
│ │ │ │
│ │ │ │
│ │ ┌──────────────────────────────────┘
│ │ │ │
└──────────────────────────────────┐
│ │ │ │
┌────────┘ │ └─────┐ │
│ │ │ │
Q Q Q Q
Reformatted Output Record
┌──────────────┬───────────────┬────┬─────────┬──────────────────────────────────┐
│ Field 2 │ Field 6 │ F3 │ Field 1 │ (Padded on the right by blanks ) │
└──────────────┴───────────────┴────┴─────────┴──────────────────────────────────┘
Figure 5. An Example of How Sort Builds an Output Record. The output record is padded
on the right by blanks to make its length equal to the output file.
Chapter 1. Introduction 7
Building the Control Field
The control field is specified like any other field; however, its contents control the
sorting. For example, to sort a series of input records in ascending order, Sort
orders them by the contents of their control fields so that records whose control
field contents begin with an ‘A’ would precede those whose control field contents
begin with a ‘B’.
Construct one control field for each sort job. For different input record types,
however, you can combine different elements from the input record into the one
control field. (The next section, “Using FMTDTA to Process the Specifications,”
describes how the Sort utility uses the control field to sort input records.)
Input Record
┌─────────────┬────┬─────────┬─────────┬────┬──────────┬─────────┐
│ Field 1 │ C1 │ Field 2 │ Field 3 │ F4 │ Cntl 2 │ Field 5 │
└─────────────┴────┴─────────┴─────────┴────┴──────────┴─────────┘
│ │
┌───┘ ┌────────────────────────────┘
│ │
Q Q
Control Field
┌────┬──────────┐ ┌──────────────────────────────────────────────┐
│ C1 │ Cntl 2 │ │ Reformatted output record │
└────┴──────────┘ └──────────────────────────────────────────────┘
└───────┬───────┘
│
Order of sort───────C
Figure 6. An Example of How Sort Builds a Control Field. The control field is then used as
a key to sort the reformatted output record.
As part of the sort specifications, therefore, you must define the input fields and the
output fields, and specify their start and end positions. Sort then divides the data in
the files according to these specifications, and sorts and reformats the input records
accordingly.
Ensure that the lengths of the fields you specify match the data in the file. For
example, if positions 5 to 10 contain a date and positions 11 to 32 contain a name,
the start and end positions of your fields will probably be 5, 10, 11, and 32.
where FILE1 is the input file, and FILE2 is the output file.
Because no source file is identified here, the system assumes the source specifica-
tions are stored in the first member of the default file, QFMTSRC, found in the library
list. Because no libraries or members have been specified for input or output files,
the system automatically defaults to the current library and the first member of each
file. If you want to specify another library or member, enter the name of each in
the following way:
Here, the input records are taken from the first member of file FILE1 in library
LIBRAR1, and the output records are put into member MEMB3 of file FILE2 in the
current library. The source specifications are taken from the first member in file
FILE3 in library LIBRAR2.
To specify a member in the source file, add another parameter to the FMTDTA
command. For example, to specify member MEM2 in the source file, enter:
Chapter 1. Introduction 9
2. Reformat records. The utility then restructures each input record according to
the data field specifications for the record type. It takes sections of the input
record, then changes and repositions them to create the output record.
3. Putting together the control field. For each record type, you can specify one
or more elements (from the input record) to make up the entire control field.
The total length of all these elements must not exceed the length entered in
columns 15 through 17 of the header specification.
4. Sort records. The output records, stored in their own separate work area, are
sorted according to the collating sequence specified and according to the con-
tents of the control field.
The control field is used as a key. Its size is determined by the entry in
columns 15 through 17 of the header specification. The data that is placed in
this control field during the reformatting process is determined by the control
field specifications, and can be formatted differently for each record type.
5. Store records. The result is stored in a physical file.
The Sort utility does not require unique control fields. If duplicate control field
values are found in the input records, those records will appear in a group in the
output file, in the same order that they were found in the input file.
Related Concepts
The following concepts are useful in understanding how the Sort utility works.
Input Files
The input files used by the Sort utility must follow these rules:
Normal AS/400 security is in effect for all input files. The user using the utility
must have use and read authority for the input files.
The Sort utility defaults to a shared-read lock on the input file. If you want to
restrict other users’ access to the input file while the utility is running, you must
override the locked state with the CL command Allocate Object (ALCOBJ). You
Output File
The following rules apply to the file containing the output produced by the Sort
utility:
You must create the output file and member before running the Sort utility. The
utility checks for the presence of this file and member; if neither exists, an error
message is issued.
Note: The output file in the database can have either a keyed or an arrival
sequence access path. Depending on the specified application, a
keyed access path to the output file may be redundant, and can cause
the Sort utility to run more slowly.
The sum of the field lengths specified for each record in the output file should
be consistent with the record length of the output file. If the reformatted record
length is less than the output file record length, the file will contain left-justified
data and will be padded on the right with blanks. If the reformatted record
length is greater than the output file record length, the output record will be
truncated (on the right) to the file record length.
The data description of the output file, though not used by the Sort utility,
becomes the data management view of the output data. The string of data
constructed by the utility should correspond to this associated data description.
Normal AS/400 security is enforced for the output file. You must have the
proper authority to clear and write into the file and member.
Chapter 1. Introduction 11
The Sort utility defaults to a shared-update lock on the output file. If you want
to restrict other users’ access to the output file while the utility is running, you
must override the locked state with the ALCOBJ command. This command must
be issued before the FMTDTA. The DLCOBJ command can be used to return the
output file to its prior locked state.
The names of the output file and member are specified by FMTDTA. The utility
opens this file name and member, although you can use an override command
to redirect the output to a different file.
Note: The same physical database file and member name can be specified for
both the output file and one of the input files. Here, the output data is
written over the input data. The Sort utility clears the output file
member so that it contains no records before output is written to the file
(except for copy-only requests). If a major failure occurs between
clearing the file member and writing the resequenced data records to
the file member, your input data (and your sorted data) will be lost.
Thus, make sure that this file member has adequate backup.
Work Area
Sort internally creates a work area to accommodate the input records and codes
generated during the sorting process. The work area resides in a temporary work
library, and is only accessible to the program that is being run. The area is auto-
matically deleted at the end of the job.
Copying the input records into a work area and then working with only the copied
records allows several programs to use the same input files at the same time. This
is also the reason the input files are not altered by the Sort utility.
Source File
The sort specifications are considered to be source input, and must therefore come
from a source file (either a database or a diskette unit file). The name of the
source file from which the sort specification set comes is specified as a parameter
to the FMTDTA command. If the specified name is not a source file, an error condi-
tion occurs. You can use an override command to redirect the utility to another
source file.
Print File
If the *PRT or *DUMP options of FMTDTA are selected, a print file can be identified to
store information about the sort job. All the print data is directed to this file. The
file that is specified must already exist before running Sort; otherwise, an error con-
dition occurs.
If a print file is not specified, print output is sent to QSYSPRT, the system print file by
default.
This field-level view is used only by the Sort utility, and does not have to match the
one used by data management. However, inconsistencies can occur if the two
views are not compatible; for example, if only half of a data field is selected by the
Sort utility, only half of the original field will appear in the output record. Also, if a
field that was originally defined to data management as a character field is speci-
fied by the Sort utility as a numeric field, the output may not be as you expected.
Although the Sort utility does generate tables during a copy-only request, the
storage these tables occupy is insignificant in comparison to the amount of auxiliary
storage available for the output file. To determine the approximate number of
records you can copy, subtract 100 000 bytes from the amount of auxiliary storage
you have available for your output file, and divide the remainder by the length of
the records you are copying.
Chapter 1. Introduction 13
4. To this, add two million bytes to determine the total work area space needed
by the Sort utility.
For example, if you have determined that there are 5 000 work records that are
each 150 bytes long, the total storage required for the work records is 750 000
bytes. The work area would then require 2 750 000 bytes of storage (750 000
plus 2 million). If you determine that there are 30 000 work records that are
each 500 bytes long, the storage required for the work records is 15 million
bytes. The utility would then require 17 million bytes of storage.
5. Add the storage required for the output file to determine the total amount of
storage required to resequence the specified number of input records.
Use this value to check the status of a sort job and to direct the system to perform
certain tasks based on the result. To access the return code value, use the CL
command RTVJOBA and its appropriate parameters. The CL Reference manual
contains information about this command.
5763SS1 V3R1M0 910329 IBM SORT MESSAGE(S)
LINE
00001 MSGID: FMT1080 SEVERITY: 30 A
B Message . . . . : Maximum-control-field-length entry is greater
than 256.
C Cause . . . . . : Columns 13-17 of the header statement contains
numeric entry greater than 256.
Recovery . . . : Choose the correct entry. Resubmit the
request.
B The text you see online or on a listing, giving a brief (generally one-sentence)
description of the problem.
C The text you see online when you press Help from the screen with the
message displayed. It will be printed on your listing if you specify *SECLVL in your
run-time options. (The default for this option is *NOSECLVL.) This text contains an
expanded description of the message, and a section detailing the correct user
response.
Chapter 1. Introduction 15
A blinking cursor is repositioned at the input field in error
The input field in error is highlighted in reverse image
The keyboard is locked; that is, pressing any keyboard key has no result
An alarm (beep) sounds.
If the error message is not sufficient for you to decide how to handle the error,
press the Help key. This displays additional information about the error, and
describes how to correct it.
Note: Running a sort job can cause messages that are not part of the Sort utility
to be displayed. In such cases, press Help to obtain further information, and then
refer to the appropriate user’s manual, if necessary.
Figure 8. Sorting and Reformatting a Single File into One Physical File
The output is a physical file in the database, meaning that it contains a sorted and
reformatted copy of the actual input records.
When sorting a single file to produce a physical output file, note the following:
The output type on the header specification must be SORTR.
The maximum control field length must be greater than zero.
Field specifications must be entered to define the control field.
You need not enter a separate field specification for each input field you want
to appear in the output record. If there are to be no changes in their order or
content, you can enter just one field specification that treats the entire input
record as a single output field.
The INFILE parameter of the FMTDTA command has only one value, because
only one input file is being specified.
Examples
The following examples extract records from a single input file.
The Sort utility looks for only one type of input record. Records are selected by
comparing the INSTOCK field (columns 69 through 74) with the REORDER field
(columns 40 through 45) of the input record. If the INSTOCK field is less than the
REORDER field, the record is selected for sorting and included in the output file.
The output records are to contain six rearranged data fields, one of which is the
control field. Note that once the control field is used for sorting, if it is to be
included in the output record it is treated as a data field.
HEADER SPECIFICATIONS
1 2 73 74 75 76 77 78 79 80
Page ┌──┬──┐ Program ┌──┬──┬──┬──┬──┬──┬──┬──┐
│ │ │ Identification │ │ │ │ │ │ │ │ │
└──┴──┘ └──┴──┴──┴──┴──┴──┴──┴──┘
┌───────────┬─────────────────┬─────┬────────┬──┬────────────────────┬──┬──┬──┬────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │ │ R │ │ S│ │A │ R│O │ │ / / │
├────────┬──┤ Output Type │ e │Maximum │ e│ │l │ e│u │ │ / / │
│ │T │ │ s │Control │ q│ │tC│ s│t │ │ / / │
│ │y │ SORTR │ e │Field │ u│ │ o│ e│p │ │ / / │
│ Number │p │ SORTRS │ r │Length │ e│ Reserved │Sl│ r│u │ Reserved │ Comments / / │
│ │e │ SORTA │ v │ │ n│ │e │ v│t │ │ / / │
│ │ │ │ e │(1─256) │ c│ │q │ e│ │ │ / / │
│ │ │ │ d │ │ e│ │ │ d│ │ │ / / │
│ │H │ │ │ │A │ │S │ │ │ │ / / │
│ │* │ │ │ │D │ │F │ │X │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┬──┬──┬──┬──┬──┼──┬──┼──┬──┬──┼──┼──┬──┬──┬──┬──┬──┬──┼──┼──┼──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ H│ S│ O│ R│ T│ R│ │ │ │ 0│ 0│ 8│ A│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
These two specifications establish the two elements of the control field. The con-
tents of the first specification are:
The second field specification defines the second element of the control field, called
ITEMNO in the input record. Sort regards both elements as a single string of control
characters, and begins the sort with the character farthest to the left.
These five specifications define five data fields to be taken from each input record.
The contents of the first specification are:
The field specification is followed by four more specifications, each defining a new
data field (UNIT, QTY, DATE, and ORDERNO) corresponding to the original data
description for the input records. Notice the order in which these fields are entered
into the source file, represented by the number in columns 3 through 5. This is the
order in which they will be put into the output record, not the order in which they
occur in the input record.
There is an additional condition placed on the second record type: only the
QTRSALES records containing dates greater than or equal to October 7, 1989, are to
be included in the sort.
For ITEMNO records, the ITEMNO, DESC, SUPPLY, and SUPPADR fields are to be included
in the output record. For QTRSALES records, the ITEMNO, QTRTOTAL, OUTLISTS, and
DATE fields are to be included in the output record.
Both record types are to be sorted in ascending order in the output file based on
the control field ITEMNO. QTRSALES records that have the same ITEMNO are arranged
in descending order based on the control field QTRTOTAL. The two record types are
merged in the output file. The first record will be the ITEMASTER record with the
lowest ITEMNO, and following it will be the QTRSALES record with the same ITEMNO. If
more than one QTRSALES record has the same ITEMNO, the records will be arranged
in descending order based on the QRTOTAL field.
HEADER SPECIFICATIONS
1 2 73 74 75 76 77 78 79 80
Page ┌──┬──┐ Program ┌──┬──┬──┬──┬──┬──┬──┬──┐
│ │ │ Identification │ │ │ │ │ │ │ │ │
└──┴──┘ └──┴──┴──┴──┴──┴──┴──┴──┘
┌───────────┬─────────────────┬─────┬────────┬──┬────────────────────┬──┬──┬──┬────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │ │ R │ │ S│ │A │ R│O │ │ / / │
├────────┬──┤ Output Type │ e │Maximum │ e│ │l │ e│u │ │ / / │
│ │T │ │ s │Control │ q│ │tC│ s│t │ │ / / │
│ │y │ SORTR │ e │Field │ u│ │ o│ e│p │ │ / / │
│ Number │p │ SORTRS │ r │Length │ e│ Reserved │Sl│ r│u │ Reserved │ Comments / / │
│ │e │ SORTA │ v │ │ n│ │e │ v│t │ │ / / │
│ │ │ │ e │(1─256) │ c│ │q │ e│ │ │ / / │
│ │ │ │ d │ │ e│ │ │ d│ │ │ / / │
│ │H │ │ │ │A │ │S │ │ │ │ / / │
│ │* │ │ │ │D │ │F │ │X │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┬──┬──┬──┬──┬──┼──┬──┼──┬──┬──┼──┼──┬──┬──┬──┬──┬──┬──┼──┼──┼──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ H│ S│ O│ R│ T│ R│ │ │ │ │ 1│ 1│ A│ │ │ │ │ │ │ │ │ │ X│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
These four specifications define four data fields to be taken from each input record
of this type. The contents of the first specification are:
The field specification is followed by three more specifications, each defining a new
data field (DESC, SUPPLY, and SUPPADR, respectively), corresponding to the original
data description for the input records. Notice the order in which these fields are
entered into the source file, represented by the sequence number in columns 3
through 5. This is the order in which they will be put into the output record.
This set of record specifications defines a new record type. The record specifica-
tions are interspersed with comment specifications to help explain the input record
selection criteria. The column entries for the first record specification in the set are:
FIELD SPECIFICATIONS
┌───────────┬──┬───┬───────────────────────┬────────┬────────┬──────────────────────────────────────────────────┬───────────────────────────────────────────────────────────/ /──┐
│ Statement │F │D │ Field Location │ Forced │Overflow│ │ / / │
├────────┬──┤i │a ├───────────┬───────────┤ Charac-│Field │ │ / / │
│ │T │e │t T│ │ │ ters │Length │ │ / / │
│ │y │l │a y│ │ ├──┬──┬──┤ │ │ / / │
│ │p │d │ p│ │ │R │S │C │ │ │ / / │
│ │e │ │ e│ │ │e │u │o │... │ │ / / │
│ Number │ │ │ │ Start │ End │c │b │n │A . │ Reserved │ Comments / / │
│ │ │ │C,K│ │ │o │s │t │l . │ │ / / │
│ │ │ │Z,L│ │ │r │t │i │tS. │ │ / / │
│ │ │ │D,E│ │ │d │i │n │ e. │ │ / / │
│ │ │D │P,I│ │ │ │t │u │ q. │ │ / / │
│ │ │N │V,J│ │ │ │u │a │ . │ │ / / │
│ │ │O │U,R│ │ │ │t │t │ . │ │ / / │
│ │ │F │M,S│ │ │ │e │i │ . │ │ / / │
│ │F │S │H,T│ │ │ │ │o │ . │ │ / / │
│ │* │* │B │ │ │ │ │n │A . │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 / /72│
├──┬──┬──┼──┼──┼───┼──┬──┬──┬──┼──┬──┬──┬──┼──┼──┼──┼──•──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ F│ N│ C │ │ │ │ 1│ │ │ │ 6│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ I│ T│ E│ M│ N│ O│ │ I│ S│ │ N│ O│ R│ M│ A│ L│ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ F│ O│ U │ │ │ 2│ 5│ │ │ 2│ 9│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ (│ A│ S│ C│ E│ N│ D│ I│ N│ G│ )│ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ *│ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ Q│ T│ R│ T│ O│ T│ A│ L│ │ I│ S│ │ O│ P│ P│ O│ S│ I│ T│ E/ / │
└──┴──┴──┴──┴──┴───┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
These two specifications establish the control field for this record type. The con-
tents of the first specification define the first part of the control field, and are:
FIELD SPECIFICATIONS
┌───────────┬──┬───┬───────────────────────┬────────┬────────┬──────────────────────────────────────────────────┬───────────────────────────────────────────────────────────/ /──┐
│ Statement │F │D │ Field Location │ Forced │Overflow│ │ / / │
├────────┬──┤i │a ├───────────┬───────────┤ Charac-│Field │ │ / / │
│ │T │e │t T│ │ │ ters │Length │ │ / / │
│ │y │l │a y│ │ ├──┬──┬──┤ │ │ / / │
│ │p │d │ p│ │ │R │S │C │ │ │ / / │
│ │e │ │ e│ │ │e │u │o │... │ │ / / │
│ Number │ │ │ │ Start │ End │c │b │n │A . │ Reserved │ Comments / / │
│ │ │ │C,K│ │ │o │s │t │l . │ │ / / │
│ │ │ │Z,L│ │ │r │t │i │tS. │ │ / / │
│ │ │ │D,E│ │ │d │i │n │ e. │ │ / / │
│ │ │D │P,I│ │ │ │t │u │ q. │ │ / / │
│ │ │N │V,J│ │ │ │u │a │ . │ │ / / │
│ │ │O │U,R│ │ │ │t │t │ . │ │ / / │
│ │ │F │M,S│ │ │ │e │i │ . │ │ / / │
│ │F │S │H,T│ │ │ │ │o │ . │ │ / / │
│ │* │* │B │ │ │ │ │n │A . │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 / /72│
├──┬──┬──┼──┼──┼───┼──┬──┬──┬──┼──┬──┬──┬──┼──┼──┼──┼──•──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ F│ D│ C │ │ │ │ 1│ │ │ │ 6│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ I│ T│ E│ M│ N│ O│ │ F│ I│ E│ L│ D│ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ F│ D│ C │ │ │ 2│ 5│ │ │ 2│ 9│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ Q│ T│ R│ T│ O│ T│ A│ L│ │ F│ I│ E│ L│ D│ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ F│ D│ C │ │ │ 1│ 1│ │ │ 1│ 3│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ O│ U│ T│ L│ I│ S│ T│ S│ │ F│ I│ E│ L│ D│ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ F│ D│ C │ │ │ 1│ 4│ │ │ 1│ 9│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ D│ A│ T│ E│ │ F│ I│ E│ L│ D│ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴───┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
These four specifications define four data fields to be taken from each input record.
The data fields are specified in the same way as the previous record type.
Because the header specification omitted the control fields from the output record,
the two control field elements are respecified here as the first two data fields of the
output record.
INPUT RECORD
┌───────────┬─┬───────────┬────┬─────────────┬─┬────────────┐
FIELD │ ITEM │ │ PRICE │ │ BAL │ │ REORD │
NAME │ (item │ │ (price │ │ (number │ │ (reorder │
│ number) │ │ per item) │ │ in stock) │ │ point) │
└───────────┘ └───────────┘ └─────────────┘ └────────────┘
FIELD │:─────────2│ │:─────────2│ │:───────────2│ │:──────────2│
POSITION │1 6│ │7 12│ │15 21│ │23 29│
OUTPUT RECORD
┌──────────┬─────────────┬─────────────────┐
FIELD │ │ │ │
NAME │ ITEM │ REORD │ BAL │
│ │ │ │
└──────────┴─────────────┴─────────────────┘
FIELD │:────────2│:───────────2│:───────────────2│
POSITION │ 1 6│7 13│14 20│
HEADER SPECIFICATIONS
1 2 73 74 75 76 77 78 79 80
Page ┌──┬──┐ Program ┌──┬──┬──┬──┬──┬──┬──┬──┐
│ │ │ Identification │ │ │ │ │ │ │ │ │
└──┴──┘ └──┴──┴──┴──┴──┴──┴──┴──┘
┌───────────┬─────────────────┬─────┬────────┬──┬────────────────────┬──┬──┬──┬────────────────────────────────┬──────────────────────────────────────────────────/ /──┐
│ Statement │ │ R │ │ S│ │A │ R│O │ │ / / │
├────────┬──┤ Output Type │ e │Maximum │ e│ │l │ e│u │ │ / / │
│ │T │ │ s │Control │ q│ │tC│ s│t │ │ / / │
│ │y │ SORTR │ e │Field │ u│ │ o│ e│p │ │ / / │
│ Number │p │ SORTRS │ r │Length │ e│ Reserved │Sl│ r│u │ Reserved │ Comments / / │
│ │e │ SORTA │ v │ │ n│ │e │ v│t │ │ / / │
│ │ │ │ e │(1─256) │ c│ │q │ e│ │ │ / / │
│ │ │ │ d │ │ e│ │ │ d│ │ │ / / │
│ │H │ │ │ │A │ │S │ │ │ │ / / │
│ │* │ │ │ │D │ │F │ │X │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 / /72│
├──┬──┬──┼──┼──┬──┬──┬──┬──┬──┼──┬──┼──┬──┬──┼──┼──┬──┬──┬──┬──┬──┬──┼──┼──┼──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ H│ S│ O│ R│ T│ R│ │ │ │ │ 2│ 0│ A│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ S│ O│ R│ T│ │ I│ N│ P│ U│ T│ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ *│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ F│ I│ E│ L│ D│ S│ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
This is a standard header specification for a Sort job, similar to that entered for the
previous examples. The significant column entry, here, is:
This means that the unchanged data from the input record is to be used, and that
the sort sequence is specified in the header specification (ascending). A blank in
column 28 will include the control field in the output record.
RECORD SPECIFICATIONS
┌───────────┬──┬──┬───────────────────────┬─────┬──┬───────────────────────────────────────────────────────────┬──────────────────────────────────────────────────/ /──┐
│ Statement │C │D │ Factor 1 │Com- │F │B───────────────── Factor 2 Constant ───────────────────C│ / / │
├────────┬──┤o │a ├───────────┬───────────┤pari-│a │ • │ / / │
│ │T │n │t │ │ │son │c │B─── Factor 2 ───C• │ / / │
│ │y │t │aT│ │ │Oper-│t │ Keyword • │ / / │
│ Number │p │i │ y│ Start │ End │ator │o │ • │ Comments / / │
│ │e │n │ p│ Position │ Position │ │r │B────── Factor 2 ─────C• │ / / │
│ │ │u │ e│ │ │ │2 │ Field • │ / / │
│ │I │e │C │ │ │ │ │ • │ / / │
│ │O │ │Z │ │ │ │C │ Location • │ / / │
│ │* │A │D │ │ │EQ,NE│F │ │ • │ / / │
│ │ │O │P │ │ │LT,GT│K │ Start │ End • │ / / │
│ │ │* │U │ │ │LE,GE│S │ │ • │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 / /72│
├──┬──┬──┼──┼──┼──┼──┬──┬──┬──┼──┬──┬──┬──┼──┬──┼──┼──┬──┬──┬──┼──┬──┬──┬──•──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──│
│ │ │ │ *│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ A│ L│ L│ │ R│ E│ C│ O│ R│ D│ S│ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──│
│ │ │ │ *│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ I│ N│ C│ L│ U│ D│ E│ D│ │ I│ N│ │ S│ O│ R│ T│ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
This is the specification that defines the control field as ITEM from the input record.
The control field is to be included in the output record and, because it is the first
field specified, it will be the first field in the output record and will automatically
occupy columns 1 to 6.
FIELD SPECIFICATIONS
┌───────────┬──┬───┬───────────────────────┬────────┬────────┬──────────────────────────────────────────────────┬───────────────────────────────────────────────────────────/ /──┐
│ Statement │F │D │ Field Location │ Forced │Overflow│ │ / / │
├────────┬──┤i │a ├───────────┬───────────┤ Charac-│Field │ │ / / │
│ │T │e │t T│ │ │ ters │Length │ │ / / │
│ │y │l │a y│ │ ├──┬──┬──┤ │ │ / / │
│ │p │d │ p│ │ │R │S │C │ │ │ / / │
│ │e │ │ e│ │ │e │u │o │... │ │ / / │
│ Number │ │ │ │ Start │ End │c │b │n │A . │ Reserved │ Comments / / │
│ │ │ │C,K│ │ │o │s │t │l . │ │ / / │
│ │ │ │Z,L│ │ │r │t │i │tS. │ │ / / │
│ │ │ │D,E│ │ │d │i │n │ e. │ │ / / │
│ │ │D │P,I│ │ │ │t │u │ q. │ │ / / │
│ │ │N │V,J│ │ │ │u │a │ . │ │ / / │
│ │ │O │U,R│ │ │ │t │t │ . │ │ / / │
│ │ │F │M,S│ │ │ │e │i │ . │ │ / / │
│ │F │S │H,T│ │ │ │ │o │ . │ │ / / │
│ │* │* │B │ │ │ │ │n │A . │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 / /72│
├──┬──┬──┼──┼──┼───┼──┬──┬──┬──┼──┬──┬──┬──┼──┼──┼──┼──•──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ F│ N│ C │ │ │ 2│ 3│ │ │ 2│ 9│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ R│ E│ O│ R│ D│ │ F│ I│ E│ L│ D│ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ F│ N│ C │ │ │ 1│ 5│ │ │ 2│ 1│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ B│ A│ L│ │ F│ I│ E│ L│ D│ │ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴───┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
The control field specification is then followed by two more field specifications, one
identifying the field REORD, and the other identifying the field BAL from the input
record.
HEADER SPECIFICATIONS
1 2 73 74 75 76 77 78 79 80
Page ┌──┬──┐ Program ┌──┬──┬──┬──┬──┬──┬──┬──┐
│ │ │ Identification │ │ │ │ │ │ │ │ │
└──┴──┘ └──┴──┴──┴──┴──┴──┴──┴──┘
┌───────────┬─────────────────┬─────┬────────┬──┬────────────────────┬──┬──┬──┬────────────────────────────────┬──────────────────────────────────────────────────/ /──┐
│ Statement │ │ R │ │ S│ │A │ R│O │ │ / / │
├────────┬──┤ Output Type │ e │Maximum │ e│ │l │ e│u │ │ / / │
│ │T │ │ s │Control │ q│ │tC│ s│t │ │ / / │
│ │y │ SORTR │ e │Field │ u│ │ o│ e│p │ │ / / │
│ Number │p │ SORTRS │ r │Length │ e│ Reserved │Sl│ r│u │ Reserved │ Comments / / │
│ │e │ SORTA │ v │ │ n│ │e │ v│t │ │ / / │
│ │ │ │ e │(1─256) │ c│ │q │ e│ │ │ / / │
│ │ │ │ d │ │ e│ │ │ d│ │ │ / / │
│ │H │ │ │ │A │ │S │ │ │ │ / / │
│ │* │ │ │ │D │ │F │ │X │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 / /72│
├──┬──┬──┼──┼──┬──┬──┬──┬──┬──┼──┬──┼──┬──┬──┼──┼──┬──┬──┬──┬──┬──┬──┼──┼──┼──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ H│ S│ O│ R│ T│ R│ │ │ │ │ 2│ 1│ A│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ S│ O│ R│ T│ │ I│ N│ P│ U│ T│ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ *│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ F│ I│ E│ L│ D│ S│ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
FIELD SPECIFICATIONS
┌───────────┬──┬───┬───────────────────────┬────────┬────────┬──────────────────────────────────────────────────┬───────────────────────────────────────────────────────────/ /──┐
│ Statement │F │D │ Field Location │ Forced │Overflow│ │ / / │
├────────┬──┤i │a ├───────────┬───────────┤ Charac-│Field │ │ / / │
│ │T │e │t T│ │ │ ters │Length │ │ / / │
│ │y │l │a y│ │ ├──┬──┬──┤ │ │ / / │
│ │p │d │ p│ │ │R │S │C │ │ │ / / │
│ │e │ │ e│ │ │e │u │o │... │ │ / / │
│ Number │ │ │ │ Start │ End │c │b │n │A . │ Reserved │ Comments / / │
│ │ │ │C,K│ │ │o │s │t │l . │ │ / / │
│ │ │ │Z,L│ │ │r │t │i │tS. │ │ / / │
│ │ │ │D,E│ │ │d │i │n │ e. │ │ / / │
│ │ │D │P,I│ │ │ │t │u │ q. │ │ / / │
│ │ │N │V,J│ │ │ │u │a │ . │ │ / / │
│ │ │O │U,R│ │ │ │t │t │ . │ │ / / │
│ │ │F │M,S│ │ │ │e │i │ . │ │ / / │
│ │F │S │H,T│ │ │ │ │o │ . │ │ / / │
│ │* │* │B │ │ │ │ │n │A . │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 / /72│
├──┬──┬──┼──┼──┼───┼──┬──┬──┬──┼──┬──┬──┬──┼──┼──┼──┼──•──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ F│ N│ C │ │ │ 2│ 0│ │ │ 2│ 0│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ S│ I│ N│ G│ L│ E│ -│ C│ H│ A│ R│ │ F│ I│ E│ L│ D│ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴───┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
You then process the source file by using the FMTDTA command as in “Example 3.
Reformatting Records–1” on page 30.
Up to eight input files can be specified. The utility processes the files in the order
in which they are entered in the FMTDTA command. The output is a physical file in
the database, meaning that it contains a sorted and reformatted copy of the actual
input records.
When sorting multiple input files to produce a physical output file, note the
following:
The output type on the header specification must be SORTR.
The maximum control field length must be greater than zero.
Field specifications must be entered to define the control field.
You need not enter a separate field specification for each input field you wish
to appear in the output record. If there are to be no changes in their order or
content, you can treat the entire input record as one output field.
The INFILE parameter of the FMTDTA command has several values, one for each
input file being specified.
Examples
This section gives one example of how to use the Sort utility to sort records from
several input files.
The control field is composed of two fields from the input record. The high order
part comes from the ACCNO input field (columns 1 through 6), and the low order part
a new character that is forced into the control field based on the value found in
column 7. Letters in column 7 of the input records represent days of the week: M,
T, W, R, and F. If column 7 contains an M, this character is a 1; if T, 2; if W, 3; if
R, 4; and if F, 5. If it contains none of these, the new character will be 6. These
modifications to the control field are made before the input records are sorted.
The original letters represent days of the week. One objective of the sort is to
rearrange the input records so that Monday’s records appear before Tuesday’s,
which appear before Wednesday’s, and so on. If the letters were left in the control
field, then the records would be sorted F-M-R-T-W. The change is for the conven-
ience of this sorting only. It is invisible to you, since the input records remain
unmodified, and the control fields are not included as control fields in the output
records.
The output records are arranged in ascending order by ACCNO. If two records have
the same ACCNO, they are arranged in ascending order by the character forced into
the last column of the control field. All data fields will appear in the output records.
HEADER SPECIFICATIONS
1 2 73 74 75 76 77 78 79 80
Page ┌──┬──┐ Program ┌──┬──┬──┬──┬──┬──┬──┬──┐
│ │ │ Identification │ │ │ │ │ │ │ │ │
└──┴──┘ └──┴──┴──┴──┴──┴──┴──┴──┘
┌───────────┬─────────────────┬─────┬────────┬──┬────────────────────┬──┬──┬──┬────────────────────────────────┬────────────────────────────────────────────────/ /──┐
│ Statement │ │ R │ │ S│ │A │ R│O │ │ / / │
├────────┬──┤ Output Type │ e │Maximum │ e│ │l │ e│u │ │ / / │
│ │T │ │ s │Control │ q│ │tC│ s│t │ │ / / │
│ │y │ SORTR │ e │Field │ u│ │ o│ e│p │ │ / / │
│ Number │p │ SORTRS │ r │Length │ e│ Reserved │Sl│ r│u │ Reserved │ Comments / / │
│ │e │ SORTA │ v │ │ n│ │e │ v│t │ │ / / │
│ │ │ │ e │(1─256) │ c│ │q │ e│ │ │ / / │
│ │ │ │ d │ │ e│ │ │ d│ │ │ / / │
│ │H │ │ │ │A │ │S │ │ │ │ / / │
│ │* │ │ │ │D │ │F │ │X │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┬──┬──┬──┬──┬──┼──┬──┼──┬──┬──┼──┼──┬──┬──┬──┬──┬──┬──┼──┼──┼──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ H│ S│ O│ R│ T│ R│ │ │ │ │ │ 7│ A│ │ │ │ │ │ │ │ │ │ X│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
No record specifications are entered. Thus, there are no conditions imposed on the
selection of input records. This means that all input records are to be processed.
These field statements define the source fields that are used to make up the control
field. The first specification defines the input field that is to become the first part of
the control field, and the next six all pertain to what is to form the last part of the
control field. The significant column entries are:
Columns Explanation
7 The first field specification is for a normal control field. The remaining six specifications contain an F,
and describe a forced control field.
9-12 The start position of the field in the input record from which the data for the control field is taken.
Data from columns 1 through 6 of the input record forms the first part of the control field; data from
column 7 forms the last part.
13-16 The end position of the field in the input record from which the data for the control field is taken.
17 The value in this column identifies the character which, if found in the input record, is replaced.
18 This contains the value that is substituted.
19 An X in this column links the field specification to the previously entered field specification. Here, the
last six specifications describe the same field.
This field specification identifies the data fields to be included in the output records.
No start or end positions are specified; therefore, all the input data fields are to be
included in the output. The data in these fields is character data (column 8 con-
tains a C).
The output is an RA file in the database. An RA file is a physical file that contains
4-byte binary relative record numbers rather than data. The output RA file has an
arrival sequence access path. A relative record number of minus one (−1) indi-
cates the end of an RA file.
Each record selected for processing produces a 4-byte, binary relative record
number in the RA file.
When the relative record numbers are written to the output RA file, they are
blocked up to the record size. Each output record represents a record in the input
file. The position of the record in the output RA file is the position the input record
has after the sort. When being printed or displayed, the RA file is read sequentially
to process the records in the input file. As each relative record number is read, it
can be used to access the original file directly.
When you sort a single file to produce an RA output file, note the following:
The output type on the header specification must be SORTA.
The maximum control field length must be greater than zero.
Column 28 of the header specification should contain an X. This excludes the
control field from the output record.
Field specifications must be entered to define the control field.
No other field specifications should be entered. If you try to include data fields
in the output records of an RA file, you can get inconsistent results.
The INFILE parameter of the FMTDTA command has only one value, because
only one input file can be specified for this type of sort.
The file will contain the addresses of the input records only; therefore, even if the
original input file records are altered, any sorted output that is displayed or printed
will contain the modifications and reflect the most up-to-date records.
Chapter 4. Sorting Records from a Single File to Produce a Record Address File 43
Entering the Specifications
To sort this file, enter the following header, record, and field specifications. Only
those columns that are important to this example are described.
HEADER SPECIFICATIONS
1 2 73 74 75 76 77 78 79 80
Page ┌──┬──┐ Program ┌──┬──┬──┬──┬──┬──┬──┬──┐
│ │ │ Identification │ │ │ │ │ │ │ │ │
└──┴──┘ └──┴──┴──┴──┴──┴──┴──┴──┘
┌───────────┬─────────────────┬─────┬────────┬──┬────────────────────┬──┬──┬──┬────────────────────────────────┬────────────────────────────────────────────────/ /──┐
│ Statement │ │ R │ │ S│ │A │ R│O │ │ / / │
├────────┬──┤ Output Type │ e │Maximum │ e│ │l │ e│u │ │ / / │
│ │T │ │ s │Control │ q│ │tC│ s│t │ │ / / │
│ │y │ SORTR │ e │Field │ u│ │ o│ e│p │ │ / / │
│ Number │p │ SORTRS │ r │Length │ e│ Reserved │Sl│ r│u │ Reserved │ Comments / / │
│ │e │ SORTA │ v │ │ n│ │e │ v│t │ │ / / │
│ │ │ │ e │(1─256) │ c│ │q │ e│ │ │ / / │
│ │ │ │ d │ │ e│ │ │ d│ │ │ / / │
│ │H │ │ │ │A │ │S │ │ │ │ / / │
│ │* │ │ │ │D │ │F │ │X │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 / /72│
├──┬──┬──┼──┼──┬──┬──┬──┬──┬──┼──┬──┼──┬──┬──┼──┼──┬──┬──┬──┬──┬──┬──┼──┼──┼──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬───/ /──┤
│ │ │ │ H│ S│ O│ R│ T│ A│ │ │ │ │ │ 2│ A│ │ │ │ │ │ │ │ │ │ X│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴───/ /──┘
This specification establishes the ITEMCLASS field as the control field. The contents
of the specification are:
Chapter 4. Sorting Records from a Single File to Produce a Record Address File 45
Processing These Specifications
Once the specifications for the RA sort job are stored in the source file, use the
FMTDTA command to run the job. The INFILE parameter specifies a single database
physical file. A FMTDTA command that could run this job is:
Based on the actual input, the contents of the output file are:
/──────────────────┐
/ RELATIVE RECORD │
/ NUMBERS │
/ │
/ 00003 │
/ 00001 │
/ 00002 │
/ 00006 │
/ 00005 │
/ 00007 │
/ 00004 │
/ 00008 │
/──────────────────┘
Figure 11. Sorting and Reformatting Records, and Producing Totals for Certain Data Fields
The output is a physical file in the database, meaning that it contains the actual
output records. Note that the output file will contain only as many records as there
are unique control field values; it is thus usually much smaller than the input file.
The Sort utility sorts the output records according to the contents of the control
field.
| If two or more input record types are specified for a summary sort, each record
| type must have at least one summary data field defined. When specifying a
| summary sort with multiple record types, you should consider whether the control
| fields specified will allow records of different types to share an identical control field
| value, and if so, whether it is appropriate to add together the corresponding
| summary of data fields from the different record types.
Handling Overflow
If the totals are larger than the size allowed by the original summary data fields, the
system puts only the lower-order digits into the summary field. The higher-order
digits are lost, and the system gives no indication that this has happened. For
example, if the total is 1 324 567, and the summary data field is only four charac-
ters long, the output record will contain only the last four digits, 4567, and you will
not be aware that this is not the correct total.
| To use an overflow indicator you must enter an overflow indicator field specification
| containing S in column 7 and V in column 8. This will define a single character
| field in the next position of the output record to hold the overflow indicator. You
| may also enter a character in column 17 of the specification, which will be used to
| denote that overflow has occurred. If column 17 is left blank, an asterisk will be
| used instead. If a character is entered in column 18, it will be used to denote that
| overflow has not occurred.
| The overflow indicator is placed in the output record if any of the summary data
| fields contained in the record have overflowed. Only one overflow indicator can be
| specified. If you specify more than one, the last indicator specified will be used.
| To increase the size of the summary data field, enter the required size of the field
| in columns 20 through 22 of the field specification for the summary data field. The
| new size must not exceed the maximum size for the data type defined in column 8.
| The new, larger field is referred to as an overflow field, and replaces the summary
| data field in the output record.
| You can specify an overflow field for any summary data field. You can designate
| an overflow indicator in addition to overflow fields.
Examples
Following are four examples that illustrate the summary sort feature.
These adjustment records are sorted, and the number of items (QUANTITY ORDERED
field) is totaled for each item (identified by the item number in the ITEM NUMBER
field). The ITEM NUMBER field, therefore, is the control field, and the QUANTITY
ORDERED field is the summary data field.
The output records are 14 columns long: the first 8 columns contain the control
field data (the item number), and the last 6 columns contain the totals for each
item. The output records are sorted so that the item numbers are in ascending
order, according to the standard EBCDIC collating sequence for character data.
There will be as many output records as there are different item numbers.
Because there is only one record type, all output records are sorted as one unit.
┌───────┬────────┬────────┬───────────┬──────────┬─────────┬─────────────┬─────────┬──/ /──────────────────────────┐
│ DELETE│ RECORD │ ITEM │ QUANTITIY │ CUSTOMER │ INVOICE │ TRANSACTION │ SELLING │ / / │
│ CODE │ CODE │ NUMBER │ ORDERED │ NUMBER │ NUMBER │ DATE │ PRICE │ / / │
└───────┴────────┴────────┴───────────┴──────────┴─────────┴─────────────┴─────────┴──/ /──────────────────────────┘
1 2 3 10 11 16 17 24 25 32 33 38 39 43
RECEIPT RECORDS
/────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
/ RECORD CODE ITEM CLASS ITEM NUMBER SELLING PRICE PURCHASE ORDER # QUANTITY ORDERED TRANSACTION DATE │
/ │
/ R 20 20011230 85000 0568 10 880812 │
/ R 10 10012000 6295 4330 6 880816 │
/ R 40 40016210 542 2110 3 880816 │
/ R 50 50011230 28325 3110 2 880816 │
/ R 20 20011230 49515 0568 5 880816 │
/ . . . . . . . │
/ . . . . . . . │
/────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌───────┬────────┬────────┬─────────┬──────────┬──────────────┬──────────┬─────────────┬───/ /─────────────────────┐
│ DELETE│ RECORD │ ITEM │ ITEM │ SELLING │ PURCHASE │ QUANTITY │ TRANSACTION │ / / │
│ CODE │ CODE │ CLASS │ NUMBER │ PRICE │ ORDER NUMBER │ ORDERED │ DATE │ / / │
└───────┴────────┴────────┴─────────┴──────────┴──────────────┴──────────┴─────────────┴───/ /─────────────────────┘
1 2 3 4 5 12 13 17 18 21 22 27 28 33
ADJUSTMENT RECORDS
/────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
/ RECORD CODE ITEM NUMBER ADJUSTMENT CODE QUANTITY ORDERED TRANSACTION DATE WAREHOUSE │
/ │
/ A 10012000 1 1 880816 2 │
/ A 20011230 1 6 880812 2 │
/ A 20011230 1 5 880816 3 │
/ A 40016210 2 4 880816 1 │
/ A 30010010 1 2 880816 1 │
/ . . . . . . │
/ . . . . . . │
/────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌──────────┬──────────┬──────────┬──────────────┬─────────────┬─────────────────┬───────────────┬─────/ /──────────┐
│ DELETE │ RECORD │ ITEM │ ADJUSTMENT │ QUANTITY │ TRANSACTION │ WAREHOUSE │ / / │
│ CODE │ CODE │ NUMBER │ CODE │ ORDERED │ DATE │ │ / / │
└──────────┴──────────┴──────────┴──────────────┴─────────────┴─────────────────┴───────────────┴─────/ /──────────┘
1 2 3 10 11 12 17 18 23 24 25
Figure 12. The Input File Used in Example 1 Contains Three Different Record Types According to the Original Data
Description for the File
Two field specifications are used. The first defines the control field; the second
defines the data field to be summed (the summary data field).
These are the two field specifications. The significant column entries for the control
field specification are:
The significant column entries for the summary data field specification are:
Sort sends the output automatically to the device file QSYSPRT, which is the system
printer.
┌─────────────────────────────────────/
│ ITEM NUMBER QUANTITY ORDERED /
│ /
│ 10012000 1 /
│ 20011230 11 /
│ 30010010 2 /
│ 40016210 4 /
└─────────────────────────────────────/
┌────────────┬──────────────┬───/
│ Item │ Quantity │ /
│ Number │ Ordered │ /
└────────────┴──────────────┴───/
1 8 9 14
Both types of input record are to be sorted by item number. If there are multiple
occurrences of an item number, the selling prices are to be summed to produce a
total selling price for each item number (total sales).
INVENTORY RECORDS
/───────────────────────────────/ /────────────────────────┐
/ RECORD CODE ITEM NUMBER / / SELLING PRICE │
/ / / │
/ I 70015120 / / 212 │
/ I 10012000 / / 295 │
/ I 70015120 / / 212 │
/ I 50011230 / / 325 │
/ I 50011230 / / 325 │
/ I 20011230 / / 515 │
/ I 40016210 / / 42 │
/ I 40016210 / / 42 │
/ I 50011230 / / 325 │
/ I 10012000 / / 295 │
/───────────────────────────────/ /────────────────────────┘
/───┬────────┬────────┬────────/ /────────┬─────────┬──/
/ │ RECORD │ ITEM │ / / │ SELLING │ /
/ │ CODE │ NUMBER │ / / │ PRICE │ /
/───┴────────┴────────┴────────/ /────────┴─────────┴──/
2 3 10 11 38 39 43
RECEIPT RECORDS
/──────────────/ /─────────────────────────────────────/
/ RECORD CODE / / ITEM NUMBER SELLING PRICE /
/ / / /
/ R / / 20011230 85000 /
/ R / / 10012000 6295 /
/ R / / 40016210 542 /
/ R / / 50011230 28325 /
/ R / / 20011230 49515 /
/──────────────/ /─────────────────────────────────────/
/───┬────────┬─/ /─┬─────────┬──────────┬─/
/ │ RECORD │ / / │ ITEM │ SELLING │ /
/ │ CODE │ / / │ NUMBER │ PRICE │ /
/───┴────────┴─/ /─┴─────────┴──────────┴─/
2 3 5 12 13 17
Figure 13. Example of the Two Different Record Types in This Input File
HEADER SPECIFICATIONS
1 2 73 74 75 76 77 78 79 80
Page ┌──┬──┐ Program ┌──┬──┬──┬──┬──┬──┬──┬──┐
│ │ │ Identification │ │ │ │ │ │ │ │ │
└──┴──┘ └──┴──┴──┴──┴──┴──┴──┴──┘
┌───────────┬─────────────────┬─────┬────────┬──┬────────────────────┬──┬──┬──┬────────────────────────────────┬──────────────────────────────────────────────────/ /──┐
│ Statement │ │ R │ │ S│ │A │ R│O │ │ / / │
├────────┬──┤ Output Type │ e │Maximum │ e│ │l │ e│u │ │ / / │
│ │T │ │ s │Control │ q│ │tC│ s│t │ │ / / │
│ │y │ SORTR │ e │Field │ u│ │ o│ e│p │ │ / / │
│ Number │p │ SORTRS │ r │Length │ e│ Reserved │Sl│ r│u │ Reserved │ Comments / / │
│ │e │ SORTA │ v │ │ n│ │e │ v│t │ │ / / │
│ │ │ │ e │(1─256) │ c│ │q │ e│ │ │ / / │
│ │ │ │ d │ │ e│ │ │ d│ │ │ / / │
│ │H │ │ │ │A │ │S │ │ │ │ / / │
│ │* │ │ │ │D │ │F │ │X │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 / /72│
├──┬──┬──┼──┼──┬──┬──┬──┬──┬──┼──┬──┼──┬──┬──┼──┼──┬──┬──┬──┬──┬──┬──┼──┼──┼──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ H│ S│ O│ R│ T│ R│ S│ │ │ │ │ 8│ A│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ S│ U│ M│ M│ A│ R│ I│ Z│ E│ │ A│ M│ O│ U│ N│ T│ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ *│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ F│ O│ R│ │ E│ A│ C│ H│ │ I│ T│ E│ M│ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
Because the input file has two different record types, and you intend to work with
both, you must specify them as two separate sets of specifications. In the field
specifications for the first set, a summary data field is defined after the control field.
The significant column entries for the summary data field specification are:
Summary data fields are defined very much like normal output data fields:
Enter F into column 6, to indicate a field selection specification.
Enter S into column 7, to indicate a summary data field.
Enter the data type of the field to be added into column 8.
The same data types that are used for normal data fields are also used for
summary data fields. This data type entry is important, because the method of
adding and the interpretation of the result vary depending on the data type
selected. In the following list, the word number refers to the entire sequence of
digits: the number 4 526 is composed of the digits 4, 5, 2, and 6.
P Packed data type. System considers each sequence of four bits as one
digit, starting with the second sequence from the right. The four bits far-
thest to the right determine the sign of the number.
To allow the Sort utility to also take data from type R records, specify another
record type by entering a second set of record and field specifications. You need
the new field specifications because the start and end positions of the ITEM NUMBER
and SELLING PRICE fields for the R input records are different from those for the I
input records.
The significant column entries for the summary data field specification are:
┌──────────────────────────────────┐
│ ITEM NUMBER SELLING PRICE │
│ │
│ 10012000 6885 │
│ 20011230 35030* │
│ 40016210 626 │
│ 50011230 29300 │
│ 70015120 424 │
│ . . │
│ . . │
└──────────────────────────────────┘
* Overflow occurred
┌────────────┬──────────────┬───/
│ Item │ Selling │ /
│ Number │ Price │ /
└────────────┴──────────────┴───/
1 8 9 13
Note that, because of the addition of the overflow field, the output record length will
be longer than the input record length.
FIELD SPECIFICATIONS
┌───────────┬──┬───┬───────────────────────┬────────┬────────┬──────────────────────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │F │D │ Field Location │ Forced │Overflow│ │ / / │
├────────┬──┤i │a ├───────────┬───────────┤ Charac-│Field │ │ / / │
│ │T │e │t T│ │ │ ters │Length │ │ / / │
│ │y │l │a y│ │ ├──┬──┬──┤ │ │ / / │
│ │p │d │ p│ │ │R │S │C │ │ │ / / │
│ │e │ │ e│ │ │e │u │o │... │ │ / / │
│ Number │ │ │ │ Start │ End │c │b │n │A . │ Reserved │ Comments / / │
│ │ │ │C,K│ │ │o │s │t │l . │ │ / / │
│ │ │ │Z,L│ │ │r │t │i │tS. │ │ / / │
│ │ │ │D,E│ │ │d │i │n │ e. │ │ / / │
│ │ │D │P,I│ │ │ │t │u │ q. │ │ / / │
│ │ │N │V,J│ │ │ │u │a │ . │ │ / / │
│ │ │O │U,R│ │ │ │t │t │ . │ │ / / │
│ │ │F │M,S│ │ │ │e │i │ . │ │ / / │
│ │F │S │H,T│ │ │ │ │o │ . │ │ / / │
│ │* │* │B │ │ │ │ │n │A . │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┼───┼──┬──┬──┬──┼──┬──┬──┬──┼──┼──┼──┼──•──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ F│ N│ C │ │ │ │ 5│ │ │ 1│ 2│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ C│ O│ N│ T│ R│ O│ L│ │ F│ I│ E│ L│ D│ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ F│ S│ U │ │ │ 1│ 3│ │ │ 1│ 7│ │ │ │ • 1│ 0│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ D│ A│ T│ A│ │ F│ I│ E│ L│ D│ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴───┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
Figure 14. The Field Specifications for Record Type R from Example 2
The additional column entries for the summary data field specification are:
┌────────────────────────────────────────────────────┐
│ ITEM NUMBER SELLING PRICE │
│ │
│ 10012000 6885 │
│ 20011230 135030 │
│ 40016210 626 │
│ 50011230 29300 │
│ 70015120 424 │
│ . . │
│ . . │
└────────────────────────────────────────────────────┘
┌────────────┬──────────────┬────────────┬────/
│ Item │ Overflow │ Selling │ /
│ Number │ Area │ Price │ /
└────────────┴──────────────┴────────────┴────/
1 8 9 13 14 18
Note that the larger summary data field can now accommodate the total value for
item number 20011230.
FIELD SPECIFICATIONS
┌───────────┬──┬───┬───────────────────────┬────────┬────────┬──────────────────────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │F │D │ Field Location │ Forced │Overflow│ │ / / │
├────────┬──┤i │a ├───────────┬───────────┤ Charac-│Field │ │ / / │
│ │T │e │t T│ │ │ ters │Length │ │ / / │
│ │y │l │a y│ │ ├──┬──┬──┤ │ │ / / │
│ │p │d │ p│ │ │R │S │C │ │ │ / / │
│ │e │ │ e│ │ │e │u │o │... │ │ / / │
│ Number │ │ │ │ Start │ End │c │b │n │A . │ Reserved │ Comments / / │
│ │ │ │C,K│ │ │o │s │t │l . │ │ / / │
│ │ │ │Z,L│ │ │r │t │i │tS. │ │ / / │
│ │ │ │D,E│ │ │d │i │n │ e. │ │ / / │
│ │ │D │P,I│ │ │ │t │u │ q. │ │ / / │
│ │ │N │V,J│ │ │ │u │a │ . │ │ / / │
│ │ │O │U,R│ │ │ │t │t │ . │ │ / / │
│ │ │F │M,S│ │ │ │e │i │ . │ │ / / │
│ │F │S │H,T│ │ │ │ │o │ . │ │ / / │
│ │* │* │B │ │ │ │ │n │A . │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┼───┼──┬──┬──┬──┼──┬──┬──┬──┼──┼──┼──┼──•──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ F│ N│ C │ │ │ │ 5│ │ │ 1│ 2│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ C│ O│ N│ T│ R│ O│ L│ │ F│ I│ E│ L│ D│ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ F│ S│ U │ │ │ 1│ 3│ │ │ 1│ 7│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ D│ A│ T│ A│ │ F│ I│ E│ L│ D│ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ F│ S│ V │ │ │ │ │ │ │ │ │ ?│ │ │ - │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ P│ U│ T│ │ ?│ │ I│ N│ │ O│ U│ T│ P│ U│ T│ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ *│ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ I│ F│ │ O│ V│ E│ R│ F│ L│ O│ W│ │ │ │ / / │
└──┴──┴──┴──┴──┴───┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
A new field specification is added to provide the overflow indicator. The significant
column entries are:
Note: If overflow occurs in any of the summary data fields, the character in
column 17 will be written into the overflow indicator field.
┌────────────────────────────────────────────────┐
│ ITEM NUMBER SELLING PRICE OVERFLOW │
│ │
│ 10012000 6885 │
│ 20011230 35030 ? │
│ 40016210 626 │
│ 50011230 29300 │
│ 70015120 424 │
│ . . │
│ . . │
└────────────────────────────────────────────────┘
┌────────────┬──────────────┬──┬────────/
│ Item │ Selling │Ov│ /
│ Number │ Price │fl│ /
└────────────┴──────────────┴──┴────────/
1 8 9 13 14
Notice that the system has expanded the output record by one column, and placed
an asterisk into this column to indicate that the record with item number 20011230
has a summary data field with an overflow value.
If the output file already contains records, they are not cleared before the input
records are copied. The input records are added to the end of the file.
┌──────────────────┐
│ Sort utility │
│ specifications │
│ from source file │
└────────┬─────────┘
│
│
┌──────────────────────────────────────────┐
┌────────────────┐ │ Input records from up to eight files: │
│ The │ │ ┌──────────────────────┐ ┌──────────┐ │
│ FMTDTA │:─────────┤ │ Database files │ or │ Device │ │
│ Command │ │ │ (logical or physical)│ │ files │ │
└────────┬───────┘ │ └──────────────────────┘ └──────────┘ │
│ └──────────────────────────────────────────┘
│
┌──────────────────────────┐
│ Output records (copied │
│ or merged, possibly │
│ reformatted, but not │
│ sorted) into one │
│ physical file │
└──────────────────────────┘
Figure 17. Copying or Merging One or More Files into One Physical File
The output is a physical file in the database, meaning that the output file contains a
sorted and reformatted copy of the actual input records.
These two aspects follow the same rules as previously stated: for example, up to
eight input files can be specified.
When copying and merging records from several files into one to produce a single
physical output file, note the following:
Enter SORTR as the output type on the header specification.
Enter 0 as the maximum control field length, as there is to be no control field.
This also implies that columns 15 to 39 of the header specification should be
left blank, because the entries in these columns all pertain to the sorting
process.
Enter record specifications, if any conditions are placed on the input records
selected for copying or merging.
Enter field specifications, if the input record is reformatted in any way.
HEADER SPECIFICATIONS
1 2 73 74 75 76 77 78 79 80
Page ┌──┬──┐ Program ┌──┬──┬──┬──┬──┬──┬──┬──┐
│ │ │ Identification │ │ │ │ │ │ │ │ │
└──┴──┘ └──┴──┴──┴──┴──┴──┴──┴──┘
┌───────────┬─────────────────┬─────┬────────┬──┬────────────────────┬──┬──┬──┬────────────────────────────────┬───────────────────────────────────────────────/ /───┐
│ Statement │ │ R │ │ S│ │A │ R│O │ │ / / │
├────────┬──┤ Output Type │ e │Maximum │ e│ │l │ e│u │ │ / / │
│ │T │ │ s │Control │ q│ │tC│ s│t │ │ / / │
│ │y │ SORTR │ e │Field │ u│ │ o│ e│p │ │ / / │
│ Number │p │ SORTRS │ r │Length │ e│ Reserved │Sl│ r│u │ Reserved │ Comments / / │
│ │e │ SORTA │ v │ │ n│ │e │ v│t │ │ / / │
│ │ │ │ e │(1─256) │ c│ │q │ e│ │ │ / / │
│ │ │ │ d │ │ e│ │ │ d│ │ │ / / │
│ │H │ │ │ │A │ │S │ │ │ │ / / │
│ │* │ │ │ │D │ │F │ │X │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72 │
├──┬──┬──┼──┼──┬──┬──┬──┬──┬──┼──┬──┼──┬──┬──┼──┼──┬──┬──┬──┬──┬──┬──┼──┼──┼──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /───┤
│ │ │ │ H│ S│ O│ R│ T│ R│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /───┘
These omit record specifications indicate which records are not included in the
output file. The significant column entries are:
The last record specification is an include-all statement, meaning that the only entry
on that record specification is the sequence number and the I in column 6. This
causes all the records not omitted by the omit specifications to be included in the
copy.
Chapter 6. Copying and Merging Records from Several Files into One 69
FIELD SPECIFICATIONS
┌───────────┬──┬───┬───────────────────────┬────────┬────────┬──────────────────────────────────────────────────┬─────────────────────────────────────────────────────/ /──┐
│ Statement │F │D │ Field Location │ Forced │Overflow│ │ / / │
├────────┬──┤i │a ├───────────┬───────────┤ Charac-│Field │ │ / / │
│ │T │e │t T│ │ │ ters │Length │ │ / / │
│ │y │l │a y│ │ ├──┬──┬──┤ │ │ / / │
│ │p │d │ p│ │ │R │S │C │ │ │ / / │
│ │e │ │ e│ │ │e │u │o │... │ │ / / │
│ Number │ │ │ │ Start │ End │c │b │n │A . │ Reserved │ Comments / / │
│ │ │ │C,K│ │ │o │s │t │l . │ │ / / │
│ │ │ │Z,L│ │ │r │t │i │tS. │ │ / / │
│ │ │ │D,E│ │ │d │i │n │ e. │ │ / / │
│ │ │D │P,I│ │ │ │t │u │ q. │ │ / / │
│ │ │N │V,J│ │ │ │u │a │ . │ │ / / │
│ │ │O │U,R│ │ │ │t │t │ . │ │ / / │
│ │ │F │M,S│ │ │ │e │i │ . │ │ / / │
│ │F │S │H,T│ │ │ │ │o │ . │ │ / / │
│ │* │* │B │ │ │ │ │n │A . │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57/ /72│
├──┬──┬──┼──┼──┼───┼──┬──┬──┬──┼──┬──┬──┬──┼──┼──┼──┼──•──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ F│ D│ C │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ I│ N│ C│ L│ U│ D│ E│ │ A│ L│ L│ │ I│ N│ P│ U│ T│ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ *│ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ F│ I│ E│ L│ D│ S│ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴───┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
This field specification states that all the input data fields are to be included in the
output records. The data is character data.
The field specifications are as follows (only the column entries that are important to
this example are described):
FIELD SPECIFICATIONS
┌───────────┬──┬───┬───────────────────────┬────────┬────────┬──────────────────────────────────────────────────┬─────────────────────────────────────────────────────/ /──┐
│ Statement │F │D │ Field Location │ Forced │Overflow│ │ / / │
├────────┬──┤i │a ├───────────┬───────────┤ Charac-│Field │ │ / / │
│ │T │e │t T│ │ │ ters │Length │ │ / / │
│ │y │l │a y│ │ ├──┬──┬──┤ │ │ / / │
│ │p │d │ p│ │ │R │S │C │ │ │ / / │
│ │e │ │ e│ │ │e │u │o │... │ │ / / │
│ Number │ │ │ │ Start │ End │c │b │n │A . │ Reserved │ Comments / / │
│ │ │ │C,K│ │ │o │s │t │l . │ │ / / │
│ │ │ │Z,L│ │ │r │t │i │tS. │ │ / / │
│ │ │ │D,E│ │ │d │i │n │ e. │ │ / / │
│ │ │D │P,I│ │ │ │t │u │ q. │ │ / / │
│ │ │N │V,J│ │ │ │u │a │ . │ │ / / │
│ │ │O │U,R│ │ │ │t │t │ . │ │ / / │
│ │ │F │M,S│ │ │ │e │i │ . │ │ / / │
│ │F │S │H,T│ │ │ │ │o │ . │ │ / / │
│ │* │* │B │ │ │ │ │n │A . │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57/ /72|
├──┬──┬──┼──┼──┼───┼──┬──┬──┬──┼──┬──┬──┬──┼──┼──┼──┼──•──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ F│ D│ C │ │ │ 7│ 2│ │ 1│ 2│ 8│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ F│ I│ E│ L│ D│ │ │ 7│ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ F│ D│ C │ │ │ 6│ 6│ │ │ 7│ 1│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ F│ I│ E│ L│ D│ │ │ 6│ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ F│ D│ C │ │ │ 5│ 2│ │ │ 6│ 5│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ F│ I│ E│ L│ D│ │ │ 5│ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ F│ D│ C │ │ │ 4│ 8│ │ │ 5│ 1│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ F│ I│ E│ L│ D│ │ │ 4│ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ F│ D│ C │ │ │ 2│ 2│ │ │ 4│ 7│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ F│ I│ E│ L│ D│ │ │ 3│ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ F│ D│ C │ │ │ │ 3│ │ │ 2│ 1│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ F│ I│ E│ L│ D│ │ │ 2│ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ F│ D│ C │ │ │ │ 1│ │ │ │ 2│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ F│ I│ E│ L│ D│ │ │ 1│ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴───┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
Note that the entries in columns 9-16 reorder the fields on the output record in the
reverse order from what they are in in the input record. Only the fields that are
specified will appear in the output record.
Chapter 6. Copying and Merging Records from Several Files into One 71
Processing These Specifications
Assuming that the input records are in the same input files, the specifications are in
the same source file, and the output file is to be the same output file as in
“Example 1. Copying a File with No Reformatting” on page 68, enter the same
FMTDTA command as in “Example 1. Copying a File with No Reformatting” on
page 68 in order to process the specifications. See below.
You must enter values for the first two parameters, INFILE and OUTFILE. The
remaining parameters are optional. Default values are assumed for parameters
that you omit.
Bottom
Additional Parameters
Bottom
When you have entered the option values you need, Press Enter to begin proc-
essing, or press F3 to exit without processing the command.
file_name
Enter the name of the file. This is a required parameter.
library_name
Enter any of the following values, or accept the default.
*CURLIB
The current library. If you have not specified a current library, QGPL is
used.
library_name
The name of the particular library where the input file and member are
to be found.
member_name
Enter any of the following values.
*FIRST
The first member of the input file.
data_file_identifier
For diskette files, enter one data file identifier per diskette unit file name
specified. If more than one diskette data file is being specified as the
input file, the data file identifier must be entered for each.
member_name
For database files, enter the name of the member in which the input
records are to be found.
file_name
Enter the name of the file. You must enter an option for this field.
library_name
Enter any of the following values, or accept the default.
*CURLIB
The current library. If you have not specified a current library, QGPL is
used.
*LIBL
The current library list. The system will search this list for the output
file. The first file it finds with the specified file name is the one into
which it will put the output records.
library_name
The name of the particular library where the output file and member are
to be found.
member_name
Enter any of the following values, or accept the default.
*FIRST
The first member of the output file is to contain the output records.
member_name
Enter the name of the member into which the output records are to be
put.
QFMTSRC
An IBM-supplied source file.
source_file_name
Enter the name of a particular source file.
library_name
Enter any of the following values, or accept the default.
*LIBL
The current library list. The system searches this list for the source
file. The first file it finds with the specified file name is the one that
it attempts to process for instructions.
*CURLIB
The current library. If you have not specified a current library,
QGPL is used.
library_name
The name of the particular library where the source file and
member are to be found.
*FIRST
Sort searches for the sort specifications in the first member of the source
file.
data_file_identifier
For diskette files, enter the data file identifier for the diskette unit file name
specified.
member_name
For database files, enter the name of the member in which the source
specifications are to be found.
QSYSPRT
The contents of this file are printed automatically by the system printer.
print_file_name
Enter the name of a particular printer device file.
library_name
The name of the library containing the print file. Possible values are:
*CURLIB
The current library. If you have not specified a current library, QGPL is
used.
library_name
The name of the particular library where the printer device file is to be
found.
OPTION (Options)
Specifies the sequence-checking and print options to be used. If you specify
more than one value for an option, the last value specified will be the value that
is used. Enter a plus sign (+) into the field to the right of the + for more
values to enter more than one value. The possible options and their values
are:
*CHK
The Sort specifications are sequence-checked. The system verifies if the
sequence numbers of the job specifications in the source file match their
order in the source file. If not, a warning message is issued.
*NOCHK
The Sort specifications are not sequence checked.
*PRT
The Sort specifications for this job, as well as any error and warning mes-
sages issued by the system, are printed.
*NOPRT
The specifications and messages are not printed.
*NODUMP
The internal tables used for this job are not printed.
*DUMP
The internal tables used for this job are printed. These tables can then
help you isolate the cause of any particular problem.
*NOSECLVL
Do not list second-level messages for this job.
*SECLVL
List second-level messages for this job.
*DATE
Use the date as entered with the CL command QDHTFMT; if separators
are used, use the date as entered with the QDATSEP command.
HEADER SPECIFICATIONS
1 2 73 74 75 76 77 78 79 80
Page ┌──┬──┐ Program ┌──┬──┬──┬──┬──┬──┬──┬──┐
│ │ │ Identification │ │ │ │ │ │ │ │ │
└──┴──┘ └──┴──┴──┴──┴──┴──┴──┴──┘
┌───────────┬─────────────────┬─────┬────────┬──┬────────────────────┬──┬──┬──┬────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │ │ R │ │ S│ │A │ R│O │ │ / / │
├────────┬──┤ Output Type │ e │Maximum │ e│ │l │ e│u │ │ / / │
│ │T │ │ s │Control │ q│ │tC│ s│t │ │ / / │
│ │y │ SORTR │ e │Field │ u│ │ o│ e│p │ │ / / │
│ Number │p │ SORTRS │ r │Length │ e│ Reserved │Sl│ r│u │ Reserved │ Comments / / │
│ │e │ SORTA │ v │ │ n│ │e │ v│t │ │ / / │
│ │ │ │ e │(1─256) │ c│ │q │ e│ │ │ / / │
│ │ │ │ d │ │ e│ │ │ d│ │ │ / / │
│ │H │ │ │ │A │ │S │ │ │ │ / / │
│ │* │ │ │ │D │ │F │ │X │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┬──┬──┬──┬──┬──┼──┬──┼──┬──┬──┼──┼──┬──┬──┬──┬──┬──┬──┼──┼──┼──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
The number entered must be right-justified. For example, if you enter a 6 into
column 16 only, the system would assume that you entered a 60. The number
must be equal to or greater than the sum of the longest control field (as specified in
the field specifications).
Control fields are composed of one or more fields taken from the input records. A
different grouping can be specified for each input record type. The entry in this
field must equal or exceed the length of the largest grouping.
Copy-Only Request
If columns 15 through 17 are left blank, no sorting or reformatting occurs. This is
equivalent to specifying that records are to be copied or merged only, as described
in Chapter 6, “Copying and Merging Records from Several Files into One.”
The sorting of input records is based on the contents of the control field for the
record type. Input records are sorted according to this order unless this order is
overridden by the field specifications for the particular control field.
Column 27 (Reserved)
This column must be blank.
Notes:
1. Column 28 must contain an X for an RA sort.
2. The control field will appear in the output records in the same format it was in
when used for processing the records. If, however, it was forced in any way
(altered by the field specifications) or specified as being in packed format, the
control field data will appear quite different from the source fields from which it
was constructed.
Sort treats all input files as unformatted strings of bytes. You must divide the unfor-
matted input file into the fields that are to be sorted or reformatted.
The record specification identifies the input records to be used (sorted or omitted)
by identifying two fields, called Factor 1 and Factor 2. It states what the contents
of these two fields should be, and what the relationship of these contents should be
to each other in order for the input record to be processed. During processing, the
Sort utility scans the input file for records whose contents match these conditions,
and includes (or omits) them from the sort.
Record Type
Any difference in either the conditions established for the selection of an input
record, or the field specifications that define how these input records are to be
processed, is considered as a difference in record type. Each new record type
must be defined by its own set of record specifications.
RECORD SPECIFICATIONS
┌───────────┬──┬──┬───────────────────────┬─────┬──┬───────────────────────────────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │C │D │ Factor 1 │Com- │F │B───────────────── Factor 2 Constant ───────────────────C│ / / │
├────────┬──┤o │a ├───────────┬───────────┤pari-│a │ • │ / / │
│ │T │n │t │ │ │son │c │B─── Factor 2 ───C• │ / / │
│ │y │t │aT│ │ │Oper-│t │ Keyword • │ / / │
│ Number │p │i │ y│ Start │ End │ator │o │ • │ Comments / / │
│ │e │n │ p│ Position │ Position │ │r │B────── Factor 2 ─────C• │ / / │
│ │ │u │ e│ │ │ │2 │ Field • │ / / │
│ │I │e │C │ │ │ │ │ • │ / / │
│ │O │ │Z │ │ │ │C │ Location • │ / / │
│ │* │A │D │ │ │EQ,NE│F │ │ • │ / / │
│ │ │O │P │ │ │LT,GT│K │ Start │ End • │ / / │
│ │ │* │U │ │ │LE,GE│S │ │ • │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┼──┼──┬──┬──┬──┼──┬──┬──┬──┼──┬──┼──┼──┬──┬──┬──┼──┬──┬──┬──•──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
Table 2 (Page 1 of 2). Summary of Column Entries for the Record Specification
Columns Entry Explanation
1-2 00-99 Page number (no entry required).
3-5 000-999 Statement number (no entry required).
*
8 C Factor 1 and Factor 2 must contain character data.
Z Factor 1 and Factor 2 must contain character data, and the zone portions of the
binary representation of the characters are to be used for the comparison.
Factor 1 and Factor 2 must contain character data, and the digit portions of the
D characters are to be used for the comparison.
Factor 1 must contain signed, packed numeric data. If Factor 2 is defined, it
P must also contain signed, packed numeric data.
Factor 1 must contain signed, zoned numeric data. If Factor 2 is defined, it must
U also contain signed, zoned numeric data.
9-12 1-9999 The start position of the Factor 1 field. This can be left blank.
13-16 1-9999 The end position of the Factor 1 field. If columns 9 through 12 are blank, this
entry defines a Factor 1 field that is one character long in the position specified.
17-18 EQ Factor 1 must equal Factor 2.
NE Factor 1 must not equal Factor 2.
LT Factor 1 must be less than Factor 2.
GT Factor 1 must be greater than Factor 2.
LE Factor 1 must be less than or equal to Factor 2.
GE Factor 1 must be greater than or equal to Factor 2.
19 C Factor 2 is a constant.
F Factor 2 is a field in the input record.
K Factor 2 is a keyword.
S Factor 2 is a constant, but it is shifted one character to the left before compar-
ison.
20-23 1-9999 The start position of the Factor 2 field. This can be left blank if the Factor 2 field
is one character long.
24-27 1-9999 The end position of the Factor 2 field. If columns 20 through 23 are blank, this
entry defines a Factor 2 field that is one character long in the position specified.
20-39 Any entry If columns 20 through 27 are not being used to define the start and end posi-
tions of the Factor 2 field, then columns 20 through 39 can be used to specify a
constant or keyword against which Factor 1 is compared.
40-72 Any entry Comments.
Use the *CHK option of the FMTDTA command (see Chapter 7, “The Format Data
(FMTDTA) Command”) to check for out-of-sequence conditions in the Sort specifi-
cation set.
Note: Alternative collating sequence (ALTSEQ) statements are not sequence-
checked, but must immediately follow the header statement.
Only one such blank record specification can be used per sort job.
You can also omit the blank record specification. If field specifications are entered
on their own (that is, without being preceded by record specifications for a record
type), Sort assumes the field specifications apply to all the remaining unprocessed
input records. Again, such field specifications must be the last ones entered for the
particular sort job.
| The following tables show the combination of entries you can make in columns 6
| and 7 for sets of include and omit specifications.
| Note: There are no field statements in omit sets. Each omit set must be followed
| by an include or an include-all set.
Because Sort reads the input record as a sequence of unformatted bytes (and bits),
column 8 specifies how many bits are to be assigned to each character. For
example, in packed format each digit is represented by four bits; in zoned format,
by eight bits.
┌──────────┬────────────────────────────┬───────────────┐
│ Column 8 │ │ Maximum Field │
│ Entry │ Compare Operations │ Length * │
├──────────┼────────────────────────────┼───────────────┤
┌ │ │ │ │
│ │ C │ Use both zone and digit │ 256 characters│
│ │ │ portions of the characters │ │
│ ├──────────┼────────────────────────────┼───────────────┤
Alpha- │ │ │ │ │
numeric :─┤ │ Z │ Use only the zone portion │ 1 character │
Data │ │ │ of the character │ │
│ ├──────────┼────────────────────────────┼───────────────┤
│ │ │ │ │
│ │ D │ Use only the digit portion │ 16 characters │
└ │ │ of the character │ │
├──────────┼────────────────────────────┼───────────────┤
┌ │ │ │ 8 bytes, or │
│ │ P │ Numeric data is packed.** │ 15 digits │
Signed │ │ │ │ plus sign │
Numeric:─┤ ├──────────┼────────────────────────────┼───────────────┤
Data │ │ │ │ │
│ │ U** │ Numeric data is unpacked │ 16 digits │
│ │ │ (zoned) ** │ │
└ ├──────────┴────────────────────────────┴───────────────┤
│ * For both Factor 1 and Factor 2 fields │
│ │
│** Do not use a packed or zoned data type for Factor 1 │
│ field in an include or omit specification (P or U │
│ in column 8) if you specify an alternative │
│ collating sequence (S in column 26) in the header │
│ specification │
└───────────────────────────────────────────────────────┘
1 Note that the digit portion of a zero and a blank are exactly the same.
If you instruct the Sort utility to use only the digit portions of characters (by putting
a D into column 8), characters with identical digit portions will look alike and
compare as equal. Likewise, if you instruct it to use only the zone position of char-
acters (by putting a Z into column 8), characters with identical zone positions will
look alike and compare as equal. Thus the column 8 entry is critical to ensuring
that the compare operations produce the results you intend.
For example, suppose you want only those records with a 2 in column 15 and a 2
in column 50. If you put a D into column 8, you will get the records you want, but
you may also get many records you do not want (several characters have the same
digit position as a 2). To get only the desired records, with a 2 in column 15 and a
2 in column 50, you must put a C into column 8 instead. The C tells Sort to use
both the zone and digit portions of characters in its compare operations, and no
other character has the same combination of zone and digit portions as the ones
you want.
If you specify that these fields are to contain numeric data in zoned (unpacked)
format, Sort reads the digit portion of each set of eight bytes up to and including
the last byte. This determines the number in the field. Sort also reads the zone
portion of the last byte. The value in that portion determines whether the number is
to be positive or negative.
Table 5 shows the binary representation of the ten digits. Figure 24 shows some
examples of packed and zoned numbers, and their signs.
− 1101
1011
1 Standard Form. The Sort Utility accepts all four forms of the plus sign. Before sorting
the file, however, the program converts all forms of the plus sign to the standard form
(1111). If you print a dump, the plus sign will always be expressed as a hexadecimal F.
If you specify alphanumeric data, digit portion only (a D in column 8), then Sort
interprets each set of four bits as a digit, and automatically assumes that the
resulting number is positive.
Note that the difference between this entry and that entered into columns 13
through 16 (Factor 1 End Position) determines the length of the Factor 1 field. This
length can be from 1 to 256 characters, but is subject to some restrictions, as
shown in Table 7.
If only the zone portions of characters are to be compared (column 8 contains a Z),
then EQ or NE are the only two entries you can make.
To describe fields that are only one-character long, leave columns 20 through 23
(start position) blank, and enter the number of the position on the input record that
contains the character in columns 24 through 27 (end position).
For comparisons to packed numeric fields (column 8 contains P), the number of
numeric digits in the Factor 2 constant must be equal to twice the Factor 1 length
minus 1 (the sign occupies only one position in both the packed field and the zoned
constant). For comparisons to zoned numeric fields (U in column 8), the number of
numeric digits in the Factor 2 constant must equal the Factor 1 length.
RECORD SPECIFICATIONS
┌───────────┬──┬──┬───────────────────────┬─────┬──┬───────────────────────────────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │C │D │ Factor 1 │Com- │F │B───────────────── Factor 2 Constant ───────────────────C│ / / │
├────────┬──┤o │a ├───────────┬───────────┤pari-│a │ • │ / / │
│ │T │n │t │ │ │son │c │B─── Factor 2 ───C• │ / / │
│ │y │t │aT│ │ │Oper-│t │ Keyword • │ / / │
│ Number │p │i │ y│ Start │ End │ator │o │ • │ Comments / / │
│ │e │n │ p│ Position │ Position │ │r │B────── Factor 2 ─────C• │ / / │
│ │ │u │ e│ │ │ │2 │ Field • │ / / │
│ │I │e │C │ │ │ │ │ • │ / / │
│ │O │ │Z │ │ │ │C │ Location • │ / / │
│ │* │A │D │ │ │EQ,NE│F │ │ • │ / / │
│ │ │O │P │ │ │LT,GT│K │ Start │ End • │ / / │
│ │ │* │U │ │ │LE,GE│S │ │ • │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┼──┼──┬──┬──┬──┼──┬──┬──┬──┼──┬──┼──┼──┬──┬──┬──┼──┬──┬──┬──•──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ I│ │ P│ │ │ │ 1│ │ │ │ 2│ E│ Q│ C│ 0│ 0│ 1│ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ P│ A│ C│ K│ E│ D│ │ ─│ 1│ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ I│ A│ U│ │ │ │ 5│ │ │ │ 8│ E│ Q│ C│ │ │ 2│ M│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ U│ N│ P│ A│ C│ K│ E│ D│ │ ─│ 2│ 4│ │ │ │ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ I│ A│ U│ │ │ 1│ 1│ │ │ 1│ 6│ E│ Q│ C│ │ │ │ │ 1│ }│ │ • │ │ │ │ │ │ │ │ │ │ │ │ U│ N│ P│ A│ C│ K│ E│ D│ │ ─│ 1│ 0│ │ │ │ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
Figure 25. Examples of How to Code Negative Constants into Record Specifications
When Factor 2 is a keyword, Sort compares all or part of the program date with the
Factor 1 field. The length of the Factor 1 field must be the same as the Factor 2
field. You can use the following keywords:
If UDATE is used, the program date must be in the same format as the date con-
tained in the input records.
The program date parameter of the FMTDTA command (see Chapter 7, “The Format
Data (FMTDTA) Command”) provides the date, month, day, and year that will be
used.
Control fields are used to control the way in which the input record is sorted and
reformatted, as described in Chapter 1, “Introduction.” Data fields identify those
fields that contain data to be summed (see Chapter 5, “Sorting Records from a File
and Producing Totals”), or fields that appear in the output records. Summary data
fields are fields in the output record that contain the totals that are produced.
You can enter one or more field specifications for each field.
A series of field specifications must be entered for each record type. Record types
are defined by record specifications, as described in Chapter 9, “Record
Specifications.” Sort allows one series of field specifications to be entered without
being preceded by the record specifications that define the record type. This can
be done only once, and must be the last set of field-record specifications entered
for the job. In this case, the system assumes that the record type is “all,” meaning
that the field specifications pertain to all the remaining input records that have not
yet been processed.
FIELD SPECIFICATIONS
┌───────────┬──┬───┬───────────────────────┬────────┬────────┬──────────────────────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │F │D │ Field Location │ Forced │Overflow│ │ / / │
├────────┬──┤i │a ├───────────┬───────────┤ Charac-│Field │ │ / / │
│ │T │e │t T│ │ │ ters │Length │ │ / / │
│ │y │l │a y│ │ ├──┬──┬──┤ │ │ / / │
│ │p │d │ p│ │ │R │S │C │ │ │ / / │
│ Number │ │ │ │ Start │ End │c │b │n │A . │ Reserved │ Comments / / │
│ │ │ │C,K│ │ │o │s │t │l . │ │ / / │
│ │ │ │Z,L│ │ │r │t │i │tS. │ │ / / │
│ │ │ │D,E│ │ │d │i │n │ e. │ │ / / │
│ │ │D │P,I│ │ │ │t │u │ q. │ │ / / │
│ │ │N │V,J│ │ │ │u │a │ . │ │ / / │
│ │ │O │U,R│ │ │ │t │t │ . │ │ / / │
│ │ │F │M,S│ │ │ │e │i │ . │ │ / / │
│ │F │S │H,T│ │ │ │ │o │ . │ │ / / │
│ │* │* │B │ │ │ │ │n │A . │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┼───┼──┬──┬──┬──┼──┬──┬──┬──┼──┼──┼──┼──.──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ . │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤ . ├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ . │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴───┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
Table 8 (Page 1 of 2). Summary of Column Entries for the Field Specifications
Columns Entry Explanation
1-2 00-99 Page number (no entry required).
3-5 000-999 Statement number (no entry required).
6 F Identifies this specification as a field specification.
7 D The field is a data field.
N The field is a normal control field.
O The field is an opposite control field.
F The field is a forced control field.
S The field is a summary data field.
* Identifies this specification as a comment specification.
8 P The field contains signed decimal data, in packed format.
U The field contains signed decimal data, in zoned format.
C The field contains character data.
Z Only the zone portion is used for sorting.
D Only the digit portion of each character is used for sorting.
V Force a single data character into the data field.
F Simplified Chinese DBCS control field using character-type, total strokes, radical
sequence.
G Simplified Chinese DBCS control field using character-type, radical, strokes beyond
radical sequence.
N Simplified Chinese DBCS control field using character-type, single-pronunciation,
radical, total strokes, tie-breaker sequence.
Q Simplified Chinese DBCS control field using character-type, single-pronunciation,
total strokes, radical, tie-breaker sequence.
W Simplified Chinese DBCS control field using character-type, single-pronunciation, tie-
breaker, radical, total strokes sequence.
X Simplified Chinese DBCS control field using character-type, total strokes, radical,
single-pronunciation, tie-breaker sequence.
Y Simplified Chinese DBCS control field using character-type.
M Traditional Chinese DBCS control field using character-type sequence.
H Traditional Chinese DBCS control field using character-type, stroke, radical
sequence.
B Traditional Chinese DBCS control field using character-type, radical, strokes beyond
radical sequence.
K Korean DBCS control field using primary Hangeul pronunciation of Hanja characters.
Korean DBCS control field using secondary Hangeul
L pronunciation of Hanja characters that start Korean DBCS
words, and primary Hangeul pronunciation of all other Hanja
characters.
Sei-On Katakana control field.
E Japanese DBCS control field using single-pronunciation, radical, stroke, tie-breaker
I sequence.
Japanese DBCS control field using single-pronunciation, stroke, radical, tie-breaker
J sequence.
Japanese DBCS control field using radical, stroke, tie-breaker
R sequence.
Japanese DBCS control field using stroke, radical, tie-breaker
S sequence.
Japanese DBCS control field using character-type sequence.
T
Use the *CHK option of the FMTDTA command (see Chapter 7, “The Format Data
(FMTDTA) Command”) to check for out-of-sequence conditions in the Sort specifi-
cation set.
Note: Alternative collating sequence (ALTSEQ) statements are not sequence-
checked, but must immediately follow the header statement.
If you are describing a control field, you can use the entry in column 8 to further
specify which part of each character in the control is used for sorting or reformat-
ting. Columns 8 through 19 allow you to control the sorting and reformatting more
precisely. This can be useful for special types of sort, or to save space in memory
and processing time during very long sorts.
FIELD SPECIFICATIONS
┌───────────┬──┬───┬───────────────────────┬────────┬────────┬──────────────────────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │F │D │ Field Location │ Forced │Overflow│ │ / / │
├────────┬──┤i │a ├───────────┬───────────┤ Charac-│Field │ │ / / │
│ │T │e │t T│ │ │ ters │Length │ │ / / │
│ │y │l │a y│ │ ├──┬──┬──┤ │ │ / / │
│ │p │d │ p│ │ │R │S │C │ │ │ / / │
│ Number │ │ │ │ Start │ End │c │b │n │A . │ Reserved │ Comments / / │
│ │ │ │C,K│ │ │o │s │t │l . │ │ / / │
│ │ │ │Z,L│ │ │r │t │i │tS. │ │ / / │
│ │ │ │D,E│ │ │d │i │n │ e. │ │ / / │
│ │ │D │P,I│ │ │ │t │u │ q. │ │ / / │
│ │ │N │V,J│ │ │ │u │a │ . │ │ / / │
│ │ │O │U,R│ │ │ │t │t │ . │ │ / / │
│ │ │F │M,S│ │ │ │e │i │ . │ │ / / │
│ │F │S │H,T│ │ │ │ │o │ . │ │ / / │
│ │* │* │B │ │ │ │ │n │A . │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┼───┼──┬──┬──┬──┼──┬──┬──┬──┼──┼──┼──┼──.──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ 0│ 7│ │ F│ F│ C│ │ │ │ │ │ │ │ 1│ Z│ +│ │ . │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤ . ├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ . │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴───┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
Sort does this replacement before using the control field to process the input
record.
Enter a separate conditional force field specification for the first three cases, and a
| conditional force-all specification for the last case. A conditional force-all field is
| specified in the same way as an unconditional force field, except that it is related to
| the preceeding statements using a continuation character in column 19.
If you do not place a force-all statement after a conditional force line, and the Sort
utility does not find the specified characters in the control field of the input record,
then Sort will:
Replace the control field character with X'FF' (if you specified ascending
sequence in the header statement)
Replace the control field character with X'00' (if you specified descending
sequence in the header statement).
In summary sort jobs, the data found in the field are added for all input records
| which have identical control field values. The same field in the output record is
normally used to hold the totals, except in the case of an overflow.
In the case of a summary sort, only one output record is produced for each sepa-
rate input record type specified. You can, in addition to specifying summary sort
fields, also enter data field specifications. If you do so, however, the output record
will contain the data field; the contents in that field will correspond to the contents
of the data field found in the first input record (of that set) that was processed.
When you use this entry to change control field characters, the control field remains
changed in the output records. Usually, this changed control field data is used only
for the sorting and is otherwise meaningless; enter an X into column 28 of the
header specification to exclude it from the output record. Or, use another field
specification to respecify the original control field as a data field before entering the
field specification that alters the contents of the control field.
Table 9 (Page 1 of 3). Possible Column 8 Entries and Restrictions on Field Length
Col. 8 Character Portion Used Maximum
Entry Field Length
C Use both zone and digit portions of the charac- 999 characters (data)
ters. 256 characters (control field)
Z Use only the zone portion of the character. 1 character
D Use only the digit portion of the characters. 16 characters
U The characters are interpreted as signed decimal 16 digits
numbers in zoned (unpacked) format.
P The characters are interpreted as signed decimal 8 bytes or 15 digits and sign
numbers in packed format.1
Suppose, for example, that your input records have a one-character control field
that can be either *, 1, 2, or 3. The zone and digit portion of each character is:
If you want the records resequenced in ascending order using the digit position of
the control field characters, enter D into column 8. The records will then be sorted
in this order:
1
2
3
*
If you want the records resequenced in ascending order using both the zone and
digit positions, enter C into column 8. The records will then be sorted in this order:
*
1
2
3
Suppose you place a Z into column 8 and want the records resequenced in
ascending order. You can be sure that the records with an * control field will
precede the records with a 1, 2, or 3 control field. Because 1, 2, and 3 have iden-
tical zone positions, records with any of these numbers as a control field will be in
the order in which they were encountered in the input file.
If you want to force characters into your data field, place a V into column 8 and
specify the character to be forced in column 18. That character will be placed in
the first available data field position of the output record.
F C 2 1
Z 2 1
D 2 1
D C 99999
Z 1
D 16
P 8
U 16
V 1
S C 256
Z 1
D 16
P 8
U 16
V 1
To describe fields that are only one character long, leave columns 9 through 12
blank and enter the number of the record position that contains the character in
columns 13 through 16.
If columns 9 through 12 and 13 through 16 are blank, Sort assumes that the field
length is equal to the record length.
To describe fields that are only one character long, leave columns 9 through 12
blank, and enter the number of the record position that contains the character in
columns 13 through 16.
If a control field can contain any one of the several characters and you want to
specify a replacement for each one, you must enter a field specification for each
replacement, and use an entry in column 19 to relate the field specifications to
each other.
See “Column 7 (Field Type)” on page 101 for a general discussion of forced control
fields.
Make an entry in column 17 only when you want to see a conditional force. For
example, use it to put an * instead of an A into a position on the output record.
(See the descriptions for columns 7 and 18 in this chapter for more information
about conditional force.)
In other words, if you specify a summary sort job, then in the case of an overflow
(not enough room in the output record field for the accumulated total), the character
you enter into column 17 will be the one that will be put into the overflow indicator
field, a one-column field immediately to the right of the rightmost data field in the
output record.
You must use forced control characters only with one-character control fields.
Column 19 (Continuation)
Any entry put into this column links the field specification to the previously entered
field specification. This is required when several field specifications are needed to
define how a single field is processed (such as during a conditional force when the
control field character is replaced by another character and several possibilities are
to be specified).
If this column is left blank, the system assumes the field specification is for a new
field.
In summary sort jobs, the data fields that are summarized are used to contain the
totals in the output record. It is possible, however, that these totals can require
more space than the summary data field allows.
The length of this new overflow field should not exceed the maximum length for the
output record.
The overflow field length should also not exceed the lengths specified in Table 10
on page 107 for each data type.
If the data to be summed is in packed format, each digit needs only 4 bits of
memory for storage, plus another 4 bits to store the sign. Be aware that the
number in columns 20 through 22 represents units of 8-bit bytes; that is, each byte
represents two numbers in packed format, with the last byte representing only one
digit and the sign (plus or minus) for the entire number. For example, if you specify
3 for the overflow field length, you are reserving 24 bits of storage: therefore 999 is
the maximum number you can store in unpacked format, and +99999 is the
maximum number you can store in packed format.
If you specify an alternative collating sequence for a particular field, that field will be
changed (according to the alternative collating sequence specified by ALTSEQ)
whenever the field is used again as a control field for that record type.
RECORD SPECIFICATIONS
┌───────────┬──┬──┬───────────────────────┬─────┬──┬───────────────────────────────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │C │D │ Factor 1 │Com- │F │B───────────────── Factor 2 Constant ───────────────────C│ / / │
├────────┬──┤o │a ├───────────┬───────────┤pari-│a │ • │ / / │
│ │T │n │t │ │ │son │c │B─── Factor 2 ───C• │ / / │
│ │y │t │aT│ │ │Oper-│t │ Keyword • │ / / │
│ Number │p │i │ y│ Start │ End │ator │o │ • │ Comments / / │
│ │e │n │ p│ Position │ Position │ │r │B────── Factor 2 ─────C• │ / / │
│ │ │u │ e│ │ │ │2 │ Field • │ / / │
│ │I │e │C │ │ │ │ │ • │ / / │
│ │O │ │Z │ │ │ │C │ Location • │ / / │
│ │* │A │D │ │ │EQ,NE│F │ │ • │ / / │
│ │ │O │P │ │ │LT,GT│K │ Start │ End • │ / / │
│ │ │* │U │ │ │LE,GE│S │ │ • │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┼──┼──┬──┬──┬──┼──┬──┬──┬──┼──┬──┼──┼──┬──┬──┬──┼──┬──┬──┬──•──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──│──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
Figure 27. Comments Can Be Entered onto Header, Record, or Field Specification Forms
Header Specification
Print Option (Column 27)
Although Sort will accept all of the options available in the System/36
Sort Utility, assume the following:
0 Prints sort specifications, diagnostic messages, and
program status message.
1, 2, or 3 This column is syntax-checked, but no printout is gener-
ated when the job is run.
Note: No messages are displayed.
Ideographic Sort (Column 35) – Valid on DBCS systems only
Support for ideographic fields:
One Ideographic Character (IGC) field type is used.
Multiple IGC fields are used.
Null Output (Column 36)
Within the AS/400 system, the entry in this column is syntax-checked
only.
| Output Record Length (Columns 29 to 32)
| When the output file is an externally described file, these columns are
| syntax-checked.
Also, when your summary sort contains more than one record format, and the cor-
responding summary fields are either different lengths or different data types, your
results may differ from those on the System/36.
Header Specification
Collating Sequence (Column 26): The Sort utility has the additional feature of
being able to use an alternative collating sequence for specified parts of the control
field. (Enter F.)
You must enter an A into column 20 of any field specification that defines a portion
of the control field that is to be sorted with respect to the alternative collating
sequence. If you specify an alternative collating sequence for any input field in this
way, this sequence will apply to any other record types that also specify this input
field as part of the control field.
Note: This enhancement cannot be used with the System/38 Conversion Reformat
Utility.
This appendix provides examples of the standard EBCDIC collating sequence, and
explains how to define an alternative one.
Figure 29. Standard EBCDIC Collating Sequence Used When You Compare Only the Zone Portion of Characters
Figure 30. Standard EBCDIC Collating Sequence Used When You Compare Only the Digit Portion of Characters
Sort will apply these changes to the entire job. The appropriate characters are
changed in all input records before any processing is done: this means that the
selection of input records, as stated on the record specifications for the job, is
based on the changed characters as specified in the alternative collating sequence.
Forced characters and any other constants and comparisons will also be changed
and controlled by the alternative collating sequence.
Note: Do not use packed or zoned Factor 1 or Factor 2 fields in an include or omit
record specification (P or U in column 8) if you specify an alternative col-
lating sequence on the entire control field. You can only do so when you
are using an alternative collating sequence only on specified parts of the
control field.
Be aware that:
Record selection (including or omitting records) and conditional force (replacing
a single character or all characters) are based on an input record that has not
been changed by the alternative collating sequence.
Any control field specification that has an A in column 20 must not be packed or
zoned. (Do not code a P or U in column 8.)
If you specify an alternative collating sequence for a particular input field, this
sequence will be applied to any other input record type that uses the same
input field as part of its control field.
The alternative collating sequence will apply only to the specified normal and
opposite control fields that were indicated in this way.
ALTSEQ specifications never change data fields in records or forced control field
characters. Characters defined for an alternative collating sequence could be inter-
preted as other data fields.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──
│ A│ L│ T│ S│ E│ Q│ │ │ H│ X│ H│ Y│ H│ X│ H│ Y│ │ │ │ │ ...
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──
Use the following steps to code ALTSEQ specifications. You can code them onto
any Sort specifications form.
1. Code ALTSEQ into columns 1-6 to tell the Sort utility that you want to change the
standard collating sequence.
2. Leave columns 7-8 blank.
3. Enter the hexadecimal equivalent (shown as X'HX' in the figure) of the char-
acter you are taking out of its normal sequence into the next two columns.
4. Enter the hexadecimal equivalent (shown as X'HY' in the figure) of the value
that the character specified is to assume into the next two columns.
5. Enter as many pairs of original and new hexadecimal values (each occupying
four columns) as required. Leave no spaces between sets of hexadecimal
numbers.
6. When you reach the end of one specification (column 96), you can continue
entering more pairs of hexadecimal values in a new ALTSEQ specification.
(Repeat steps 1 to 5.)
7. Do not code comments on an ALTSEQ line.
Note: When you move a character into the sequence position normally assigned
to another character, both the new and the original character occupy the
same position and are considered equal. The system does not know which
character should precede the other, and therefore, does not sort these two
characters. If you do not want the two characters to be equal, you must
also move the character that normally occupies that position. (See the
examples later in this appendix.)
Examples
The following examples describe two situations that involve using an alternative col-
lating sequence.
Normal Altered
Sequence Sequence
A A
B $
C B
D C
E D
F E
G F
H G
I H
I
Note: For this sequence, assign the dollar sign ($) the same value as B, B the
same value as C; continue this process until the I has the same value as an
unprintable character. This produces the desired results, because there are
no printable characters between I and J. (See Figure 28 on page 118.)
The ALTSEQ specification used to enter this alternative collating sequence is:
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 37 38 39 40 41 42 43 44 45
┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──
│ A│ L│ T│ S│ E│ Q│ │ │ 5│ B│ C│ 2│ C│ 2│ C│ 3│ C│ 3│ C│ 4│ C│ 4│ C│ 5│ C│ 5│ C│ 6│ C│ 6│ C│ 7│ C│ 7│ C│ 8│ C│ 8│ C│ 9│ C│ 9│ C│ A│ ...
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──
│ A│ L│ T│ S│ E│ Q│ │ │ 4│ 0│ F│ 0│ │ │ │ │ │ │ │ │ ...
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──
Before you can sort double-byte characters, you must have the following:
The DBCS version of the AS/400 system installed on your system.
A DBCS-capable display station (if you want to display or enter double-byte
characters in your source file).
A printer capable of printing characters in your language, if you are going to
print double-byte characters.
Sort tables
– DBCS master sort table
The DBCS master sort table for each language contains the sort informa-
tion to specify for each user-defined DBCS character in that language.
Every time you define a new character or make changes to an existing
character, you must update the sort information for that character in this
table.
– DBCS active sort table
The DBCS active sort table for each language contains the active collating
sequence of the DBCS characters in that language. Every time you update
the DBCS master sort table, you should update this table as well.
Note: For Korean DBCS characters, there is a DBCS active sort table but no
DBCS master sort table. The active sort table is used to convert Hanja
characters to their equivalent Hangeul characters.
Header Specifications
The following coding considerations must be noted to successfully run your
program. For further details regarding coding your header specifications, see
Chapter 8, “The Header Specification.”
Columns 15 through 17 (Maximum Control Field Length)
Shift-in (SI) and shift-out (SO) control characters are present in all records and
do not need to be included as part of a DBCS control field. The maximum
control field length must not exceed 256 bytes. The control field is the number
of bytes, not the number of characters.
Note: When you convert a one-byte EBCDIC Katakana field to the Japanese
(Sei-On) Katakana control field, you must calculate the value in columns
15 through 17. To do this, divide the EBCDIC Katakana field length by
4 and round the quotient, if there is one, up to the nearest whole
number. Multiply this value by 2, and add the result to the original
Katakana field length. The maximum control field length is 256 bytes.
Column 26 (Alternative Collating Sequence)
An S or F entry in this column can produce undesirable results, because the
double-byte alternative collating sequence is not supported.
Column 28 (Include or Exclude Control Field in Output)
When DBCS control fields are used, they are changed in building the work
record; therefore, if you must keep the original data, repeat the information as a
data field. A blank in column 28 means to keep the control field; an X means to
drop the control field.
Column 35 (DBCS Sort Option)
This column is valid only in the System/36 environment and applies only to
Japanese DBCS sorts. Entries 1 and 2 will only be supported for System/36
compatibility; otherwise, you must leave this column blank.
Record Specifications
For further details regarding coding your record specifications, see Chapter 9,
“Record Specifications.”
Column 8 (Data Type)
For users of double-byte characters, the only valid entry is C.
Note: Although Z and D are not invalid entries and no error message will be
issued if they are coded, undesirable results may occur when you sort
double-byte character sets.
Columns 17 through 18 (Comparison Operator)
Although all entries are valid for Hangeul characters, only EQ and NE are mean-
ingful when Factor 1 and Factor 2 contain all other DBCS characters.
Column 19 (Type of Data Contained in Factor 2)
Enter C to allow a DBCS data type field in the input record (Factor 1) to be
compared to a DBCS constant that will be represented, for example, by
SOKKKKSI (DBCS constant).
Enter S to allow a DBCS constant to be shifted one byte to the left. A blank will
be placed on the right.
Factor 2 as a constant may contain shift-in or shift-out characters that are not
defined as part of Factor 1. If Factor 2 is a DBCS constant, then it must be
delimited by shift-out (SO) and shift-in (SI) on the record specification.
If shift-in is not included in the Factor 2 comparison, the length of Factor 2 must
be specified as the length of Factor 1 minus 1.
Note: For packed data, Factor 2 must be the same size as the Factor 1 field.
Field Specifications
For further details regarding coding your field specifications, see Chapter 10, “Field
Specifications.”
Column 8 (Data Type)
This field describes the structure of the data in the field. You can show the
data being defined, for example, one-byte alphanumeric Katakana or two-byte
DBCS.
A DBCS control field with a C in this column is sorted into IBM-code (EBCDIC)
order, with a maximum length of 128 two-byte characters (256 bytes).
A DBCS control field with a K or L in this column is sorted into the following
sequence:
– blanks
– special symbols
– a through z
– A through Z
– Greek letters
– Japanese Katakana symbols
– 0 through 9
– Roman numerals
– DBCS (in IBM-code sequence).
If column 8 contains a K, each Hanja character will sort to the same position as
the primary Hangeul pronunciation of that character.
If column 8 contains an L, Hanja characters that start a DBCS word will sort to
the same position as the secondary Hangeul pronunciation of that character.
All other Hanja characters will sort to the same position as the primary Hangeul
pronunciation.
Columns 9 through 16 (Location of Field in the Input Record)
The length of the control field must be a multiple of two, and its length must not
exceed 256 bytes.
Note: DBCS characters for which no entries in the active collating sequence
exist will have a DBCS control field entry of X'FFFF' if ascending
sequence is specified on the header specification. This will cause
records with undefined DBCS characters to be placed behind those with
defined DBCS characters.
Radical: Characters can be ordered into their respective radicals. Within each
radical set, the characters are ordered by strokes. Radical numbers can be user-
defined. The ADTS/400: Character Generator Utility, SC09-1769 contains a listing
of radical numbers.
Strokes: Characters can be ordered by the number of strokes used to write the
character, by the total number of strokes, or by the number of strokes excluding the
radical.
DBCS Code Sequence: If all the sort criteria are the same for any two DBCS
characters in sequences 1 through 4 in Figure 32 on page 129, then the charac-
ters will be ordered based on their internal hexadecimal representations.
From To Explanation
1 10 Kanji field with So and Si person’s name.
11 16 Kanji field with So and Si title.
17 64 Other information.
HEADER SPECIFICATIONS
1 2 73 74 75 76 77 78 79 80
Page ┌──┬──┐ Program ┌──┬──┬──┬──┬──┬──┬──┬──┐
│ │ │ Identification │ │ │ │ │ │ │ │ │
└──┴──┘ └──┴──┴──┴──┴──┴──┴──┴──┘
┌───────────┬─────────────────┬─────┬────────┬──┬────────────────────┬──┬──┬──┬────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │ │ R │ │ S│ │A │ R│O │ │ / / │
├────────┬──┤ Output Type │ e │Maximum │ e│ │l │ e│u │ │ / / │
│ │T │ │ s │Control │ q│ │tC│ s│t │ │ / / │
│ │y │ SORTR │ e │Field │ u│ │ o│ e│p │ │ / / │
│ Number │p │ SORTRS │ r │Length │ e│ Reserved │Sl│ r│u │ Reserved │ Comments / / │
│ │e │ SORTA │ v │ │ n│ │e │ v│t │ │ / / │
│ │ │ │ e │(1─256) │ c│ │q │ e│ │ │ / / │
│ │ │ │ d │ │ e│ │ │ d│ │ │ / / │
│ │H │ │ │ │A │ │S │ │ │ │ / / │
│ │* │ │ │ │D │ │F │ │X │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┬──┬──┬──┬──┬──┼──┬──┼──┬──┬──┼──┼──┬──┬──┬──┬──┬──┬──┼──┼──┼──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ 0│ 0│ 1│ H│ S│ O│ R│ T│ R│ │ │ │ │ │ 8│ │ │ │ │ │ │ │ │ │ │ X│ │ │ │ │ │ │ │ │ │ │ │ N│ O│ │ C│ O│ N│ T│ R│ O│ L│ │ F│ I│ E│ L│ D/ / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
RECORD SPECIFICATIONS
┌───────────┬──┬──┬───────────────────────┬─────┬──┬───────────────────────────────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │C │D │ Factor 1 │Com- │F │B───────────────── Factor 2 Constant ───────────────────C│ / / │
├────────┬──┤o │a ├───────────┬───────────┤pari-│a │ • │ / / │
│ │T │n │t │ │ │son │c │B─── Factor 2 ───C• │ / / │
│ │y │t │aT│ │ │Oper-│t │ Keyword • │ / / │
│ Number │p │i │ y│ Start │ End │ator │o │ • │ Comments / / │
│ │e │n │ p│ Position │ Position │ │r │B────── Factor 2 ─────C• │ / / │
│ │ │u │ e│ │ │ │2 │ Field • │ / / │
│ │I │e │C │ │ │ │ │ • │ / / │
│ │O │ │Z │ │ │ │C │ Location • │ / / │
│ │* │A │D │ │ │EQ,NE│F │ │ • │ / / │
│ │ │O │P │ │ │LT,GT│K │ Start │ End • │ / / │
│ │ │* │U │ │ │LE,GE│S │ │ • │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┼──┼──┬──┬──┬──┼──┬──┬──┬──┼──┬──┼──┼──┬──┬──┬──┼──┬──┬──┬──•──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ 0│ 0│ 3│ I│ │ C│ │ │ 1│ 2│ │ │ 1│ 5│ E│ Q│ S│ O│ K│ K│ K│ K│ I│ │ • │ │ │ │ │ │ │ │ │ │ │ │ C│ O│ M│ P│ A│ R│ E│ │ 2│ │ C│ H│ A│ R│ S│ ./ / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
FIELD SPECIFICATIONS
┌───────────┬──┬───┬───────────────────────┬────────┬────────┬──────────────────────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │F │D │ Field Location │ Forced │Overflow│ │ / / │
├────────┬──┤i │a ├───────────┬───────────┤ Charac-│Field │ │ / / │
│ │T │e │t T│ │ │ ters │Length │ │ / / │
│ │y │l │a y│ │ ├──┬──┬──┤ │ │ / / │
│ │p │d │ p│ │ │R │S │C │ │ │ / / │
│ │e │ │ e│ │ │e │u │o │... │ │ / / │
│ Number │ │ │ │ Start │ End │c │b │n │A . │ Reserved │ Comments / / │
│ │ │ │C,K│ │ │o │s │t │l . │ │ / / │
│ │ │ │Z,L│ │ │r │t │i │tS. │ │ / / │
│ │ │ │D,E│ │ │d │i │n │ e. │ │ / / │
│ │ │D │P,I│ │ │ │t │u │ q. │ │ / / │
│ │ │N │V,J│ │ │ │u │a │ . │ │ / / │
│ │ │O │U,R│ │ │ │t │t │ . │ │ / / │
│ │ │F │M,S│ │ │ │e │i │ . │ │ / / │
│ │F │S │H,T│ │ │ │ │o │ . │ │ / / │
│ │* │* │B │ │ │ │ │n │A . │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┼───┼──┬──┬──┬──┼──┬──┬──┬──┼──┼──┼──┼──.──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ 0│ 0│ 3│ F│ N│ J│ │ │ │ 2│ │ │ │ 9│ │ │ │ . │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ S│ R│ T│ │ S│ E│ Q│ U│ E│ N│ C│ E│ │ │ │ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤ . ├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ . │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴───┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
FIELD SPECIFICATIONS
┌───────────┬──┬───┬───────────────────────┬────────┬────────┬──────────────────────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │F │D │ Field Location │ Forced │Overflow│ │ / / │
├────────┬──┤i │a ├───────────┬───────────┤ Charac-│Field │ │ / / │
│ │T │e │t T│ │ │ ters │Length │ │ / / │
│ │y │l │a y│ │ ├──┬──┬──┤ │ │ / / │
│ │p │d │ p│ │ │R │S │C │ │ │ / / │
│ │e │ │ e│ │ │e │u │o │... │ │ / / │
│ Number │ │ │ │ Start │ End │c │b │n │A . │ Reserved │ Comments / / │
│ │ │ │C,K│ │ │o │s │t │l . │ │ / / │
│ │ │ │Z,L│ │ │r │t │i │tS. │ │ / / │
│ │ │ │D,E│ │ │d │i │n │ e. │ │ / / │
│ │ │D │P,I│ │ │ │t │u │ q. │ │ / / │
│ │ │N │V,J│ │ │ │u │a │ . │ │ / / │
│ │ │O │U,R│ │ │ │t │t │ . │ │ / / │
│ │ │F │M,S│ │ │ │e │i │ . │ │ / / │
│ │F │S │H,T│ │ │ │ │o │ . │ │ / / │
│ │* │* │B │ │ │ │ │n │A . │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┼───┼──┬──┬──┬──┼──┬──┬──┬──┼──┼──┼──┼──.──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ 0│ 0│ 4│ F│ N│ E│ │ │ 1│ 1│ │ │ 2│ 6│ │ │ │ . │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ S│ E│ I│ -│ O│ N│ │ K│ A│ T│ A│ K│ A│ N│ A│ / / │
├──┼──┼──┼──┼──┼───┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤ . ├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ 0│ 0│ 5│ F│ N│ S│ │ │ │ 2│ │ │ │ 9│ │ │ │ . │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ S│ R│ T│ │ S│ E│ Q│ U│ E│ N│ C│ E│ │ │ │ / / │
└──┴──┴──┴──┴──┴───┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
The following describes the column entries that differ on the second control field.
The following describes the column entries that differ on the second control field.
Strokes: Characters can be ordered by the number of strokes used to draw the
character or by the total number of strokes.
Radical: Characters can be ordered into their respective radicals. Within each
radical set, the characters are ordered by strokes. Radical numbers can be user-
defined. The ADTS/400: Character Generator Utility, SC09-1769 contains a listing
of radical numbers.
DBCS Code Sequence: If all the sort criteria are the same for any two DBCS
characters in sequences 1 to 6 in Figure 33 on page 135, the characters will be
ordered based on their internal hexadecimal representation.
From To Explanation
1 10 Simplified Chinese field with SO and SI person’s name.
11 30 Simplified Chinese field with SO and SI department name.
31 64 Other information.
HEADER SPECIFICATIONS
1 2 73 74 75 76 77 78 79 80
Page ┌──┬──┐ Program ┌──┬──┬──┬──┬──┬──┬──┬──┐
│ │ │ Identification │ │ │ │ │ │ │ │ │
└──┴──┘ └──┴──┴──┴──┴──┴──┴──┴──┘
┌───────────┬─────────────────┬─────┬────────┬──┬────────────────────┬──┬──┬──┬────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │ │ R │ │ S│ │A │ R│O │ │ / / │
├────────┬──┤ Output Type │ e │Maximum │ e│ │l │ e│u │ │ / / │
│ │T │ │ s │Control │ q│ │tC│ s│t │ │ / / │
│ │y │ SORTR │ e │Field │ u│ │ o│ e│p │ │ / / │
│ Number │p │ SORTRS │ r │Length │ e│ Reserved │Sl│ r│u │ Reserved │ Comments / / │
│ │e │ SORTA │ v │ │ n│ │e │ v│t │ │ / / │
│ │ │ │ e │(1─256) │ c│ │q │ e│ │ │ / / │
│ │ │ │ d │ │ e│ │ │ d│ │ │ / / │
│ │H │ │ │ │A │ │S │ │ │ │ / / │
│ │* │ │ │ │D │ │F │ │X │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┬──┬──┬──┬──┬──┼──┬──┼──┬──┬──┼──┼──┬──┬──┬──┬──┬──┬──┼──┼──┼──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ 0│ 0│ 1│ H│ S│ O│ R│ T│ R│ │ │ │ │ │ 8│ │ │ │ │ │ │ │ │ │ │ X│ │ │ │ │ │ │ │ │ │ │ │ N│ O│ │ C│ O│ N│ T│ R│ O│ L│ │ F│ I│ E│ L│ D/ / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
┌───────────┬──┬──┬───────────────────────┬─────┬──┬───────────────────────────────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │C │D │ Factor 1 │Com- │F │B───────────────── Factor 2 Constant ───────────────────C│ / / │
├────────┬──┤o │a ├───────────┬───────────┤pari-│a │ • │ / / │
│ │T │n │t │ │ │son │c │B─── Factor 2 ───C• │ / / │
│ │y │t │aT│ │ │Oper-│t │ Keyword • │ / / │
│ Number │p │i │ y│ Start │ End │ator │o │ • │ Comments / / │
│ │e │n │ p│ Position │ Position │ │r │B────── Factor 2 ─────C• │ / / │
│ │ │u │ e│ │ │ │2 │ Field • │ / / │
│ │I │e │C │ │ │ │ │ • │ / / │
│ │O │ │Z │ │ │ │C │ Location • │ / / │
│ │* │A │D │ │ │EQ,NE│F │ │ • │ / / │
│ │ │O │P │ │ │LT,GT│K │ Start │ End • │ / / │
│ │ │* │U │ │ │LE,GE│S │ │ • │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┼──┼──┬──┬──┬──┼──┬──┬──┬──┼──┬──┼──┼──┬──┬──┬──┼──┬──┬──┬──•──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──│──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ 0│ 0│ 2│ I│ │ C│ │ │ 1│ 2│ │ │ 2│ 9│ E│ Q│ S│ O│ K│ K│ K│ K│ K│ K│ K- K│ K│ K│ K│ K│ K│ K│ K│ K│ K│ K│ I│ C│ O│ M│ P│ A│ R│ E│ │ 9│ │ C│ H│ A│ R│ s│ ./ / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
Strokes: Characters can be ordered by the number of strokes used to draw the
character or by the total number of strokes.
Radical: Characters can be ordered into their respective radicals. Within each
radical set, the characters are ordered by strokes. Radical numbers can be user
defined. For a listing of radical numbers, refer to the ADTS/400: Character Gener-
ator Utility, SC09-1769.
DBCS Code Sequence: If all of the sort criteria are the same for any two DBCS
characters in sequences 1 and 2 in Figure 34, the characters will be ordered based
on their internal hexadecimal representations.
From To Explanation
1 10 Traditional Chinese field with SO and SI person’s name.
11 30 Traditional Chinese field with SO and SI department name.
31 64 Other information.
HEADER SPECIFICATIONS
1 2 73 74 75 76 77 78 79 80
Page ┌──┬──┐ Program ┌──┬──┬──┬──┬──┬──┬──┬──┐
│ │ │ Identification │ │ │ │ │ │ │ │ │
└──┴──┘ └──┴──┴──┴──┴──┴──┴──┴──┘
┌───────────┬─────────────────┬─────┬────────┬──┬────────────────────┬──┬──┬──┬────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │ │ R │ │ S│ │A │ R│O │ │ / / │
├────────┬──┤ Output Type │ e │Maximum │ e│ │l │ e│u │ │ / / │
│ │T │ │ s │Control │ q│ │tC│ s│t │ │ / / │
│ │y │ SORTR │ e │Field │ u│ │ o│ e│p │ │ / / │
│ Number │p │ SORTRS │ r │Length │ e│ Reserved │Sl│ r│u │ Reserved │ Comments / / │
│ │e │ SORTA │ v │ │ n│ │e │ v│t │ │ / / │
│ │ │ │ e │(1─256) │ c│ │q │ e│ │ │ / / │
│ │ │ │ d │ │ e│ │ │ d│ │ │ / / │
│ │H │ │ │ │A │ │S │ │ │ │ / / │
│ │* │ │ │ │D │ │F │ │X │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┬──┬──┬──┬──┬──┼──┬──┼──┬──┬──┼──┼──┬──┬──┬──┬──┬──┬──┼──┼──┼──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ 0│ 0│ 1│ H│ S│ O│ R│ T│ R│ │ │ │ │ │ 8│ │ │ │ │ │ │ │ │ │ │ X│ │ │ │ │ │ │ │ │ │ │ │ N│ O│ │ C│ O│ N│ T│ R│ O│ L│ │ F│ I│ E│ L│ D/ / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
┌───────────┬──┬──┬───────────────────────┬─────┬──┬───────────────────────────────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │C │D │ Factor 1 │Com- │F │B───────────────── Factor 2 Constant ───────────────────C│ / / │
├────────┬──┤o │a ├───────────┬───────────┤pari-│a │ • │ / / │
│ │T │n │t │ │ │son │c │B─── Factor 2 ───C• │ / / │
│ │y │t │aT│ │ │Oper-│t │ Keyword • │ / / │
│ Number │p │i │ y│ Start │ End │ator │o │ • │ Comments / / │
│ │e │n │ p│ Position │ Position │ │r │B────── Factor 2 ─────C• │ / / │
│ │ │u │ e│ │ │ │2 │ Field • │ / / │
│ │I │e │C │ │ │ │ │ • │ / / │
│ │O │ │Z │ │ │ │C │ Location • │ / / │
│ │* │A │D │ │ │EQ,NE│F │ │ • │ / / │
│ │ │O │P │ │ │LT,GT│K │ Start │ End • │ / / │
│ │ │* │U │ │ │LE,GE│S │ │ • │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┼──┼──┬──┬──┬──┼──┬──┬──┬──┼──┬──┼──┼──┬──┬──┬──┼──┬──┬──┬──•──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──│──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ 0│ 0│ 2│ I│ │ C│ │ │ 1│ 2│ │ │ 2│ 9│ E│ Q│ S│ O│ K│ K│ K│ K│ K│ K│ K- K│ K│ K│ K│ K│ K│ K│ K│ K│ K│ K│ I│ C│ O│ M│ P│ A│ R│ E│ │ 9│ │ C│ H│ A│ R│ s│ ./ / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
For Korean DBCS characters, there is a DBCS active sort table but no DBCS
master sort table. The Data Management contains more information about these
tables.
Pronunciation: Characters can be ordered by the phonetic sound they have when
pronounced. Pronunciations can be either user-defined or defined by IBM. All
Hanja characters are equivalent in pronunciation to some Hangeul character;
however, a second pronunciation may be necessary if the character is at the start
of a word.
From To Explanation
1 10 Hangeul/Hanja field with shift-out and shift-in, person's
name.
11 14 Hangeul/Hanja field with shift-out and shift-in, sex.
17 72 Other information.
HEADER SPECIFICATIONS
1 2 73 74 75 76 77 78 79 80
Page ┌──┬──┐ Program ┌──┬──┬──┬──┬──┬──┬──┬──┐
│ │ │ Identification │ │ │ │ │ │ │ │ │
└──┴──┘ └──┴──┴──┴──┴──┴──┴──┴──┘
┌───────────┬─────────────────┬─────┬────────┬──┬────────────────────┬──┬──┬──┬────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │ │ R │ │ S│ │A │ R│O │ │ / / │
├────────┬──┤ Output Type │ e │Maximum │ e│ │l │ e│u │ │ / / │
│ │T │ │ s │Control │ q│ │tC│ s│t │ │ / / │
│ │y │ SORTR │ e │Field │ u│ │ o│ e│p │ │ / / │
│ Number │p │ SORTRS │ r │Length │ e│ Reserved │Sl│ r│u │ Reserved │ Comments / / │
│ │e │ SORTA │ v │ │ n│ │e │ v│t │ │ / / │
│ │ │ │ e │(1─256) │ c│ │q │ e│ │ │ / / │
│ │ │ │ d │ │ e│ │ │ d│ │ │ / / │
│ │H │ │ │ │A │ │S │ │ │ │ / / │
│ │* │ │ │ │D │ │F │ │X │ │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┬──┬──┬──┬──┬──┼──┬──┼──┬──┬──┼──┼──┬──┬──┬──┬──┬──┬──┼──┼──┼──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ 0│ 0│ 1│ H│ S│ O│ R│ T│ R│ │ │ │ │ │ 8│ │ │ │ │ │ │ │ │ │ │ X│ │ │ │ │ │ │ │ │ │ │ │ N│ O│ │ C│ O│ N│ T│ R│ O│ L│ │ F│ I│ E│ L│ D/ / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
┌───────────┬──┬──┬───────────────────────┬─────┬──┬───────────────────────────────────────────────────────────┬───────────────────────────────────────────────/ /──┐
│ Statement │C │D │ Factor 1 │Com- │F │B───────────────── Factor 2 Constant ───────────────────C│ / / │
├────────┬──┤o │a ├───────────┬───────────┤pari-│a │ • │ / / │
│ │T │n │t │ │ │son │c │B─── Factor 2 ───C• │ / / │
│ │y │t │aT│ │ │Oper-│t │ Keyword • │ / / │
│ Number │p │i │ y│ Start │ End │ator │o │ • │ Comments / / │
│ │e │n │ p│ Position │ Position │ │r │B────── Factor 2 ─────C• │ / / │
│ │ │u │ e│ │ │ │2 │ Field • │ / / │
│ │I │e │C │ │ │ │ │ • │ / / │
│ │O │ │Z │ │ │ │C │ Location • │ / / │
│ │* │A │D │ │ │EQ,NE│F │ │ • │ / / │
│ │ │O │P │ │ │LT,GT│K │ Start │ End • │ / / │
│ │ │* │U │ │ │LE,GE│S │ │ • │ / / │
│ 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 37 38 39│40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55/ /72│
├──┬──┬──┼──┼──┼──┼──┬──┬──┬──┼──┬──┬──┬──┼──┬──┼──┼──┬──┬──┬──┼──┬──┬──┬──•──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──│──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──/ /──┤
│ 0│ 0│ 2│ I│ │ C│ │ │ 1│ 2│ │ │ 1│ 3│ E│ Q│ S│ O│ D│ B│ I│ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ C│ O│ M│ P│ A│ R│ E│ │ 1│ │ C│ H│ A│ R│ .│ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──•──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──/ /──┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ / / │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──/ /──┘
control field. A field that identifies a record's relation- force-all. A specification that tests if the control field in
ship to other records (such as a part number in an the input record contains a particular entry. If it does
inventory record). Control fields determine the order of not, the control field character is replaced before the
records in the sorted file. record is sorted.
DBCS. See double-byte character set (DBCS). forced character substitution. The substitution of
one character of the control field by another for sorting
DBCS code. The hexadecimal code, 2 bytes in length, purposes.
that identifies a double-byte character.
forced control field. A one-position control field that
DBCS font file. A system-supplied file that holds the results from replacing one character with another, or
24x24 character images of one of the following groups from forcing a character into a control field position.
of commonly used characters: 1) Japanese non-Kanji
and basic-Kanji, 2) Korean non-Hangeul/non-Hanja, Hangeul. A written language of Korea. Each Hangeul
Hangeul, and a subset of Hanja, 3) Traditional Chinese character is composed of two to six Jamo characters.
non-Chinese and a subset of Traditional primary
Chinese characters, or 4) all IBM-defined Simplified Hanja. Chinese characters used in Korean written lan-
Chinese characters. guage.
DBCS font table. A system-supplied table that holds Hiragana. A native Japanese character set used
either 24x24 or 32x32 character images of a double- mainly to express the pronunciation of native Japanese
byte character set. Japanese 24x24 font table holds words. Contrast with Katakana.
Japanese extended-Kanji character set. A subset of overflow field. A field that allows for field expansion.
Japanese DBCS, consisting of less commonly used
Kanji characters. There are 3 487 characters in this overflow indicator field. The one-character field into
set. which the overflow character is placed.
Japanese double-byte character set. An IBM-defined packed decimal format. A format in which each byte
double-byte character set for Japanese consisting of the (except the rightmost byte) within a field represents two
Japanese non-Kanji set, basic Kanji set, extended Kanji numeric digits. The rightmost byte contains one digit
set, and up to 4 370 user-definable characters. and the sign. For example, the decimal value +123 is
represented as 0001 0010 0011 1111. Contrast with
Japanese non-Kanji character set. A subset of the zoned decimal format.
Japanese DBCS, consisting of non-Kanji characters like
Greek, Russian, Roman numeric, alphanumeric and record address file. A physical file that contains
related symbols, Katakana, Hiragana, and special 4-byte binary relative record numbers rather than data.
symbols. There are 550 characters in this set.
set. A grouping of one or more record specifications.
Kanji. Chinese characters used in Japanese written
language. shift-in character. A control character (hex 0F) that
indicates the end of a string of double-byte characters.
Katakana. A native Japanese character set that is Contrast with shift-out character.
used to write foreign words phonetically in Japanese.
Contrast with Hiragana. shift-out character. A control character (hex 0E) that
indicates the start of a string of double-byte characters.
Korean double-byte character set. An IBM-defined Contrast with shift-in character.
double-byte character set for Korean, consisting of
Korean non-Hangeul/non-Hanja set, Hangeul set, Hanja Simplified Chinese. The Chinese character set that
set and up to 1 880 user-definable characters. has been simplified by reducing the number of strokes
in common characters and deleting complicated vari-
Korean Hangeul character set. A subset of the ants. Simplified Chinese characters are used primarily
Korean DBCS, consisting of 2 369 Hangeul characters in the People's Republic of China.
and 52 Jamo characters.
Simplified Chinese double-byte character set. An
Korean Hanja character set. A subset of the Korean IBM-defined double-byte character set for Simplified
DBCS, consisting of 4 500 Hanja characters. Chinese. It consists of Simplified Chinese non-Chinese
set, primary set, secondary set, and up to
Korean non-Hangeul/non-Hanja character set. A 1 880 user-definable characters.
subset of the Korean DBCS, consisting of non-
Hangeul/non-Hanja characters, such as Greek, Russian, Simplified Chinese non-Chinese character set. A
Roman numeric, alphanumeric and related symbols, subset of the Simplified Chinese DBCS, consisting of
Katakana, Hiragana, and special symbols. There are non-Chinese characters, such as Latin alphabet, Greek,
398 characters in this set. Russian, Roman numeric, alphanumeric and related
symbols, Katakana, Hiragana, Japanese, special
master sort table. A system-supplied table that con- symbols, and Chinese phonetic symbols. There are
tains sort information required for sorting double-byte 712 characters in this set.
characters. This table is maintained by the character
generator utility function of the Application Development Simplified Chinese primary character set. A subset
Tools licensed program. of the Simplified Chinese DBCS, consisting of com-
monly used Chinese characters. There are 3 755 char-
normal control field. A control field that is sorted in acters in this set.
the sequence specified in the header specification.
specification sheets. Forms on which a program is unconditional force. A specification that always
coded and described. results in a character being forced into the control field
before the records are sorted.
summary data field. A data field designated for accu-
mulated totals. work area. An area in storage reserved for temporary
storage of data that is being resequenced.
Traditional Chinese. The Chinese character set
expressed in traditional form. Traditional Chinese char- work file. A file that is used for temporary storage of
acters are used in Taiwan, Hong Kong, and some other data being processed.
parts of the world.
work record. A record built by the Sort program for
Traditional Chinese double-byte character set. An later processing.
IBM-defined double-byte character set for Traditional
Chinese, consisting of the traditional Chinese non- zoned decimal format. A format for representing
Chinese set, primary set, secondary set, and up to numbers in which the digit is contained in bits 4 through
2 632 user-definable characters. 7 and the sign is contained in bits 0 through 3 of the
rightmost byte; bits 0 through 3 of all other bytes
Traditional Chinese non-Chinese character set. A contain 1s (hexadecimal F). For example, in zoned
subset of the Traditional Chinese DBCS, consisting of decimal format, the decimal value of +123 is repres-
non-Chinese characters, such as Greek, Russian, ented as 1111 0001 1111 0010 1111 0011. Contrast
Roman numeric, alphanumeric and related symbols, with packed decimal format.
Katakana, Hiragana, special symbols, and Chinese pho-
netic symbols. There are 675 characters in this set. zoned field. A field that contains data in the zoned
decimal format.
Traditional Chinese primary character set. A subset
of the Traditional Chinese DBCS, consisting of com-
Glossary 151
152 Sort User's Guide and Reference
Index
alternative collating sequence (continued)
Special Characters how to specify 120
*, as overflow character 48
introduction 117
*CHK option, FMTDTA command 78
limitation of System/38 Conversion Reformat
*CURLIB 75
Utility 115
*CURRENT option 79
specifying on header specification 82, 111
*DATE option 79
ALTSEQ specifications
*DUMP option 78
as a type of sort specification 5
*FIRST, member name 76
for entire control field 121
*LIBL 76
for part of control field 121
*NOCHK option, FMTDTA command 78
how to code 122
*NODUMP option 78
how to define 120
*NOPRT option 78
AND specifications
*NOSECLVL option 78
continuation of preceding statement 89
*PRT option, FMTDTA command 78
field specifications 38
*SECLVL 15
record specification 28, 89
option of FMTDTA command 78
arrival sequence 41
*SRC filetype 11
ascending key sequence, definition 149
attributes of output file 11
A authority 11
access restrictions 10, 12 automatic updating in RA files 42
accumulated totals auxiliary storage
example of 48 output file 13
overflow 108 sort requests 13
active sort table
brief description 125
coding considerations
B
begin/continue record definition, record specifica-
field specifications 128
tion 89
header specifications 126
bibliography 147
record specifications 127
binary representation
definition 149
definition 149
adding data field, summary sort 102
of characters 93
adding records, RA files 42
of signs 94
address file, record, definition 150
blank record specifications 89
alarm 16
blanks
alphanumeric
padding the output record 7
constants, Factor 2 field 96
blinking cursor 16
data, interpretation of 92
building the control field 8
fields 91
building the output record 7
ALTCOLLSEQ column, header specification 120
byte strings 8
alternative collating sequence
advantage over System/38 Conversion
Reformat Utility 115 C
by field 109 CGU (Character Generator Utility), definition 149
definition 149 changing
for individual fields 84 contents of control field 102
header specification 84, 120 input records 8
Index 155
defaults EBCDIC collating sequence (continued)
normal control fields 102 standard collating sequence 118
using all input records 89 zone portion comparison 119
deleting records, RA files 42 entering 4
device file comments 5
as input file 11 specifications 3
diskette 12 error
multiple input 41 Error Reset key 16
printer 77 messages 78
QSYSPRT 77 missing file 11
single input 41 exception condition, RA files 42
diagnostic message, System/36 Sort Utility 113 exclude input records 87
digit 91
digit portion
EBCDIC 117
F
Factor 1
of character byte 91
end position, record specification 95
diskette files 76, 77
field length 92, 95
diskette unit file 12
field, record specification 87
diskettes 10
fields, alternative collating sequence 121
disks 10
length restrictions 95
display parameters 77
start position, record specification 95
displaying messages 15
Factor 2
documenting the job 111
1-character long 96
double-byte character set
alphanumeric constants 96
character-type 135, 139
as a keyword, record specification 97
character-type sequence 130
comparisons to packed numeric fields 96
code sequence
comparisons to zoned numeric fields 96
Japanese 130
constant 96
Simplified Chinese 136
end position, record specification 96
Traditional Chinese 139
field length 92, 96
code, definition 149
field, record specification 87
definition 149
fields, alternative collating sequence 121
font file, definition 149
length considerations 96
number, definition 149
length restrictions 96
pronunciation 142
numeric constants 97
radical 129, 135, 139
signed constants 97
Sei-On Katakana sequence 130
start position, record specification 96
single-pronunciation 135
UDATE keyword 97
single-pronunciation sequence 129
UDAY keyword 97
sorting 125
UMONTH keyword 97
strokes 129, 135, 139
UYEAR keyword 97
strokes beyond radical 135, 139
field length
tie-breaker 136
Factor 1, restrictions on 95
tie-breaker sequence 130
Factor 1/Factor 2 92
DSPMSGD, CL command 15
restrictions
on field statement 107
E specifying
EBCDIC collating sequence Factor 1 95
description 117 Factor 2 96
digit portion comparison 120 on field statement 107
Index 157
forced control field (continued) include (record) specifications 89
unconditional 104 include input records 87
forced field, unconditional 104 include set, definition 150
form include-all specifications 68
field specification, sample 99 include/exclude control field, header
format specification 84
date, international 98 including input records 89
input and output record 12 indicator field, overflow, definition 150
unpacked, numeric fields 91 indicator, summary overflow, field
Format Data (FMTDTA) CL command specification 108
See FMTDTA (Format Data) CL command input fields, start/end positions 8
format description 12 input file name 75
format of numeric fields input files 10
packed 91 device file 11
zoned 91 processing 11
format, unpacked 19 same as output file 12
security 10
sequential processing of 11
G single 17
graphic symbol, printable 123
used by several programs simultaneously 12
input library name 75
H input member name 75
Hangeul, definition 149, 150 input record
Hanja, definition 149, 150 accessibility 9
header specification 5, 81 changing 8
alternative collating sequence 84, 120 format 12
column entries 82 include/exclude 87
column summary 82, 111 including 89
comments 85 input field, location of 107
differences from System/36 Sort Utility 113 length 11
file-name 85 omitting 89
include/exclude control field 84 type 7
maximum control field length 83 inserting characters into sort sequence 122
output file type 83 interactive entry of specifications 4
page 83 internal tables 78
sort sequence 84 international date format 98
SORTA entry 83 interpreting alphanumeric data 92
SORTR entry 83 interpreting numeric data 93
SORTRS entry 83 interpreting the sign of a number 94
specification identifier 83
statement number 83
Help key 16
J
Jamo, definition 150
Hiragama, definition 149
Japanese character set, Kanji, definition 150
Japanese double-byte character set,
I definition 150
identifier Japanese double-byte character sets
comment specification 111 character sequences 129
specification, field specification 101 character-type 130
DBCS code sequence 130
radical 129
Sei-On Katakana sequence 130
Index 159
order of field specifications in source file 99
N order of fields, 99
name
order of specifications 2, 78
file 85
ordering specifications 6
names of output file and member 12
output file 11, 150
naming
header specification 83
conventions 73
physical 17, 35, 67
file 73
record address 41
negative constants, coding of 97
record length 11
nonkeyed logical file 11
same as input file 12
normal control field 102
storage 13
field specification 101, 102
type 83
normal control field, definition 150
output file parameter
number 91
FMTDTA command 76
interpreting the sign of 94
output record
sequence, field specification 101
building of 7
signed 94
creation 10
number of records in work area 13
exceeding maximum length for 109
number of records, copy-only requests 13
format 12
numeric constants, Factor 2 field 97
length, print file 12
numeric data
order of fields 7
interpreting 93
padding with blanks 7, 102
signed 92
type 7
numeric fields 91
output, redirecting 12
packed format 91
overflow
zoned format 91
field 48
field length 109
O handling overflow 48
omit (record) specifications 89 indicator 48, 64
omit specifications 68 indicator, field specification 108
omitting input records 89 overflow field, definition 150
opposite control field 102, 150 overflow indicator field definition 150
field specification 102 overflow indicator, definition 150
output option 106 overriding defaults 11
opposite control field, definition 150 source file 12
opposite sorting 29
optional attributes of output file 11
optional specifications 6
P
packed
OPTIONS
control field 106
*CHK 78
numeric fields 91
*DUMP 78
zoned numbers, sign placement 94
*NOCHK 78
packed decimal format, definition 150
*NOPRT 78
padding
*NOSECLVL 78
output records with blanks 102
*SECLVL 78
padding with zeros 4
keyword value
with blanks 7
options parameter 78
parameters, FMTDTA command 8, 75
OR a record specification 90
physical file
OR extension 108
as output 17, 35, 67
to forced field 108
multiple input 35
Index 161
record specifications, input record type 7 sequence checking 78, 101
record specifications, purpose of 6 record specifications 89
record type 6, 7, 87 sequence number
beginning a new 7 description 101
defining 6 field specification 101
input 7 header specification 83
order of fields within 99 record specification 89, 101
output 7 sequence, alternative by field 109
specifying different 87 sequence, collating, alternative, definition 149
records 1 sequence, collating, definition 149
format considerations 12 sequence, key, ascending, definition 149
input, include/exclude 87 sequencing specifications 6
input, including 89 sequential processing of input files 11
input, location of input field 107 sequential reading 41
input, omitting 89 service information
limitations on number of set of record specifications 87
copy request 13 set, definition 150
sort request 13 SEU 4
number in work area 13 shared-read lock 10
output, exceeding maximum length for 109 shared-update lock 12
output, padding with blanks 102 shift-in character, definition 150
Sort treatment of 87 shift-out character, definition 150
redirecting output 12 signed constants, Factor 2 field 97
reformatting 1, 7 signed numeric data 92
related printed information 147 signs
relative record number 41 binary representation of 94
restricting access 10 placement in packed and zoned numbers 94
restricting file access 12 Simplified Chinese double-byte character set, defi-
restrictions on Factor 1 field length 95 nition 150
restrictions, Factor/Factor2 field length 92 Simplified Chinese double-byte character sets
return code after processing 14 character-type 135
right justification 4 DBCS code sequence 136
RTVJOBA command 14 radical 135
running the sort job 75 single-pronunciation 135
strokes 135
strokes beyond radical 135
S tie-breaker 136
saving space in memory 102
Simplified Chinese, definition 150
screen displays
single-pronunciation sequence, Japanese 129
first FMTDTA prompt display 74
single-pronunciation, Simplified Chinese 135
messages 14
sort order, overriding 84
second FMTDTA prompt display 75
sort process
second-level messages 78
how to use 2—3
security 11
maximization 9
Sei-On Katakana sequence, Japanese 130
sort requests, storage 13
select and rearrange fields 1
sort sequence
selection criteria 9
header specification 84
sequence
making characters equal 123
arrival 41
sort table
key 41
Index 163
speed of processing 11 totals 104
standard collating sequence 117 tracking problems 14
start/end positions in input records 8 Traditional Chinese double-byte character sets
status message, System/36 Sort Utility 113 character-type 139
status of job 14 DBCS code sequence 139
storage radical 139
auxiliary 13 strokes 139
sort requests 13 strokes beyond radical 139
storing specifications 5 Traditional Chinese, definition 151
strings of bytes 8 truncation of output record 11
strokes beyond radical, Simplified Chinese 135 type
strokes beyond radical, Traditional Chinese 139 data, field specification 104
strokes sequence, Japanese 129 field, field specification 101
strokes, Simplified Chinese 135 record 87
strokes, Traditional Chinese 139 type of Factor 2 data, record specification 96
STRSEU, CL commands 4
substitution character, field specification 108
substitution of characters in output record 36
U
UDATE keyword
substitution of characters, forced, definition 149
Factor 1 field 95
summary data field 48, 102, 104
Factor 2 field 97
description 47
UDAY keyword, Factor 2 field 97
increasing size of 48
UMONTH keyword
overflow 48
Factor 1 field 95
summary data field, definition 151
Factor 2 field 97
summary overflow indicator, field
unconditional control field 102
specification 108
unconditional force
summary sort 47, 48, 83
description 104
summing 47
unconditional force, definition 151
summing and sorting
unconditional forced control field 104
detecting overflow 64
unconditionally forced character
two input record types 54
unique control field value, summary sort 48
using an overflow field 63
unpacked format 19
syntax checking, System/36 Sort Utility 113
updating, automatic 42
syntax of FMTDTA command 74
useful things to know 10—14
system data description 11
using all input records, default 89
system printer 12, 77
UYEAR keyword
system security 11
Factor 1 field 95
Factor 2 field 97
T
table, active sort, definition 149
tables
W
warning messages 78
generation of 13
work area 9, 10, 12, 151
internal 78
automatic deletion of 10
temporary work library 12
copy-only requests 10
testing for overflow indicator 64
description 12
tie-breaker, Japanese 130
number of records 13
tie-breaker, Simplified Chinese 136
work area, definition 151
total, overflow 108
Z
zone portion
EBCDIC 117
of character byte 91
zoned decimal format, definition 151
zoned field, definition 151
zoned format, numeric fields 91
Index 165
SC09-1826-00