how to handle junk data while using UNSTRING



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

how to handle junk data while using UNSTRING

Postby gyt3 » Sun Feb 10, 2013 1:51 pm

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 ??
gyt3
 
Posts: 16
Joined: Sun Dec 16, 2012 9:58 am
Has thanked: 3 times
Been thanked: 0 time

Re: how to handle junk data while using UNSTRING

Postby enrico-sorichetti » Sun Feb 10, 2013 2:10 pm

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 )
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: how to handle junk data while using UNSTRING

Postby NicC » Sun Feb 10, 2013 4:02 pm

Do not multi-post. I cannot o anything about it on other forums but I am locking this topic.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post