Explain sorting techniques in cobol program? Provide the sort file definition, the sort statement, its syntax and meaning



Explain sorting techniques in cobol program? Provide the sort file definition, the sort statement, i..

Answer / Dhirendra Kuamr

COBOL provides a SORT statement for sorting records within a data set. The SORT statement is used with an input/output SECTION and an associated SORT-FILE.nnFile Definition:n```coboln 01 EMPLOYEE-RECORD.n 05 EMPLOYEE-ID PIC X(4).n 05 NAME PIC X(30).n WORKING-STORAGE SECTION.n 01 SORT-FILE.n 05 ID PIC X(4) VALUE ZEROS.n 05 SEQ PIC 9(4) VALUE ZEROS.n 05 NEXT PIC 9(4) VALUE ZEROS.n```nSort Statement:n```coboln SORT EMPLOYEE-RECORD BY ID INTO SORT-FILE OUTPUT RECORDING ONLY.n```nThis statement sorts the records in an EMPLOYEE-RECORD file by employee id and writes the sorted records to the SORT-FILE.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More COBOL Interview Questions

Write a program that uses move corresponding.

1 Answers  


Write the syntax of a two dimensional array?

8 Answers   Honeywell, Xansa,


What is the point of the REPLACING option of a copy statement?

3 Answers  


When can the USING phrase be included in the call statement ?

2 Answers  


Can you call an OS VS COBOL pgm from a VS COBOL II pgm ?

3 Answers   Microsoft,


how the control comes back from subprogram to mainprogram

3 Answers   IBM,


I have two sequential files, FILE-1 and FILE-2. FILE-1 contains 2 columns(A,B) and FILE-2 contains 3 columns (C,D,E).I want an output file, FILE-3 which has all five columns with duplicates eliminated from column A.

3 Answers  


1)what is the maximum limit for occurs? Eg: 01 A PIC X(10) OCCURS N TIME. What is the max value for N?

11 Answers   Wipro,


Describe the cobol database components?

1 Answers  


record length in spool?

2 Answers   Infosys,


which is better comp or comp-3 in terms of memory utilization?

6 Answers  


What is inspect in cobol ?

1 Answers   Infosys,


Categories