Microsoft KB Archive/50463

An Isolated Case Where COBOL 3.0 SORT Verb Hangs During Sort

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

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

Summary: When using Microsoft COBOL version 3.0 or 3.0a, the program below hangs while it SORTs the data file that is also provided below. This data file consists of a single record. The program also hangs if this single record is included in a file with other record of the same description and the file is sorted with the program below. The program executes correctly if run from the animator. This is an isolated case where the SORT facility in COBOL 3.0 or 3.0a can hang. This hanging problem is unusual, because the SORT facility usually works without any problems in most programs. The cause of the problem, or the conditions under which it might occur in other programs, is not known at this time. Microsoft has confirmed this to be a problem in COBOL 3.0 and 3.0a for MS-DOS and MS OS/2. This problem has been corrected in Microsoft COBOL Professional Development System version 4.0.

More Information: To reproduce the problem, compile the code below with only the ANS85 directive under COBOL 3.0a and LINK without options using LINK version 5.02.05 as follows: COBOL hangprog.cob; LINK hangprog; ENVIRONMENT DIVISION. CONFIGURATION SECTION. FILE-CONTROL. SELECT SORTCHECK-FILE ASSIGN TO disk ORGANIZATION IS SEQUENTIAL. SELECT SORTCHCK-FILE ASSIGN TO disk ORGANIZATION IS SEQUENTIAL. SELECT SORT-FILE ASSIGN TO disk. DATA DIVISION. FILE SECTION. FD SORTCHCK-FILE value of file-id is “sortout.txt”. 01 SRTCHK2-RECORD. 03 CHK2 PIC X(3155). FD SORTCHECK-FILE value of file-id is “sortin.txt”. 01 SRTCHK-RECORD. 03 SRTCHK-KEY. 05 SRTCHK-YEAR PIC 99. 05 rest PIC x(3153). SD SORT-FILE. 01 SORT-RECORD. 03 SORT-KEY. 05 SORT-YEAR PIC 99. 05 rest PIC x(3153). PROCEDURE DIVISION. PROCESSING-CONTROL-SECTION. SORT SORT-FILE ON ASCENDING KEY SORT-YEAR USING SORTCHECK-FILE GIVING SORTCHCK-FILE. STOP RUN. The data file is included below. It consists of all the text between the dashed lines (but not the dashed lines themselves). The size of the data file should be 3155 bytes when created from the data below. Note that the size of the record in the code above is also 3155 bytes. To include the file in this article, carriage-returns and linefeeds have been added at the end of each line. To use the file with the above program, it is necessary to remove all of the carriage-returns and linefeeds with a text editor. If you are retyping this data, type the characters all on one line (one record) in your editor. ——————————————————————— 8906018066060289UNITED AIRLINES 090061203510000000 523010063000 MARQUARDT/XC SEATTLE 000000000 054Z0000000 523010126800SCOTT/BUS DEV 000000000 054Z000000028949518500009900SCOTT/DUNN EDWARDS 000000000 054Z000000081307518500039500SCOTT/SO CAL ROCK 000000000 054Z0000000 523010174500SCOTT/WASI TRAINING 000000000 031I00000001682751850002700pSTEINER/CHEVRON#1 000000000 031R000000077469518500011800FRAZIER/SAWCX 000000000 031R000000013699518500035600FRAZIER/CALJPIA 000000000 031T000000044507518500027200LINNEY/HUMBOLT 000000000 031R000000060267518500021200DARBY/CTY MOHAVE 000000000 031R000000091224518500061000DARBY/ST. WASH 000000000 031R000000079234518500026200DARBY/SHASTA ———————————————————————

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