skip to main content

Procedure Division Statements : RETURN

RETURN
General Format
RETURN File-Name-1 RECORD [ INTO Identifier-1 ]
  [ AT END Imperative-Statement-1 ] 
  [ NOT AT END Imperative-Statement-2 ] 
  [END-RETURN]
Syntax rules
1.
2.
3.
4.
General rules
1.
2.
3.
4.
5.
A.
B.
Examples
Use Return on output procedure of Sort to provide output records
 input-output section.
 file-control.
   select work-file assign to "sort-workfile".
 file section.
 sd work-file.
 01 work-rec.
    03 wr-key-1 pic x(5).
    03 wr-key-2 pic x(5).
 working-storage section.
 01 eof-flag pic x.
    88 eof-sort value "Y" false "N".
 procedure division.
  display x"0d0a" "First sort descending on key 1, ascending on key 2"
  sort work-file on descending key wr-key-1
       input procedure is input-proc
       output procedure is output-proc.
  display x"0d0a" "Second sort descending on key 2, ascending on key 1"
  sort work-file on descending key wr-key-2
       input procedure is input-proc
       output procedure is output-proc.
  goback.
     release work-rec from "aaaaabbbb1"
     release work-rec from "aaaaazzzz2"
     release work-rec from "ccccczzzz3"
     release work-rec from "cccccdddd4"
     release work-rec from "cccccmmmm5"
     release work-rec from "zzzzzcccc6"
     release work-rec from "zzzzzaaaa7"
     release work-rec from "zzzzznnnn8".
      set eof-sort to false
      perform until eof-sort
        return work-file
         at end set eof-sort to true
         not at end display work-rec
      end-perform.

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left