Tutorial: Working with Blob Link Lists


The Developer Blob Editor has a feature to automatically split a file and store it as many 32k blobs. This allows developers to store data larger than 32k in a series of blobs and provides a simple tool to refresh the data from a source file.

Creating a Link List

To create a link list blob you first need to create a header blob that points to the original content (file) and to the data blobs that store the data. A header blob is an XML document describing the link list.

  • From the Blob Editor, select "New / New from Template..." and "Blob Link List".
  • Save the header blob. For example "admindoc".
  • Change the Prefix. The prefix is used to name the data blobs containing the actual data. Normally use the name of header blob as the prefix, for example "admindoc".

Note. When creating data blobs, the Developer appends "_" and a number to each data blob. As the maximum length of a blob name is 16 characters, the prefix should never be longer than 13 characters (to allow for 99 data blobs).

  • Change the Source file name. This should point to the source file containing the data (that exceeds 32k). The file must be a text file. For example "c:/docs/admindoc.htm".
  • Re-save the header blob.
  • Select Import Link List from the Edit menu. This will open the source file and split it into 32k chunks and import them as individual blobs and save them using the nominated prefix. When the import is done the header blob will contain a list of data blobs.
  • Re-save the header blob.

To re-import the data file at a future time, just open the header blob and select Edit / Import Link List.. and resave the header blob.

Reading the Link List

There no support in the runtime environment to automatically read a link list blob so you will need a function to automatically read the data blobs referred to in the header blob.

The following example code reads the related data blobs and concatenates then into a text buffer:

EXPECTS BlobName BufferName
NOTE From a LinkList blob, automatically open all related blobs into one supplied buffer.
NOTE Used when blob content exceeds 32k.


XML *OPEN "tmp" *BLOB= L-BlobName
IF *XMLSTAT <> 0 THEN ERROR "2Error in Header Link List"; EXIT

XML *READ "tmp" *ELEMENT= "/LinkList" *P01
ERROR "2This is not a header link list blob."; EXIT

XML *COUNT "tmp" *ELEMENT= "/LinkList/Blobs/Blob" L-xmlHits
FOR L-xmlCount1 = 1; L-xmlCount1 <= L-xmlHits; L-xmlCount1 ++
L-xmlElement = "/LinkList/Blobs/Blob[" L-xmlCount1 "]/@Id"
XML *READ "tmp" *ELEMENT= L-xmlElement L-xmlId
TEXT *LOAD L-BufferName *BLOB= L-xmlId

The following code shows an example of of calling the above function:

NOTE Open link list to buffer temp and write to file:
VISIT comOpenLinkList "admindoc" "temp"
TEXT *WRITE *FILE= "c:/installfiles/admindoc.htm" "temp"


The data file need not exceed 32k for you to use a link list. The simplicity in synchronizing blobs with external files might be motivation enough for using a link list even if the header blob only refers to a single data blob. Should the data file exceed 32k at any time in the future, you will automatically get several data blobs.

The data file must be text and contain line breaks. The Developer reads the file line by line until the it reaches a chunk size of 29k. Link lists are useful for text, HTML and XML data.