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



Hi Chuck,

now I read the stmf one byte at a time and I decide
whether is text data to be converted or a control char
based on its value.

However, for some reasons, it is better if I can read
it as crlf lines; then I will try with the flags you
suggest.

Thanks.
Giuseppe.

--- CRPence <crp@xxxxxxxxxxxxxxxxxxxx> ha scritto:

The original environment describes a mixed
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://www-03.ibm.com/servers/eserver/iseries/software/globalization/controlcodes.html

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


http://publib.boulder.ibm.com/iseries/v5r2/ic2924/books/c415607107.htm#HDRFOPEN
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.

Each line is crlf delimited and contains text
words
with some control characters (that have hex value
< 20)

(Control character are the blank spaces that
should be
inserted between words.)

For example an ascii value of
0109524F5345 that is x'0109' + ROSE

In this line the word ROSE should be printed at
column 9.

I've tried to get it with fopen (mode = "r") +
fgets
but it translates SOME control characters too.

fgets returns:
0105D9D6E2C5 that is x'0105' + ROSE

I've also tried with mode = "rb" but fgets
retrieves
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.








___________________________________
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.html

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.