Rules for dummy arguments

The following rules apply to dummy arguments:

  • If a parameter is an element (that is, a variable that is neither a structure nor an array), the argument must be an element expression.
  • When a VARYING, VARYING4, or VARYINGZ string element is passed to a NONVARYING parameter, whose length is undefined (that is, specified by an asterisk), a dummy argument with the current length of the original is created.
  • Entry variables passed as arguments are assumed to be aligned; therefore, no dummy argument is created when only the alignments of argument and parameter differ. See Generic entries for a description of generic name arguments for entry parameters.
  • If the parameter is of the program-control data type (except locator), the argument must be a reference of the same data type.
  • If a parameter is a locator (pointer or offset), the argument must be a locator. If the types differ, a dummy argument is created. The parameter descriptor of an offset parameter must not specify an associated area.
  • A noncontrolled parameter can be associated with an argument of any storage class. However, if more than one generation of the argument exists, the parameter is associated only with that generation existing at the time of invocation.
  • If the parameter is controlled, you must explicitly state this in the parameter descriptor for the ENTRY declaration. In addition, a controlled parameter must always have a corresponding controlled argument that is not subscripted, that is not an element of a structure, and that does not cause a dummy to be created.

    If more than one generation of the argument exists at the time of invocation, the parameter corresponds to the entire stack of generations in existence. Consequently, at the time of invocation, a controlled parameter represents the current generation of the corresponding argument. A controlled parameter can be allocated and freed in the invoked procedure, allowing the manipulation of the allocation stack of the associated argument.

    If the extents of the controlled parameter are specified as asterisks or nonrestricted expressions, the original declaration must have extents declared as nonrestricted expressions.