LegacyDesign Engineering

Reading a legacy stock file.

A worked example of a format investigation. The file, field names and quantities were created for this demonstration.

Investigation brief

Preserve zero quantities during migration.

An importer needs to distinguish an existing item with zero stock from an item missing altogether. This 12-byte file supplies two records for that check.

Download stock.lda
stock.lda12 bytes HEX
Archive inspector

Select a field to find its bytes in the file.

004C014402410331040205000641070C080009420A000B00
LDA1The first four bytes spell the format identifier in ASCII.
2Bytes 04 and 05 specify two records. The least significant byte comes first.
A = 12 / B = 0Each record uses three bytes. Record B is present and has a quantity of zero.

Field layout

Hex offsetLengthFieldInterpretation
00–034 bytesFormat signatureLDA1 in ASCII
04–052 bytesRecord countUnsigned 16-bit integer, little-endian
06–083 bytesFirst recordIdentifier A and quantity 12
09–0B3 bytesSecond recordIdentifier B and quantity 0

Acceptance check

The file must produce two rows. Item A must have 12 units and item B must remain present with 0 units. An importer that drops item B fails the check.

Limits of the sample

This file exercises two complete records. Testing truncated files, duplicate identifiers or quantities above 255 would require additional examples.

Discuss a legacy format