Recursive Procedures

Posted By on October 25, 2014


Download PDF
Re-entrant Procedure
GATE and Gate Descriptor Format

A recursive procedure can reference itself directly or indirectly. Recursion is permitted if the keyword RECURSIVE is specified in a FUNCTION or SUBROUTINE statement, or if RECURSIVE is specified as a compiler option or in an OPTIONS statement.

If a function is directly recursive and array valued, the keywords RECURSIVE and RESULT must both be specified in the FUNCTION statement.

The procedure interface is explicit within the subprogram in the following cases:

  • When RECURSIVE is specified for a subroutine
  • When RECURSIVE and RESULT are specified for a function

The keyword RECURSIVE must be specified if any of the following applies (directly or indirectly):

  • The subprogram invokes itself.
  • The subprogram invokes a subprogram defined by an ENTRY statement in the same subprogram.
  • An ENTRY procedure in the same subprogram invokes one of the following:
    • Itself
    • Another ENTRY procedure in the same subprogram
    • The subprogram defined by the FUNCTION or SUBROUTINE statement
Re-entrant Procedure
GATE and Gate Descriptor Format

Download PDF

Posted by Akash Kurup

Founder and C.E.O, World4Engineers Educationist and Entrepreneur by passion. Orator and blogger by hobby

Website: http://world4engineers.com