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



On 10/10/2017 3:53 PM, Darren Strong wrote:
I'm playing around with generating a text based IFS file as shown below,
from an example I received a few years ago. The issue I had then, and am
still having now, is that I'd like the resulting IFS file, copied from a
source member in this case as a test, to be ASCII, rather than EBCDIC
(sp?). Does anyone know a way to control the conversion differently?

An interesting way to create stream files from DB2.

I couldn't find a way to get RPG to tell DB2 that I wanted the resultant
stream file to be CCSID(819) so I brute forced it by running PASE
'touch'. Once the file was in the IFS, IBM i did the conversions as
expected. Top o' the hat to Charles for helping me down that path.

ctl-opt dftactgrp(*no) actgrp('QILE');

// test clob for darren

//****************************************************************
// Definition Specifications
//****************************************************************
dcl-s FromCLOB SQLTYPE(CLOB_File);
dcl-s ToCLOB SQLTYPE(CLOB_File);
dcl-s IFSFile char(256) inz('/home/buck/CLOBFILE.txt');
dcl-s FromFile char(256)
inz('/QSYS.LIB/BUCK.lib/QRPGLESRC.file/DARREN.mbr');


dcl-pr qp2shell extpgm('QP2SHELL');
cmd_ptr char(64) const;
parm_ptr char(64) const;
end-pr;

dcl-s cmd char(64) inz('/QOpenSys/usr/bin/touch');
dcl-s parm char(64);

*InLR = *On;


// first, create the file with an ASCII CCSID
cmd = %trim(cmd) + x'00';
parm = %trim(IFSFILE) + x'00';
qp2shell(cmd: parm);


FromCLOB_Name = %trim(FromFile);
FromCLOB_NL = %len(%trim(FromCLOB_Name));
FromCLOB_FO = SQFRD; // read

toCLOB_Name = %trim(IFSFile);
toCLOB_NL = %len(%trim(toCLOB_Name));
toCLOB_FO = SQFOVR; // overwrite

exec sql set :toCLOB = :FromCLOB;

return;

--buck


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.