Programming Languages on Power

 View Only

 Putting http_post_verbose response into IFS file using sqltype(clob_file)

  • RPG
David Miller's profile image
David Miller posted Wed April 16, 2025 03:23 PM

I am using the following statement expecting response_message to be put into a IFS file. 

  exec sql
    select response_message,
              cast(response_http_header as varchar(5000))
      into :ggResponseFile, :ggResponseHeader
      from table(qsys2.http_post_verbose( :llUrl, :ggFileName, :llOptions )) ;

ggResponseFile is sqltype(clob_file) and ggResponseHeader is char(5000).

I can see the 385 byte response data in the Axis trace.

The file gets created (zero bytes) but I get this error:

 

I have a similar program that works as expected but I don't see any differences that would stop this program from working. Does anyone have know what causes this error?


#RPG
Paul Nicolay's profile image
Paul Nicolay

3021 means "The value specified for the argument is not correct"... so how is your ggResponsFile filled (_Name, _NL and _FO subfields ) ?


#RPG
David Miller's profile image
David Miller

Hi, Paul. Here's how I'm populating the subfields:

  ggResponseFile_name = %trim(%scanrpl( '.json' : '_Response.json' : colTmxH.fileName ));
  ggResponseFile_nl   = %len(%trim(ggResponseFile_name));
  ggResponseFile_fo   = SQFOVR;

The file name is similar to this: /home/dmiller/out/Account-2025-04-10-12.06.23.832801_Response.json

As I mentioned, the file is being created/ replaced (I've started without the file existing and also with it already existing).


#RPG
Paul Nicolay's profile image
Paul Nicolay

If it really creates the file (empty I suppose) then I don't see why he's still complaining with a 3021.

Maybe display the 3 values once more with "eval ggResponseFile_...:X" in debug to see if there's nothing special in the data.


#RPG
David Miller's profile image
David Miller

I just ran it again in debug (because you're right, it's better to double check) and the file name is exactly what I expect and the _nl value is the exact length and _fo is 16 (SQFOVR).

The file is always created/replaced after the execution with 0 bytes.

I have a ticket open w/IBM now. I'll try to post an update here once it's resolved.


#RPG
David Miller's profile image
David Miller

There wasn't a problem with the SQL or the file. The file was being created and populated but was referenced by a different procedure without changing the _fo value, clearing the file. Can I delete this thread to avoid a lifetime of embarrassment? ;)


#RPG