HP3000-L Archives

October 2001, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Ron Wuerth <[log in to unmask]>
Reply To:
Ron Wuerth <[log in to unmask]>
Date:
Tue, 23 Oct 2001 14:22:03 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (115 lines)
Donna,

Disclaimer:
My suggestions in no way implies my mind is any
bigger than yours ... ;-)

How about using an awk script? (Assuming you
only want to use system given tools.)

I haven't worked out any details yet, the biggest
is getting the value of the second item back into
a variable useable by the CI for your purposes,
but it's an interesting exercise.  Awk's ability to
split records seems like a good match here.

If you can use Perl, you're in like Flint as a two
item record is easily convertible into Perl's favorite
son,  the Hash.

Other than that...you could "/bin/fold" the file into
a temporary msg file, then input until you match,
then input one beyond for the value needed.
The temporary file should save disc io, but still
does seem like a lot of overhead.

With most posix solutions, and a permanent file
to start with for input, I usually print the file to $newpass
first, then redirect input from $oldpass, so if I were
to /bin/grep it, it would be something like

print datafile > $newpass
/bin/grep "<options> lookforthis" < $oldpass > tempfile
input myval < tempfile
setvar myval, str(rtrim(ltrim(myval)), x, y)
<...clean up...>

x = enough characters past all first records
y = enough characters for longest second record

Of course that assumes the data file is semi nicely
formatted, whereby column 1 never runs into
column 2.  If it's really nicely formatted (left justified
you can get rid of the "ltrim()" by knowing the right
x value.

I'll fire up my rusty awk knowledge to see what
I can come up with.

Ron Wuerth
Computer Operations Specialist
Virginia International Terminals
Phone: 757-391-6194
Fax    : 757-391-6223
mailto:[log in to unmask]


-----Original Message-----
From: Donna Garverick [mailto:[log in to unmask]]
Sent: Tuesday, October 23, 2001 1:39 PM
To: [log in to unmask]
Subject: [HP3000-L] mpe scripting and file extracts


hi all!

i've got a little puzzler and i thought i'd let more/bigger
(:-) minds than just mine ponder a solution.

i've got a simple little text file with two pieces of
information on each record.  the first 'word' (piece of
information) could be considered as a key value.  that is --
another process will be examining this file looking for a
match on the first field.  (and btw, since i know the
data....most of the time the match will fail....).  if a
match is found, i need the 2nd 'word' (piece of information)
placed into a ci variable.  sound rather simple....except
that last piece -- getting the information from the file
into a variable.

i've considered a number of solutions -- that all result in
some how echoing the matched data record to a (one record)
disc file and doing a 'input blah < disc'.  (qedit and grep
and similar are all going boil down to this sort of
solution, imo)  it's the amount of disc i/o that's got me
'grumpy'.  otoh....maybe all this disc i/o is really the
'cheapest' solution and i'm just unenlightened.

i had one idea proposed -- since the 1st word in this little
file is numeric -- align the data onto the correct record by
number (that is, if the 1st word's value is '50', make it
the 50th record...and so on...and 'holes' would just be
blank records) then do something like a directed read (using
the 'start' and 'end' options from the print command (of
course, this still would taking the 'input blah < disc'
route)).  what concerns me, is the 'relationship' between
the data and the record number is really arbitrary -- not
well coupled (like it might be with a ksam file or a
database -- and neither of these are really solutions since
everything is being scripted).

so...hoping that i've described this well...does anyone else
have any other suggestions?        - d

--
Donna Garverick     Sr. System Programmer
925-210-6631        [log in to unmask]

>>>MY opinions, not Longs Drug Stores'<<<

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2