Posted by Robert G Laurin on June 08, 2011 at 09:17:26:
I have a program that, among other things, reads a 562 bytes SEQ file and updates variables in a 2105 bytes Extended Key file.
One of the variables is a ZIP code. It is ZCRZIP$ length 9 in the SEQ file and PostalCode$ length 50 in the Extended Key file. When I assign the value and re-write the extended file, I get extra garbage at the end of the variable.
Code looks like this...
Inquire (Seq,SeqFormat) Excp=EOF
...
Extract (ExtKey,ExtKeyFormat) Key=OrderID$
...
Let PostalCode$=ZCRZIP$
Write (ExtKey,ExtKeyFormat)
...
In one instance, PostalCode$ was '75067 ' (padded to 50) and ZCRZIP$ was '750674718'. After the Write, PostalCode$ was:
123456789012345678901234567890123456789012345678901234567890
750674718....750674718....313028329....0 .4695551280
In Hex looks like this:
37 35 30 36 37 34 37 31 38 09 00 00 00 37 35 30 36 37 34 37 31 38 09 00 00 00 33 31 33 30 32 38 33 32 39 0A 00 00 00 30 20 20 20 20 20 20 20 20 0A 34 36 39 35 35 35 31 32 38 30 20 20 ...
Where 4595551280 is the next variable in the format (after all 50 bytes) and length is 15. The last $0A is part of PostalCode$.
I found this problem when I tried printing (on a separate pass), the CRLF$ after PostalCode did not show up on records that had been corrected.
I eventually fix this by parsing PostalCode$ as Sub(ZCRZIP$,1,5) + '-' + Sub(ZCRZIP$,6,4).
I was able to re-create this.
Using Comet32 2011.441.
Barb,
If you want to see the code, I can send you a compile listing (10,205 lines). From that you can re-create a source to recompile.
Email me at work or on my yahoo mail.
Each file can be a maximum of 1MB in length Uploaded files will be purged from the server on a regular basis.