Browse Prior Art Database

Algorithm for an Automatic Variable Length Truncation of a Composite Document Size While Closing It

IP.com Disclosure Number: IPCOM000040709D
Original Publication Date: 1987-Dec-01
Included in the Prior Art Database: 2005-Feb-02
Document File: 1 page(s) / 12K

Publishing Venue

IBM

Related People

Kendrick, MR: AUTHOR [+3]

Abstract

A method is described which permits unused media space to be freed from the end of the document and made available for general use. When a document is closed, Data Management Services (DMS), knows that there might be several unused sectors at the end of a document. The unused sectors (storage space) contain trash and need to be truncated from a document. In accordance with the new method, DMS builds a table which tracks the allocation of sectors within a document starting at OPEN time. This table known as the Free Space Map can be scanned to locate the highest Logical Sector Number (LSN) used within the document and then used to truncate the document to a smaller size. An undocumented function of DOS supported file truncation by seeking to the position in the file to truncate and writing a data length of 0.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 65% of the total text.

Page 1 of 1

Algorithm for an Automatic Variable Length Truncation of a Composite Document Size While Closing It

A method is described which permits unused media space to be freed from the end of the document and made available for general use. When a document is closed, Data Management Services (DMS), knows that there might be several unused sectors at the end of a document.

The unused sectors (storage space) contain trash and need to be truncated from a document. In accordance with the new method, DMS builds a table which tracks the allocation of sectors within a document starting at OPEN time. This table known as the Free Space Map can be scanned to locate the highest Logical Sector Number (LSN) used within the document and then used to truncate the document to a smaller size. An undocumented function of DOS supported file truncation by seeking to the position in the file to truncate and writing a data length of 0. The algorithm for implementing this feature is given below: Set LSN = Max LSN

Address end of Free Space Map

Until no more unused bytes (sectors), do

get a byte (eight bits, one for each potential sector)

until sector that is allocated is found or

until loop, do

get a bit (bit indicator = 0 if sector allocated or 1 if

sector free)

rotate bit to carry flag (look at bit)

if no allocation found then (carry flag = 1)

decrement LSN

else

get out of loop (allocation found)

enddo

decrement pointer to scan backwards in Free Space Map

enddo Get an Lseek to the LSN where hi...