Previous Topic Next topic Print topic


Common, Initial and Recursive Attributes

A program can be described with attributes that affect its initial state or that define the manner in which it can be called.

ANS85 A common program is one that is directly contained within another program and that can be called by programs directly or indirectly contained in that other program, as described in the section Scope of Names in the chapter Concepts of the COBOL Language. The common attribute is attained by specifying the COMMON clause in a program's Identification Division. When the COMMON clause is not specified, a contained program that is not recursive can be called only from the directly-containing program. The COMMON clause facilitates the writing of subprograms that can be used by all the programs contained within a program.

ANS85  An initial program is one whose program state is initialized when the program is called. During the process of initializing an initial program, that program's internal data is initialized as described in the section State of a Function, Method, Object or Program. The initial attribute is attained by specifying the INITIAL clause in the program's Identification Division.

ISO2002MFOS390 A recursive program may call itself directly or indirectly. The program's internal data is initialized as described in the section State of a Function, Method, Object or Program. The recursive attribute is attained as specified in the section The Program-ID Paragraph in the chapter Identification Division.

ISO2002MFOS390 Methods are always recursive. Their data is initialized in the same way as recursive programs.

ISO2002MFOS390 If a program is neither initial nor recursive, the program's data is in the last-used state on other than the first activation of the program as described in the section State of a Function, Method, Object or Program. The program cannot be activated while it is active unless it has the recursive attribute.

Previous Topic Next topic Print topic