Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parsing a file that's not quite comma-delimited
Message
From
10/07/2007 08:52:52
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Parsing a file that's not quite comma-delimited
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01238841
Message ID:
01238841
Views:
79
I have a data stream like below and I want to "walk" through it to parse out the different pieces. There are 7 identifiers that start each line, but in the example below FT1 and DG1 have wrapped; not normally the case. Without getting too deep into the various parts that are not actually field elements, I would like to work through the text and pull out the data to populate a table. It's a lot like a comma-delimieted file, but not quite. I did think about having different cursors for each of the 7 identifier lines, tranforming the "|" into a comma, and just doing an append - and maybe that is the best way - but wanted to see what others thought. Thanks!
MSH|^~\&|Medinotes|CP|External||20070705154008||DFT^P03|468D4AD320F3|P|2.4|||AL|||
EVN|P03|20070705154008|20070705154008
PID|1|11384|468AE48A7926||Johengen^Jay||20051108000000||||||||||||
PV1|1|O|Ambulatory Surgery Center^^^^^^^^Ambulatory Surgery Center||||^Cardio^Full|||||||||||||||||||||||||||||||||||||20070705154008||||||
ORC|SN|
FT1|1|||20070705154008||CG||||||||||^^^Ambulatory Surgery Center|||250.00^Diabetes Mellitus Without Mention Of Complication, Type II Or Unspecified Type, Not Stated As Uncontrolled^I9|^Cardio^Full|||||99212^Office Or Other Outpatient Visit For The Evaluation And Management Of An Established Patient, Which Requires At Least Two Of These Three Key Components: A Problem Focused History; A Problem Focused Examination; Straightforward Medical Decision Making. Counseling And/Or Coordination Of Care With Other Providers Or Agencies Are Provided Consistent With The Nature Of The Problem(s) And The Patient's And/Or Family's Needs. Usually, The Presenting Problem(s) Are Self Limited Or Minor. Physicians Typically Spend 10 Minutes Face-To-Face With The Patient And/Or Family.^C4|
DG1|1||250.00^Diabetes Mellitus Without Mention Of Complication, Type II Or Unspecified Type, Not Stated As Uncontrolled^I9|||F
Next
Reply
Map
View

Click here to load this message in the networking platform