in reply to Automatic Sage Line 50 stock adjustments

As an update to the above code, we have recently upgraded to Sage 50 Accounts version 2011 (aka version 17 internally). The main difference is that the stock reference field has increased in size to 30 characters, and the header has had some minor changes:
sub sgt_header { # You need to know how many rows you will be writing my $items = shift; print pack("V",0x0740); # Magic number print pack("V",17); # Major version number print pack("V",166); # Possibly minor version? print pack("V",$items); # Number of rows print pack('Vx','0x9bd5'); # We seem to have an extra null byte in h +ere since v11 }
Then in sgt_item you will need to increase the length of the reference field:
print pack('a30x',$reference);