Subject: | |
From: | |
Reply To: | |
Date: | Thu, 25 Oct 2001 12:48:30 -0700 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Donna is of the opinion that my comments about the command file that she
posted should be made available to the whole list.
So here they are along with the command file that I suggested.
Regards
Paul Christidis
>btw -- if you haven't already, you're going to see a posting from me back
to
>list with my 'solution'. please don't think that i don't appreciate all
the
>work you did - d
I did not expand much effort in this since it is a slight variation of a
script that I developed last week in response to someone's request of a
method to 'trap' warnings out of quiz.
I did receive your solution, it seems well designed. I do have a couple of
comments however.
In your previous e-mails you indicated that system overhead was one of your
concerns. However the usage of the binary search does not really save
anything since you still have to read the entire file, in order to place it
in an array. Thus you have the additional overhead of CI variable
allocation and possibly a serial CI variable table search, in order to
evaluate each variable used in the binary search. The only situation where
some processing savings may be realized is if the array would be searched
multiple times, the number of 'records' was sufficiently large and the
command file had logic that would detect the presence of the 'array' and
thus avoid the reload operation in subsequent invocations.
Regards
Paul Christidis
...
...
Donna,
How about something along the following lines:
Supposing we have the following data file named 'INFOFILE.DATA'.
9 nine
10 ten
11 eleven
12 twelve
13 thirteen
14 fourteen
15 fifteen
The following job sample will set a variable of your choice to the second
word in the matching record:
!...
!# process data file
!
!getword2 12 _SECORD_WORD < INFOFILE.DATA
! if BOUND(_second_word) then
!....
!else
!....
!endif
!..
Where the command file 'getword2' is comprised of the following:
parm Info_In Info_Out="_Info_Out", key_word=1, val_word=2
setvar _gp_Eof FINFO(HPSTDIN,"eof") + 1
setvar _gp_lflag false
while (NOT _gp_lflag) AND (SETVAR(_gp_Eof, _gp_Eof - 1) > 0) do
INPUT _gp_Text
if WORD(_gp_Text,,!key_word) = "!Info_In" then
setvar _gp_lflag true
setvar !Info_Out WORD(_gp_Text,,!val_word)
endif
endwhile
deletevar _gp_@
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|