COBOL

COBOL

COBOL

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

 View Only
  • 1.  Enterprise Cobol V5/V6 and Fastlink CALL convention

    Posted Thu April 28, 2016 03:26 AM

    Hi,

    According the informations found in the PPA1 structure, Enterprise Cobol V5 for z/OS (and probably Enterprise Cobol V6) would use the "Fastlink" CALL convention; (like C/C++), while Enterprise Cobol V4 and earlier used the "Standard Link" calling convention.
    • Fastlink : passing arguments by registers + list pointed to by register R1
    • Standard link : passing argument list pointed to by register R1

    Is this correct and what are the consequences ?

    Thank you.

     

    Sincerely,.

    Denis FALLAI

    DenisFALLAI


  • 2.  Re: Enterprise Cobol V5/V6 and Fastlink CALL convention

    Posted Thu April 28, 2016 12:50 PM

    What documentation specifically makes you believe this is the case?  It does not appear to me to be the case, otherwise I'd imagine that a COBOL 5/6 program would not be able to correctly call a COBOL 4 program (and visa versa), and this is most certainly not the case.  So unless there is some handling of the differences "under the covers" I can't imagine that this is true.

    fswarbrick


  • 3.  Re: Enterprise Cobol V5/V6 and Fastlink CALL convention

    Posted Thu April 28, 2016 01:08 PM

    Error on my part: the information is in the prolog of the code and not the structure PPA1 :

    1PP 5655-TRY IBM Enterprise COBOL Developer Trial for z/OS 5.2.0INFOBYTE  Date 07/11/2015  Time 22:38:15   Page    270 000002:         Program-id. InfoByte.     000000                     000002            PROC    INFOBYTE     000000  47F0 F014          000002            BC      R15,20(,R15)          £  Skip over constant area     000004  01C3 C5C5          000002            DC      X'01C3C5C5'           £  Eyecatcher: CEE

    Value "01" in CEE Eyecatcher is for "Fastlink" CALL ("00" for "Standard Link").

    Documentation :

    • Cobol V5R2, Migration Guide, chapter 17, Debug Tool changes with IBM Enterprise COBOL Version 5 (page 196).
    • Cobol V6R1, Migration Guide, chapter 18, Debug Tool changes with IBM Enterprise COBOL Version 5 and 6 (page 210).
    • Listing analysis : look at z/OS 2.1 Language Environment Vendor Interface, Chapter 1, Common interfaces and conventions, Routine Layout, page 6.
    DenisFALLAI


  • 4.  Re: Enterprise Cobol V5/V6 and Fastlink CALL convention

    Posted Thu April 28, 2016 01:46 PM

    In Migration Guide, (page xviii for Cobol V5R2, page xx for Cobol V6R1), I think the following sentence is a consequence of Fastlink CALL convention :

    To be compatible with the convention used by C and C++, the linkage convention for returning a doubleword binary item specified in the RETURNING phrase PROCEDURE DIVISION header and the CALL statement is changed. If a COBOL program returns a doubleword binary item via a PROCEDURE DIVISION RETURNING header to a calling COBOL program with a CALL ... RETURNING statement, an issue occurs if only one of the programs is recompiled with Enterprise COBOL V5. Both the called and calling programs must be recompiled with Enterprise COBOL V5 together, so that the linkage convention for the RETURNING item is consistent.

     

    DenisFALLAI


  • 5.  Re: Enterprise Cobol V5/V6 and Fastlink CALL convention

    Posted Thu May 12, 2016 02:14 PM

    This is a bit confusing.  Even I was confused while I was implementing it.  :-)  There are a number of variants of the basic "OS Linkage."  That's the linkage that uses R1 as a pointer to a block of incoming arguments (or outgoing parameters.)  One of those variants is called "C private," and it is the one that is used by C.  To tell that you are C private, you start by "pretending" that you are fastlink.  All the magic is here in the PPA1:

     0003F8  90                                                     =AL1(144)          Flags


    That's the program flags at offset hex 18 in the PPA1.  The value 1 in the top bit says "fastlink stack frame layout."  But that is "waved off" by the value 001 in the next three bits.  That means "C private" convention.  So we always generate a 9x for that field of the PPA1.   (In fact a 90.)

    That note about returning a doubleword binary item is something that did change between V4 and V5.  The C private calling convention requires that such items be returned in storage whose address is passed as a hidden first argument.  The V4 compiler didn't implement that quite right but it did everything else correctly for C private.  The V5/V6 compiler also implements C private and it adheres to the specification correctly even in this case.

    So the bottom line is:  we use C private and not fastlink for COBOL.

    ahkielstra


  • 6.  Re: Enterprise Cobol V5/V6 and Fastlink CALL convention

    Posted Thu May 26, 2016 02:26 PM

    Here's something that might be related to this issue that you (ahkielstra) might look in to.  While in IBM Debug Tool if you issue the "DESCRIBE CUS" command you get something like the following:

     DESCRIBE CUS ;                                                 
    The compile-time data for program STEPPING ::> STEPPING is      
    Compiler: IBM COBOL  5.2.0                    2016/05/26  12:13
        Its address is X'0E700000' and its length is X'00000286'    
        Its linkage is Language Environment FastLink               

     

    Sounds like from what you say it should say something like "Its linkage is C private", or something like that.

    fswarbrick