Click to See Complete Forum and Search --> : [Programming Rant]
Diver01
December 22nd, 2003, 03:22 PM
Just a general question/small rant about programming...
Is is really THAT difficult to write an interface to a varaible length file. I know im not a professional programmer but I have taken classes and written a few programs myself. I just dont get it. :redeyes: :flame: :butt: :rolleyes:
NooNoo
December 22nd, 2003, 05:06 PM
Define "interface"
What does the program have to do with the variable length file?
deepblu
December 26th, 2003, 08:34 PM
Just a general question/small rant about programming...
Is is really THAT difficult to write an interface to a varaible length file. I know im not a professional programmer but I have taken classes and written a few programs myself. I just dont get it. :redeyes: :flame: :butt: :rolleyes:
Variable length?
Are you referring to variant records by chance?
+Daemon+
February 3rd, 2004, 03:15 PM
like hwo much you can write to a file?
Diver01
February 3rd, 2004, 03:28 PM
I was having a really bad day and needed someplace to vent...
Yes I was talking about variable length records (Sorry for the confusion)
Yes I have very limited experience writing to a file. I hope to gain more as I try and continue my VBasic training this year.... Atleast thats why I keep promising myself I would like to try and do... Just need to get my hands on a recent copy of VB.
NooNoo
February 4th, 2004, 12:26 AM
use oracle.
confus-ed
February 4th, 2004, 07:36 AM
use oracle.
Huh ? Why do we want to use database software ? :confused:
In VB you just need to have met my mate 'LEN' ;) (returns the length of 'digits' in any variable) & know how about variable types (so char, string etc etc) so that you can strip out the character strings & turn input into real numbers or whatever :) - at first this is 'hard' conceptually but a little practice with string handling soon puts you right :)
NooNoo
February 4th, 2004, 07:41 AM
oracle handles variable length fields. I don't know what's in the files he refers to, but if it is database type data, then oracle can handle it.
confus-ed
February 4th, 2004, 08:01 AM
oracle handles variable length fields. I don't know what's in the files he refers to, but if it is database type data, then oracle can handle it.
& ? ...VB knows about variable length records, C knows about variable length records, Pascal knows about them, infact pretty much every programming language I can think of knows about them & some non programatical stuff like databases 'know' too !
String handling in VB is very much like any other language you need to be able to find lengths of strings, change their types so you can operate on them, strip characters in & out, swap characters, compare characters - yada yada yada !!! - string handling is a pain in any language, but they all have sufficient operators to handle it ;) if they can define that as a TYPE that the language accepts.
NooNoo
February 4th, 2004, 08:15 AM
True.... I guess we don't get what the problem is....
Diver01
February 4th, 2004, 08:50 AM
True.... I guess we don't get what the problem is....
That was my point to begin with. The file in question was an ascii file with variable length records. In one particular area of the country, it doesnt seem to matter who I talked with, nobody knew how to write a program that knew how to deal with a variable length records. I know it can be done. I know other people can do it. I was frustrated because these other vendords refused. Caused me a lot of headaches and an extra days worth of work. Job security I guess...
confus-ed
February 4th, 2004, 09:39 AM
Finally I get the problem ... so the records were created by some other application & have non standard record markers & seperators then ?
So you'd have to read the entire record & parse it into fields yourself (by searching each string for markers, but if its big{exceeds the maximum single record size} it gets pretty tricky pretty quick) & then read that, but that's sort of past beginner level programming ... not expert, but intermediate to - too bloody hard for me :D
Diver01
February 4th, 2004, 10:24 AM
Each field type has a marker within the file. For Example:
1(32)Beer(36)5.00
2(32)Cigarettes(33)1.50(34)02042004(35)02102004(36 )3.00
(32) in this case would equal a Description
(33) would be a Sale Price
(34) Would be Start Date
(35) Would be End date
(36) is a regular retail
The 1 and 2 is the record #.
Note: This is not an issue I am currently having. It is just a curiosity to me on how difficult it would be to write an app in VB that could translate a file that is variable length. I will be trying to learn how to do this later this year using VB.
NooNoo
February 4th, 2004, 12:15 PM
Translate it to what?
you would read the file into an array... space filling as appropriate.
confus-ed
February 4th, 2004, 12:44 PM
Right so what you've got is a big list of data, seperated into fields, but with an ascii file you'd have seperators between each entry of a line feed or comma or somesuch (or the ascii char for it) & a carriage return at the end of each line or record.
So what you do is get the length of the record (as long as its not more than 32k -which is when it gets hard) then you read each character in turn into an array of chars until you reach your first seperator, that then gets set as = to field one of your record, clear your array .. repeat until you find the end of record marker. Read next record, repeat etc..
If you haven't got any seperators as its literally described in the question, it'd be mighty hard indeed, as ascii files don't contain any info about field lengths like say a binary record might.