On 11/12/23 16:18:04, Jon Perryman wrote:
Specifically asked was z/OS RECFM=FB. As long no one ever uses DISP=MOD, then the calculation is simple because number of records per block and blocks per track is consistent.
RECFM=FBS prevents that. You simply divide record number by records per block giving the block number used in the point and remainder is the number of records you must read after the point. Not quite correct but you get the idea.
That's mostly how the Divide instruction works.
If you need DISP=MOD functionality, then you must create the functionality. All programs needing DISP=MOD must open the file for update, position to the last block and read until EOF.
... Fill the block with additional records and rewrite in place. Why, in this 21st Century hasn't that function been added to the access methods!? UNIX does it, as you say below.
Suggestions have been made for a USS file. The advantage is that positioning is at the byte level instead of block. The calculation is greatly simplified to records times record size and DISP=MOD is greatly simplified because Unix does an append to the end of the file. The drawback is that the read record size must be handled by the programmer.
I think that can be done by the Multiply instruction, provided by most modern computer hardware. But fixed-length records are alien to UNIX -- I think they're a relic of UR-device practice. -- gil
