9. SDEF – Structured Data Editable Format

This Format is the little brother of SDXF (the Structured Data Exchange Format)

SDEF is designed as an intermediate format: An SDXF structure (or a set of SDXF structures) may be 'unload' to SDEF, interpreted or manipulated by a text oriented system (REXX or BASIC) or edited manually by a text editor and then reloaded into SDXF for shipping to another site.

The differences are:

(+)       SDEF is editable and readable by humans
(-)        it is not platform independent
(-)        no compression
(-)        no encryption

SDEF is a text file format: data is organized as text lines, the exact definition of a text file is system dependent: UNIX uses linefeed character to separate text lines, MSDOS / Windows the carriage-return / linefeed sequence, on mainframe an SDEF file is organized in records of variable length (Fixed length is not allowed for SDEF!).

Every elementary chunk is represented as a text line. The SDXF chunkID and type is represented in a fixed header part of this line, the rest of the line is filled up with the chunk data. The chunk length is implicit given by the length of the text line.

Description of an elementary chunk:

field position length Remark
chunkID 1 5 decimal number with leading zeroes
type 6 1 type of chunk
data 7 var  


^ ^^

A structure is represented by a pair of  SDEF lines without data and the type character "(" = start of structure and ")" = end of structure. These two lines surrounds the SDEF lines which are the part of this structure. The corresponding ")"-line contains the same chunkID as the "("-line, the chunkID of the structure.

An array is represented by a pair of  SDEF lines with the type character "<" = start of array and ">" = end of array. These two lines surrounds the SDEF lines which are the part of this array. These SDEF lines carries the chunkID of the array. The start-line (with the "<" type) should have the number of array elements in his data part. The data part of the type ">" line is empty.
All the lines between "<" and ">" must have the same type. They have all the special ("impossible") chunkID "99999"
(Real chunkID's has a maximal value of "65535").
As type only "#" and "!" (numericals) are allowed.  In one SDEF line you can place values separated by blanks as much as it might be reasonable: A limit of 250 Bytes for the data is recommended.
While converting to SDXF the datalength is fixed: "#" becames a long with length 4 and "!" becames a double with length 8 (C types) .
(This part is changed on 2005-10-09)

This is the list of type characters:

type description
# integer numerical
! floating point numerical, p.e. 3.141592 or -31.41596E-1
x bit-string represented as hexadecimal digits
' characters in host representation (text)
/ text in UTF-8 notation
< begin of array
> end of array
( begin of structure
) end of structure

There is a convert utility which tranforms a SDXF file into SDEF and vive versa. Usage is:

SDXconvert from <infile> to <outfile> as <format> <compression type> <de/encryption key>

format can be: SDXF or SDEF
compression types are: (only for convert to SDXF) RL1, DEF (deflate)