Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data Normalization
Message
From
14/07/2000 13:35:10
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00392515
Message ID:
00392557
Views:
8
If there is a practical limit to the number of times the information repeats on a single line (like 10 or 20 sets of data) then create a cursor that has the same structure as the file, just repeat the fields for each time...

ie:
create cursor mycursor (idnum c(3), somenum c(1), desc c(20), qty1 n(5), cost1 n(6.2), qty2 n(5), cost2 n(6.2)) etc...

Just repeat the qty and cost fields for the maximum number of times that the data appears in the mainframe file.

Use append from myfile.txt delimited with "*" to load the data into the cursor.

Then scan the file, using a for loop to pull the qty and cost fields and insert them into a single normalized table.

If there could be 100's of cost and qty fields, then load the file (using filetostr) into a memory variable, and scan thru the string looking for "*" and do it that way, but it will be more work.

>I have a mainframe file that has not been normalized. It contains data in a horizontal fashion instead of vertically. for example:
>
>400*2*CREDIT VOUCHER*208*$42,190.89*477*$69,806.49*108*$17,490.11*231*$39,007.35
>
>All of the above is really on one line. As you can see, there are asterix separating the data I need.I am trying to get the "stuff between each asterix. I have no way telling how many etries will be on one line. this example is a short line. The otehrs were too long to put in her. I tried using the ATC() etc. commands. They work but as I said I can't ever know how many entries will be on one line.
>
>Any ideas out ther as to how i can solve this problem?
>
>Thanks in advance for your help! :-)
>
>Randall
--Todd Sherman
-Wake Up! Smell the Coffee!
Previous
Reply
Map
View

Click here to load this message in the networking platform