Issue 74375 - read file with fixed record len, missing bytes, 2 bytes offset
Summary: read file with fixed record len, missing bytes, 2 bytes offset
Status: ACCEPTED
Alias: None
Product: App Dev
Classification: Unclassified
Component: scripting (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All Windows XP
: P3 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-09 12:45 UTC by szodrow
Modified: 2017-05-20 11:27 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Program file to Test the problem (2.47 KB, text/plain)
2007-02-09 12:49 UTC, szodrow
no flags Details
file with data to test (512 bytes, text/plain)
2007-02-09 12:49 UTC, szodrow
no flags Details
Worksheet with Macros and instructions (10.66 KB, application/vnd.oasis.opendocument.spreadsheet)
2007-02-13 15:39 UTC, szodrow
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description szodrow 2007-02-09 12:45:28 UTC
I have a DATEV file with fixed len records (256 Bytes) and want to read record
by record (in OO Basic). I open it in Random mode with block len 256. The
problem is that the first two bytes are skipped and all subsequent records have
2 bytes offset.

I expected bytes rec 1: 1 - 256, rec 2: 257 - 512, etc, but I get rec 1: 3 -
258, rec 2: 259 - 514

Something similar happens when writing this files in Random mode: the first two
bytes are "away" (I don't remember anymore, because writing the file in binary
mode solves the problem)

When reading the file in binary mode, the same applies. The first 2 bytes are
missing. When I do a subsequent get with a Byte Position (e. g. 2560), again the
first two bytes are missing (starts from 2562). Since I don't need the first two
bytes, I can program a workaround (in attached file), but that is enerving. I
tried, if this is a platform depending problem and did this also on Linux (OO
2.0, SuSE 9.3), but there the get command doesn't work at all (runtime error?!)
Comment 1 szodrow 2007-02-09 12:49:01 UTC
Created attachment 42878 [details]
Program file to Test the problem
Comment 2 szodrow 2007-02-09 12:49:35 UTC
Created attachment 42879 [details]
file with data to test
Comment 3 kpalagin 2007-02-09 20:32:38 UTC
szodrow,
any chance you could provide step-by-step repro instruction?

Thanks a lot.
Comment 4 szodrow 2007-02-13 15:39:13 UTC
Created attachment 42979 [details]
Worksheet with Macros and instructions
Comment 5 szodrow 2007-02-13 15:44:52 UTC
Hello,

in the worksheet FileReadProblem.ods you find macros and instructions that show
my problem(s). You have to modiy the directory and file name in the macro and
you have to create a new test file or use e. g. the test file datev2blocks.

:-)
Comment 6 noel.power 2007-02-15 12:28:15 UTC
->ab
Comment 7 ab 2007-02-15 16:31:53 UTC
STARTED, not yet reproduced
Comment 8 szodrow 2007-03-13 13:39:17 UTC
What does "STARTED, not yet reproduced" mean?
Did the problem not occur?
Is there something missing to reproduce it?
Is it still unclear what the problem is?

:-)
Comment 9 ab 2007-03-13 15:16:52 UTC
ab->szodrow: Unfortunately the status STARTED is misleading. It does not
mean that I'm already working on this issue, it's only the next logical step 
following the status NEW. My boss wants me (and all my colleagues) to react 
on a NEW issue very fast. So I don't have the time to really reproduce every 
issue, especially if they look complicated like this one. I only check, if 
I'm the right one to deal with it in general and set it on STARTED. But I 
still need to reproduce it. I hope things are clearer now... :-)
Comment 10 Mathias_Bauer 2007-12-04 14:57:41 UTC
basic and scripting issues now should be assigned to component "scripting"
Comment 11 Martin Hollmichel 2007-12-07 12:13:49 UTC
set target to 3.x according to http://wiki.services.openoffice.org/wiki/Target_3x
Comment 12 szodrow 2009-12-11 17:20:42 UTC
After some more testing, I found the cause for this problem now: I had created a
buffer of data type string. String is in Unicode in OpenOffice Basic. When
writing non ASCII characters to disk those characters were physically expanded.
When looking to those files in a hex editor, you could see this and suspecting
an error. I replaced the string buffer with an Byte Array and the problem is
solved. 

I think it was good to place a comment somewhere in the OpenOffice Documentation
how to handle binary files correctly (Help or Wiki). Can you tell me a place
where I can place an example?

:-)
Comment 13 ab 2009-12-18 07:20:30 UTC
ab->szodrow: So you think we can close this issue or is
there still also a wrong behavior in Basic?

Concerning a hint in help or an example: If you think
this should be part of the OpenOffice.org help please
submit an issue to ufi@openoffice.org.

Concerning Wiki I doubt that the OpenOffice.org Deve-
loper's guide is the right place as it mainly deals
with using UNO and only covers Basic in this context.
You can have a look yourself:
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OpenOffice.org_Developers_Guide


STARTED again to don't leave it on NEW.
Comment 14 szodrow 2009-12-23 16:56:52 UTC
szodrow->ab: Can be closed
Comment 15 Marcus 2017-05-20 11:27:34 UTC
Reset assigne to the default "issues@openoffice.apache.org".