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.  ZOS/Unix cob2 compiling and executing

    Posted Tue September 19, 2023 09:44 AM

    Hello everybody.
    I'm starting with Cobol on ZOS/Unix.

    My  environment is terminal via SSH to ZOS machine.


    I have Cobol program hello.cbl with basic code to display message.
    ```

           IDENTIFICATION DIVISION.
           PROGRAM-ID. "HELLOWORLD".
           AUTHOR. PIOTR SYNOWIEC.
           ENVIRONMENT DIVISION.

           DATA DIVISION.
           
           PROCEDURE DIVISION.
           MAIN-PROCEDURE.
               DISPLAY "**************************************************"
               DISPLAY " *** Hello World"
               
               STOP RUN.
           END PROGRAM HELLOWORLD.
    ```


    Program compiles easily with GnuCobol & IBM Cobol compiler on Linux and I can easily execute compiled program.
    I tried the same on ZOS/Unix using flag "RENT" as per description here Running COBOL programs under z/OS UNIX

    cob2 -v hello.cbl -o hello.exe

    Compiler messages
    compiler: ATTCRCTL PARM=RENT,TERM /u/ibmuser/TIPS/tests/basic/hello.cbl
    linker: /bin/c89 -o hello.exe -e // hello.o
    Running program
    ./hello.exe
    Message
    Killed

    Tried with -q64

    cob2 -v -q64 hello.cbl -o hello.exe

    Compiler messages:
    compiler: ATTCRCTL PARM=RENT,TERM,LP(64) /u/ibmuser/TIPS/tests/basic/hello.cbl
    linker: /bin/c89 -o hello.exe -Wl,LP64 -e // hello.o
     IEW2480W A711 EXTERNAL SYMBOL CEELLIST OF TYPE LD WAS ALREADY DEFINED AS A
              SYMBOL OF TYPE LD IN SECTION CELQLLST.
     IEW2482W A712 THE ORIGINAL DEFINITION WAS IN A MODULE IDENTIFIED BY DDNAME
              SYSLIB.  THE DUPLICATE DEFINITION IS IN SECTION CEEBLLST  IN A
              MODULE IDENTIFIED BY DDNAME SYSLIB.
    FSUM3065 The LINKEDIT step ended with return code 4.
    running result is the same: Killed

    Could anybody help me to sort that out ?

    Regards,

    Piotr





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


  • 2.  RE: ZOS/Unix cob2 compiling and executing

    Posted Wed September 20, 2023 08:06 AM

    Hi Piotr,

    I suspect that you don't have the LE runtime (*.SCEERUN in the LP(32) case) in your search order. You could try adding it to the STEPLIB environment variable to see if that's the case.

    On the other hand, the compile should result in a warning, truncating the name HELLOWORLD to 8 characters, which your examples don't show.

    Bernie



    ------------------------------
    Bernie Rataj
    Technical Support Professional
    IBM Canada Ltd.
    Markham ON Canada

    https://www.ibm.com/products/cobol-compiler-zos
    https://www.ibm.com/products/pli-compiler-zos
    ------------------------------



  • 3.  RE: ZOS/Unix cob2 compiling and executing

    Posted Fri September 29, 2023 09:53 AM

    tried STEPLIB=CEE.SCEERUN bit didn't help 



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



  • 4.  RE: ZOS/Unix cob2 compiling and executing

    Posted Tue October 03, 2023 09:12 AM

    this solved the problem

    STEPLIB=IGY630.SIGYCOMP



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



  • 5.  RE: ZOS/Unix cob2 compiling and executing

    Posted Tue October 03, 2023 10:07 AM

    Hi Piotr,

    If adding the compiler to the STEPLIB resolved a runtime problem (./hello.exe ... Killed), I expect that you were probably running some very old compiler using a pre-LE runtime?

    You might want to check your linklist for an older compiler. 

    Bernie



    ------------------------------
    Bernie Rataj
    Technical Support Professional
    IBM Canada Ltd.
    Markham ON Canada

    https://www.ibm.com/products/cobol-compiler-zos
    https://www.ibm.com/products/pli-compiler-zos
    ------------------------------