The important thing is when INPUT and OUTPUT procedures used in a program, Output file (sorted file ) we need to open in OUTPUT mode explicitly.
No need to close the Sort-work file. Once all the records are processed, it will close automatically.
It writes a record to sort records. It is used in the INPUT PROCEDURE.
If Input procedure and Output procedures are defined in a program, Input procedure is the first one to be mentioned.
In the Input procedure, we first write a record to be sorted to Sort-work record.
INPUT PROCEDURE 200-para1.
Move input-rec to Sort-Workrecord
Release SORT-WORKRECORD.==> writes the record to sort file.
It is given in OUTPUT PROCEDURE. Output procedure should be given after the Input procedure.
OUTPUT PROCEDURE 300-para2.
Return Sort-workfile==> Return is equal to “OPEN” the sort file.