ISO2002MF 

The Method-ID Paragraph

The Method-ID paragraph indicates that this Identification Division introduces a method definition, specifies the name that identifies the method or method prototype, and assigns method attributes to the method.

General Format

Syntax for the Method-ID paragraph

Syntax Rules

  1. Literal-1 must be an alphanumeric literal and must not be a figurative constant.
  2. If property-name-1 is specified as a data-name in the Working-Storage Section of the containing object or factory definition, the PROPERTY clause must not be specified in the data description entry of that data-name.
  3. If the GET phrase is specified, then the method must have no USING phrase parameters specified in the PROCEDURE DIVISION header and must have a single RETURNING phrase.
  4. If the SET phrase is specified, then the method must have a single USING parameter specified in the PROCEDURE DIVISION header and no RETURNING phrase.
  5. If STATIC is specified, the method is a static method. In other words, it is accessed through the class rather than an instance of the class.
  6. The OVERRIDE phrase must not be specified in a method prototype.
  7. If the OVERRIDE phrase is specified, there must be a method with the same name as the method declared by this method definition defined in a superclass. The method in the superclass must not be defined with the FINAL clause.
  8. If the OVERRIDE phrase is not specified:
    1. If this method definition is contained in a class definition, no inherited method may have the same name as the method declared by this method definition
    2. If this method definition is contained in an interface definition, no inherited method prototype may have the same name as the method prototype declared by this method definition.
  9. NETJVM If the REDEFINE phrase is specified, there must be a method with the same name as the method declared by this method definition defined in a superclass.
  10. The FINAL clause must not be specified in a method prototype.
  11. If method-name-1 or literal-1 is the same as a method-name inherited by the containing definition, the parameter declarations and returning item in the PROCEDURE DIVISION header must obey the rules of conformance to ensure that the definition that contains this method definition conforms to every inherited definition according to the section Conformance for Parameters and Returning Items in the chapter Procedure Division.
  12. NETJVM If the ABSTRACT phrase is specified, the ABSTRACT phrase must also be specified in the CLASS-ID paragraph of the containing class.
  13. NETJVM If the ABSTRACT phrase is specified, the Procedure Division of this method must be empty.
  14. NETJVM The ABSTRACT phrase must not be specified in a static method.
  15. NETJVM If the PROTECTED phrase is specified, the ABSTRACT phrase must not be specified.
  16. NETJVM The FOR clause may only be specified for instance methods.
  17. NETJVM Interface-name-1 must be the name of an interface, which is implemented by the current class.
  18. NETJVM This interface must include a method with the same signature as the current method.
  19. NETJVM Attribute-clause is defined in the topic on the Attribute, Custom-Attribute Clause.

General Rules

  1. The name of the method declared by this method definition is determined as follows:
    1. If the PROPERTY clause is specified, the name is formed as follows:
      1. If the GET phrase is specified, the characters "GET" are concatenated to property-name-1 folded to upper case.
      2. If the SET phrase is specified, the characters "SET" are concatenated to property-name-1 folded to upper case.
    2. If the PROPERTY clause is not specified, the name is method-name-1. However, literal-1, if specified, is the name of the method that is externalized to the operating environment.
  2. The OVERRIDE phrase indicates that this method overrides the inherited method.
  3. NETJVM The REDEFINE phrase indicates that this method creates a new method with the same name that hides the parent method. Hiding is the same as overriding the inherited method when an object is described as being of an inherited class, however, when an object is described as being of a particular class, but actually contains an instance of a derived class, the method in the class referenced in the description of the object is executed.
  4. The FINAL clause indicates that this method must not be overridden in any subclasses

    NETJVM , but it can be redefined

    .
  5. The name of this method can be referenced in the invocation of a method for an object of the class in which this method is defined.
  6. If a given user-defined word is defined in the Data Division of this method definition and in the Data Division of the containing factory definition or object definition, the use of that word in this method refers to the declaration in this method. The declaration in the containing factory object or object definition is inaccessible to this method.
  7. If the GET phrase is specified, this method is a get property method for property-name-1.
  8. If the SET phrase is specified, this method is a set property method for property-name-1.
  9. NETJVM If the PUBLIC phrase is specified or implied, this method may be invoked from any run-time system element.
  10. NETJVM If the PRIVATE phrase is specified, this method may be invoked only from within the containing class.
  11. NETJVM If the PROTECTED phrase is specified without the INTERNAL phrase, this method may be invoked only from within the containing class or a class that inherits from the containing class.
  12. NETJVM If the PROTECTED phrase is specified with the INTERNAL phrase, this method may be invoked only from within the containing class, a class that inherits from the containing class, or from within the current compilation unit.
  13. NETJVM If the INTERNAL phrase is specified without the PROTECTED phrase, this method may be invoked only from within the current compilation unit.
  14. NETJVM If the ABSTRACT phrase is specified, this method must be overridden in every derived class that is not itself ABSTRACT.
  15. NETJVM The CUSTOM-ATTRIBUTE phrase associates the specified custom attributes with this method.
  16. NETJVM If the FOR clause is specified, this method is an Explicit Interface Member Implementation. The method may not be invoked explicitly. It will be invoked implicitly when the corresponding method is invoked on an instance of this class which has been cast to the interface type.
  17. NETJVM The SYNC modifier locks the values of the arguments sent to the method, so that they do not change while the method is processing.

    When an argument is sent to a method and is received as a reference parameter, the value of the parameter and its corresponding sending argument might be updated. Without the SYNC modifier, the value of the sending argument is unknown, while the method is processing.

    The SYNC modifier on a method is equivalent to wrapping the whole method in a SYNC statement.

  18. NETJVM The EXTENSION keyword indicates that the method is an extension method. You declare extension methods as static methods declared in a static class that is not nested or generic.

    If you specify EXTENSION, you can omit the STATIC keyword. This is because EXTENSION implies STATIC.

    In the method, the first parameter in the USING phrase is the class to extend. It is always a value parameter.