Inside VESOFT covers
tips and techniques you can use with VESOFTs products,
especially MPEX. As always, I am totally open to getting input from
you users of MPEX, Security/3000 or VEAudit/3000 it helps me
learn, too. Send me your tricks, and well get a 3000 for
2000 cap out to you as our thanks.
Below is a list of the database calls that are supported by MPEX and Streamx (all are database IO functions):
You should notice that there are some intrinsics here that dont exist in any IMAGE/SQL manual. You might be wondering what VEDBDELETEK, VEDBGETV, VEDBPUTL, and VEDBUPDATEK do. Basically, these are implemented for ease of use. In the case of VEDBDELETEK, if you pass a key value then it will do DBLOCK/DBGET/DBELETE/DBUNLOCK for you in a single call. You can take this even further by using the auto-open mode, which allows you to specify all of the database open parameters instead of the database ID. In this case the single call will do DBOPEN/ DBLOCK/ DBGET/ DBDELETE/ DBUNLOCK/ DBCLOSE for you. Hows that for convenient?
The VEDBUPDATEK works the
same way as VEDBDELETEK, but for updates. VEDBPUTL, will wrap the
DBLOCK..DBULOCK around the DBPUT. VEDBGETV will return a Boolean
value so that you can use it in a WHILE or IF statement, so you have
to specify the return variable inside the function. Here is the call
The VEDBGET function will return the data buffer into the variable specified, as in:
VEDBGET (dbid, dset, mode, list[, key]) [STR]
There are a number of
status array variables that you can also get access to. VEDBERR and
VEEOF are the two most useful, but at least you have some others that
are available. You could, for example, take a key value from a user
in a STREAMX job, do a VEDBFIND, and then use the VEDBCHAINLEN to
return an integer that could be used to build a file of the correct
size.Heres the list of variables:
There are a couple of real-world-type examples below that show STREAMX and an Expression Program (well talk about those in a later column). If, in the first example, we open our database, and then prompt for a STATE, we keep looping on the state prompt until we get a valid VEDBFIND. There are a couple of interesting things to note here. First of all, this is a TPI-enabled database it has Omnidex on it. The STATE-KEY is actually a combination of STATE plus some other fields its not actually an IMAGE key, but an Omnidex key. So we append an @; to the key value to do a wild card lookup.
The next interesting thing
to note is in the IF VEDBFIND statement. You will notice the STRWRITE
command. This is so that we pass a specific length value to the key.
We want the key value length to match the keys actual length. This is
explained in more detail in the MPEX manual.
In this next example you
will see an expression program doing database IO. An expression
program looks very much like Pascal. In this case we dont need
to specify the STRWRITE on the key value on the VEDBFIND because an
expression program allows us to declare variables of a specific
length. In this particular program we are checking to see if a record
exists in a detail set. If the DBFIND doesnt find a record,
then we DBPUT the record into the dataset.
This are just a couple of examples of what MPEX offers you through its database access tools. I personally like them a lot for submission time validation on job streams.
whose S.M. Gordon & Associates firm supplies HP 3000 utilities,
has worked with 3000s since 1983.
Copyright The 3000 NewsWire. All rights reserved.