Import dos file variable record length 
Author Message
 Import dos file variable record length

Hi everyone,

   I am traying to read a dos file with variable record lengths from a
program in C4 in order to import it to a TPS file.
How do you declare the file?
How do you access the file?

Thanks in advance,

Homero



Mon, 26 Mar 2001 03:00:00 GMT  
 Import dos file variable record length
Hi Homero

My first thought is to try to use the BASIC(SDF) file driver ...

--
Best Regards
sm
-------------------------------------------------------------
Steve MacLeod, Microcomputer Specialist   Computer Centre
University College of Cape Breton         Phone (902)563-1625
Sydney, N.S. Canada B1P 6L2               Fax   (902)562-0119

       ----- Member of Team TopSpeed Internet -------

Quote:

>Hi everyone,

>   I am traying to read a dos file with variable record lengths from a
>program in C4 in order to import it to a TPS file.
>How do you declare the file?
>How do you access the file?

>Thanks in advance,

>Homero



Mon, 26 Mar 2001 03:00:00 GMT  
 Import dos file variable record length
I always thought that DOS files had only one big record spanning the entire
file and that "reading records" would actually read smaller segments of the
file. Isn't it so?

--



Mon, 26 Mar 2001 03:00:00 GMT  
 Import dos file variable record length

Quote:

>   I am traying to read a dos file with variable record lengths from a
>program in C4 in order to import it to a TPS file.
>How do you declare the file?
>How do you access the file?

Homero,

Here's something for you to chew on. Hopefully, it will help point you in the
right direction. Reading your DOS file is simple; you will need little more
than the code below. I assume you are intimate with the internal structure of
this variable record file; you're going to have to be. <g>

Take a look at the declaration of aDOSFile below. The record is simply an
array of bytes which, in this case, is DIMed to 1024. Given your variant
records, you may have to give special consideration to both the size of
aDOSFile.buffer, and the number of bytes you read with each get.

The basic idea is to use this form of Clarion's Get():
Get(file, filepointer, length) to read a no more than Size(aDOSFile.buffer)
per call. You can read less if required. In any event, you'll have to
maintain your own pointer into aDOSFile.

! the DOS file declaration

aDOSFile    FILE,DRIVER('DOS'),PRE(DOSFile)
Record      record
buffer      byte, dim(1024)
    end
end

! two local variables you will need

lDOSFilePointer         long
sSizeReadBuffer         signed

        ! a sample of the usage of Get()
        Get(DOSFile, lDOSFilePointer, sSizeReadBuffer)

        ! do some magic stuff to write to your TS record

You have a good deal of work to add to this to handle your variant records.

HTH

Regards,

Mark
----------------------------
sig under construction

Certified Hobbyist

The clueless shall inherit the earth,
and will need directions to get there.



Tue, 27 Mar 2001 03:00:00 GMT  
 Import dos file variable record length

Quote:

>I always thought that DOS files had only one big record spanning the entire
>file and that "reading records" would actually read smaller segments of the
>file. Isn't it so?

From the help file .. "The DOS driver reads a buffer at a time (not a
record)"

Hard to say exactly what is best to do here as there is a shortage of
details,
"variable length records" does not tell the whole story, there has to be
some
more information on the record structure.

--
Best Regards
sm
-------------------------------------------------------------
Steve MacLeod, Microcomputer Specialist   Computer Centre
University College of Cape Breton         Phone (902)563-1625
Sydney, N.S. Canada B1P 6L2               Fax   (902)562-0119

       ----- Member of Team TopSpeed Internet -------



Tue, 27 Mar 2001 03:00:00 GMT  
 Import dos file variable record length
A couple questions on the variable length file:
1) What is the maximum record length?
2) What are the field seperators?
3) What is the end of record deliminator?

Using the BASIC file driver, you can use the following Driver init
strings to specify the Record deliminator and field seperators:
/ENDOFRECORD=n,<m>
where N is the number of characters in the end of record and M is the
value(s) of those characters.

/FIELDDELIMITER=n,<m>
N and M are the same as above.

If this doesn't help you, could you please post an example of the
record(s) you are trying to read in? If this is a report you are trying
to grab data from, I can give you some help with that. I've had to do it
before.

HTH!



Tue, 27 Mar 2001 03:00:00 GMT  
 Import dos file variable record length
Maybe I am makeing things more complicated than they are. Bottom line I need
to import large
Excell spread sheets to TPS. I need to be selective on what records to
import and read 3 or mor of the spreadsheet to make one record for TPS file.
I thought converting the file to .csv and the using the basic driver would
help, but I found out that the record length is variable and I don't know
how to handle that. Is there an easy way to do this ???

Thanks,

Homero

Quote:

> A couple questions on the variable length file:
> 1) What is the maximum record length?
> 2) What are the field seperators?
> 3) What is the end of record deliminator?

> Using the BASIC file driver, you can use the following Driver init
> strings to specify the Record deliminator and field seperators:
> /ENDOFRECORD=n,<m>
> where N is the number of characters in the end of record and M is the
> value(s) of those characters.

> /FIELDDELIMITER=n,<m>
> N and M are the same as above.

> If this doesn't help you, could you please post an example of the
> record(s) you are trying to read in? If this is a report you are trying
> to grab data from, I can give you some help with that. I've had to do it
> before.

> HTH!



Tue, 27 Mar 2001 03:00:00 GMT  
 Import dos file variable record length
Hi Homero,

On Fri, 09 Oct 1998 11:39:46 -0500, Homero Montemayor

Quote:

>I thought converting the file to .csv and the using the basic driver would
>help, but I found out that the record length is variable and I don't know
>how to handle that. Is there an easy way to do this ???

I've just been importing a bunch of excel sheets into tps databases.
I exported them as dbaseIII files, imported the files into a
dictionary and then read them into my tps databases.  Worked fine,
except for one thing:  The field declaration in the debase files that
excel creates is column width dependent.  So, even if your excel
column show all the data, we experienced that only about 90% of the
data was in the dbase file, the 10% was clipped off the fields.  So,
make your excel columns ca 15% wider than the longest string and it
should work ok:)

Best regards,

Arnor Baldvinsson        
[Team Topspeed - Internet Connect]
Allerup Edb
Denmark

http://www.icetips.com  (http://199.34.26.90)
UIN nr.: 2428601



Tue, 27 Mar 2001 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Getting true length of a variable length record - IBM Mainframe

2. Finding Variable-Length Record Length

3. processing variable length records in text file

4. Reading variable-length records from a file

5. How to access files with variable length records?

6. How to access files with variable length records?

7. Sorting a file with variable length records.

8. Accessing variable-length records files in C-ISAM standard

9. How to read a binary file with variable length record

10. Accessing variables created after import in imported files

11. Importing via Access 97 odbc driver variable length Access Memo fiels

12. Processing variable length/variable data files

 

 
Powered by phpBB® Forum Software