COBOL Manual for TNS and TNS/R Programs
Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs—522555-006
9-236
SORT
°
OUTPUT PROCEDURE Phrase
If the OUTPUT PROCEDURE phrase appears, the output phase executes an 
implicit PERFORM procedure-group statement (where procedure-
group is the procedure name, optionally followed by THROUGH or THRU 
and another procedure name). The sort output procedure thereby specified is 
responsible for retrieving the sort file records by one or more executions of 
RETURN statements. The sort output procedure must not open the sort input 
file infile. Control automatically returns to the sort operation after execution 
passes beyond the last statement in the range of the PERFORM statement.
The range of the output procedure must not cause the execution of a MERGE, 
RELEASE, or SORT statement or a RETURN statement that references any 
sort or merge file other than the one identified by sd-name.
•
Sort Scratch File
The FastSort utility determines the default scratch file size if the file-system file 
named in the file-control entry does not exist. If the file does exist, SORT uses it. 
You can use the File Utility Program CREATE or command interpreter CREATE 
command to create the scratch file on disk. If the sort input file is defined to be on 
tape, or if the sort receives its records from an input procedure, the default number 
of records in the scratch file is 50K.
SORT deletes the scratch file after it completes ordering the records unless you 
specify SAVE-SCRATCH in the routine COBOL85^SET^SORT^PARAM^VALUE or 
COBOL_SET_SORT_PARAM_VALUE_.
Example 9-64. Typical Use of Input and Output Procedures (page 1 of 2)
FILE-CONTROL.
 SELECT EMPLOYEE-MASTER ASSIGN TO "EMPMST"
 ORGANIZATION IS SEQUENTIAL
 ACCESS MODE IS SEQUENTIAL.
 SELECT SORT-WORK ASSIGN TO "SORTWORK".
DATA DIVISION.
FD EMPLOYEE-MASTER
 LABEL RECORDS ARE OMITTED
 RECORD CONTAINS 52 CHARACTERS.
01 EMPLOYEE-DETAIL.
 05 EMPLOYEE-NUMBER PIC X(05).
 05 EMPLOYEE-NAME PIC X(20).
 05 DEPT PIC X(03).
 05 JOB-CLASS PIC X(05).
 05 HOURLY-RATE PIC 9(3)V99.
 05 DEDUCTIONS PIC 9(3)V99.
 05 ANNUAL-SALARY PIC 9(7)V99.










