Menu

Configure compiler to manage indexed files

2020-08-07
2024-11-19
  • Óscar Guajardo

    Óscar Guajardo - 2020-08-07

    Hi.
    I have the following code:

    ENVIRONMENT DIVISION.
      9 INPUT-OUTPUT SECTION.
     10 FILE-CONTROL.
     11         select CustomerFile assign to "customers.txt"
     12             organization is indexed
     13             access mode     is random
     14             record key      is IDNum.
     15 *>END ENV
    

    When I compile using cobc -xj -free filename.cob I get the following message: error [-Werror]: compiler is not configured to support ORGANIZATION INDEXED; FD CustomerFile.

    I read on the docs that the "organization indexed" instruction doesn't really do anything (which I find a bit puzzling), but I want this program to compile. Reading the file /etc/gnucobol/runtime.conf I found the options to handle these sort of files; also, here is the output of cobcrun -i:

    libcob (GnuCOBOL) 4.0-early-dev.0
    Copyright (C) 2020 Free Software Foundation, Inc.
    License LGPLv3+: GNU LGPL version 3 or later <http://gnu.org/licenses/lgpl.html>
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    Written by Keisuke Nishida, Roger While, Ron Norman, Simon Sobisch, Edward Hart
    Built     Jul 12 2020 03:26:15
    Packaged  Jun 06 2020 20:56:36 UTC
    
    build information
    build environment        : x86_64-pc-linux-gnu
    CC                       : gcc
    C version                : "9.3.0"
    CPPFLAGS                 : -Wdate-time -D_FORTIFY_SOURCE=2
    CFLAGS                   : -g -O2 -finline-functions -U_FORTIFY_SOURCE -pipe
                               -fsigned-char -Wall -Wwrite-strings
                               -Wmissing-prototypes -Wno-format-y2k
    LD                       : /usr/bin/ld -m elf_x86_64
    LDFLAGS                  : -Wl,-z,relro -Wl,-z,relro,-z,now,-O1
    
    GnuCOBOL information
    COB_MODULE_EXT           : so
    dynamic loading          : system
    64bit-mode               : yes
    BINARY-C-LONG            : 8 bytes
    endianness               : little-endian
    native character set     : ASCII
    extended screen I/O      : ncursesw, version 6.2.20200212 (CHTYPE=32, WIDE=1)
    mouse support            : yes
    variable file format     : 0
    sequential file handler  : built-in
    indexed file handler     : disabled
    mathematical library     : GMP, version 6.2.0
    XML library              : disabled
    JSON library             : disabled
    

    So the "index file handler" is disabled, and I want to enable it. How do I do this? I tried uncommenting lines in runtime.conf but I realised this file is not exactly for that, but I cannot find out where or how I can enable the indexed file handler. Where does one do that?
    Thanks!

     
    • Vincent (Bryan) Coen

      You will need to install a ISAM library such as BDB (Berkeley database) from Oracle or VBISAM etc.

      Personally I have always used BDB (including the development headers) as I have found in the past that the others have problems.

      Once done and installed now recompile gnucobol and based on your previous by running

      ./configure --without-xml2 --without-cjson  --with-db  # <- if using BDB
      

      otherwise do ./configure -h and look near the end for the others)

      make > build.log 2>build.err
      

      examine build.err for errors and if needed fix them before rerunning above.

      make check
      

      if good: now do

      make test
      

      and if that good then

      sudo make install
      

      You should really know most of the above already .

       

      Last edit: Simon Sobisch 2020-08-11
      • Anonymous

        Anonymous - 2024-11-19

        how can I install BDB?

         
        • Mickey White

          Mickey White - 2024-11-19

          This is the default: Use Berkeley DB >= 4.1 (libdb) (ISAM handler)
          https://sourceforge.net/projects/gnucobol/files/

           
        • Simon Sobisch

          Simon Sobisch - 2024-11-19

          If you don't have BDB installed (system package manager is commonly preferable) you may want to check the dependency install on [7c6b048b95].
          If you don't need ORGANIZATION INDEXED then configure --without-db would be best in any case (smaller footprint).

          If you want that and don't have it installed - you can also get it from Oracle - either a current version (may not be well tested with GC) or the last one with the old license.

          See https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-db/PKGBUILD for a recipe to build it - if you need patches to compile it on a more modern environment.

           

          Related

          Discussion: 7c6b048b95

        • Vincent (Bryan) Coen

          As a follow on from Simon's post, I have been ruuning for some years, db-18.1.32, although I also have 18.1.40 but have compiled it just never installed.
          This under Magiea v9 X64 Linux.

           
  • Simon Sobisch

    Simon Sobisch - 2020-08-11

    GC 4+ comes with the option to include multiple index handlers and then adjust per actual file which one to use. Currently you have to explicit note which ones to include, the old default can be included with --with-db.
    I hope to find the time to work on the configure script this week, the planned behaviour is to include every indexed handler which is available (if not explicit disabled by --without).

     
    • Óscar Guajardo

      Óscar Guajardo - 2020-08-11

      Thank you! Indeed, I compile with --with-db and now the file comipiles. Cheers!

       
  • Anonymous

    Anonymous - 2020-08-12

    currently taking online training course inCobol using Cygwin & Gnucobol. I canno
    get the make command to work. Using gnucobol 3.3.03.3.0tar.3.3.03.3.0tar.gz version
    Ican unzip and configure but can't get "make"make"work
    Please Help!

     
    • Simon Sobisch

      Simon Sobisch - 2020-08-12

      Any course that begins with a Cygwin install is not a COBOL course (and if its the lynda one then it isn't so good in any case)...

      I suggest to skip that building part and just take the pre-built 3.3 binaries from https://arnoldtrembley.com/GnuCOBOL.htm - if you want to build it with Cygwin on your own please create a new topic for that [and possibly login/register as it removes the need and delay of manual moderation]. Side note: if you don't have cygwin setup before and don't want to use it in any case then I'd suggest to not use it "only for GnuCOBOL".

       
  • Vincent (Bryan) Coen

    I do not know what version of the Cobol compiler you are trying to install as the last two versions are v3.0 and v3.1 with v4.0 being in early development so a v3.3 has never been created.

    Suggest you obtain v3.1 rc-1 from Arnold's wsite if using Windows at :
    https://arnoldtrembley.com/GnuCOBOL.htm

    What website did you get the 'v3.3' version from ?

     

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.