Specifying Non-Ascii Collating Sequences With The Collating; Sequence Is Alphabet-Name Phrase; Multiple Sorting; Overriding The Collating Sequence Is Phrase - Compaq COBOL AAQ2G1FTK User Manual

Compaq computer accessories user manual
Table of Contents

Advertisement

In contrast, the WITH DUPLICATES IN ORDER phrase guarantees that records
with duplicate sort keys remain in the same sequence as they were in the input
file.

9.1.6 Specifying Non-ASCII Collating Sequences with the COLLATING

SEQUENCE IS Alphabet-Name Phrase

This phrase lets you specify a collating sequence other than the ASCII default.
You define collating sequences in the Environment Division SPECIAL-NAMES
paragraph. A sequence specified in the COLLATING SEQUENCE IS phrase of
the SORT statement overrides a sequence specified in the Environment Division
PROGRAM COLLATING SEQUENCE IS phrase.
Example 9–3 shows the alphabet name NEWSEQUENCE overriding the
EBCDIC-CODE collating sequence.
Example 9–3 Overriding the COLLATING SEQUENCE IS Phrase
ENVIRONMENT DIVISION.
OBJECT-COMPUTER. FOO
PROGRAM COLLATING SEQUENCE IS EBCDIC-CODE.
SPECIAL-NAMES.
ALPHABET NEWSEQUENCE IS "ZYXWVUTSRQPONMLKJIHGFEDCBA"
ALPHABET EBCDIC-CODE IS EBCDIC.
.
.
.
PROCEDURE DIVISION.
000-DO-THE-SORT.
SORT SORT-FILE ON ASCENDING KEY

9.1.7 Multiple Sorting

A program can contain multiple sort files, multiple SORT statements, or both
multiple sort files and multiple SORT statements. Example 9–4 uses two sort
files to produce two reports with different sort sequences.
Example 9–4 Using Two Sort Files
.
.
.
DATA DIVISION.
FILE SECTION.
SD SORT-FILE1.
01 SORT-REC-1.
03 S1-KEY-1
03 FILLER
03 S1-KEY-2
03 FILLER
SD SORT-FILE2.
01 SORT-REC-2.
9.1 Sorting Data with the SORT Statement
SORT-KEY-1
SORT-KEY-2
COLLATING SEQUENCE IS NEWSEQUENCE
USING INPUT-FILE GIVING OUTPUT-FILE.
PIC X(5).
PIC X(40).
PIC X(5).
PIC X(50).
Using the SORT and MERGE Statements
Using the SORT and MERGE Statements 9–7
(continued on next page)

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COBOL AAQ2G1FTK and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents