[Info-vax] OpenVMS - DCL - Data entry filtering
Bob Gezelter
gezelter at rlgsc.com
Thu Mar 26 21:38:14 EDT 2015
On Thursday, March 26, 2015 at 2:55:04 PM UTC-4, Norm Raphael wrote:
> >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
Norm,
Mea culpa. Transposed while typing.
- Bob
More information about the Info-vax
mailing list