[Info-vax] READ and WRITE vs. SEARCH/OUTPUT
VAXman- at SendSpamHere.ORG
VAXman- at SendSpamHere.ORG
Sat Jan 21 14:44:16 EST 2012
In article <Z9adnRLw-NnMbYfSnZ2dnUVZ_uGdnZ2d at giganews.com>, "Richard B. Gilbert" <rgilbert88 at comcast.net> writes:
>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!"
I suspect that SEARCH, a single image designed to specifically perform the
function which is described by its verb, is much more efficient than a DCL
procedure to do the same; especially, when you are searching MANY records.
There are "search" optimization in SEARCH that would not come into play in
DCL -- at least, not with the example code you provided.
>SEARCH *should* be faster because SEARCH is an executable and "IF" is
>interpreted but I will not guarantee it for all cases.
You will not guarantee that "IF" is interpreted in all cases? :)
>And if I've just done your homework for you, I'm sorry and I hope your
>instructor knows it!
He could put your name on his written assignment as mentor.
--
VAXman- A Bored Certified VMS Kernel Mode Hacker VAXman(at)TMESIS(dot)ORG
Well I speak to machines with the voice of humanity.
More information about the Info-vax
mailing list