1. What is the different types of sorting available? Internal sort and external sort. 2. How do you sort in a COBOL pr...
1. What is the different types of sorting available?
Internal sort and external sort.
2. How do you sort in a COBOL program? Give sort file definition, sort statement syntax and meaning. -
Syntax:
SORT file-1 ON ASCENDING/DESCENDING KEY....
USING file-2
GIVING file-3.
USING can be substituted by INPUT PROCEDURE IS para-1 THRU para-2
GIVING can be substituted by OUTPUT PROCEDURE IS para-1 THRU para-2.
file-1 is the sort work-file and must be described using SD entry in FILE SECTION.
file-2 is the input file for the SORT and must be described using an FD entry in FILE SECTION and SELECT clause in FILE CONTROL.
file-3 is the out-file from the SORT and must be described using an FD entry in FILE SECTION and SELECT clause in FILE CONTROL.
file-1, file-2 & file-3 should not be opened explicitly.
INPUT PROCEDURE is executed before the sort and records must be RELEASEd to the sort work file from the input procedure.
OUTPUT PROCEDURE is executed after all records have been sorted. Records from the sort work file must be RETURNed one at a time to the output procedure.
3. How do you define a sort file in JCL that runs the COBOL program?
Use the SORTWK01, SORTWK02,..... DD names in the step. Number of sort Datasets depends on the volume of data being sorted, but a minimum of 3 is required.
4. What is the difference between performing a SECTION and a PARAGRAPH? -
Performing a SECTION will cause all the paragraphs that are part of the section, to be performed.
Performing a PARAGRAPH will cause only that paragraph to be performed
No comments
Post a Comment