In the documentation for a function, it shows entry-interface and entry-name being "optional (comment) paragraphs" following the function-id paragraph. This does not compile. The correct documentation is that they are clauses of the function-id paragraph, just as is documented for a function prototype.
In the documentation for both function and function-prototype, it states that the '.' between function-id and the remainder of the paragraph is optional. This is not the case. It is required.
While we're on the topic, it seems to me that the ENTRY-INTERFACE and ENTRY-NAME clauses should be in the new OPTIONS paragraph (section 11.9 in the COBOL 2014 standard). I suppose it's too late now, but figured I'd bring it up anyway. For example:
function-id. error-number as 'The_Number_of_the_Error' is prototype.
options.
entry-interface is static
entry-name is long-upper.
In the listing header for a function prototype having the optional 'AS' clause, the function name value that is printed is of the "AS literal" (THE_NUMB, in this example) rather than that of the function name (ERROR-NUMBER). The actual function definition is handled correctly.
PP 5655-EC6 IBM Enterprise COBOL for z/OS 6.4.0 P240202 THE_NUMB Date 08/01/2024 Time 17:27:17 Page 7
LineID PL SL ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6----+----7-|--+----8 Map and Cross Reference
/* THE_NUMBER_OF_THE_ERROR
000011 001100 identification division. COBOL6.4
000012 001200 function-id. error-number as 'The_Number_of_the_Error'
000013 001300 is prototype
000014 001400 entry-interface is static
000015 001500 entry-name is longupper.
PP 5655-EC6 IBM Enterprise COBOL for z/OS 6.4.0 P240202 ERROR-NU Date 08/01/2024 Time 17:27:17 Page 13
LineID PL SL ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6----+----7-|--+----8 Map and Cross Reference
/* THE_NUMBER_OF_THE_ERROR
000023 002300 identification division. COBOL6.4
000024 002400 function-id. error-number as 'The_Number_of_the_Error'
000025 002500 entry-name is longupper.
User defined functions are included in "Cross-reference of programs" of the function (or prototype) itself, but not for programs that invoke the UDF. The following is from the prototype for function ONEFUNC. This one is fine.
PP 5655-EC6 IBM Enterprise COBOL for z/OS 6.4.0 P240202 ONEFUNC Date 12/30/2024 Time 11:10:20 Page 3
LineID PL SL ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6----+----7-|--+----8 Map and Cross Reference
/* ONEFUNC
000001 000200 identification division. COBOL6.4
000002 000300 function-id. onefunc is prototype.
000003 000400
000004 000500 data division.
000005 000600 linkage section.
000006 000700 01 r pic s9(8) comp. BLL=XXXXX 4C
000007 000800
000008 000900 procedure division returning r. 6
000009 001000 end function onefunc. UND
000010 001100
*/ ONEFUNC
PP 5655-EC6 IBM Enterprise COBOL for z/OS 6.4.0 P240202 ONEFUNC Date 12/30/2024 Time 11:10:20 Page 4
An "M" preceding a data-name reference indicates that the data-name is modified by this reference.
Defined Cross-reference of data names References
6 R. . . . . . . . . . . . . . . 8
PP 5655-EC6 IBM Enterprise COBOL for z/OS 6.4.0 P240202 ONEFUNC Date 12/30/2024 Time 11:10:20 Page 5
Defined Cross-reference of programs References
2 ONEFUNC
However, in the program that "calls" the function, ONEFUNC is not listed:
PP 5655-EC6 IBM Enterprise COBOL for z/OS 6.4.0 P240202 MAINPGM Date 12/30/2024 Time 11:10:20 Page 7
LineID PL SL ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6----+----7-|--+----8 Map and Cross Reference
/* MAINPGM
000011 001200 identification division. COBOL6.4
000012 001300 program-id. mainpgm.
000013 001400
000014 001500 environment division.
000015 001600 configuration section.
000016 001700 repository.
000017 001800 function onefunc.
000018 001900
000019 002000 data division.
000020 002100 working-storage section.
000021 002200 01 x pic s9(8) comp. 000000000 4C
000022 002300
000023 002400 procedure division.
000024 002500 call 'subpgm' EXT
000025 002600 compute x = onefunc 21
000026 002700 goback.
000027 002800 end program mainpgm. 12
000028 002900
*/ MAINPGM
PP 5655-EC6 IBM Enterprise COBOL for z/OS 6.4.0 P240202 MAINPGM Date 12/30/2024 Time 11:10:20 Page 8
An "M" preceding a data-name reference indicates that the data-name is modified by this reference.
Defined Cross-reference of data names References
21 X. . . . . . . . . . . . . . . M25
PP 5655-EC6 IBM Enterprise COBOL for z/OS 6.4.0 P240202 MAINPGM Date 12/30/2024 Time 11:10:20 Page 9
Defined Cross-reference of programs References
12 MAINPGM. . . . . . . . . . . . 27
EXTERNAL SUBPGM . . . . . . . . . . . . 24
I believe that the following is missing here:
EXTERNAL ONEFUNC. . . . . . . . . . . . 25
Finally, it is also often the case that a compile of an invalid program results in an RC=0016 or an abend, and the compile is never completed. I have run into this in way too many situations, but here are a few examples:
Record key variable not defined.
IGYRC5108-U COBOL compiler terminating: Uncorrectable program
interrupt condition.
IGYRC3135-S Correct severe (S-level) program errors and recompile
before requesting IBM support.
IGYGR1174-S "CHF-STATUS" was not defined as a data-name.
"CHF-STATUS" was discarded.
Depending in Record clause.
IGYRC5108-U COBOL compiler terminating: Uncorrectable program
interrupt condition.
IGYRC3135-S Correct severe (S-level) program errors and recompile
before requesting IBM support.
IGYDS1352-S "DEPENDING" was found in a "RECORD" clause. The clause
was discarded.
There are likely many others, but I've only recently started keeping track.
------------------------------
Frank Swarbrick
------------------------------