I have a .dat file like below eg: sample.DAT
21111111110000652 B86860003OLFXXX000000120081227
21111111110000652 B86860003ODL-SP000000220081227
21111111110000652-B94030001ODL-CH000000320081227
22222222220000653-B94030001OLFXXX000001120081227
23333333330000654-E71060001OLFXXX000001220081227
24444444440000655 E71060002OLFXXX000001420081227
24444444440000655 E71060002ODL-SP000001520081227
111111111 is a ssno with 3 records self(amt is 0000001), spouse(amt is 0000002),child (amt is 0000003)
222222222 is a ssno with just 1 record self
333333333 is a ssno with just 1 record self
444444444 is a ssno with just 2 record self(amt is 0000014),spouse(amt is 0000015)
after reading the above file in the WHILE READ LINE DO loop
Basically i am creating 2 more new columns amt_1 and amt_2 in the flat file (sampleout.txt) seperating if any records exists with spouse or child.
for eg: record 21111111110000652 we have 3 records self,spouse & child, i need to create only one record seperating the spouse or child record exists with the amount coulumns seperate spouse amt is 0000002 & child amt is 0000003 like wise the loop should check
21111111110000652 B86860003OLFXXX000000120081227 0000002 0000003
22222222220000653-B94030001OLFXXX000001120081227
23333333330000654-E71060001OLFXXX000001220081227
24444444440000655 E71060002OLFXXX000001420081227 0000015
-----
-----
...etc
Any help is appreciated.
Thanks in adv.