LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-24-2004, 11:22 AM   #1
naijaguy
Member
 
Registered: Aug 2004
Posts: 88

Rep: Reputation: 15
problems reading in fixed-length record file


We just moved to the Linux version of a database, and we have a program written to load a fixed-length record file of info into the database that we have just copied over to the Linux version of the database. Most of the reading is fine, but we do have problems with larger files of info (e.g. greater than 24 MB) where it starts getting off by a few bytes. Could this be related to Linux, or only the Linux version of this database? Thanks...
 
Old 08-24-2004, 03:34 PM   #2
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 34
Without getting really technical - it sounds like your input file was created somewhere else and got garbage in it - or somebody is doing something dumb when writing the data.

I would suspect the files first - try figuring out where in the file you first go off, then use od to examine the data a few records before the offset problem occurs -

Code:
od -x -j nnnnn  filename | pg
Or - see if the file is the problem to start with -
example lrl = 120 bytes
Code:
let result=0
let lrl=120
let filelen=`cat file | wc -c`
result=`expr $filelen % $lrl`
if [ result -ne 0 ] ; then
       echo "Houston, we have a problem"
fi

Last edited by jim mcnamara; 08-24-2004 at 03:40 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Zero-length bash .history file! revmyo Linux - Security 1 12-03-2005 09:09 PM
problems reading iso fedora core 4 file from cd/hard drive tencan Fedora - Installation 6 10-31-2005 03:50 PM
gawk, comma delim to fixed length? johniccp Programming 1 01-20-2005 05:21 PM
csv to fixed-length file roballen Programming 0 03-11-2004 04:12 AM
Can you create an empty file and specify the byte length? harryo Linux - General 3 02-25-2004 11:01 PM


All times are GMT -5. The time now is 09:12 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration