[Programming Rant]
Results 1 to 15 of 15

Thread: [Programming Rant]

  1. #1
    King of the Mermaids Diver01's Avatar
    Join Date
    Mar 2000
    Location
    Minnisoooda (cold wasteland)
    Posts
    1,443

    [Programming Rant]

    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. :butt:

  2. #2
    Driver Terrier NooNoo's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    31,824
    Define "interface"
    What does the program have to do with the variable length file?

  3. #3
    Registered User deepblu's Avatar
    Join Date
    Mar 2003
    Location
    Portland, Oregon
    Posts
    52
    Quote Originally Posted by Diver01
    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. :butt:

    Variable length?
    Are you referring to variant records by chance?

  4. #4
    Registered User +Daemon+'s Avatar
    Join Date
    Jan 2002
    Location
    RC, Ca
    Posts
    3,406
    like hwo much you can write to a file?

  5. #5
    King of the Mermaids Diver01's Avatar
    Join Date
    Mar 2000
    Location
    Minnisoooda (cold wasteland)
    Posts
    1,443
    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.

  6. #6
    Driver Terrier NooNoo's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    31,824
    use oracle.

  7. #7
    Geezer confus-ed's Avatar
    Join Date
    Jul 1999
    Location
    In front of my PC....
    Posts
    13,087
    Quote Originally Posted by NooNoo
    use oracle.
    Huh ? Why do we want to use database software ?

    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

  8. #8
    Driver Terrier NooNoo's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    31,824
    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.

  9. #9
    Geezer confus-ed's Avatar
    Join Date
    Jul 1999
    Location
    In front of my PC....
    Posts
    13,087
    Quote Originally Posted by NooNoo
    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.

  10. #10
    Driver Terrier NooNoo's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    31,824
    True.... I guess we don't get what the problem is....

  11. #11
    King of the Mermaids Diver01's Avatar
    Join Date
    Mar 2000
    Location
    Minnisoooda (cold wasteland)
    Posts
    1,443
    Quote Originally Posted by NooNoo
    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...

  12. #12
    Geezer confus-ed's Avatar
    Join Date
    Jul 1999
    Location
    In front of my PC....
    Posts
    13,087
    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

  13. #13
    King of the Mermaids Diver01's Avatar
    Join Date
    Mar 2000
    Location
    Minnisoooda (cold wasteland)
    Posts
    1,443
    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.
    Last edited by Diver01; February 4th, 2004 at 11:32 AM.
    W

  14. #14
    Driver Terrier NooNoo's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    31,824
    Translate it to what?
    you would read the file into an array... space filling as appropriate.

  15. #15
    Geezer confus-ed's Avatar
    Join Date
    Jul 1999
    Location
    In front of my PC....
    Posts
    13,087

    Roughly here's how ...

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •