Skip to Main Content
IBM Power Ideas Portal

Shape the future of IBM!

We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:

Post your ideas

Start by posting ideas and requests to this portal to enhance a Power product or service. Take a look at ideas others have posted and upvote them if they matter to you,

  1. Post an idea

  2. Upvote ideas and add comments to ideas that matter most to you

  3. Get feedback from the IBM team to refine your idea

Help IBM prioritize your ideas and requests

The IBM team may need your help to refine the ideas so they may ask for more information or feedback. The Power teams will then decide if they can begin working on your idea. If they can start during the next development cycle, they will put the idea on the priority list. Each team at IBM works on a different schedule, where some ideas can be implemented right away, others may be placed on a different schedule.

Receive notification on the decision

Some ideas can be implemented at IBM, while others may not fit within the development plans for the product. In either case, the team will let you know as soon as possible. In some cases, we may be able to find alternatives for ideas which cannot be implemented in a reasonable time.


Specific link you will want to bookmark for future use

IBM Unified Ideas Portal - https://ideas.ibm.com/ - Use this site to create or search for existing Ideas across all IBM products that are outside of Power, and track all of your personal interactions with all Ideas.

Status Future consideration
Workspace IBM i
Categories Db2 for i
Created by Guest
Created on Feb 15, 2022

Implement qsys2.Http_get for blob file

I think then the new sql function for http_get are really interesting, fast and above all there isn't java!

I started use it instead of systools funcion, but I need an http_get that allow me download binary files like .zip .

Please implement it!

Many thanks!


Use Case:

http_get returns clob, and there's no manner to put it into a blob.


Idea priority Medium
  • Guest
    May 31, 2022

    Hi

    I think allowing BLOB's in the new http-functions from qsys2 is really a requirement.

    When you are calling different (related) API's in 1 process and 1 of them returns a BLOB, than you need to use the old systools function for that 1 API call to make the process work. (or go back using systools for all the API calls.

  • Guest
    Mar 10, 2022

    Hi Pablo,

    You are correct. Further research indicates this was just a short-coming in the new HTTP_GET UDTF. I believe IBM is planning to enhance it soon, but IDK for certain. :)

  • Guest
    Feb 17, 2022

    Hi BOB,

    excuse me but I don't understand how can it be possibile with your technics.

    Here's a sample with the different between http_get and HTTPGETBLOB.
    the result of HTTP_get is:

    // HTTPTransportException: Problem occurred when receiving the stream.
    // No data available for message.

    **FREE
    // Elabora richiesta di chiamate http fatte da un programma esterno
    Ctl-Opt DftActGrp(*no)
    ActGrp(*StgMdl)
    StgMdl(*SNGLVL)
    Thread(*Concurrent)
    Option(*NoUnRef :*SrcStmt :*NoDebugIo)
    DatFmt(*Iso) TimFmt(*Iso)
    Debug(*Constants)
    AlwNull(*UsrCtl)
    DftName(TESTCLOB)
    Text('Elabora richiesta di chiamate http in batch');
    // ___________________________________________________________________

    Dcl-Pr TESTCLOB ExtPgm('TESTCLOB');
    End-Pr TESTCLOB;

    Dcl-Pi TESTCLOB;
    End-Pi TESTCLOB;

    // ____________________________________________________________________________
    Dcl-S OutputClob SqlType(Clob_File) ccsid(1208);
    Dcl-S OutputBlob SqlType(Blob_File);
    Dcl-S HttpOptions VarChar(2000);
    Dcl-S HttpHeader SqlType(Xml_Clob :10000) ccsid(1208);
    Dcl-C SQLOK '00000';
    Dcl-C SQLEOF '02000';

    // Main Line
    // ___________________________________________________________________

    *Inlr = *On;

    Exec Sql
    Set Option Datfmt = *Iso,
    Timfmt = *Iso,
    Closqlcsr = *EndActGrp,
    Commit = *chg;

    HttpOptions = '{"connectTimeout":"5","redirect" : "10", "header":"content-type, accept, image/webpd"}';

    OutputClob_Name = '/home/paolos/test.jpeg';
    OutputClob_NL = %Len(%Trim(OutputClob_Name));
    OutputClob_FO = SQFOVR; // OverWrite

    Exec Sql
    Values Qsys2.Http_Get('http://httpbin.org/image', :HttpOptions)
    into :OutputClob;

    If (SqlState = SQLOK);
    Exec Sql Commit;
    EndIf;

    // the result of this is:
    // HTTPTransportException: Problem occurred when receiving the stream.
    // No data available for message.

    OutputBlob_Name = '/home/paolos/testblob.jpeg';
    OutputBlob_NL = %Len(%Trim(OutputBlob_Name));
    OutputBlob_FO = SQFOVR; // OverWrite

    HttpHeader_Data = '+
    +
    ';
    HttpHeader_Len = %len(%Trim(HttpHeader_Data));
    Exec Sql
    Values Systools.HttpGetBlob('http://httpbin.org/image', :HttpHeader)
    into :OutputBlob;

    If (SqlState = SQLOK);
    Exec Sql Commit;
    EndIf;

    Return;

  • Guest
    Feb 17, 2022

    Hi IBM,

    Why uncommited candidate?

  • Guest
    Feb 16, 2022

    IBM will use this request as input to planning but no commitment is made or implied. This request will be updated in the future if IBM implements it.

  • Guest
    Feb 16, 2022

    I reread my CGI BOUNDARY stuff in CGILIB and iQuery both of which support file uploads. I also read about CCSIDs and CLOB vs BLOB. Since a multipart form upload will be in USASCII for the header and boundary parts, it needs to be CLOB with a CCSID of 1208 (probably). Then once you get the boundary markers, you extract the content between the markers (that is your file data) which will be ASCII but "binary ASCII", and then save that out to the IFS, to a file with CCSID 1208.
    If the result were a BLOB, then you'd have to move all that stuff to another CLOB and do some of that CCSID conversion (maybe via iconv if you're not using native SQL/PL) and then repeat the above. So again, unless I'm way off here, I don't think a BLOB is going to help you with file upload/transfers. May remembering/realizing that a CLOB is _NOT_ a null-terminated string would help visual it.

  • Guest
    Feb 16, 2022

    I could be wrong, but doesn't .ZIP and other binary uploads get converted to base64 when they're received? Thus, a BLOB won't really do you any good as nothing comes back through HTTP as a BLOB.
    I know with POST method, you need to search for the BOUNDARY= marker and reconstruct the file upload from those marker boundaries. We us CLOBs for this today. But again, I could be off on this as I don't have the spec in front of me.