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].
On Tue, May 16, 2023 at 7:46 AM Paul Gilmartin < 0000042bfe9c879d-dmarc-requ...@listserv.ua.edu> wrote: > On Tue, 16 May 2023 09:03:56 +0000, Prashant Joshi wrote: > > > >I was trying to read file using "with open as". This way I was expecting > to pull single record at every iteration of loop. > >With your suggestion, I opened entire file in memory and read each record > based on record length in RDW. Now I can read each record as expected. > > > Are the line breaks then not within the binary file but an artifact of the > read() method of the file object created by "with open() as"? > > If the file is too large to open in memory, is it possible to read it in > small pieces of an arbitrary number of byres and reassemble the > VBS logical records with a concatenation operator according to > the SDWs (RDWs)? > > -- > 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