Discussion:
reading MEM files
(too old to reply)
dbyy
2004-07-05 11:08:51 UTC
Permalink
hi everytone,

right now I'm working on a migration "ADS/DFB to Mediator/Oracle"
As part of this migration I would like to replace all the MEM files in
use with a solution to store all MEM file data on Oracle.

For this I purpose I investigated already in old posting regards MEM
files in this NG and I found some info's about the structure of MEM files.

My plan is to replace "SAVE TO/RESTORE FROM" with a code which reads
low-level the MEM file and stores/retrieves data from the Oracle table.

It's easy to handle "Char" and "logical" data. But a bit I'm puzzled
about the Numeric/Data fields.

My question is:
Does anyone knows the exact structure of Numeric (and Date fields)
entries in a MEM file?
- where/how is the sign (minus values) stored?
- how are decimals stored?

I used the program "readmem" (OASIS) as template to read MEM files.

Hope someone can share some thoughts about this.

Any help is much appreciated.

Cheers
Fred
Dave Pearson
2004-07-05 12:12:35 UTC
Permalink
Post by dbyy
Does anyone knows the exact structure of Numeric (and Date fields)
entries in a MEM file?
- where/how is the sign (minus values) stored?
- how are decimals stored?
<URL:http://groups.google.com/groups?as_umsgid=slrn94jqru.fh7.davep.news%40hagbard.davep.org>
might interest you if you've not already seen it. The GT library for Clipper
is available on The Oasis so you'll easily be able to look at the source for
GT_UnCompN.
--
Dave Pearson | OSLib - Timeslice release functions.
http://www.davep.org/ | eg - Norton Guide reader for Linux.
http://www.davep.org/clipper/ | weg - Norton Guide reader for Windows.
http://www.davep.org/norton-guides/ | dgscan - DGROUP scanner for Clipper.
dbyy
2004-07-07 00:58:04 UTC
Permalink
Post by Dave Pearson
Post by dbyy
Does anyone knows the exact structure of Numeric (and Date fields)
entries in a MEM file?
- where/how is the sign (minus values) stored?
- how are decimals stored?
<URL:http://groups.google.com/groups?as_umsgid=slrn94jqru.fh7.davep.news%40hagbard.davep.org>
might interest you if you've not already seen it. The GT library for Clipper
is available on The Oasis so you'll easily be able to look at the source for
GT_UnCompN.
Thanks Dave,

run the first test with GT LIbrary and it seemms to me
that I can use the functions GT_CompN and GT_UncompN.

Even I would prefer pure Clipper code (company policy regards external
libs, C-code etc.), I guess this lib is the solution.

Thanks for your input.

BTW. Test with Mediator V 4.1 and Oracle looking good.

Cheers

Fred
Dave Pearson
2004-07-07 08:29:52 UTC
Permalink
Post by dbyy
Post by Dave Pearson
<URL:http://groups.google.com/groups?as_umsgid=slrn94jqru.fh7.davep.news%40hagbard.davep.org>
might interest you if you've not already seen it. The GT library for
Clipper is available on The Oasis so you'll easily be able to look at
the source for GT_UnCompN.
Thanks Dave,
My pleasure.
Post by dbyy
run the first test with GT LIbrary and it seemms to me that I can use the
functions GT_CompN and GT_UncompN.
IIRC it only uses GT_UncompN.
Post by dbyy
Even I would prefer pure Clipper code (company policy regards external
libs, C-code etc.), I guess this lib is the solution.
Interesting policy, why is that? But you should be aware that GT_UncompN is
written in C and for good reason (a lot less messing about then doing it in
Clipper code). As such it probably contravenes your company's policy.
Post by dbyy
Thanks for your input.
Hope it helps.
--
Dave Pearson | OSLib - Timeslice release functions.
http://www.davep.org/ | eg - Norton Guide reader for Linux.
http://www.davep.org/clipper/ | weg - Norton Guide reader for Windows.
http://www.davep.org/norton-guides/ | dgscan - DGROUP scanner for Clipper.
dbyy
2004-07-07 12:06:10 UTC
Permalink
Post by Dave Pearson
Post by dbyy
Post by Dave Pearson
<URL:http://groups.google.com/groups?as_umsgid=slrn94jqru.fh7.davep.news%40hagbard.davep.org>
might interest you if you've not already seen it. The GT library for
Clipper is available on The Oasis so you'll easily be able to look at
the source for GT_UnCompN.
Thanks Dave,
My pleasure.
Post by dbyy
run the first test with GT LIbrary and it seemms to me that I can use the
functions GT_CompN and GT_UncompN.
IIRC it only uses GT_UncompN.
Post by dbyy
Even I would prefer pure Clipper code (company policy regards external
libs, C-code etc.), I guess this lib is the solution.
Interesting policy, why is that? But you should be aware that GT_UncompN is
written in C and for good reason (a lot less messing about then doing it in
Clipper code). As such it probably contravenes your company's policy.
Post by dbyy
Thanks for your input.
Hope it helps.
Dave,
Just to fill you in.
In my group (Clipper developer's), I'm the only one who knows C/C++ and
we have to maintain a big package written in Clipper.
The policy is that any developer must understand all the time the code
used in our applications.
Even I like C/C++/Java, we have to keep that in mind.
And beside that, we have had bad experience with 3rd party libraries and
I have to fight hard with the sen. mgmnt. about this issues (even it is
not really an 'issues' for ME.)

I hope this explains it a bit - life is not offering always candies :-(

Rgds.
Fred

PS. I used GT_CompN and GT_UnCompN to verify the data (num(6,2);
num(8,4); num(10,6); num(12,8) a.s.o.)

gabor salai
2004-07-05 15:19:17 UTC
Permalink
Post by dbyy
hi everytone,
right now I'm working on a migration "ADS/DFB to Mediator/Oracle"
As part of this migration I would like to replace all the MEM files in
use with a solution to store all MEM file data on Oracle.
For this I purpose I investigated already in old posting regards MEM
files in this NG and I found some info's about the structure of MEM files.
My plan is to replace "SAVE TO/RESTORE FROM" with a code which reads
low-level the MEM file and stores/retrieves data from the Oracle table.
It's easy to handle "Char" and "logical" data. But a bit I'm puzzled
about the Numeric/Data fields.
Does anyone knows the exact structure of Numeric (and Date fields)
entries in a MEM file?
- where/how is the sign (minus values) stored?
- how are decimals stored?
I used the program "readmem" (OASIS) as template to read MEM files.
Hope someone can share some thoughts about this.
Any help is much appreciated.
i have not tested it, but [if i should to] i'd start with binary conversion:

integers [short] and dates:
cvalue:=i2bin(ivalue), then store cvalue (2 bytes), and
read cvalue, then ivalue:=bin2i(cvalue)

long integers and floats [with decimals] are stored as double:
cvalue:=ftoc(dvalue), then store cvalue (8 bytes), and
read cvalue, then dvalue:=ctof(cvalue)

i2bin() and bin2i() are standard functions, while
ftoc() and ctof() are ct3 conversion functions, look at ng.

if this is true, you don't have to carry nor about sign nor decimals,
systemm does everything for you!
Loading...