[Info-vax] READ and WRITE vs. SEARCH/OUTPUT

Richard B. Gilbert rgilbert88 at comcast.net
Sat Jan 21 12:05:08 EST 2012


On 1/21/2012 11:29 AM, Phillip Helbig---undress to reply wrote:
> Imagine a file x.x like
>
> A
> A
> A
> B
> A
> A
> B
> A
> A
> A
> A
> B
>
> Would SEARCH x.x B /OUT=X.LIS be better than
>
> $  OPEN/READ IN X.X
> $  OPEN/WRITE OUT X.LIS
> $LOOP:
> $  READ/END=DONE IN REC
> $  IF REC .EQS. "B" THEN WRITE OUT REC
> $ GOTO LOOP
> $DONE:
> $  CLOSE IN
> $  CLOSE OUT
> $  EXIT
>
> Some tests indicate that SEARCH is much faster.  Can one depend on this
> always being the case?
>

Not until you have tested with all possible inputs!  Even then, keep 
Murphy's law in mind; "If anything CAN go wrong, IT WILL!"

SEARCH *should* be faster because SEARCH is an executable and "IF" is 
interpreted but I will not guarantee it for all cases.

And if I've just done your homework for you, I'm sorry and I hope your 
instructor knows it!





More information about the Info-vax mailing list