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

I think I looked too much to the debug data. First I reduced my program today. I created a program, that reads a file an creates a new file.

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:4194304);
dcl-s BLOBFILE sqltype(BLOB_FILE);
dcl-s BLOBFILE2 sqltype(BLOB_FILE);

dcl-proc Main;
dcl-pi *N extpgm('TEST24');
end-pi;

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 :BLOB = :BLOBFILE;

clear BLOBFILE2;
BLOBFILE2_fo = SQFOVR;
BLOBFILE2_name = '/Home/File2.pdf';
BLOBFILE2_nl = %len(%trimr(BLOBFILE2_name));
exec sql
set :BLOBFILE2 = :BLOB;

end-proc;

This works without problem. When debugging this, the variable BLOB has unreadable data. I thought this would be wrong.

In the next step I added some parameters and called the program from another program and created File2 there.

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:4194304) template;
dcl-s BLOBFILE sqltype(BLOB_FILE);

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

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 :Output = :BLOBFILE;

end-proc;

This still works. I would say, now I have a program, that can return binary data of files from IFS.

When I now use this program in IWS I'm getting a PDF-File, but in hex this looks like the unreadable data I saw in debug.
The documentation of IWS says: "Data received from the web service implementation code is assumed to be in the CCSID that is specified." As far as I understand, this means, that I have to send the data in 1141, because this is the CCSID, the WebService is actually running with. Is this correct? Can this be done with sqltype BLOB?

Greetings Jens

-----Ursprüngliche Nachricht-----
Von: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] Im Auftrag von Ottersberg, Jens
Gesendet: Freitag, 5. Juli 2019 16:39
An: rpg400-l@xxxxxxxxxxxxxxxxxx
Betreff: Sending File via IWS WebService with RPG


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.