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.