Go Back

Terabyte relative file

Can you convert a relative file to a terabyte relative file?

2 Answers
0   | Posted by Glynis Lyttle to Synergy DBMS on 2/17/2022 9:52 AM
Geoff MacCue
Hi Glynis,
If you mean a normal DDF style file having a series of records which are all the same size and you access the records by record number, then you can expand the file quite easily using your own code.

Open the file in Update Mode (U), you will need to handle record locks.

Read the last record (^LAST) and then WRITES the additional empty records for however big you want to make the file. You can also use the WRITE command but you would need to put in the correct record number starting at the last record plus 1.

for rec_count from 1 thru 1000000 writes (chn,data) ; adding a million records to the end
or
for rec_count from Last_record+1 to Last_record+1000000 write (chn,data,rec_count)

Using the write method is a bit slower than using writes, also using the write method requires you knowing or determining the number of records in the file before you start to expand it. If your data record has a field that contains the record position in the file then when you read ^last you will know where to start.

They both seem to work in multi-user mode as long as you handle record locks etc. There would be issues if you were to have concurrent dbrs running the expand program (2 or more users running it at the same time)

There are some limitations expressed in the manual page (Page 4-153)

System File type Maximum size per physical file
Windows FAT16/32 2,147,483,647 bytes
TBYTE ISAM file on NTFS REV4: 1,099,511,627,775 bytes (1 terabyte)
REV6: 281,474,976,710,655 bytes (256 
terabytes)

Using this method to writes a log file on Windows enables you to view the contents of the log file before the program has closed the log file
Open (logchn,o,'log.txt')
close logchn
open (logchn,u,'log.txt')
writes (logchn,data)
...

Another program can read the details of the log file and does not need to wait for it to be closed on Windows to get access to it.

Hope this helps

 

2/18/2022 1:11 AM   1  
Best Answer chosen by Glynis Lyttle
Phillip Bratt
Had this discussion with Glynis already, but wanted to post this here for others looking. 

Regarding Terabyte relative files, there is no specific limitations as to how large a relative file is can be on Windows or VMS beyond the OS file size limit. The relative file has no “header” to describe its contents on non-VMS platforms so the concept of “terabyte” file doesn’t really fit relative files on those platforms. 
 
On UNIX-based systems, terabyte relative/sequential files can’t be opened in update mode and record locking doesn’t work. Need to open in I, O, or A mode.
 

3/8/2022 5:43 PM   1  
Please log in to comment or answer this question.