VMS Help
COBOL, PROCEDURE_DIVISION, PERFORM

 *Conan The Librarian

  The PERFORM statement executes one or more procedures.  It returns
  control to the end of the PERFORM statement when procedure execution
  ends.

  1 - 1format

  The PERFORM statement executes one or more procedures.  It returns
  control to the end of the PERFORM statement when procedure execution
  ends.

  Format 1 -

   PERFORM [first-proc [ { THRU    } end-proc ]]
           [           [ { THROUGH }          ]]

    [ stment  END-PERFORM ]

 1.1 - first-proc

  is a procedure-name that identifies a paragraph or section in the
  Procedure Division.  The set of  statements in first-proc are the
  first (or only) set of statements in the PERFORM range.

 1.2 - end-proc

  is a procedure-name that identifies a paragraph or section in the
  Procedure Division.  The set of statements in end-proc are the last
  set of statements in the PERFORM range.

 1.3 - stment

  is an imperative statement.

  2 - 2format_repeat-count

  The PERFORM statement executes one or more procedures.  It returns
  control to the end of the PERFORM statement when procedure execution
  ends.

  Format 2 -

   PERFORM [first-proc [ { THRU    } end-proc ]] repeat-count TIMES
           [           [ { THROUGH }          ]]

    [ stment  END-PERFORM ]

 2.1 - first-proc

  is a procedure-name that identifies a paragraph or section in the
  Procedure Division.  The set of  statements in first-proc are the
  first (or only) set of statements in the PERFORM range.

 2.2 - end-proc

  is a procedure-name that identifies a paragraph or section in the
  Procedure Division.  The set of statements in end-proc are the last
  set of statements in the PERFORM range.

 2.3 - stment

  is an imperative statement.

 2.4 - repeat-count

  is a numeric integer literal or the identifier of a numeric integer
  elementary item.  It controls how many times the statement set (or
  sets) executes.

  3 - 3format UNTIL

  The PERFORM statement executes one or more procedures.  It returns
  control to the end of the PERFORM statement when procedure execution
  ends.

  Format 3 -

   PERFORM [first-proc [ { THRU    } end-proc ]] [ WITH TEST { BEFORE } ]
           [           [ { THROUGH }          ]] [           { AFTER  } ]

       UNTIL cond

    [ stment  END-PERFORM ]

 3.1 - first-proc

  is a procedure-name that identifies a paragraph or section in the
  Procedure Division.  The set of  statements in first-proc are the
  first (or only) set of statements in the PERFORM range.

 3.2 - end-proc

  is a procedure-name that identifies a paragraph or section in the
  Procedure Division.  The set of statements in end-proc are the last
  set of statements in the PERFORM range.

 3.3 - stment

  is an imperative statement.

 3.4 - cond

  can be any conditional expression.

  4 - 4format VARYING

  The PERFORM statement executes one or more procedures.  It returns
  control to the end of the PERFORM statement when procedure execution
  ends.

  Format 4 -

   PERFORM [first-proc [ { THRU    } end-proc ]] [ WITH TEST { BEFORE } ]
           [           [ { THROUGH }          ]] [           { AFTER  } ]

      VARYING var FROM init BY increm UNTIL cond

    [ AFTER var FROM init BY increm UNTIL cond ] ...

    [ stment  END-PERFORM ]

 4.1 - first-proc

  is a procedure-name that identifies a paragraph or section in the
  Procedure Division.  The set of  statements in first-proc are the
  first (or only) set of statements in the PERFORM range.

 4.2 - end-proc

  is a procedure-name that identifies a paragraph or section in the
  Procedure Division.  The set of statements in end-proc are the last
  set of statements in the PERFORM range.

 4.3 - stment

  is an imperative statement.

 4.4 - cond

  can be any conditional expression.

 4.5 - var

  is an index-name or the identifier of a numeric elementary data item.
  Its value is changed by increm each time all statements in the
  PERFORM range execute.

 4.6 - init

  is a numeric literal, index-name, or the identifier of a numeric
  elementary data item.  It specifies the value of var before any
  statement in the PERFORM range executes.

 4.7 - increm

  is a nonzero numeric literal or the identifier of a numeric
  elementary data item.  It systematically changes the value of var
  each time the program executes all statements in the PERFORM range.
  Close     Help