[Info-vax] OpenVMS - DCL - Data entry filtering

Norm Raphael norman.raphael at verizon.net
Thu Mar 26 14:49:44 EDT 2015


 >On 03/26/15, JF Mezei<jfmezei.spamnot at vaxination.ca> wrote:
 >
>I realize the OP said 7.3
>
>In 8.3 wasn't there a F$REPLACE lexical added ? or is that just in my
>imagination ?
According to HELP, it's all in you imagination.
>
>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.

Oh, and the DCL suggested by RLG is not quite right. It s/b more like:
$!      FILTER.COM
$!INITIALZATION
$ STRINGOFVALIDCHARACTERS="ABCDEFGHIJKLMNOPQRSTUVWZYZ0123456789abcdefghijklmnopqrstuvwxyz_$"
$ LENG=F$LENGTH(STRINGOFVALIDCHARACTERS)
$START:
$ READ/END=EXIT/ERROR=EXIT/PROMPT="STRING IN: " SYS$COMMAND STRING
$ VALIDSTRING=""
$ I=0
$TESTLOOP:
$ I=I+1
$ TOBETESTED = F$EXTRACT(0, 1, STRING)
$ STRING = F$EXTRACT(1, F$LENGTH(STRING) - 1, STRING)
$ IF (F$LOCATE(TOBETESTED, STRINGOFVALIDCHARACTERS) .EQ. LENG) THEN TOBETESTED = ""
$ VALIDSTRING = VALIDSTRING + TOBETESTED
$ IF STRING .EQS. ""
$ THEN
$ WRITE SYS$OUTPUT "STRING OUT IS """,VALIDSTRING,"""
$ GOTO START
$ ELSE
$ GOTO TESTLOOP
$ ENDIF
$EXIT:
$EXIT 1


 
 Norman F. Raphael
"Everything worthwhile eventually 
degenerates into real work." -Murphy




More information about the Info-vax mailing list