COBOL- Release and Return in Sort

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.

Advertisements

No need to close Sort-work file. Once all the records are processed, it will close automatically.

COBOL Release..

It writes a record to sort record. It is used in 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-workrecord.

INPUT PROCEDURE 200-para1.
200-para1.
Move input-rec  to Sort-Workrecord
END-PARA.

Release SORT-WORKRECORD.==> writes the record to sort file.

COBOL Return..

It is given in OUTPUT PROCEDURE. Output procedure should be given after the Input procedure.

OUTPUT PROCEDURE 300-para2.
300-para2.
Return Sort-workfile.
End-para.

Return Sort-workfile==> Return is equal to “OPEN” the sort file.

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.