Menu

dbpre GNUCOBOL with mysql

Anonymous
2015-06-07
2021-11-28
<< < 1 2 3 4 5 > >> (Page 2 of 5)
  • Vincent (Bryan) Coen

    The following answers to your question 'Assume' you are using the latest
    versions of the GNU Cobol compiler v2 taken from the source tree or from
    the current RC (release candidate) but recommend you use the latest from
    the code base.

    If not then go to :

    https://sourceforge.net/p/open-cobol/code/HEAD/tree/branches/gnu-cobol-2.0/

    Select 'Download Snapshot'

    Save it in the directory where you wish to have your copy of the
    compiler SOURCES (not the binaries).
    In my case it is cobolsources

    Now extract the zipped file using unzip which will create a new
    directory called :

    open-cobol-code-1350-branches-gnu-cobol-2.0/

    The number 1350 will be higher as it shows the latest commit.

    Change to that directory

    Look at the README file and install the required packages from your
    distro repository, (Shown here are for x64 CPU's)
    that will include :

    libgmp i.e., For
    lib64gmp10
    lib64gmp-devel

    libdb but for 64bit it is For ISAM file processing
    lib64db5.3
    lib64db5.3-devel

    ncurses i.e.,
    lib64ncurses5
    lib64ncurses-devel

    The full GCC development compiler and libraries (including 64bit versions)

    Go into the directory containing the compiler sources and do:

    ./configure

    Assuming the returns with no warning or error msgs but if so resolve
    them (install missing components) before continuing :

    make

    make checkall

    This last one is very important to verify that the build fully worked.

    Again should return NO errors

    Now you can remove the old version if it is below v2 such as v1.1.

    Go back into the compiler directory and do :

    sudo make install

    sudo ldconfig

    Now you can install dbpre in any directory below you user space in my
    case it is ./cobolsrc/dbpre

    Read the README.TXT and action it to build the c api and then the source
    programs changing any file that needs it.

    These are :

    PCTB003B.param
    PCTB004B.param

    To match your systems Mysql install information.

    Note that you must have set up two users with the correct access and
    ownerships one for the master user and the other for yourself.
    I also changed user mysql

    Now continue to following the README file and compile and run the tests.

    It should work if you set up the correct details into the .param files.

    For my development I changed the framework files dramatically for my
    development application (ACAS) as what is supplied is strictly to demo
    the system and hardly for any kind of production.

    Should also point out I have on my distro their standard offering which
    is MariaDB but on my Mac connected to the LAN is MySQL (community
    version). There are differences but you will not notice using dbpre
    but will if you use the more advanced SQL pre compiler system from
    JCurrey which I have made available. This one uses a variation of EXEC
    SQL type directives but does a lot more so I use a combination of both
    but mostly the JC version.

    If you cannot find the JC one you can get it from my website at :

    http://www.applewood.dtdns.net/files/MySQL-Pre-Compilers/JC-Versions/

    and grab the latest version.

    I have updated it again but that is more for the fact that I run MySQL
    and Mariadb and have to cater for the differences.
    Also I find that Mysql runs a lot faster despite running on a slower
    system and that Mysql-Workbench works with MySQL and not Mariadb so have
    to use phpmyadmin which is no way as good or flexible.

    Hopefully I have answered your questions but if not you know where I am :)

    Vince

    ---
    Mod edit, remove some reply-to

     

    Last edit: Brian Tiffin 2017-02-12
  • PatMcC

    PatMcC - 2017-02-11

    Hi Rob and Welcome

    Have a look a t Brians site:
    http://opencobol.add1tocobol.com/

    https://open-cobol.sourceforge.io/faq/index.html

    **Mod edit, old link to current link**

    There are tons of examples of all sorts of things that can be done including working with SQL.

    -Pat

     

    Last edit: Brian Tiffin 2017-02-11
  • Anonymous

    Anonymous - 2017-02-11

    Cheers Guys,

    It's a miserable grey rainy day in Feb in UK!!!
    You have made me smile - Thanks for your help.
    And if I can get the cat to give me my mouse back - I'll have a play.
    BIG thanks to you all for helping me.

    rob

     
    • Vincent (Bryan) Coen

      Not raining here (Hatfield) :)

      ... but I am indoors sitting on a keyboard programming -well ish with a
      glass of wine.

      Vince

      ---
      Mod edit, remove some reply-to

       

      Last edit: Brian Tiffin 2017-02-12
  • Anonymous

    Anonymous - 2017-02-11

    Hello,
    I'm afraid I'm too new for you.
    I downloaded the gnu COBOL and (so long ago) forgotten.
    I think I double clicked a package?
    I have a folder:-
    open-cobol-1.1
    I sort of write my COBOL here:- in my home directory I created a COBOL file, then my programs in it.
    I use a terminal and run gcc to compile as an example program I created:-
    so compiled with:- cobc -x PERSMENU.cob
    Then I run with ./ program name to run
    I am in the library were the compile has put the object (ie in COBOL) when I use ./ in the terminal.
    I can write SQL - using it for DB2 on mframes etc.
    I apologise for being stupid.
    I can get packages for ubuntu using package manager.
    Hwever getting this PCTB003B package and putting it in the folders where open cobol 1-1 is. Is a complete mystery to me.
    Sorry - but I am struggling.
    I need a get this package ie PCTB003b - gotten it.
    But thanks for your post Vincent - but I'm afraid it's all beyond me sorry.
    I'll keep meddling.
    But I need an idiot guide - sorry.

    rob

     
    • Brian Tiffin

      Brian Tiffin - 2017-02-11

      Keep asking questions Rob, that's why we host Help getting started. No question too small. We strive to strike the right balance, but it can take a few back and forths to get where everyone is comfortable.

      Have good,
      Brian

       
    • Vincent (Bryan) Coen

      Do NOT put the Cobol source programs in the same location as the
      binaries - very poor practice but use your own user directories.

      Same applies to the dbpre compiler bits

      From the rest of your comments I have to assume that all of the
      required extra packages are installed as part of v1.1 but with Ubuntu I
      do not really wish to bet the farm on it :)

      Other wise you can get the sources for the latest version and compile
      the compiler following the basic instructions of:

      ./configure
      make
      make checkall

      If that works fully you can replace the very old compiler v1.1 with the
      latest.

      Regardless of that lot follow my instructions for dbpre to build the
      test sample programs using the dbpre supplied scripts

      Vince

      ---
      Mod edit, remove some reply-to

       

      Last edit: Brian Tiffin 2017-02-12
  • Anonymous

    Anonymous - 2017-02-12

    Hello.
    So I have started following Vincents post.
    Did the download Snapshot and unpacked it to below.
    So created a folder here:- '/home/rob/Programs/COBOL/COBSQLSTUFF' with the snapshot stuff unpacked in it:- see attachment.
    I do not know or understand what packages to choose??
    So from thr readme I am hoping (guesing) that the configure and make just do the magic and copy in what is needed? (I am defo 32bit and not 64bit ubuntu -12.04 lts os type 32bit.
    I then from a terminal Cd'd into :-
    cd '/home/rob/Programs/COBOL/COBSQLSTUFF/open-cobol-code-1417-branches-gnu-cobol-2.0'
    I then tried :-
    ./configure
    last few lines from configure are:-
    configure: COB_CONFIG_DIR ${datarootdir}/gnucobol/config
    configure: COB_COPY_DIR ${datarootdir}/gnucobol/copy
    configure: COB_LIBRARY_PATH ${exec_prefix}/lib/gnucobol
    configure: COB_OBJECT_EXT o
    configure: COB_MODULE_EXT so
    configure: COB_EXE_EXT
    configure: COB_SHARED_OPT -shared
    configure: COB_PIC_FLAGS -fPIC -DPIC
    configure: COB_EXPORT_DYN -Wl,--export-dynamic
    configure: COB_STRIP_CMD strip --strip-unneeded
    configure: Dynamic loading: System
    configure: Use gettext for international messages: yes
    configure: Use fcntl for file locking: yes
    configure: Use ncurses/pdcurses/curses for screen I/O: ncurses
    configure: Use Berkeley DB for ISAM I/O: yes
    I then tried make from the above directory:-
    first few lines:-
    rob@rob-desktop:~/Programs/COBOL/COBSQLSTUFF/open-cobol-code-1417-branches-gnu-cobol-2.0$ make
    Creating defaults.h...
    make all-recursive
    make[1]: Entering directory /home/rob/Programs/COBOL/COBSQLSTUFF/open-cobol-code-1417-branches-gnu-cobol-2.0' Making all in libcob make[2]: Entering directory/home/rob/Programs/COBOL/COBSQLSTUFF/open-cobol-code-1417-branches-gnu-cobol-2.0/libcob'
    messages containing missing prototype text then follow .
    Last few lines are:-
    bison -o parser.c parser.y
    /bin/bash: bison: command not found
    make[2]: *** [parser.c] Error 127
    make[2]: Leaving directory /home/rob/Programs/COBOL/COBSQLSTUFF/open-cobol-code-1417-branches-gnu-cobol-2.0/cobc' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory/home/rob/Programs/COBOL/COBSQLSTUFF/open-cobol-code-1417-branches-gnu-cobol-2.0'
    make: *** [all] Error 2

    so can I go onto make checkall ? Or is something very wrong?

    I left it here as had to go hospital visitng etc.

    Anyway - thanks for your help and support.
    Hope your having a good Sunday?

    Thanks

    rob

     
  • Simon Sobisch

    Simon Sobisch - 2017-02-12

    Hi rob,

    the svn snapshots (= developer versions) need more tools installed than the dist-tarballs. If you're on Ubuntu you can install the missing software via apt-get but this may be some 100MBs (for texlive, which will generate a nice PDF from the manual)...
    The easiest option is actually to use the latest dist tarball, it is 2.0rc2 which you can find in the download area. The last rc for the upcoming version will likely need 2-3 weeks, you can update once it is available...

     
  • Anonymous

    Anonymous - 2017-02-12

    Simon,

    Thanks for the reply.
    From your above message, I just about understand how to use sudo apt-get from a terminal.
    However everything else does not make sense to me.
    I am very linited in what I ghave done with native linux(ubuntu).
    So I'm afraid you are pitching way above me.

    regards

    rob

     
    • Simon Sobisch

      Simon Sobisch - 2017-02-12

      Looks like you getting further. Next steps:

      ::sh
      wget https://sourceforge.net/projects/open-cobol/files/gnu-cobol/2.0/gnu-cobol-2.0_rc-2.tar.gz/download -o gnu-cobol-2.0_rc-2.tar.gz
      tar -xvf gnu-cobol-2.0_rc-2.tar.gz
      cd gnu-cobol-2.0
      ./configure # unlinky that anything fails, if it does post output here
      make && make check
      
       
  • Anonymous

    Anonymous - 2017-02-13

    Thanks Simon,

    I have to pause now for a few days.
    Real life and work next few days.
    Will try and attempt the above over next few evenings - and back thinking about it next weekend.
    Many thanks.

    rob

     
  • Anonymous

    Anonymous - 2017-02-14

    Ok Simon,
    trying to execute your commands, unsure if the second line tar -xvf should be part of the first line or executed after the wget line.
    Anyway tried this:

    wget https://sourceforge.net/projects/open-cobol/files/gnu-cobol/2.0/gnu-cobol-2.0_rc-2.tar.gz/download -o gnu-cobol-2.0_rc-2.tar.gz
    

    runs and returns back to this comand line:-

    rob@rob-desktop:~/Programs/COBOL/COBSQLSTUFF/open-cobol-code-1417-branches-gnu-cobol-2.0$
    

    now I do see

    gnu-cobol-2.0_rc-2.tar.gz
    

    However I don't have a gnu-cobol-2.0 directory yet. I am assumin that is why I need to run the second tar. So try that and get:

    tar -xvf gnu-cobol-2.0_rc-2.tar.gz
    gzip: stdin: not in gzip format
    tar: Child returned status 1
    tar: Error is not recoverable: exiting now
    

    So back to the kettle and coffee!

    Regards
    rob

     

    Last edit: Simon Sobisch 2017-02-14
    • Simon Sobisch

      Simon Sobisch - 2017-02-14

      Your steps were fine so far, but the result is strange.

      Is the resulting tar.gz about 2,2 MB? If not download it directly.
      Can you unpack the file directly (not from command line)?

      Simon

       
  • Anonymous

    Anonymous - 2017-02-14

    gnu-cobol-2.0_rc-2.tar.gz
    Tar archive (gzip-compressed) (application/x-compressed-tar)
    4.9 kB (4,879 bytes)
    Downloaded it direct and its now 2.3 mb
    Ecellent
    Running

    tar -xvf gnu-cobol-2.0_rc-2.tar.gz
    

    gives final lines (so it worked :-) )

    gnu-cobol-2.0/THANKS
    gnu-cobol-2.0/TODO
    

    ./ configure looks good - thanks
    last few lines

    configure:  Dynamic loading:                             System
    configure:  Use gettext for international messages:      yes
    configure:  Use fcntl for file locking:                  yes
    configure:  Use ncurses/pdcurses/curses for screen I/O:  ncurses
    configure:  Use Berkeley DB for ISAM I/O:                yes
    

    Now trying

    make && make check
    

    last few lines:-

    /bin/bash: autom4te: command not found
    make[4]: *** [testsuite] Error 127
    make[4]: Leaving directory `/home/rob/Programs/COBOL/COBSQLSTUFF/open-cobol-code-1417-branches-gnu-cobol-2.0/gnu-cobol-2.0/tests'
    make[3]: *** [check-am] Error 2
    make[3]: Leaving directory `/home/rob/Programs/COBOL/COBSQLSTUFF/open-cobol-code-1417-branches-gnu-cobol-2.0/gnu-cobol-2.0/tests'
    make[2]: *** [check-recursive] Error 1
    make[2]: Leaving directory `/home/rob/Programs/COBOL/COBSQLSTUFF/open-cobol-code-1417-branches-gnu-cobol-2.0/gnu-cobol-2.0/tests'
    make[1]: *** [check-recursive] Error 1
    make[1]: Leaving directory `/home/rob/Programs/COBOL/COBSQLSTUFF/open-cobol-code-1417-branches-gnu-cobol-2.0/gnu-cobol-2.0'
    make: *** [check] Error 2
    

    thank you for your help.

    rob

     

    Last edit: Simon Sobisch 2017-02-15
    • Simon Sobisch

      Simon Sobisch - 2017-02-15

      Another strange issue. his is normal if you downloaded from svn but not from a release tarball... (just rechecked: the times of all files seem to be the same, shouldn't be the case).
      As the release tarball has the files generated you should be able to simply touch tests/testsuite and re-run make check. If files in doc or .1 show the same error simply touch them, too.

       
  • Anonymous

    Anonymous - 2017-02-15

    Hello Simon,

    How do I 'simply touch tests/testsuite' before trying make && make check please?

    This is making MVS and JCL look easy ;-))) (argh!!)

    cheers

    rob

     
  • Anonymous

    Anonymous - 2017-02-15

    I just found the touch command!
    So i'll try it later.
    Thanks.
    r

     
  • Anonymous

    Anonymous - 2017-02-15

    Hello Simon,
    I hope this is now looking good?
    did the touch tests/testsute from the /gnu-cobol-2.0 directory.
    Then ran make && make check
    result is:

    ## ------------- ##
    ## Test results. ##
    ## ------------- ##
    
    675 tests behaved as expected.
    1 test was skipped.
    I assume this test was skipped?
    391: SORT: table sort (3)                            skipped (run_misc.at:1990)
    

    Also some tests gave :-

    584: CALL BY VALUE alphanumeric item                 expected failure (run_extensions.at:1022)
    

    I assume expected means it's OK.

    So hopefully a bit more progress thanks to you.

    Regards,

    rob

     

    Last edit: Simon Sobisch 2017-02-16
    • Simon Sobisch

      Simon Sobisch - 2017-02-16

      Yes, this is fine. You can use the software from in-built-tree or (if you have the rights to install) do sudo make install

       
  • Anonymous

    Anonymous - 2017-02-16

    ok - done.
    went into gnu-cobol-2.0 folder and did sudo make install
    make install-recursive
    Making install in libcob


    Libraries have been installed in:
    /usr/local/lib

    This is not dpkg install-info anymore, but GNU install-info
    last line:-
    make[1]: Leaving directory `/home/rob/Programs/COBOL/COBSQLSTUFF/open-cobol-code-1417-branches-gnu-cobol-2.0/gnu-cobol-2.0'
    rob@rob-desktop:~/Programs/COBOL/COBSQLSTUFF/open-cobol-code-1417-branches-gnu-cobol-2.0/gnu-cobol-2.0$

    so is it next step to the package thing for allowing me to use EXEC SQL statements in my COBOL?

    rgds

    rob

     
  • Anonymous

    Anonymous - 2017-02-17

    Hello,
    I am assuming it's now these steps?

    sudo ldconfig
    Now you can install dbpre in any directory below you user space in my
    case it is ./cobolsrc/dbpre
    Read the README.TXT and action it to build the c api and then the source
    programs changing any file that needs it.
    These are :
    PCTB003B.param
    PCTB004B.param
    To match your systems Mysql install information.

    Please can you help me unpack them a bit more.
    I can go into
    rob@rob-desktop:~/Programs/COBOL/COBSQLSTUFF/open-cobol-code-1417-branches-gnu-cobol-2.0/gnu-cobol-2.0$
    and type sudo ldconfig?
    Then I am struggling with the PCT stuff and the database I use is MySQL.

    I really appreciate all your help.

    Regards
    rob

     
    • Brian Tiffin

      Brian Tiffin - 2017-02-18

      I'm not up on all the other ins and outs of this thread Rob, but sudo ldconfig can be typed from any working directory. It affects system files, the ld.so cache in particular. It won't matter where you type in the command. See man ld.so for the full skinny (well, hints on the full skinny and pointers to further reading).

      The ld.so cache will be a separate issue from dbpre and MySQL compile time and runtime lookups.

      Cheers,
      Brian

       
    • Vincent (Bryan) Coen

      Now and assuming you have installed the compiler after building it by using

      'sudo make install'

      Go to the directory you have un-archived dbpre in to.

      The following is NOT good practice or secure so use it short term as
      using root as the test user is not wise.

      1. First ensure you have set up Mysql correctly including :
        A. That the root user has a password set up if not create one but
        not the same as Linux root user password.
        B. Know what the following settings are for you MySql install
        which you would have found out to check the setting for (A).

      2. Change the dbpre files PCTB003B.param and 4B.param values as shown
        here :


      DBHOST=localhost
      DBUSER=root
      DBPASSWD=YourPasswordHere <=== change it!! (IT IS case sensitive)
      DBNAME=testdb
      DBPORT=03306
      DBSOCKET=null


      1. Compile the C api - the .o file is needed for all of your programs
        gcc -I/usr/include/mysql -c cobmysqlapi.c

      I run under 64 bit Linux so I have to do a modification of the above to :

      gcc -fPIC -I/usr/include/mysql -c cobmysqlapi.c
      
      1. Compile the dbpre pre compiler which is used for all programs
        requiring the pre-compiler by :
        c

      2. Test that it worked by :
        dbpre --help

        should produce :

      --
      dbpre V 0.4 2015-09-24
      dbpre [options] progname

      Options

      -h, --help - this message
      -v, --version - print version of dbpre
      -I - specify path for copybooks, e.g -I/tmp/copybooks/
      -ts - tab stop, tabs will be expanded to nnn spaces, e.g. -ts=3
      -f - freestyle source code formatting allowed

      Developed by the_piper@web.de
      For more infos see here: http://pipersopencoboltoolbox.blogspot.de/
      --

      1. Compile the sample programs by running :
        cPCTB003B
        cPCTB004B
        cPCTB004S

      2. Now you can run the sample program by :
        PCTB003B
        PCTB004B

      You will get a lot of displayed information but each one ending with :

      For 3B :
      

      Ende PGCTB-ACTION.


      • *
      • *
      • End....: 2017-02-18 15:06:55 *
      • *
      • *


      For 4B :
      

      ----

      End PGCTB-ACTION (subroutine).
      after CALL PCTB004S001 Status=000
      EXIT display-all-records
      End PGCTB-ACTION (batch program).


      • *
      • *
      • End....: 2017-02-18 15:07:00 *
      • *
      • *


      All the above is in the README file but I must admit could do with being
      a lot clearer.

      Now you can use the tool how ever if you are going to use it for your
      Cobol programs you WILL want to change the frame work copy books to suit
      your needs.

      In addition I have made mods to the api c code to include extra
      functions such as getting the result from SQL-State which I find has
      more info over the standard errno which does not provide info for dup keys.

      I use the modified api c library with the JCurrey MySQL pre compiler
      mostly as it does more of the work when creating a program such and
      bringing in the table layouts and copy books from them.

      If I get time I will change the dbpre one to do similar but as it is in
      C and I am a bit rusty using it will be later this year (at the
      earliest) as I am still updating the ACAS accounts package (available on
      Sourceforge) to use MySQL RDB instead of or in addition to Cobol files
      as well as rewriting the manuals and want that release in the next month
      or two.

      Vince

      On 18/02/17 05:18, noreply@in.sf.net wrote:

      Hello,
      I am assuming it's now these steps?

      sudo ldconfig
      Now you can install dbpre in any directory below you user space in my
      case it is ./cobolsrc/dbpre
      Read the README.TXT and action it to build the c api and then the source
      programs changing any file that needs it.
      These are :
      PCTB003B.param
      PCTB004B.param
      To match your systems Mysql install information.

      Please can you help me unpack them a bit more.
      I can go into
      rob@rob-desktop:~/Programs/COBOL/COBSQLSTUFF/open-cobol-code-1417-branches-gnu-cobol-2.0/gnu-cobol-2.0$
      and type sudo ldconfig?
      Then I am struggling with the PCT stuff and the database I use is MySQL.

      I really appreciate all your help.

       
  • Rob Heath

    Rob Heath - 2017-02-18

    Hello,
    Thanks for your help.
    I think some of my confusion is coming from the PCTB003B download.
    When I download it as PCTB003B it appears in my download file as see an executable not a zipped file:- see image below.
    However if I browse all files from the dbpre sourceforge screen I see a list of files including the ones you refrence above.
    I will make a dbpre folder under here:-
    rob@rob-desktop:~/Programs/COBOL/COBSQLSTUFF/open-cobol-code-1417-branches-gnu-cobol-2.0/gnu-cobol-2.0$
    Then I will carry on following your kind instructions.

    regards
    rob

     
<< < 1 2 3 4 5 > >> (Page 2 of 5)

Anonymous
Anonymous

Add attachments
Cancel