Informix

 View Only
Expand all | Collapse all

Updated utils2_ak package available

  • 1.  Updated utils2_ak package available

    IBM Champion
    Posted Fri November 24, 2023 01:07 PM

    Folks:

    I have uploaded updates to myschema and dostats_ng.ec included in the latest utils2_ak.zip package. Here are the changes:

    Added version & copyright to the verbose 2+ output in dostats. Thanks to Chris Karsten for the suggestion.


    Myschema: Fixed the reported length of LVARCHAR type columns when the multibyte flag is set.
    Fixed routine parameter lists in GRANT and REVOKE statements for stored routines that contain complex
    parameters. Thanks to Davorin Kremenjas for reporting these issues.



    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------


  • 2.  RE: Updated utils2_ak package available

    Posted Mon November 27, 2023 04:59 AM

    Art,

    Where can we find it?



    ------------------------------
    Sincerely,
    Dennis
    ------------------------------



  • 3.  RE: Updated utils2_ak package available

    IBM Champion
    Posted Mon November 27, 2023 07:26 AM

    Woops, sorry, you can always find the latest release of my utilities on my web site, free to download and use, at:

    My Utilities

    ASK Database Management remove preview
    My Utilities
    Utils2_ak is my primary package of utilities. This is the November 24, 2023 release. Included: dbping.ec - Tests connections and reports connection time as well as the actual host...
    View this on ASK Database Management >



    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------



  • 4.  RE: Updated utils2_ak package available

    Posted Tue November 28, 2023 04:46 AM

    Art,

    FYI: In ratios.1170.sql a procedure is called rt() instead of ratios()



    ------------------------------
    Sincerely,
    Dennis
    ------------------------------



  • 5.  RE: Updated utils2_ak package available

    IBM Champion
    Posted Tue November 28, 2023 07:20 AM

    Thanks Dennis. Don't remember when or why I did that. Probably I was testing it on a system where I didn't want to overwrite an existing copy and forgot to rename it in the file afterwards. I'll upload a fixed package later today.

    Art



    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------



  • 6.  RE: Updated utils2_ak package available

    Posted Tue December 05, 2023 05:00 AM

    Art,

    I modified ratios() for 11.70 to meet conditions of read-only replica.
    The original procedure has aborted with a division-by-zero error.



    ------------------------------
    Sincerely,
    Dennis
    ------------------------------



  • 7.  RE: Updated utils2_ak package available

    IBM Champion
    Posted Tue December 05, 2023 05:04 PM

    Thank you Dennis. I have included those fixes and a few related ones in an updated package uploaded to my web site today. 

    Folks:I have also updated the ratios.sql script to include the new RAU calculation that will only work in Informix v14.10.FC8 or later. If you have an earlier release you can install the ratios.1410.preFC8.sql which is identical to the ratios.sql in the previous package release with Dennis's fix included.



    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------



  • 8.  RE: Updated utils2_ak package available

    Posted Wed December 06, 2023 12:33 PM

    Art,

    Building the package on AIX 7.1 with GNU make and gcc I got the following warnings:

    getopt.c: In function 'exchange':
    getopt.c:106:27: warning: incompatible implicit declaration of built-in function 'malloc' [enabled by default]
       #define __alloca        malloc
                               ^
    getopt.c:274:27: note: in expansion of macro '__alloca'
       char **temp = (char **) __alloca (nonopts_size);
                               ^

    Also, I had to replace <getopt.h> with <unistd.h>.



    ------------------------------
    Sincerely,
    Dennis
    ------------------------------



  • 9.  RE: Updated utils2_ak package available

    IBM Champion
    Posted Wed December 06, 2023 02:17 PM

    That one is really strange Dennis. The line in question is not defining/declaring malloc but rather defining __alloca to be replaced by malloc. The argument list should be correct anyway in the call at the top of exchange(). Maybe try removing the space between __alloca and the argument list, though that shouldn't make any differencce.

    Why did you need to replace getopt.h with unistd.h? The getiopt.h header is included in the package. Which utility was compiling at this point?

    Art



    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------



  • 10.  RE: Updated utils2_ak package available

    Posted Thu December 07, 2023 08:06 AM

    Art,

    You have `#include <getopt.h>` in a couple of files. Below is my utils2_ak.patch file to apply against the source.

    Before applying the patch I have to fix file permissions: `chmod 644 Makefile *.ec`

    --- Makefile    2023-02-22 16:59:50.000000000 +0300
    +++ Makefile.new        2023-12-07 12:08:29.000000000 +0300
    @@ -5,7 +5,7 @@
      # If your copy of GNU make is not called 'make' or is not first in
      # your path set the variable MAKE appropriately so the recursive make
      # of myschema will use the correct version of make.
    - MAKE=make
    + MAKE=/opt/freeware/bin/make

      .SUFFIXES:
      .SUFFIXES: .ec .c .o
    @@ -91,12 +91,12 @@
      bload: ul
            -rm bload 2>/dev/null
            -ln ul bload
    -       -touch -h bload
    +       -touch bload

      bunload: ul
            -rm bunload 2>/dev/null
            -ln ul bunload
    -       -touch -h bunload
    +       -touch bunload

      printfreeB: printfreeB.ec
            INFORMIXC=$(INFORMIXC) $(ESQL) $(ECFLAGS) -o $@ $^
    --- dbdelete.ec 2023-10-26 22:52:42.000000000 +0300
    +++ dbdelete.ec.new     2023-12-07 12:09:04.000000000 +0300
    @@ -83,7 +83,11 @@
      #include <string.h>
      #include <errno.h>
      #include <time.h>
    + #ifdef _AIX
    + #include <unistd.h>
    + #else
      #include <getopt.h>
    + #endif

      EXEC SQL include sqlca;
      EXEC SQL include sqlda;
    --- dbping.ec   2021-12-21 20:12:53.000000000 +0300
    +++ dbping.ec.new       2023-12-07 12:09:22.000000000 +0300
    @@ -86,7 +86,11 @@
      #endif
      #include <time.h>
      #include <sys/time.h>
    + #ifdef _AIX
    + #include <unistd.h>
    + #else
      #include <getopt.h>
    + #endif
      #include <errno.h>

      #define SQLOK 0
    --- myschema.d/myschema.mk      2023-11-24 16:55:31.000000000 +0300
    +++ myschema.d/myschema.mk.new  2023-12-07 12:40:37.000000000 +0300
    @@ -4,12 +4,12 @@
      SHELL=/usr/bin/ksh
      VPATH=.:./RCS

    - LDFLAGS=                      # none needed on most systems
    + # LDFLAGS=                    # none needed on most systems
      # LDFLAGS=-static             # static libraries are not compatible under GCC v5 or later
      # LDFLAGS=-xarch=v9           # For Solaris 64bit versions
      # LDFLAGS=-q64                        # For AIX 64 bit mode using XLC
      # LDFLAGS=-q64 -static                # For AIX 64 bit mode & static link using XLC
    - # LDFLAGS=-maix64             # For AIX 64 bit mode using GCC
    + LDFLAGS=-maix64               # For AIX 64 bit mode using GCC

      CFLAGS=$(CDFLAGS)
      # CFLAGS=$(CDFLAGS) -Ae               # For HP-32bit executables
    @@ -20,10 +20,10 @@
      # ECFLAGS=$(CFLAGS) -EDbigint=int # For CSDK earlier than 3.50

      # CDFLAGS=-g
    - CDFLAGS=-O3             # Mostly only for GCC
    + # CDFLAGS=-O3             # Mostly only for GCC
      # CDFLAGS=-O2 -qmaxmem=32768    # For AIX using XLC to improve optimization.
      # CDFLAGS=-O2 -qmaxmem=32768 -q64    # For AIX 64bit using XLC
    - # CDFLAGS=-O3 -maix64 # For AIX 64bit using GCC
    + CDFLAGS=-O2 -maix64   # For AIX 64bit using GCC
      # CDFLAGS=-O            # For HP and other systems that do not have -O3
      # CDFLAGS=-Onolimit   # For myschema.ec only - the HP compiler complains that
      #                     # it does not have enough memory to optimize & suggests



    ------------------------------
    Sincerely,
    Dennis
    ------------------------------



  • 11.  RE: Updated utils2_ak package available

    IBM Champion
    Posted Thu December 07, 2023 08:55 AM

    Dennis:

    I'm aware that getopt.h is included in several places. The file is included in the distribution so I'm wondering why you ran into a need to use unistd.h instead? I may need to add a note about that in the Building file.

    Art



    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------



  • 12.  RE: Updated utils2_ak package available

    Posted Thu December 07, 2023 09:42 AM

    Art,

    I haven't find the getopt.h file in my distribution, that's why I use unistd.h.

    If your distribution has /usr/include/getopt.h, which package does it come from?



    ------------------------------
    Sincerely,
    Dennis
    ------------------------------



  • 13.  RE: Updated utils2_ak package available

    Posted Wed January 03, 2024 02:27 PM

    "The warnings you're encountering during the package build on AIX 7.1 with GNU make and gcc seem to be related to incompatible declarations with the 'malloc' function. It appears that there's an implicit declaration conflict within the 'getopt.c' file.

    To address the warning regarding 'malloc', it might be helpful to review the 'getopt.c' file, particularly around line 106 where the 'malloc' function seems to be implicitly declared as '__alloca'. This could potentially conflict with the system's declaration of 'malloc'.

    Regarding the replacement of '<getopt.h>' with '<unistd.h>', if your system requires this change, it's likely due to differences in header file structures or system-specific configurations. This might affect how certain functions or declarations are handled within your code.

    To resolve these warnings, you may need to modify the 'getopt.c' file, ensuring proper declarations and include statements. Additionally, consider checking the codebase for any system-specific configurations or requirements for AIX 7.1, especially regarding memory allocation functions like 'malloc'."



    ------------------------------
    John Michal
    ------------------------------



  • 14.  RE: Updated utils2_ak package available

    IBM Champion
    Posted Wed January 03, 2024 03:11 PM

    You only really need the getopt.c for myschema which uses extended commands which are not supported by the AIX delivered version of getopt() when using the AIX xlc compiler. However, if you are using the GNU-C libraries,  you do not need the getopt.c at all because the GNU getopt() supports the extended arguments. 

    Art



    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------



  • 15.  RE: Updated utils2_ak package available

    Posted Thu December 14, 2023 09:42 AM

    Art,

    On AIX 7.1, myschema fails with coredump on VIEWs:

    Writing full schema DDL to:       stdout
    Memory fault(coredump)



    ------------------------------
    Sincerely,
    Dennis
    ------------------------------



  • 16.  RE: Updated utils2_ak package available

    IBM Champion
    Posted Thu December 14, 2023 01:13 PM

    Dennis:

    Would it be possible to compile it with -g and run it in a debugger to at least get me a location in the code where it is crapping out?

    Art



    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------



  • 17.  RE: Updated utils2_ak package available

    Posted Fri December 15, 2023 05:48 AM
    Edited by Dennis Melnikov Fri December 15, 2023 05:55 AM

    Starting program: /home/denis/ArtKagel/utils2_ak/myschema -d eagle -t v_reestr_ord_k1
    Writing full schema DDL to:       stdout

    Program received signal SIGSEGV, Segmentation fault.
    0x00000001001c5c84 in gettok2 () at tokens.c:135
    135                 *delp = *pos;
    (gdb) bt
    #0  0x00000001001c5c84 in gettok2 () at tokens.c:135
    #1  0x00000001001c3cd4 in print_views (tabid=2904, tabname=0x11006fff8 <systables> "v_reestr_ord_k1",
      owner=0x110070079 <systables+129> "systec", outfile=0x9001000a0004d40 <_iob+88>,
        outfileG=0x9001000a0004d40 <_iob+88>, tabauths=1, colauths=1, grantas=1) at print_views.ec:253
    #2  0x000000010000db8c in main (argc=5, argv=0xffffffffffff308) at myschema.ec:3539
    (gdb) print delp
    $1 = 0x20000001100b3280 <error: Cannot access memory at address 0x20000001100b3280>



    ------------------------------
    Sincerely,
    Dennis
    ------------------------------



  • 18.  RE: Updated utils2_ak package available

    IBM Champion
    Posted Fri December 15, 2023 07:05 AM

    That's great. Thanks Dennis. Hopefully that will be enough for me to figure out what's happening.

    Art



    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------



  • 19.  RE: Updated utils2_ak package available

    IBM Champion
    Posted Fri December 15, 2023 08:44 AM

    Getting closer. Dennis: Please send me the schema for the v_reestr_ord_k1 view from dbschema -ss.

    Art



    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------



  • 20.  RE: Updated utils2_ak package available

    Posted Fri December 15, 2023 08:59 AM

    create view "systec".v_reestr_ord_k1 (reestr_id,ship_via_code,accepted,z_num,status,source,collect,transfer_num,rsd_code,rsd_code_auto,autograph_type,shed_dt,unreglament) as
      select x0.reestr_id ,x0.ship_via_code ,x0.accepted ,x0.z_num
        ,x0.status ,x0.source ,x0.collect ,x0.transfer_num ,x1.code
        ,x2.code ,x3.autograph_type ,x0.shed_dt ,x0.unreglament from
        "systec".reestr_ord_k1 x0 ,outer("kdg".rsd_rule x1 ) ,outer(
        "kdg".rsd_rule x2 ) ,outer("systec".customer_1 x3 ) where (((x0.rsd_id
        = x1.rsd_id ) AND (x0.auto_rsd_id = x2.rsd_id ) ) AND (x0.cust_num
        = x3.cust_num ) ) ;



    ------------------------------
    Sincerely,
    Dennis
    ------------------------------