Spectrum - Jul/Aug 1997

D3/NT - What is OSFI?

Nathan Rector

Natec Systems

nater@northcoast.com

http://www.northcoast.com/~nater/

D3 supports an Open System File Interface (OSFI) which allows you to read and write items in "standard" UNIX, DOS, and NT file formats. The OSFI allows a developer to work with non-Multi-Value files as if they were part of the D3 file system.

OSFI is different from the D3 File System Interface (FSI). The FSI is a hashed file format that Pick Systems developed to allow the host system to be used as the file I/O. The D3 FSI file format can only be accessed through D3.

OSFI files are actually host system directories and each item is a host system file. For example, if someone needed access to word processing documents from a Pick program, then the OSFI could be used. The file would be the directory that document is stored in and the item would be the word processing document.

There are several options that can be applied to OSFI files to define how they operate. Any OSFI file can be open, read, and written to as if it were a standard D3 file. The OSFI files have access to any changes done to the host system files in the same directory. Any changes the OSFI files make to the directory are also available for other programs on the host system.

The definition of an OSFI file is the following:

001 QS

002

003 {UNIX/NT/DOS/NT_BIN}:{directory}]{options}

UNIX - only used when creating OSFI files under D3/UNIX

NT - used for text records which use a line feed to delimit line breaks

DOS - used for text records which use both a carriage return and a line feed to delimit

line breaks. NT_BIN - used to access binary records or data which is not to be translated

in any way.

Options:

t{n} - Converts any white space (space characters) preceding text that line up with tab-stops to be converted to tabs. The n is the length of the tab-stops. For example, if the tab-stops were set to 5 and the string had 7 spaces before the text, then 5 of the spaces will be replaced by a tab. This works the reverse when reading a file; the tab would be replaced with 5 spaces.

A - Specifies that an extra attribute mark always be added when a file is read. This is necessary if copying an item from the OSFI file to a standard D3 file. Again, this works in reverse when writing to the OSFI file.

c - Specifies that this file is a special character file such as a pipe or device.

n - Does the opposite of the A option. Does not allow the extra attribute mark to be added to the end of the item.

R - Does nothing to the file when read or write. The data is read and write as raw data.

Here are a few examples of OSFI files:

001 Q

002

003 DOS:C:\TEMP

or

001 Q

002

003 NT:C:\DOCS]T5

If you need to access an dictionary for an OSFI file, then there needs to be a subdirectory created. If D3/NT is being used, the subdirectory is called $DICT. For D3/UNIX, the subdirectory needs to be called .DICT . If there is no subdirectory and you try writing to an OSFI dictionary, an "file write protected" error results. If you try opening the dictionary and no subdirectory exists, a blank item is opened. If the subdirectory doesn't exist and you try reading the dictionary, the item will not be found.

Why would someone use these files? A good place to use this type of file is for accessing documents. Most word processors write documents as individual UNIX, DOS, or NT files and place them in a directory. This also allows developers the ability to interface with non-D3 files that other non-D3 programs use.

Since OSFI is not a native D3 file system, nor are the file systems it interfaces with designed for large data processing, it is not recommended to use it for anything other than interfacing with the native host file system. The OSFI is slower than native D3 files and requires more overhead to access.

OSFI allows D3 to become more flexible than it has traditionally been. Developers no longer need third-party software to access and manipulate NT, DOS, or UNIX files.

Spectrum - Jul/Aug 1997

Spectrum - Jul/Aug 1997

D3/NT - What is OSFI?

Nathan Rector

Natec Systems

nater@northcoast.com

http://www.northcoast.com/~nater/

D3 supports an Open System File Interface (OSFI) which allows you to read and write items in "standard" UNIX, DOS, and NT file formats. The OSFI allows a developer to work with non-Multi-Value files as if they were part of the D3 file system.

OSFI is different from the D3 File System Interface (FSI). The FSI is a hashed file format that Pick Systems developed to allow the host system to be used as the file I/O. The D3 FSI file format can only be accessed through D3.

OSFI files are actually host system directories and each item is a host system file. For example, if someone needed access to word processing documents from a Pick program, then the OSFI could be used. The file would be the directory that document is stored in and the item would be the word processing document.

There are several options that can be applied to OSFI files to define how they operate. Any OSFI file can be open, read, and written to as if it were a standard D3 file. The OSFI files have access to any changes done to the host system files in the same directory. Any changes the OSFI files make to the directory are also available for other programs on the host system.

The definition of an OSFI file is the following:

001 QS

002

003 {UNIX/NT/DOS/NT_BIN}:{directory}]{options}

UNIX - only used when creating OSFI files under D3/UNIX

NT - used for text records which use a line feed to delimit line breaks

DOS - used for text records which use both a carriage return and a line feed to delimit

line breaks. NT_BIN - used to access binary records or data which is not to be translated

in any way.

Options:

t{n} - Converts any white space (space characters) preceding text that line up with tab-stops to be converted to tabs. The n is the length of the tab-stops. For example, if the tab-stops were set to 5 and the string had 7 spaces before the text, then 5 of the spaces will be replaced by a tab. This works the reverse when reading a file; the tab would be replaced with 5 spaces.

A - Specifies that an extra attribute mark always be added when a file is read. This is necessary if copying an item from the OSFI file to a standard D3 file. Again, this works in reverse when writing to the OSFI file.

c - Specifies that this file is a special character file such as a pipe or device.

n - Does the opposite of the A option. Does not allow the extra attribute mark to be added to the end of the item.

R - Does nothing to the file when read or write. The data is read and write as raw data.

Here are a few examples of OSFI files:

001 Q

002

003 DOS:C:\TEMP

or

001 Q

002

003 NT:C:\DOCS]T5

If you need to access an dictionary for an OSFI file, then there needs to be a subdirectory created. If D3/NT is being used, the subdirectory is called $DICT. For D3/UNIX, the subdirectory needs to be called .DICT . If there is no subdirectory and you try writing to an OSFI dictionary, an "file write protected" error results. If you try opening the dictionary and no subdirectory exists, a blank item is opened. If the subdirectory doesn't exist and you try reading the dictionary, the item will not be found.

Why would someone use these files? A good place to use this type of file is for accessing documents. Most word processors write documents as individual UNIX, DOS, or NT files and place them in a directory. This also allows developers the ability to interface with non-D3 files that other non-D3 programs use.

Since OSFI is not a native D3 file system, nor are the file systems it interfaces with designed for large data processing, it is not recommended to use it for anything other than interfacing with the native host file system. The OSFI is slower than native D3 files and requires more overhead to access.

OSFI allows D3 to become more flexible than it has traditionally been. Developers no longer need third-party software to access and manipulate NT, DOS, or UNIX files.