× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Well, I think I have this figured out.  Now I just need to see if Domino 
can read this BLOB field.

     H ActGrp(*CALLER)
     H DftActGrp(*NO)
 
***************************************************************************
      * Program:      *
      * This is a test program.  It tests how to populate a blob field.   
*
      * Inputs:      *
      *  A one character field that is the record key to the file.      *
      *  The IFS file name to fill the blob field with.  Sample:      *
      *   //ROB/dominochatsept12.pdf      *
      *      *
      * Modification log:      *
      * mm/dd/02 by R.Berendt, CCP    Group Dekko Services, LLC      *
      *          Created.      *
      *      *
      * Compilation instructions:      *
      *   (no special instructions this time.)      *
      *      *
 
***************************************************************************


      /DEFINE DSpec
     D BLOB            PR                  EXTPGM('BLOB')
     D  FileKey                       1a
     D  FileName                    255a

     D InsertSQl       PR

     D CreateFileSql   PR

     D BLOB            PI      *ENTRY PLIST
     D  FileKey                       1a
     D  FileName                    255a

     D My_File         s                   SQLTYPE(BLOB_FILE)
     D* Code/400 may have a problem with the above.  That's ok, the 
compiler won't.
     D* My_File will be expanded by the SQL preprocessor to the following:
     D*My_File         DS
     D* My_File_NL                   10u 0 // Name Length
     D* My_File_DL                   10u 0 // Data Length
     D* My_File_FO                   10u 0 // File Operation
     D*                                    // SQFRD  =  2 = This is a file 
that can be open, read
     D*                                                     and closed. 
DB2 figures the length of
     D*                                                     the file, in 
bytes, and stores that into
     D*                                                     My_File_DL.
     D*                                    // SQFCRT =  8 = Create a new 
file.  If the file already
     D*                                                     exists, 
generate an error.
     D*                                    // SQFOVR = 16 = Create a new 
file.  If the file already
     D*                                                     exists, 
overwrite it.
     D*                                    // SQFAPP = 32 = Create a new 
file.  If the file already
     D*                                                     exists, append 
to it.
     D* My_File_Name                255a   // IFS file name
      /UNDEFINE DSpec

     C/EXEC SQL
     C+ Set Option
     C+     Naming    = *Sys,
     C+     Commit    = *None,
     C+     UsrPrf    = *User,
     C+     DynUsrPrf = *User,
     C+     CloSqlCsr = *EndMod
     C/END-EXEC

      /free
       My_File_NL = %len(%trim(FileName));
       My_File_FO = SQFRD; // FileOperation = Read from the IFS file
       My_File_Name = %trim(FileName);
       InsertSql();
       *inlr=*on;
       return;
      /end-free

     P InsertSql       B
     D InsertSql       PI
     C/EXEC SQL
     C+ Insert into TestBlob
     C+  (MyChar, MyBlob)
     C+ Values(:FileKey, :My_File)
     C/END-EXEC
     C/free
       dsply sqlstt;
       dsply sqlcod;
       return;
      /end-free
     P InsertSql       E

     P CreateFileSql   B
     D CreateFileSql   PI
     D* Dummy subprocedure.  Used for documentation only.
     C/EXEC SQL
     C+ CREATE TABLE ROB/TESTBLOB
     C+  (MYCHAR CHAR ( 1) NOT NULL WITH DEFAULT,
     C+   MYBLOB BLOB (100 m) NOT NULL WITH DEFAULT)
     C/END-EXEC
     C/free
       dsply sqlstt;
       dsply sqlcod;
       return;
      /end-free
     P CreateFileSql   E

Rob Berendt
-- 
"They that can give up essential liberty to obtain a little temporary 
safety deserve neither liberty nor safety." 
Benjamin Franklin 

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.