The code

    with open('workfile', encoding="utf-8") as f:
        read_data = f.read()

is for reading text and you would normally be concerned with the character 
count. Try
    with open('workfile', "rb") as f:
        read_data = f.read()

________________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of 
Paul Gilmartin <0000042bfe9c879d-dmarc-requ...@listserv.ua.edu>
Sent: Tuesday, May 16, 2023 12:23 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: VBS file read in windows - end of record issue

On Tue, 16 May 2023 11:06:59 -0500, John McKown wrote:

>In one of my C programs, I first read the RDW, did a ntohs() to convert
>from mainframe to Intel integer, subtracted 4, then read that number of
>bytes into a char[32768].
>
I'm Python-naive.  But trying to educate myself with the example,
<https://docs.python.org/3/tutorial/inputoutput.html>:
    with open('workfile', encoding="utf-8") as f:
        read_data = f.read()

... I see no explicit byte count.  Is that implied, perhaps by a declaration
such as "char read_data[ LRECL ]"?

--
gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to