Error in an Insert using BLOB with Acucobol and Embeded SQL

Hi,

We are trying to insert a file in a BLOB in the database. Is it possible to do it with Acucobol? Do someone have a sample for that?

The support team said that BLOB type is not supported but maybe someone found a way to deal with this restriction.

We have a variable defined in this way:

01 documento-BLOB SQL TYPE IS BLOB(1048576).

We can do a select but when we want to do an insert we receive a memory access violation error.

Regards,

  • I do not believe type is blob or usage blob is supported. You might try a large PIC X() field, say a size of 16K or something along those lines.

  • Hi, 

    It didn´t work. Defining the variable this way:

    01 documento-BLOB.
           49 MY-BLOB-LENGHT  PIC 9(9) BINARY.
           49 MY-BLOB-DATA        PIC X(16384).

    Doesn´t compile and returns an error :

    The host variable data lenght is out of range.
    The host variable "DOCUMENTO-BLOB" is undefined.
    A value is not compatible with the data type of its assignment tarjet. Target name is "DOCUMENTO". SQLSTATE=42821

    Regards,

  • Using the compiler - no options a PIC X(16384) compiles for me

    Using the compiler and AcuSQL embedded precompiler .. the -Ps compiler option this compiles.

    EXEC SQL INCLUDE SQLCA END-EXEC.

    EXEC SQL BEGIN DECLARE SECTION END-EXEC.
    01 C-RECORD.
    05 C-NUMBER PIC S9(3) COMP-5.
    05 C-FIRST-NAME PIC X(20).
    05 C-LAST-NAME PIC X(20).
    05 C-BIRTHDAY PIC X(19).
    05 C-INFO PIC X(16384).

    01 dsn-name pic x(12).
    01 userid pic x(8).
    01 passwd.
    49 passwd-length PIC s9(4) comp-5 value 0.
    49 passwd-name PIC x(18).
    EXEC SQL END DECLARE SECTION END-EXEC.

  • Hi,

    AcuSQL is not being used but the DB2 precompiler. Then the generated Cobol source file is compiled with Acu this way:

    db2 PREP ./Source/$1.sqb TARGET ANSI_COBOL BINDFILE FUNCPATH cob_generico COLLECTION cob_generico QUALIFIER cob_generico PACKAGE USING "$1"

    db2 bind ./Bind/$1.bnd COLLECTION cob_generico QUALIFIER cob_generico

    ccbl -Sp .:./Copylib:/desarrollo/cobol/llamados/FD:/desarrollo/cobol/auxiliares/definiciones_parametros:/desarrollo/cobol/auxiliares/definiciones_tablas:/desarrollo/cobol/auxiliares/definiciones_tablas/compras:/desarrollo/cobol/auxiliares/definiciones_tablas/roles:/desarrollo/cobol/auxiliares/definiciones_tablas/entidades:/desarrollo/cobol/auxiliares/definiciones_tablas/especialidades:/desarrollo/cobol/auxiliares/definiciones_tablas/historia:/home/db2inst1/sqllib/include/cobol_a -Ga -Zl -Zy -Za ./Source/$1.cbl

    So, what compiler option do you propose?

    Regards,

     

  • Your compiler options look correct, there isn't anything special needed to compile. You might try -dw32

    If the error is the 42821, that error is a DB2 error. The data item value is not recognized by DB2.  It would probably be best to provide the pre compiled output to Customer Care to see if they can sort it out.