by jeffcalc » Mon Jan 06, 2020 2:26 pm
Hi Mike,
(long answer, at least as long as Mike's question)
I'm not sure to have the right answer to your question, but may give some indications.
First, when you create a DATA file with CREATE, you specify a number of "registers".
Filling the file with HP41 registers is consistent with this size, you can fill up to the declared size.
However, the physical size of the DATA file is 8 bytes times the declared size, because each HP41 register is using 8 bytes in the DATA file, there is one unused byte (HP41 registers are 7-byte long, as you know:-).
For instance, a 59-register DATA file is 59*8=472 bytes long (using two 256-byte records on disc)
Now when you use a DATA file to store ASCII data, things are more complicate and there is no more a direct correspondence between the ASCII file size expressed in data registers and the ASCII data you can store in the file.
The size of the ASCII XMEM file (in HP41 reg.) is only *approximatively* the size of the DATA file you have to CREATE. The exact size needed depends of the length of the ASCII records.
BTW, the X-I/O manual states that FLLENG returns "undefined" values for ASCII files...
So back to your question: how did you create the 59-reg file long ago?
Since you can reload it in XMEM without loss of data, you should be able to rewrite it again, no?
You wrote:" My file consists of 67 records of 5 bytes and one of 4 bytes."
So it uses in XMEM: 67*6+5=407 bytes that is 407/7 = 59 XMEM reg. Ok this is what you reported.
But how much space does it use on the LIF file? As you noted, it uses more because of the 2-byte line length and the even length padding.
So it uses 67*8+6=542 bytes =542/8 = 68 DATA file "reg" (remember, DATA file "registers" are 8 byte long)
IT NEEDS a 68-reg DATA file ! It can't fit in a 59-reg DATA file on disc.
And so, the question is (again): how did you do years ago??
To answer, we must go to the LIF file system details:
First, LIF files are not expandable, once they are created they can't be made longer. Or in other words, a LIF file is always made of one fixed piece of contiguous sectors, that I will call "slot" below.
Second, when you create a LIF file, the catalog entry is build in the first free slot available (of size equal or larger than the requested size). If there is no such free slot, the file is just created in a new slot at the end of the catalog, with exactly the requested size. But if a free slot exists coming from a previously deleted file (and larger that your requested size), all the slot will be used and the unused area is no more available for other files, until the file is deleted and the slot is available again.
Third, the physical file size is recorded in the catalog entry in number of 256-byte sectors. The size in "registers" is for information only and is not used by the LIF system.
So my hypothesis is:
At the time, you created a 59-reg data file using by chance a larger slot (from a deleted file). The physical file size was then large enough for the ASCII data, even if the size in data register was recorded as 59 registers.
To prove it, please follow these few steps:
- start with an new LIF volume: NEWM 100
- create a 59-reg DATA file: "FILE1" 59 CREATE
- create a 68-reg DATA file: "FILE2" 68 CREATE
- create a 59-reg DATA file: "FILE3" 59 CREATE
- delete FILE2: "FILE2" PURGE
- create a 59-reg DATA file: "FILE4" 59 CREATE
Now, DIR says:
NAME TYPE REGS
FILE1 DA 59
FILE4 DA 59
FILE3 DA 59
Now try to copy your XMEM ASCII file in FILE1, FILE3, FILE4 with SAVEAS.
I predict that it will fail with FILE1 and FILE3, but pass with FILE4.
FILE4 is using the 2nd slot, previously used by FILE2. Even if the size in "reg" is recorded as 59, it physically uses 3 sectors, large enough to hold the ASCII data.
Let me know if I'm right.
J-F