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



Hello,

this topic belongs to RPG and Web. But I think it's mainly RPG, so I post it here.

Task

- Sending a file in IFS via WebService (IWS) with a RPG program.

- The file isn't more specifically detailed. It can be pdf or tif or doc or whatever. It can be CCSID 1252 or 1208 or 819 or whatever.

- The WebService shall directly send the binary data to the client.

I thought best way would be to use BLOB. So I created a first part with a fixed file. A PDF with CCSID 1252.
This is my program:
ctl-opt main(Main) pgminfo(*PCML:*MODULE) dftactgrp(*NO) actgrp(*new);
ctl-opt decedit('0,') datedit(*DMY.) option(*SRCSTMT:*NODEBUGIO);

dcl-s BLOB sqltype(BLOB:10000) template;

dcl-proc Main;
dcl-pi *N extpgm('TEST22');
Input char(8);
Output like(BLOB);
end-pi;

dcl-s String varchar(10000) ccsid(1252);
dcl-s BLOBFILE sqltype(BLOB_FILE);

exec sql
Set Option Commit = *NONE, CLOSQLCSR = *ENDMOD;

clear BLOBFILE;
BLOBFILE_fo = SQFRD;
BLOBFILE_name = '/Home/File1.pdf';
BLOBFILE_nl = %len(%trimr(BLOBFILE_name));

exec sql
SET :String = :BLOBFILE;
Output = String;

end-proc;

Problem number one: As you can see I have a variable with CSSID 1252. Directly using Output doesn't work.

Using another program calling this looks good. If debugging Output it looks like the hex data of the pdf.

Problem number two: If using a WebService and debugging this, Output doesn't look good. The PDF I'm getting can't be opened. Maybe this is because of different Job-CCSID? My 5250-Job is CSSID 65535 with Standard-ID 273 and the IWS-Job is CSSID 1141.

What do I have to do to solve my two problems?

Greetings Jens


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.