|
The original environment describes a mixedhttp://www-03.ibm.com/servers/eserver/iseries/software/globalization/controlcodes.html
character encoding where
the results are correct. The ASCII 0x09 is the Tab
character which maps
to the EBCDIC 0x05 Horizontal Tab (HT) character.
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/books/c415607107.htm#HDRFOPEN
If that is understood, yet the original intent
from the OP is not
progressed by that comment, some more comments that
might be worth review...
Using "rb" giving more than one line is also
correct because binary
data can not have line control characters, since no
byte should be
interpreted as anything other than the code point it
is. However, I
believe "type=record" may be used to /trick/ binary
open to treat the
data as record oriented; that may require using
fread() instead.?
Since apparently the stream file is tagged with
CCSID 1252, then the
concern can be resolved by specifying on the open
"o_ccsid = 1252".
For either case above, the program that reads the
data, if that
program will also write the concatenated data, it
must only concat data
which has already been converted to the CCSID(1252)
in order to maintain
the integrity of the STMF having been tagged with
that encoding. That
is, for the string 'ROSE' in EBCDIC to be appended
to the 0x0109, the
x'D9D6E2C5' must be converted to the ASCII
x'524F5345' before writing
that full string x'0109524F5345'.
see "Keyword parameters for Integrated File
System only"
Regards, Chuck
--
All comments provided "as is" with no warranties
of any kind
whatsoever and may not represent positions,
strategies, nor views of my
employer
beppecosta wrote:
I've to read a IFS file that has a ccsid of 1252.words
Each line is crlf delimited and contains text
with some control characters (that have hex value< 20)
should be
(Control character are the blank spaces that
inserted between words.)column 9.
For example an ascii value of
0109524F5345 that is x'0109' + ROSE
In this line the word ROSE should be printed at
fgets
I've tried to get it with fopen (mode = "r") +
but it translates SOME control characters too.retrieves
fgets returns:
0105D9D6E2C5 that is x'0105' + ROSE
I've also tried with mode = "rb" but fgets
more than one line at a time.
What's another way ?
--
This is the RPG programming on the AS400 / iSeries
(RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the
archives
at http://archive.midrange.com/rpg400-l.
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.