Menu

COBCPY

2025-03-12
2025-03-20
  • Maurizio Bongini

    Hi..
    Env Ubuntu 24.04 with Gnucobol installed from Ubuntu repository
    cobc (GnuCOBOL) 3.1.2.0
    Built Apr 14 2024 07:59:15 Packaged Dec 23 2020 12:04:58 UTC
    C version "13.2.0"
    loading standard configuration file 'default.conf'
    PRB:
    Source files to be compiled are in direcotry
    ~/MyPgm/Cobol
    COPY files are in the direcotory
    ~/MyPgm/Cobol/copy
    when i try to compile it soes not find copy files
    How to specify to gnucobol this directory ?
    thanks in advance for the support

     
    • Mickey White

      Mickey White - 2025-03-12

      Set environmental variable
      COBCPY= your copybook directory
      COBCPY= ~/MyPgm/Cobol/copy

       

      Last edit: Mickey White 2025-03-12
  • Anonymous

    Anonymous - 2025-03-12

    Hi Mickey
    Thanks for the quick answer ...
    for my knowledge..
    investigating .. i issue "cobc --info " command and i get
    COB_COPY_DIR : /usr/share/gnucobol/copy
    which is the search order ?
    1) COB_COPY_DIR
    2) COBCPY
    thanls for the support
    Maurizio

     
    • Mickey White

      Mickey White - 2025-03-12

      Maurizio, Welcome and if you login to the discussion board, your post will not have to be moderated (waiting) and it will post immediately.
      I would not really know Which is first,
      I put all my (user) copybooks in my dev or prd directory
      COB_COPY_DIR : /usr/local/share/gnucobol/copy
      env: COBCPY : /home/mickeyw/cpy:/home/mickeyw/prd/cpy

      I have no problem there. it searches /home/mickeyw/cpy first before the prd/cby
      COBCPY=/home/mickeyw/cpy:/home/mickeyw/prd/cpy

       

      Last edit: Mickey White 2025-03-12
  • Eugenio Di Lorenzo

    Hi,
    please have a look at chapter 10.1.6 Locating Copybooks of Programmers Guide.

     
    👍
    2
  • Maurizio Bongini

    Hi..
    My programmers guidi is old ihas not 10.1.6 it just end at 10.1.5 , i 'll download the last version
    next
    if i put .cpy files to COB_COPY_DIR it works
    if i put
    .cpy files to COBCPY it is unalble to find files
    (i added COBCPY ro .bashrc file via export... logoff end then logon)
    here the output of cobc --info


    COB_COPY_DIR : /usr/share/gnucobol/copy
    env: COBCPY : /home/bong/MyPgm/Cobol/copy


    i suspect my version buggy
    let me know your opinion
    Thanks
    Maurizio

     
  • Simon Sobisch

    Simon Sobisch - 2025-03-13

    COBCPY overrides COB_COPY_DIR which is the "real" name. It is possible that the first one goes away with GnuCOBOL 4.

    So I suggest dropping COBCPY altogether and set COB_COPY_DIR - but only if you need it.
    Commonly it is better to just do something like:

    cobc -I $HOME/MyPgm/Cobol/copy -o $HOME/MyPgm/Cobol/bin/some.so $HOME/MyPgm/Cobol/some.cob, or something along
    cd $HOME/MyPgm/Cobol/bin; cobc -I $HOME/MyPgm/Cobol/copy $HOME/MyPgm/Cobol/some.cob

     

    Last edit: Simon Sobisch 2025-06-25
  • TechInnovator

    TechInnovator - 2025-03-15

    You can specify the directory for COPY files using the -I option in the cobc command. Try compiling with:

    swift

    cobc -I ~/MyPgm/Cobol/copy -x your_program.cob

    This tells GnuCOBOL where to look for COPY files. Hope this helps!

     
    👍
    1
  • Maurizio Bongini

    Thanks to all for the support.. i fix the problem and it was a my error..
    This is the first time i use lubuntu.. in the past i was using debian..
    Debian works with root user and normal users ...
    Lubuntu works with a normal user, but it is in he sudo list...
    I compile my programs using a script, it compiiles executables and move them to system libraries , to perform this second step it neeeds root privilege...
    so i issue
    sudo sh compall.sh
    i modified .bashrc of the user and cobc --info reports COBCPY , but is i issue
    sudo cobc --info
    it does not show COBCPY because i did not modify bash settings in /etc library
    so it works as designed... it was i my error ... i apologyze and renew my thanks to all people supported me
    Maurizio

     
    ❤️
    1

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.