|
Joe, I have the following in one of my service programs. Notice the "437" on the open function, that's the code page you need. Also, due to how the open unix API works, you must open the file twice, at least when creating files. The first time, you set the flags on the file and the code page - this creates the file. (I assume you want to create new files when you do this.) Close the file, then open for write privileges. Since the file is created, codepage 437 (ascii) is already attached to the file, and data conversion is automatic. Note on the second open I did not include security flags or a code page. HTH, Loyd Sorry for the verbose code... c eval ifsopenflags = c o_readwrite + c o_create + c o_truncate + c o_codepage c eval ifssecbits = c s_orwx + c s_grwx + c s_wr c eval descriptor = Open( %trim(Location) : c ifsopenflags : ifssecbits : 437 ) c if descriptor = -1 c eval returncode = FAILURE c return returncode c endif c eval rc = Close( descriptor ) c if descriptor = -1 c eval returncode = FAILURE c return returncode c endif c eval ifsopenflags = c o_writeonly + c o_textdata c eval descriptor = Open( %trim(Location) : c ifsopenflags ) c if descriptor = -1 ... -----Original Message----- From: Joe Pluta [mailto:joepluta@PlutaBrothers.com] Sent: Wednesday, June 06, 2001 11:57 PM To: MIDRANGE-L@midrange.com Subject: Unix APIs, stream files, codepages and the like All done with this phase. I now have a generic program that I can use to write an EBCDIC stream file. I can then use the CPY command to convert it from EBCDIC to ASCII. I suspect that with a little more work, I could figure out how to get around the CPY step, but this is perfectly acceptable for the time being. It works, and that's pretty darned good. So now I'm generating text files from RPG, and that's what the last two days was all about. Thanks to everyone who helped. It was a heck of a learning curve, but it's paying off. Joe +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
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.