skip to main content

Library Routines : ESQL$BLOB

ESQL$BLOB
The ESQL$BLOB library routine provides a number of functions to handle BLOB data in ESQL programs.
Syntax:
 CALL "ESQL$BLOB" USING opCode 
Parameters:
Return code:
returnCode definition and meaning depend on the opcode.
Examples:
Example - The following program creates a test table and stores the file img1.bmp inside it as a blob. After it, the program reads the previously inserted record and writes the blob to a file named blob.bmp.
       PROGRAM-ID. readwriteblob.
       WORKING-STORAGE SECTION.
       copy "SQLCA".
       copy "iscobol.def".
       01 W-REC.
        03 W-KEY   pic 9(4).
        03 W-DATA  pic x(30).
        03 W-BLOB  HANDLE.
       PROCEDURE DIVISION.
           CALL "ESQL$BLOB" USING GET-BLOB-FROM-FILE, W-BLOB,"img1.bmp".
                ALTER TABLE IS_TABLE ADD PRIMARY KEY (IS_KEY)
           EXEC SQL INSERT INTO IS_TABLE VALUES (1'row1',
           CALL "ESQL$BLOB" USING FREE-BLOB-HANDLE, W-BLOB.
                SELECT * INTO :W-KEY, :W-DATA, :W-BLOB
           CALL "ESQL$BLOB" USING PUT-BLOB-INTO-FILE, W-BLOB, "blob.bmp".

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left