Special Names Example


Scenario - Changing system default collating sequence.

Code -

----+----1----+----2----+----3----+----4----+----5----+
       IDENTIFICATION DIVISION.
       PROGRAM-ID. SPLNAMES.
       AUTHOR. MTH.

       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SOURCE-COMPUTER. IBM3278.
       OBJECT-COMPUTER. IBM3278 
                PROGRAM COLLATING SEQUENCE IS TEST-COLLATE.
       SPECIAL-NAMES. ALPHABET TEST-COLLATE IS 'STUVWXY'.

       DATA DIVISION. 
       WORKING-STORAGE SECTION. 
       01 WS-VAR        PIC X(01). 

       PROCEDURE DIVISION.
           MOVE LOW-VALUE     TO  WS-VAR.
           DISPLAY "LOWEST VALUE IS : " WS-VAR.

           STOP RUN. 

Output -

LOWEST VALUE IS : S

Explaining Example -

In the above example:

  • PROGRAM COLLATING SEQUENCE - declares a user-defined test collating sequence. SPECIAL NAMES paragraph overrides the default collating sequence with the given sequence. So, LOW-VALUE is replaced by 'S' and displays 'S' when we displayed LOW-VALUE.