COBOL user-defined function definition structure

A COBOL user-defined function definition describes a user-defined function.

Format: COBOL user-defined function definition

Read syntax diagramSkip visual syntax diagramIDENTIFICATIONIDDIVISION.FUNCTION-ID.function-name-1AS'literal-1'ENTRY-NAMEISCOMPATLONGUPPERLONGMIXEDENTRY-INTERFACEISSTATICDYNAMICDLL.other identification-division-contentENVIRONMENT DIVISION.environment-division-contentDATA DIVISION.data-division-contentPROCEDURE DIVISION.procedure-division-content1END FUNCTIONfunction-name-1.23
Notes:
  • 1 The RETURNING phrase of the PROCEDURE DIVISION header is required.
  • 2 User-defined function definitions cannot be nested within any programs, user-defined function definitions, methods, or classes.
  • 3 Rules and behaviors applying to programs and program definitions generally also apply to user-defined functions and their definitions, except where explicitly specified.