Page 1 of 1

how to handle junk data while using UNSTRING

PostPosted: Sun Feb 10, 2013 1:51 pm
by gyt3
My input file is a comma delimited file and it looks like this,
a1234,123,345,1200,
b1234,123,345,19000,
c1234,123,345,1,
Sometimes, I may junk data in the input file like this
a1234,123,345,1200,
b1234,12fgdhg#$#%#$^$%&&
c1234,123,345,1,

If i get a junk data, I need to move the junk values to a separate file and process the rest of data in my program.

Junk Output file :
b1234,12fgdhg#$#%#$^$%&&

I use unstring in my program to handle the comma seperated input file. Is it possible to move the junk data to a seperate file???Can someone help me out in this ??

Re: how to handle junk data while using UNSTRING

PostPosted: Sun Feb 10, 2013 2:10 pm
by enrico-sorichetti
please review Your understanding of UNSTRING and JUNK DATA
the two things are not related

UNSTRING ... separates an <input> string in <tokens> according to some <separator> char full stop
JUNK DATA ... is something UNSTRING is unaware of
it is You(Your program) that after UNSTRING must analyze each <token> for compliance with the expected data format ( not JUNK DATA )

or as an alternative You can verify that the <input> string contains ONLY valid chars
( ALPHABETICS and NUMBERS for example , and the UNSTRNG separator naturally)
butit will just a generic check

and after that proceed with unstring

but still afterwards You will have to check also the <unstringed> data for validity ( numerics for example )

Re: how to handle junk data while using UNSTRING

PostPosted: Sun Feb 10, 2013 4:02 pm
by NicC
Do not multi-post. I cannot o anything about it on other forums but I am locking this topic.