[Info-vax] OpenVMS - DCL - Data entry filtering
hb
end.of at inter.net
Thu Mar 26 17:07:30 EDT 2015
On 03/26/2015 07:49 PM, Norm Raphael wrote:
> >On 03/26/15, JF Mezei<jfmezei.spamnot at vaxination.ca> wrote:
>> Also, wouldn't it be more efficient to built a 256 character string,
>> containing the replacement character for each possible source character,
>> and then converting the source character into an index from which you
>> can f$extract the replacement character ?
> Only if you want to do replacement.
... where you have a replacement character at the index and not an empty
string. For the filter one would like to have an array. A poor man's DCL
array can be implemented like:
$ ban_these_characters = "~`!@#$%^&*()-+={}[]\|;:',.<>/?"""
$ data_entry = "~~test~~"
$
$ i = 0
$ x = ""
$ init_ascii:
$ x[0,8] = i
$ ascii'i = x
$ i = i+1
$ if i .lt. 128 -
then $ goto init_ascii
$
$ i = 0
$ l = f$length(ban_these_characters)
$ set_banned:
$ ascii'f$cvui(8*i,8,ban_these_characters) = ""
$ i = i+1
$ if i .lt. l -
then $ goto set_banned
$
$ result = ""
$ i = 0
$ l = f$length(data_entry)
$ next:
$ result = result + ascii'f$cvui(8*i,8,data_entry)
$ i = i+1
$ if i .lt. l -
then $ goto next
$ write sys$output result
Whether this is efficient or not is another question and whether there
is always enough room for symbol definitions is also questionable.
More information about the Info-vax
mailing list