Sort File Control Description

The FCD used by the Callable Sort Module has the following fields in addition to, or overriding, the FCD used by the File Handler:
Field name Size Description of the field
fcd-use-files 1 Number of USING files involved in the sort operation (this can be zero)
fcd-give-files 1 Number of GIVING files involved in the sort operation (this can be zero)
fcd-col-seq-address 4 Pointer to the collating sequence (null if none used)
fcd-fildef-address 4 Pointer to the file definition block that defines the USING and GIVING files.

The key definition block is used to describe the structure of the key to be used in the sort operation. There is a pointer to this block in fcd-key-def-address in the Sort FCD.

For full details of the key definition block see the section Key Definition Block in the chapter File Handler and Sort APIs in your File Handling book .

For sort operations, only one key is allowed, although this key can have many components. Each of these components can be either ascending or descending and can have one of many different numeric formats. The first two bytes of the component definition area are used as follows:
Byte 0
Size: 1
bit 7 (x"80") indicates duplicates to be returned in order
bit 6 (x"40") indicates DESCENDING key
bit 1 (x"02") indicates that SIGN is in EBCDIC format
bit 0 (x"01") indicates that the data is in EBCDIC format
Byte 1
Size: 1
bit 7 (x"80")
indicates that the field is NUMERIC. If bit 7 is set:
bit 6 (x"40")
indicates that the field is SIGNED NUMERIC
bit 5 (x"20")
indicates that the field is a non-display field. If bit 5 is set:
bits 0 and 1
0 indicates that the field is BINARY
1 indicates that the field is PACKED-DECIMAL
2 indicates that the field is COMP-X format
3 indicates that the field is COMP-5 format
If bit 5 is not set (DISPLAY field) but bit 6 is set (SIGNED):
bits 0 and 1
0 indicates SIGN TRAILING INCLUDED
1 indicates SIGN TRAILING SEPARATE
2 indicates SIGN LEADING INCLUDED
3 indicates SIGN LEADING SEPARATE
bit 2 (value x"04")
indicates floating point
If bit 7 is not set:
Bit 1
set if the collating sequence specified in the FCD is to be applied to this field.

The file definition block is a table of pointers to the FCDs for each of the USING and GIVING files involved in the sort operation. The fcd-fildef-address field in the Sort FCD is a pointer to this area. The length of the file definition block is four times the total of the contents of the fields at offsets 52 and 53.