Microsoft KB Archive/37902

COBOL 3.0 “1-S Undefined Error” Using Improper SORT Syntax

PSS ID Number: Q37902 Article last modified on 04-20-1993

3.00 3.00a | 3.00 3.00a MS-DOS | OS/2

Summary: Microsoft COBOL version 3.0 returns the following incorrect error message when trying to compile a COBOL program that uses illegal syntax in the SORT statement: 1-S Undefined Error. Inform Technical Support Microsoft COBOL version 3.0a returns the following incorrect error message in the same place(s) when the same illegal syntax is used: S-13 User-Name Required Microsoft COBOL versions earlier than 3.0 return the proper compiler error messages for illegal SORT syntax. Microsoft has confirmed this to be a problem in versions 3.0 and 3.0a. This problem was corrected in Microsoft COBOL Professional Development System version 4.0 for MS-DOS and MS OS/2. The “Microsoft COBOL Compiler Version 3.0: Language Reference Manual” describes the syntax for the SORT statement on Page 6-20. The “ON” verb is missing its underlining on Page 6-20. The underline signifies that the verb is required. The “ON” verb is required in the SORT syntax.

More Information: The sample program below demonstrates possible improper syntax for the SORT statement and then shows the proper form. The following program should compile the same when using almost any of the compiler directives. Using the defaults will work correctly. The following is a code example: IDENTIFICATION DIVISION. PROGRAM-ID. TESTER. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. SELECT SORT-FILE ASSIGN TO DISK. SELECT TEST-FILE ASSIGN TO DISK. SELECT WORK-FILE ASSIGN TO DISK. DATA DIVISION. FILE SECTION. FD TEST-FILE RECORD CONTAINS 45 CHARACTERS VALUE OF FILE-ID IS ‘TEST.FIL’. 01 TEST-REC. 05 TEST-NAME PIC X(25). 05 TEST-CITY PIC X(15). 05 TEST-ZIP PIC X(5). FD WORK-FILE RECORD CONTAINS 45 CHARACTERS VALUE OF FILE-ID IS ‘WORK.FIL’. 01 WORK-REC. 05 WORK-NAME PIC X(25). 05 WORK-CITY PIC X(15). 05 WORK-ZIP PIC X(5). SD SORT-FILE RECORD CONTAINS 45 CHARACTERS VALUE OF FILE-ID IS “SORT.WRK”. 01 SORT-REC. 05 SORT-NAME PIC X(25). 05 SORT-CITY PIC X(15). 05 SORT-ZIP PIC X(5). PROCEDURE DIVISION. 000-MAIN.   The following SORT will give the “1-S” error on “SORT-NAME”. '' SORT SORT-FILE ASCENDING KEY IS SORT-NAME USING TEST-FILE GIVING WORK-FILE. '' * The following SORT will compile without any problems. * SORT SORT-FILE ON ASCENDING KEY SORT-CITY USING TEST-FILE GIVING WORK-FILE. STOP RUN.

Additional reference words: 3.00 3.00a Copyright Microsoft Corporation 1993.