Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data Normalization
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00392515
Message ID:
00392574
Views:
10
>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


Randall,

There's a sample program to show how you can do conversion
lcStr= "400*2*CREDIT VOUCHER*208*$42,190.89*477*$69,806.49*108*$17,490.11*231*$39,007.35"
* Get rid of $ and ,
lcStr = CHRTRAN(lcStr, "$,", "")

CREATE CURSOR Temp ( ;
	Col1 C(3), ;
	Col2 C(1), ;
	Col3 c(20), ;
	Code C(3), ;
	Amount N(12,2))
	
* Conver * into crlf

lcStr = STRTRAN(lcStr, "*", CHR(13) + CHR(10))

ALINES(	laArray, lcStr)

FOR lnI = 4 TO ALEN(laArray) STEP 2
	INSERT INTO Temp Values ;
		(laArray[1], laArray[2], laArray[3], ;
			laArray[lnI], Val(laArray[lnI+1]))
ENDFOR
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform