Approaches to parsing fixed length text files

Results 1 to 2 of 2

Thread: Approaches to parsing fixed length text files

  1. #1
    Join Date
    Dec 1969

    Default Approaches to parsing fixed length text files

    Hi, <BR><BR>Example stuff at the end of this message. <BR><BR>I&#039;m looking for some generic suggestions for turning a fixed-length text file (a phone company record) into something useful. I&#039;m looking for a variety of approaches (as opposed to one specific thing) that might help me learn more about C# (and whatever else... XML comes to mind). Also looking for suggestions regarding patterns (GoF) that might be used. <BR><BR>The plan is to start with a text-only console app and then enhance for a Windows and/or Web app with SQL Server and Crystal Reports. <BR><BR>Don&#039;t need to be REAL specific... just some approaches that might be interesting to learn and work with. I&#039;ve been doing ASP/VP/SQL for several years and Foxpro way before that, but those things didn&#039;t have enums, structs, interfaces, inheritance, or easy access to XML... not to mention cool stuff like patterns (which have captured my interest lately). Speaking of which, I&#039;m also looking for some suggestions on making with more generic to perhaps adapt to changes in the file structure, etc. <BR><BR>Thanks for your help and here&#039;s the example stuff (abbreviated). <BR><BR>++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++ <BR><BR>THE FILE LOOKS LIKE THIS (but a lot longer): <BR>0004225538970242088600000000000000070202360000 007038362469VAALEXANDRIA10036 <BR>0004225538970242088600000000000000070203580000 008472299472ILWHEELING 10072 <BR>0004225538970242088600000000000000070202360000 002026370899DCWASHINGTON10030 <BR>0004225538970242088600000000000000070202360000 002023370864DCWASHINGTON10024 <BR><BR>HERE&#039;S THE BEGINNING OF THE FILE LAYOUT SHEET <BR>Customer Number 10(N) <BR>Originating Number 10(N) <BR>Auth Code 14(N) <BR>Product Type 03(N) <BR>Call Type 01(N) <BR>0=Intralata <BR>1=Intrastate <BR>2=Interstate <BR><BR><BR>ULTIMATELY THIS TURNS INTO SOMETHING LIKE: <BR><BR>Account Usage Calls Minutes CPM <BR>Acct# 1 339.8226 3125 6504.6 .052 <BR>Acct# 2 3379.0364 15010 35868.0 .094

  2. #2
    Join Date
    Dec 1969

    Default System.IO namespace

    the documentation for what the .net framework has to offer in this area is at:<BR><BR><BR>in short, the namespace has all the classes for working with files, and the link includes a listing of available enumerations at the bottom of the page under the classes, etc.

Posting Permissions

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