Page 2 of 2

Re: Replace special characters and find Numeric values in st

PostPosted: Tue Apr 24, 2012 12:01 am
by BillyBoyo
I think it is time for a re-clarification of your data.

123456789
12345678901234567890123456789
1#2#3#4#5#6#7#8#9
1A2A3A4A5A6A7A8A9
1 2 3 4 5 6 7 8 9
12345678#90123456
12345678 90123456
12345678B90123456


With the above, what would be your "match" in each case?

Re: Replace special characters and find Numeric values in st

PostPosted: Wed Apr 25, 2012 7:23 am
by MSURESH309
1. 123456789 - found 9 digit number will give an error
2. 12345678901234567890123456789 - found 9 digit number, will give an error(1-9,2-10,3-11..etc)
3. 1#2#3#4#5#6#7#8#9 - it has 9 digits,excluding special characters..so will error out
4. 1A2A3A4A5A6A7A8A9 - it won't error out because it doesn't have 9 numeric bytes
5. 1 2 3 4 5 6 7 8 9 - it has 9 digits,excluding spaces..so will error out
6. 12345678#90123456 - it has 9 digits,excluding special characters(#)..so will error out
7. 12345678 90123456 - it has 9 digits,excluding spaces..so will error out
8. 12345678B90123456 - it won't error out because it doesn't have 9 numeric bytes

In the above records, my logic should check for 9 numeric bytes, except 4 and 8 all others will match the condition.

Thanks,
Suresh

Re: Replace special characters and find Numeric values in st

PostPosted: Wed Apr 25, 2012 7:47 am
by dick scherrer
Hello,

Possibly i've gotten completely lost, but it appears your clarification is not at all consistent. Actually the "clarification" neither matches the eariler "rules" nor the "rules" mentioned in the clarification.

Maybe i am just reading something incorrectly. . .

Re: Replace special characters and find Numeric values in st

PostPosted: Wed Apr 25, 2012 8:06 pm
by MSURESH309
Sorry for that..let me explain in detail. I have a 30 byte field where I may receive input from another source. If I receive any 9 byte numeric data anyware in the data(excluding spaces,special characters #,'.', '-', '/') then I have to send an error message.

So in the previous example, my program should error-out all the cases except 4 & 8 because,

4. 1A2A3A4A5A6A7A8A9 - it won't error out because it doesn't have 9 numeric bytes(found just 1 byte numeric value)
8. 12345678B90123456 - it won't error out because it doesn't have 9 numeric bytes(it has only 8 bytes of numeric value)

Hope it clarifies..let me know if it still unclear.Thanks

Re: Replace special characters and find Numeric values in st

PostPosted: Wed Apr 25, 2012 8:48 pm
by BillyBoyo
Ok, I didn't realise that. I suspect it will be a surprise to others... :-)

If you are rejecting for nine (or more) numerics which are not bounded by alpha characters*, then

From character one, count all characters which have a value zero to nine. Restart counting from zero when you get an alpha. Stop when you reach end of data (after looking at 30 characters). Stop counting and reject if you get to nine.

Once you've rejected the ones you don't want, then you can do any other processing you like on the accepted ones.

You can test byte-by-byte for NUMERIC to count, and for ALPHABETIC to re-start the count. If there are other characters than ALPHABETIC which end your criteria, then you include those with the ALPHABETIC test.

Re: Replace special characters and find Numeric values in st

PostPosted: Sat May 05, 2012 3:53 pm
by gokulNmf
MSURESH309,
Just a small hint, I think it ll be useful.
You can move the 30 byte record into an array of element pic x, then you can check every element. You can use "THRU" clause for defining the check variable as it will be easy to define from A to Z and from 0 to 9.
Add counter for finding out which will be the valid and invalid record.
Hope it will be useful.