Subject: | |
From: | |
Reply To: | |
Date: | Wed, 4 Nov 1998 11:19:42 +0000 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Folks,
I am dealing with an application that reads barcoded information into
flat files onto the HP3000. Unfortunately, sometimes the odd character
or two gets mis-read (we are only talking say 10 in 5,000) and this
"invalid character" can cause the next application to refuse to load
the file. Therefore, I have been experimenting with ways to scan the
file to pinpoint these bad characters. The only valid characters are
numbers 0-9, all upper case characters and spaces. I was going to use
Suprtool's pattern-matching but it seems that it cannot discern upper
case from lower (please correct me if I'm wrong). I could use Cobol
(being probably the fastest way) but my Cobol is not current. So, I
looked at CI programming and tried a construct to read the file
character by character e.g. :
[snip first bit]
setvar n finfo(hpstdin,"eof")
setvar y 0
while setvar(n,n-1)>=0 and
len(setvar(buf,rtrim(input())))>=0
setvar y !y + 1
setvar i 1
while setvar(i,i+1) < !flen
setvar z ord(str("!buf",i,1))
if (z > 47 and z < 58)
okay so read next...
elseif (z > 40 and z < 91)
okay so read next...
elseif z <> 32
echo Line !y : Char !i = ![str("!buf",i,1)]
endif
endwhile
endwhile
etc...
This works fine but is slow and inefficient.
I would be interested to hear from anyone who could suggest a
better/faster/more efficient way of scanning each character of a
datafile.
TIA,
Cheers,
--
John Dunlop
E-mail : [log in to unmask]
Web : http://homepages.tcp.co.uk/~jdunlop/
"All your HP3000 resources on the Net"
|
|
|