CLASS-ID. COBOLClass INHERITS CSharpClass.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
REPOSITORY.
CLASS CSharpClass.
OBJECT.
PROCEDURE DIVISION.
METHOD-ID. Factorial OVERRIDE.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 COUNTER PIC S9(9) COMP-5.
LINKAGE SECTION.
77 OPERAND PIC S9(9) COMP-5.
77 RETURN-VAL PIC S9(9) COMP-5.
PROCEDURE DIVISION USING BY VALUE OPERAND RETURNING RETURN-VAL.
MOVE 1 TO RETURN-VAL.
PERFORM VARYING COUNTER FROM 1 BY 1 UNTIL COUNTER > OPERAND
COMPUTE RETURN-VAL = RETURN-VAL * COUNTER
END-PERFORM.
END METHOD Factorial.
END OBJECT.
END CLASS COBOLClass.
COBOLClass.cob:
Previous slide | Next slide | Back to first slide | View graphic version |