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.  Link editing big amount of compiled objects for Cobol library

    Posted Wed February 07, 2024 07:40 AM

    Good Morning,

    I have compiled objects in APP.OBJ data set with over 100 objects
    I need to create a link edit version of library for Cobol.
    Could anybody help me to figure it out ?

    Regards,
    Piotr



    ------------------------------
    Piotr Synowiec
    ------------------------------


  • 2.  RE: Link editing big amount of compiled objects for Cobol library

    Posted Wed February 14, 2024 02:57 PM

    Hello Piotr,

    To understand your situation better, do you mean that you want to create a module by linking all objects in APP.OBJ in USS (or MVS) ?  Otherwise, could you add more details using an example? Thanks!



    ------------------------------
    Roy Bae
    ------------------------------



  • 3.  RE: Link editing big amount of compiled objects for Cobol library

    Posted Mon February 19, 2024 05:44 AM
    Edited by Piotr Synowiec Mon February 19, 2024 06:38 AM

    Hi Roy,

    this is basically continuation of my previous issues.
    I have over 1000 C files with single functions per file.
    I compiled them with xlc with options -c -O2 -Wl, DLL in Unix shell.
    I have now corresponding object modules for each function
    I prepare the shared library by
    xlc -o lib.so o/* -Wl,DLL
    I'm not sure if this is the same process as link edit

    I can successfully compile Cobol program and run it in Unix shell by
    cob2 -v -o test1 test1.cbl lib.so

    Not sure why my colleagues can't use this lib file with JCL

    Jon below stated something about main module bu I do not have such thing just all single functions

    Regards,
    Piotr



    ------------------------------
    Piotr Synowiec
    ------------------------------



  • 4.  RE: Link editing big amount of compiled objects for Cobol library

    Posted Tue February 20, 2024 02:38 PM

    Did you compile the C modules with both DLL and EXPORTALL options?  I think those are required to build a "side-deck" (.x file) that is used by the binder to recognize each DLL function.  So when you run the bind step it will create both lib.so and lib.x.  Then under Unix you'd link it to the Cobol program like this:

    cob2 -v -o test1 test1.cbl lib.x

    note that I specified lib.x instead of lib.so.  If you link lib.so directly you are not really using a DLL.  

    For JCL, in the link step include both of the following input cards:

     SETOPT PARM(DYNAM=DLL,CASE=MIXED) 
     INCLUDE /src/lib.x         

    (change /src to whatever Unix directory contains lib.x)

    I think this is all correct.  I don't have a C compiler, so can't test it all out.

    Frank



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



  • 5.  RE: Link editing big amount of compiled objects for Cobol library

    Posted Wed February 21, 2024 07:58 AM

    Hi Frank
    I managed to compile and build library by:
    xlc -O2 -Wl,DLL -qexportall -v src/*c

    xcl -o LIB o/*.o -Wl,DLL -qexportall -v

    I have two files LIB & LIB.x

    and can compile Cobol code and execute
    cob2 -v -o test test.cbl LIB.x

    I wonder now if this LIB file is link edit modules ?

    Regards,

    Piotr



    ------------------------------
    Piotr Synowiec
    ------------------------------



  • 6.  RE: Link editing big amount of compiled objects for Cobol library

    Posted Thu February 15, 2024 08:44 AM

    You need to decide which modules are the main modules, and which are subroutines or functions.  You bind (link edit) the main modules in your JLC as the SYSLIN and use the object library as SYSLIB to pick up the required subroutines automatically.  You can not create executable objects from every member of the object library...unless they are all main modules.  That's what the binder is for.  It creates executable program objects (load modules).

    You don't need a separate object library these days.  Most people compile both main modules and subroutines straight into their LOADLIB, and reference that in the SYSLIB of the bind step.  This solves the problem you seem to have.

    Cheers,



    ------------------------------
    Jon Butler
    ------------------------------



  • 7.  RE: Link editing big amount of compiled objects for Cobol library

    Posted Tue February 20, 2024 06:51 AM

    Hello, interesting thread..

    I also have a large number of C programs which I  currently compile via JCL but would love to switch to USS.

    I may be wrong but I think that in a scenario like the one described above the "make" utility may help.

    Anyone tried make under USS? I understand it is quite different than what we have for example under Linux. For this reason I think that having a working example would be very helpful.

    Thanks!

    mario



    ------------------------------
    Mario Bezzi
    ------------------------------



  • 8.  RE: Link editing big amount of compiled objects for Cobol library

    Posted Wed February 21, 2024 08:34 AM

    Hi Mario

    I use make for all my builds
    I didn't see any difference from Linux

    Regards,
    Piotr



    ------------------------------
    Piotr Synowiec
    ------------------------------