× 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.


  • Subject: Re: BLOB
  • From: "R. Bruce Hoffman, Jr." <rbruceh@xxxxxxxxxxxxx>
  • Date: Wed, 8 Dec 1999 22:17:19 -0500

-----Original Message-----
From: Rob Berendt <rob@dekko.com>
To: MIDRANGE-L@midrange.com <MIDRANGE-L@midrange.com>
Date: Wednesday, December 08, 1999 5:32 PM
Subject: Re: BLOB


>How about a few lines of code or an SQL statement or something that would
link the two
>
>file
>/drawings/ABC123.bmp
>
>into file mylib/myfile in the record that has a key equal to the prefix of
the file name, ABC123
>and has a datalink or blob or whatever field.
>


SQL:

Create table tablea (keyfield char(6), blobfile blob)
Alter table tablea add primary key (keyfield)

Now COBOL, but you get the idea...
------------------------------------------------------------------------
EXEC SQL begin declare section end-exec.
   01 theFile            usage is sql type is BLOB-FILE.
EXEC SQL end declare section end-exec.

move  "/drawings/ABC123.bmp" to theFile-name
move 20 to theFile-name-length
move SQL-FILE-READ to theFile-file-options

EXEC SQL insert into tablea (keyfield, blobfile) values (:key, :theFile)
end-exec.

move SQL-FILE-OVERWRITE to theFile-file-options
EXEC SQL select blobfile into :theFile from tablea where keyfield = 'ABC123'
end-exec.

-----------------------------------------------------------------------

In RPG I think the SQL type def is something like:
D theFile         S           SQLTYPE(CLOB_FILE)

-----------------------------------------------------------------------
These actions will transfer the file into and out of the blob field.
Alternatively, if you can declare a field large enough in the language you
are using, you could read the file into the field, put the field in the file
and select the value out of the file and into the field. The BLOB-FILE type
allows this to happen at the database manager level without writing code.

===========================================================
R. Bruce Hoffman, Jr.
 -- IBM Certified AS/400 Professional System Administrator
 -- IBM Certified AS/400 Professional Network Administrator

"The sum of all human knowledge is a fixed constant.
    It's the population that keeps growing!"



+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.