How To: Edit SDTSEXPORT XREF module by hand


Generally, there are three steps involved when modifying the record:

1. Update each subfield with the new values.

2. Update the field length and field positon value.

3. Update the total record length.

Use an editor that supports the editing of binary data.


The XREF module contains two variable length records. The record format is based on the ISO8211 standard.

In the sample 1013XREF.DDF file, the first record is 235 bytes long and user should not edit this record since it contains meta data about the file and it will not change.

The second record is the real data record, in the sample 1013XREF.DDF file it starts at byte location 236 with the string value “00240”. This is where you need to start modifying.
[O-Image] Sample 1013XREF.DDF file
The following table shows the structure of the record.

[O-Image] Table showing the structure of the record
Since this deals with variable length records, after modifying the subfield(s) content (e.g. content of COMT), make sure the total record length, field position and field length are correct and in sync.

The following example demonstrates how to update this record. Imagine the following edits are required:

COMT from “Vertical Datum�” to "LMSL - Local Mean Sea Level"
RSNM from “UTM” to "GEO"
HDAT from “NAS” to "WGE"
ZONE from “19” to “”
VDAT from “NGVD” to "LMSL"

Update each value in the data file with the new value. You can update the corresponding subfield content but be careful not remove the end of subfield (ASCII value 31, “^_”) or end of field (ASCII value 30, “^^”) character.

After updating the subfield in the data file the field length and field position must be updated starting at byte 259 in the sample 1013XREF.DDF file.

From byte 259 the input string reads as follows:


The following table shows the breakdown of field length and position for the above string:


[O-Image] Field length and field position table

In the above example field 0001 has not changed. The XREF field is changed, the COMT is 107 char shorter, the ZONE subfield is changed from “16” to nothing, so it is 2 char shorter.

In total, the field is 109 char shorter. Therefore the new field length is 154 – 109, or 45.

The length of VATT field is also changed, the only significant change in terms of length is AUTH changes which added 2 character. So the new length is 29 + 2 = 31.

The following table shows the changes. Changes are highlighted in red.

[O-Image] Field length and position changes
Note the starting field position for VATT is also changed since XREF is shorter. The field position is the sum of the previous field position and previous field length.

The resultant string reads as follows:


The final required modification is the total record length for this updated record. It is a 5 char string at the beginning of the record at byte 236, in the sample 1013XREF.DDF file the string is "00240." Since we have updated several subfields you must recalucate this number.

There are two ways to calculate the length of the record...
[O-Image] Methods for calculating the length of the record
The update XREF module is named NOAAXR.

[O-Image] The updated XREF module