In a python program I would use the "encoding" option of the "open()" function, 
something like this:

file1 = open("file1.name", mode="r", encoding="utf-8")

Or "ISO8859" if you prefer.

Or change the tag on the file before you run your program to tell the system 
what is really in there.

What does the command "chtag -p file1.name" tell you?

HTH

Peter

-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of 
Colin Paice
Sent: Wednesday, August 3, 2022 3:34 PM
To: [email protected]
Subject: reading an ascii file

If I open a normal OMVS file with fopen(..,"r") and use fgets I get the
first line of the file.
However If this is a tagged file eg python file(in ascii)  so it has *ls -T
my.py* of IBM8859-1 , I get the whole file read in ( presumably because
there were no x15 characters to say end of line)
Are there any options I need to specify at fopen/fread/fgets which will
allow me to read the file line by line.
I'm thinking I'll have to read a big chunk from the file, convert ASCII to
EBCDIC, and search for x15 to split the line up

Colin
--

This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please notify us immediately by e-mail and delete the message and any 
attachments from your system.


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to