Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

retrive an image file

Status
Not open for further replies.

aarellano

MIS
Oct 22, 2007
168
US
Hello,
I am not sure if this is the correct place to post this, if it is not I do apologize.

I am fairly new to the as400 and db2.
I was given a file that contains a field SFID.

I was told that this field is an image. All I can see is a bunch of numbers and letters.

If I try to export it to ms access I get a "LONG BINARY DATA - CANNOT BE DISPLAYED" in the filed


Is there a way that I could see the image on the field?


Thank you


 
Try searching the internet for "Images in AS400". There are a lots of article about it. It's been 7 years since I worked on AS400 but I remember we did have a product called SQR from Brio that we use to save/extract images, logos, signature etc.

This product can be run inside AS400 or thru an ODBC client access (PC). One thing I like with this product is because it can connect to multiple types of databases such as DB2, Oracle,Sybase all at the same time thru odbc.
 
aarelano,

How are you viewing it?
Is it a tiff, gif, or what?
Where are they stored? On the IFS, in a database file, on an attached device?

 
Tiff, gif etc are file format not field. For image field they
are saves as blobs and yes you can save in both IFS or database. In SQR we can do a sql statement to print them
or sent to a viewer. MICR and signatures during check printing are an examples of this.

 
I believe that you can only pull out a blob field of a program.
Below is a short RPG IV program that creates an image file named /Home/MyIMG.ext in the IFS .
Code:
     h dftactgrp( *No )
     h option( *SrcStmt: *NoDebugIO )

     D Pic             S                   SQLTYPE(BLOB_FILE)
     D pFileName       S            255    Varying
     D                                     inz('/Home/MyIMG.ext')

      /free

       Exec SQL Set Option Commit = *NONE;
       *InLR = *On;

       // Pre-compiler constants:
       //  SQFRD  (2)    Read
       //  SQFCRT (8)    Create
       //  SQFOVR (16)   Overwrite
       //  SQFAPP (32)   Append

       // Set Attributes of Pic : Mode, name, name length

       Pic_fo = SQFOVR;
       Pic_name = pFileName;
       Pic_nl = %Len(%trim(pFileName));

       // Retrieve BLOB field
       Exec Sql Select MyBlobFld Into :Pic from BLOBTable;

       // If something goes wrong display sqlcod
       If SqlStt <> *Zero;
         Dsply sqlcod;
       Endif;

       Return;

Using SELECT INTO, the blob field MyBlobFld is stored into Pic and the new image is created in the IFS specified file in pFileName. You may then FTP this file to your desktop. You have to know the file format of this file (gif, tiff, jpg, etc) to get correct results though. Give it a try using SFID field and let me know.



 
wo you all so very much I really appreciate all the incredible help. To be honest I am not sure what program is inputing or inputed the data all I was given is a file with a bunch of fields and was told that one of the fields is an image but not sure what kind. I installed a product called Agentek and I am able to see the image. but it does not tell me what kind it is and of course it does not let me save it anyquere. I can only view it. what I ultimately like is to be able to export this to a webpage via asp or javascript I will definetly take a look at each advice by each one and see what works.

Thank you so very much!!!
 
well did not have much luck, I tried to write an asp page but it did not work. I talked to one of the guys and he told me that they used to see the data with Agentek. I am not familiar with this software. And there is not much information about it. Has anybody worked with Agentek?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top