|
*** I'm stumped. I found this article and example code by Scott K. It looked very simple, even for an idiot like me: <http://systeminetwork.com/article/convert-data-ucs2-or-utf-16>
H DFTACTGRP(*NO)
/copy ifsebook/qrpglesrc,ifsio_h
D fd s 10I 0
D data s 1000C ccsid(1200)
/free
unlink('/tmp/test.txt');
fd = open('/tmp/test.txt'
: O_CREAT + O_TRUNC + O_CCSID + O_WRONLY
: S_IWUSR+S_IRUSR
: 1200 );
if (fd < 0);
// handle error
endif;
data = %ucs2('Hello World!' + x'0d25');
callp write(fd: %addr(data): %len(%trimr(data))*2);
callp close(Fd);
*inlr = *on;
/end-free
*** So I copied the source to my system, compiled it, and ran it. The file /tmp/test.txt was correctly created as CCSID(1200):
Display Attributes Object . . . . . . : /tmp/test.txt Type . . . . . . . . . . . . . . . . . : STMF Owner . . . . . . . . . . . . . . . . : US0T1106 System object is on . . . . . . . . . : Local Auxiliary storage pool . . . . . . . . : 1 Object overflowed . . . . . . . . . : No Coded character set ID . . . . . . . . : 1200 Hidden file . . . . . . . . . . . . . : No PC system file . . . . . . . . . . . . : No Read only . . . . . . . . . . . . . . : No Need to archive (PC) . . . . . . . . . : Yes Need to archive (System) . . . . . . . : Yes *** but the data in the file (Hello World!') is still in EBCDIC:
Browse : /tmp/test.txt Record : 1 of 1 by 14 Column : 1 59 by 19 Control : - - - - + - - - - * - - - - + - - - - * ----+----*----+----* 405C5C5C 5C5C5C5C 5C5C5C5C 5CC28587 89959589 ************Beginni C8859393 9640E696 9993845A 0D25 Hello World! 405C5C5C 5C5C5C5C 5C5C5C5C 5CC59584 40968640 ************End of *** what am I doing wrong?
- sjl
As an Amazon Associate we earn from qualifying purchases.
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.