|
.-,-------.
V |
>>-SORT--FIELDS=--+-(----p,m,f,s-+--)----------------------+---->
| .-,---------------. |
| V | |
+-(----p,m,--+----+--s-+--)--,--FORMAT=f-+
| '-f,-' |
'-COPY-----------------------------------'
>--+-------------------------------------+---------------------><
| .-,-----------------------------. |
| V | |
'-,---+-CKPT----------------------+-+-'
+-DYNALLOC--+-------------+-+
| '-=-+-d-----+-' |
| +-(,n)--+ |
| +-(d,n)-+ |
| '-OFF---' |
+-+-EQUALS---+--------------+
| '-NOEQUALS-' |
+-+-FILSZ=--+-x--+-+--------+
| | +-Ex-+ | |
| | '-Ux-' | |
| '-SIZE=--+-y--+--' |
| +-Ey-+ |
| '-Uy-' |
+-SKIPREC=z-----------------+
+-STOPAFT=n-----------------+
'-Y2PAST=--+-s-+------------'
'-f-'
The SORT control statement must be used when a sorting application
is performed; this statement describes the control fields in the input
records on which the program sorts. A SORT statement can also be used
to specify a copy application. User labels will not be copied to the
output data sets.
The way in which DFSORT processes short SORT control fields depends
on the setting for VLSHRT/NOVLSHRT. A short field is one where the
variable-length record is too short to contain the entire field, that
is, the field extends beyond the record. For details about sorting
short records, see the discussion of the VLSHRT and NOVLSHRT options
in OPTION control statement.
The options available on the SORT statement can be specified in
other sources as well. A table showing all possible sources for these
options and the order of override is given in Specification/override of DFSORT options.
When an option can be specified on either the SORT or OPTION statement,
it is preferable to specify it on the OPTION statement.
DFSORT accepts but does not process the following SORT operands:
WORK=value and ORDER=value.
DFSORT's collating behavior can be modified according to your cultural
environment. The cultural environment is established by selecting
the active locale. The active locale's collating rules affect SORT
processing as follows: - DFSORT produces sorted records for output according to the collating
rules defined in the active locale. This provides sorting for single-
or multi-byte character data, based on defined collating rules that
retain the cultural and local characteristics of a language.
If locale processing is to be used, the active locale will only
be used to process character (CH) control fields.
For more information on locale processing, see Cultural environment considerations or LOCALE in OPTION control statement.
- FIELDS
.-,-------.
V |
>>-FIELDS=(----p,m,f,s-+--)------------------------------------><
Requires four facts
about each control field in the input records: the position of the
field within the record, the length of the field, the format of the
data in the field, and the sequence into which the field is to be
sorted. These facts are communicated to DFSORT by the values of the
FIELDS operand, represented by p, m, f, and s.
The value for
f can optionally be specified by the FORMAT=f parameter as explained
later in this section.
All
control fields must be located within the first 32752 bytes of a record.
The maximum length of the collected control fields for
which Blockset can be used is 4088 bytes. However, the maximum length
can be less than 4088 for various situations, such as the use of certain
formats (for example, PD), the EQUALS option, and so on. If this maximum
is exceeded, Blockset cannot be used.
The FIELDS operand can
be written in two ways.
The program examines the major control
field first, and it must be specified first. The minor control fields
are specified following the major control field. p, m, f, and s describe
the control fields. The text that follows gives specifications in
detail.
- p
- specifies the first byte of a control field relative to the beginning
of the input record. 1
The
first data byte of a fixed-length record has relative position 1.
The first data byte of a variable-length record has relative position
5. The first 4 bytes contain the record descriptor word. All control
fields, except binary, must begin on a byte boundary. The first byte
of a floating-point field is interpreted as a signed exponent; the
rest of the field is interpreted as the fraction.
Fields containing
binary values are described in a "bytes.bits" notation as follows: - First, specify the byte location relative to the beginning of
the record and follow it with a period.
- Then, specify the bit location relative to the beginning of that
byte. Remember that the first (high-order) bit of a byte is bit 0
(not bit 1); the remaining bits are numbered 1 through 7.
Thus, 1.0 represents the beginning of a record. A binary
field beginning on the third bit of the third byte of a record is
represented as 3.2. When the beginning of a binary field falls on
a byte boundary (say, for example, on the fourth byte), you can write
it in one of three ways: 4.0
4.
4
Other examples of this notation are shown
in Figure 1:
Figure 1. Examples of Notation for
Binary Fields
- m
- specifies the length of the control field. Values for all control
fields except binary fields must be expressed in integer numbers of
bytes. Binary fields can be expressed in the notation “bytes.bits”.
The length of a binary control field that is an integer value (d)
can be expressed in one of three ways:
d.0
d.
d
The number of bits specified must not exceed 7.
A control field 2 bits long would be represented as 0.2.
The
total number of bytes occupied by all control fields must not exceed
4092 (or, when the EQUALS option is in operation, 4088 bytes). When
you determine the total, count a binary field as occupying an entire
byte if it occupies any part of it. For example, a binary field that
begins on byte 2.6 and is 3 bits long occupies two bytes. All fields
must be completely contained within the first 32752 bytes of the record.
- f
- specifies the format of the data in the control field. Acceptable
control field lengths (in bytes) and available formats are shown in Table 1.
Table 1. Control Field Formats and LengthsControl Field Formats
and LengthsFormat
|
Length |
Description |
---|
CH |
1 to 4092 bytes |
Character 2 |
AQ |
1 to 4092 bytes |
Character with alternate collating
sequence |
ZD |
1 to 256 bytes |
Signed zoned decimal |
PD |
1 to 256 bytes |
Signed packed decimal |
PD0 |
2 to 8 bytes |
Packed decimal with sign and first
digit ignored |
FI |
1 to 256 bytes |
Signed fixed-point |
BI |
1 bit to 4092 bytes |
Unsigned binary |
FL |
1 to 256 bytes |
Signed hexadecimal floating-point |
AC |
1 to 4092 bytes |
ASCII character |
CSF or FS |
1 to 32 bytes |
Signed numeric with optional leading
floating sign |
UFF |
1 to 44 bytes |
Unsigned free form numeric |
SFF |
1 to 44 bytes |
Signed free form numeric |
CSL or LS |
2 to 256 bytes |
Signed numeric with leading separate
sign |
CST or TS |
2 to 256 bytes |
Signed numeric with trailing separate
sign |
CLO or OL |
1 to 256 bytes |
Signed numeric with leading overpunch
sign |
CTO or OT |
1 to 256 bytes |
Signed numeric with trailing overpunch
sign |
ASL |
2 to 256 bytes |
Signed ASCII numeric with leading
separate sign |
AST |
2 to 256 bytes |
Signed ASCII numeric with trailing
separate sign |
D1 |
1 to 4092 bytes |
User-defined data type (requires
an EFS program) |
Y2T |
3 to 6 bytes |
Character or zoned yyx...x full date
format with special indicators |
Y2U |
2 or 3 bytes |
Packed decimal yyx and yyxxx full
date format with special indicators |
Y2V |
3 or 4 bytes |
Packed decimal yyxx and yyxxxx full
date format with special indicators |
Y2W |
3 to 6 bytes |
Character or zoned x...xyy full date
format with special indicators |
Y2X |
2 or 3 bytes |
Packed decimal xyy and xxxyy full
date format with special indicators |
Y2Y |
3 or 4 bytes |
Packed decimal xxyy and xxxxyy full
date format with special indicators |
Y2C or Y2Z |
2 bytes |
Two-digit character or zoned-decimal
year data |
Y2P |
2 bytes |
Two-digit packed-decimal year data |
Y2D |
1 byte |
Two-digit decimal year data |
Y2S |
2 bytes |
Two-digit character or zoned-decimal
year data with special indicators |
Y2B |
1 byte |
Two-digit binary year data |
|
CSF, FS, UFF, SFF, Y2 and PD0 format fields can only be
used if Blockset is selected.
For Y2 format fields, real dates
are collated using the century window established by the Y2PAST option
in effect, but the century window is not used for special indicators.
Thus the Y2 formats will collate real dates and special indicators
as follows: - Y2T and Y2W:
- Ascending:
- BI zeros, blanks, CH/ZD zeros, lower century dates (for example,
19yy), upper century dates (for example, 20yy), CH/ZD nines, BI ones.
- Descending:
- BI ones, CH/ZD nines, upper century dates (for example, 20yy),
lower century dates (for example, 19yy), CH/ZD zeros, blanks, BI zeros.
- Y2U, Y2V, Y2X and Y2Y:
- Ascending:
- PD zeros, lower century dates (for example, 19yy), upper century
dates (for example, 20yy), PD nines.
- Descending:
- PD nines, upper century dates (for example, 20yy), lower century
dates (for example, 19yy), PD zeros.
- Y2C, Y2Z, Y2P, Y2D and Y2B:
- Ascending:
- Lower century years (for example, 19yy), upper century years (for
example, 20yy).
- Descending:
- Upper century years (for example, 20yy), lower century years
(for example, 19yy).
- Y2S:
- Ascending:
- BI zeros, blanks, lower century years (for example, 19yy), upper
century years (for example, 20yy), BI ones.
- Descending:
- BI ones, upper century years (for example, 20yy), lower century
years (for example, 19yy), blanks, BI zeros.
The AC format sequences EBCDIC data using
the ASCII collating sequence shown in Appendix
D. For example, if AC is used with ascending sequence, the EBCDIC
numbers (0-9) will collate before the EBCDIC uppercase letters (A-Z)
which in turn will collate before the EBCDIC lowercase letters (a-z).
You
can use p,m,s rather than p,m,f,s if you use FORMAT=f to supply the
format for the field, as described later in this section.
All floating-point data must be normalized before
the program can collate it properly. You can use an E15 or E61 user
exit to do this during processing. If you use E61, specify the E
option for the value of s in the FIELDS operand for each control field
you are going to modify with this user exit.
- s
- specifies how the control field is to be ordered. The valid codes
are:
- A
- ascending order
- D
- descending order
- E
- control fields to be modified
Specify E if you include an E61 user exit to modify
control fields before the program sorts them. After an E61 user exit
modifies the control fields, DFSORT collates the records in ascending
order using the formats specified. 3
For information on how to add a user exit, see Using your own user exit routines.
Default: None; must be specified.
See Specification/override of DFSORT options for full override details.
Applicable
Functions: See Specification/override of DFSORT options.
- FORMAT
>>-FORMAT=f----------------------------------------------------><
FORMAT=f can be used to specify a particular format
for one or more control fields. f from FORMAT=f is used for p,m,s
fields. f from FORMAT=f is ignored for p,m,f,s fields. For example,
the following are all equivalent: SORT FIELDS=(5,5,ZD,A,12,6,PD,D,21,3,PD,A,35,7,ZD,A)
SORT FORMAT=ZD,FIELDS=(5,5,A,12,6,PD,D,21,3,PD,A,35,7,A)
SORT FIELDS=(5,5,ZD,A,12,6,D,21,3,A,35,7,ZD,A),FORMAT=PD
The
permissible field formats are shown under the description of 'f' for
fields.
If you have specified the COPY operand, FORMAT=f cannot
be specified.
Default: None; FORMAT=f must be specified
if any field is specified as p,m,s rather than p,m,f,s. See Specification/override of DFSORT options for full override details.
Applicable
Functions: See Specification/override of DFSORT options.
Note: DFSORT
issues an informational message and ignores FORMAT=f if all of the
fields are specified as p,m,f,s.
- FIELDS=COPY
>>-FIELDS=COPY-------------------------------------------------><
See the discussion of the COPY option discussed
in OPTION control statement.
- CKPT
>>-CKPT--------------------------------------------------------><
See the discussion of this option discussed in OPTION control statement.
- DYNALLOC
>>-DYNALLOC--+-------------+-----------------------------------><
'-=-+-d-----+-'
+-(,n)--+
+-(d,n)-+
'-OFF---'
See the discussion of this option in OPTION control statement.
- EQUALS or NOEQUALS
>>-+-EQUALS---+------------------------------------------------><
'-NOEQUALS-'
See the discussion of these options in OPTION control statement.
- FILSZ or SIZE
>>-+-FILSZ=--+-x--+-+------------------------------------------><
| +-Ex-+ |
| '-Ux-' |
'-SIZE=--+-y--+--'
+-Ey-+
'-Uy-'
See the discussion of these options in OPTION control statement.
- SKIPREC
>>-SKIPREC=z---------------------------------------------------><
See the discussion of this option in OPTION control statement.
- STOPAFT
>>-STOPAFT=n---------------------------------------------------><
See the discussion of this option in OPTION control statement.
- Y2PAST
>>-Y2PAST=--+-s-+----------------------------------------------><
'-f-'
See the discussion of this option in OPTION control statement.
Note: CENTURY=value and CENTWIN=value
can be used instead of Y2PAST=value.
1 If
INREC is specified, p must refer to the record as reformatted by INREC.
If your E15 user exit reformats the record, and INREC is not specified,
p must refer to the record as reformatted by your E15 user exit. 2 If CHALT
is in effect, CH is treated as AQ. 3 With a conventional merge or a tape work data set sort,
control fields for which E is specified are treated as binary byte
format regardless of the actual formats specified.
|