473,385 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Read 6 bytes floating from a file

Hello,

I have an old fashion Database with several random access files and I need to import the data to a new Sql Server dababase the data.

There are tables with 6 Bytes floating numbers fields and we have no Number data type with that length in VB.

I tried and tried and... and can't find.

I found this code in the ERP folder, is AlphaBasic. It use an envoirement namend A-shell from Microsabio .

Expand|Select|Wrap|Line Numbers
  1. MAP1 OOCUM'4750        ! Cabecalhos de Documentos
  2.   MAP2 SIT'4750,B,1    ! Ocupado (Sim/Nao)
  3.   MAP2 KEY2'4750        ! Chave Secundaria
  4.    MAP3 FCA'4750,S,4      ! Cliente/Fornecedor/Armazem
  5.    MAP3 KEY'4750        ! Chave Primaria
  6.      MAP4 SERIE'4750,S,1    ! Serie
  7.      MAP4 TIPDOC'4750,S,1    ! Tipo
  8.      MAP4 NDOC'4750,S,5        ! Numero
  9.   MAP2 ARMZ'4750,S,3    ! Armazem
  10.   MAP2 NRINT'4750,B,3    ! Numero Interno
  11.   MAP2 SER'ORIG'4750,S,1    ! Documento Origem
  12.   MAP2 NUM'ORIG'4750,B,2    ! Documento Origem
  13.   MAP2 DATORIG'4750,S,8    ! Data Documento Origem    
  14.   MAP2 DATREC'4750,S,8    ! Data Computador/Prazo 
  15.   MAP2 DATDOC'4750,S,8    ! Data Documento
  16.  
  17. * * * Fields I Can't convert:
  18.  
  19.   MAP2 VALDES'4750,F,6    ! Valor Desconto
  20.   MAP2 VALPOR'4750,F,6    ! Valor Portes
  21.   MAP2 VALSEG'4750,F,6    ! Valor Seguro
  22.   MAP2 VALIMP'4750,F,6    ! Valor IVA
  23.   MAP2 VALDOC'4750,F,6    ! Valor Iliquido
  24.  
  25. * * * 
  26.  
  27.   MAP2 TRANSP'4750,S,1    ! Codigo Transporte
  28.   MAP2 FLAGEMI'4750,S,1    ! Emitido (Sim/Nao)
  29.   MAP2 COD'PAG'4750,B,1    ! Codigo Condicoes Pagamento
  30.   MAP2 VENDOR'4750,S,3        ! Vendedor
  31.   MAP2 FNDOC'4750,S,6    ! Documento Referencia
  32.   MAP2 DATFACT'4750,S,8    ! Data Documento Referencia
  33.   MAP2 NMOV'4750,B,1    ! Linhas Documento
  34.  
  35. * * *
  36.  
  37.   MAP2 PAGO'4750,F,6    ! 
  38.  
  39. * * *
  40.   MAP2 RESP'4750,B,1    ! Linhas Satisfeitas
  41.   MAP2 MOVANUL'4750,B,1    ! Linhas Anuladas
  42.   MAP2 ANULADO'4750,S,1    ! Anulado (Sim/Nao)
  43.   MAP2 FILLER'4750,S,23
  44.  
The Fields I Can't convert are Floating with 6 Bytes

Thank you,

Miguel
Mar 5 '11 #1
1 1881
Hello, Miguel,

I have not done this in VB, but you may be able to use the BitConverter class to accomplish what you need. You will need to know how the 6-byte floating values are structured. This includes which byte is the most significant and which the least, and also which bits within the 48 bit array comprise the mantissa and which bits make up the exponent.

You will need to move the 6 bytes (in the correct order) into a 64 bit Integer and then shift the exponent bits into the proper location for a Double precision floating value. You will need to extend the sign bit of the mantissa into the bits that have been "vacated" by shifting the exponent. You will also need to extend the sign bit of the exponent. Then use the Int64BitsToDouble method of the BitConverter class to get a double precision floating value that VB can use.

You might find the following reference helpful as you work on this project:

http://www.cse.msu.edu/~cse320/Docum...atingPoint.pdf

Cheers,
Randy
Mar 8 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Randy Webb | last post by:
Running Apache2 and PHP 4.3.3 on Windows, is there any way that I can have PHP read an image file and out put its color content? Preferably, I would like for it to read a .bmp file and output a...
5
by: maxwell | last post by:
I used to program in matlab An read an image file with : fread(a,,0) which gave me a matrix of 256*256 full of numbers which were the pidxel values from 0 to 256. How do i do the same in c++ ...
5
by: Pete | last post by:
I having a problem reading all characters from a file. What I'm trying to do is open a file with "for now" a 32bit hex value 0x8FB4902F which I want to && with a mask 0xFF000000 then >> right...
4
by: ESPN Lover | last post by:
Below is two snippets of code from MSDN showing how to read a file. Is one way preferred over the other and why? Thanks. using System; using System.IO; class Test { public static void...
0
by: Ahmed A. | last post by:
This will be very helpfull for many! Using RichTextBox Read/Write Unicode File http://www.microsoft.com/indonesia/msdn/wnf_RichTextBox.as p Private Function ReadFile(ByVal myfile As String)...
1
by: tim | last post by:
I have a multi-dimensional byte array, private someArray(,,) as byte and it's huge redim someArray(100,640,480,3) after populating the array, I write it to a text file to save it. (so I don't...
8
by: paraidy | last post by:
Hi all, as from object i need to read all byte from a file example c: \myphoto.jpg and recreate the file with another name to another directory c:\photo\recreatedphoto.jpg can someone write a...
6
by: Thomas Kowalski | last post by:
Hi, currently I am reading a huge (about 10-100 MB) text-file line by line using fstreams and getline. I wonder whether there is a faster way to read a file line by line (with std::string line)....
9
by: vineeth | last post by:
Hello all, I have come across a weird problem, I need to determine the amount of bytes read from a file, but couldn't figure it out , My program does this : __ file = open("somefile") data =...
1
by: platopathrose | last post by:
hai friends, i need some help with codes, to read a BMP file pixel wise. and to do run Length Encoding. also there is also another doubt if we r using fputc, or fgetc will the count we are...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.