Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

retrive an image file

retrive an image file

retrive an image file

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


RE: retrive an image file

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.

RE: retrive an image file


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?


RE: retrive an image file

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.


RE: retrive an image file

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 .


     h dftactgrp( *No )
     h option( *SrcStmt: *NoDebugIO )

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


       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;


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.


RE: retrive an image file

wowww thank 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!!!

RE: retrive an image file

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?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close