COBOL

COBOL

COBOL

COBOL is responsible for the efficient, reliable, secure, and unseen day-to-day operations of the world's economy.

 View Only

Small issues with documentation and compiler listings for user defined functions.

  • 1.  Small issues with documentation and compiler listings for user defined functions.

    Posted Wed September 04, 2024 01:44 PM

    Someone on the IBM Enterprise COBOL team might find this of interest.

    In the documentation for function it shows entry-interface and entry-name being "comment paragraphs" following the function-id paragraph.  This is not correct.  The correct documentation is that they are phrases (clauses?) of function-id, 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.
     
    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 defintion 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 PARSEDOCUMENT:
     
    PP 5655-EC6 IBM Enterprise COBOL for z/OS  6.4.0 P240202       PARSEDOC  Date 09/04/2024  Time 10:54:18   Page  1102       
     Defined   Cross-reference of programs     References                                                                      
                                                                                                                               
    EXTERNAL   DOC_TO_COBOL . . . . . . . . .  124102                                                                          
       27656   PARSEDOCUMENT                                                                                                   
     
    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.


    ------------------------------
    Frank Swarbrick
    ------------------------------