|
Looping constructs 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. Im going to talk about the various looping constructs in the VESOFT product line and how you can make use of them. First there is the %WHILE...%ENDWHILE, which operates pretty much the same as the one in the CI. It can be used in MPEX and STREAMX most usefully, and in any situation where you need a general purpose loop. Here is a simple example: %SETVAR I 0 Next there is the %REPEAT...%FOREACH loop. This reminds me of the for I =1 to 10..next I type loop in BASIC. However, as most things in MPEX go, it can be stretched much further: for example: %REPEAT My all-time favorite and most used tool is the %REPEAT...%FORFILES loop. This is where you can create command files that operate on file sets for special-purpose issues. As you work more and more with MPEX, you will find yourself turning to this construct. Here is a simple example: %REPEAT Next we have %REPEAT...%FORJOBS, which is very handy for working against job sets for a particular action that isnt directly support by the ALTJOB/BREAKJOB/ABORTJOB/RESUMEJOB commands. As an example: %REPEAT You have a flexible method
for altering batch jobs or aborting them depending on their value. %REPEAT Now %REPEAT...%FORRECS is one of those commands that I havent gotten around to using yet because I always forget about it. Its a nice sneaky way to read a file and do some processing, for example: %REPEAT The %REPEAT...%FORRECS
construct performs a sequence of MPEX commands once for each record
of a given file, with a given variable (for example,
CURRENTREC) set to each record of the file: This will do the commands between %REPEAT and %FORRECS once for each record in the file DATAFILE, setting the variable CURRENTREC to the contents of the current record. We now get to the only Security/3000-specific loop that I am aware of, %REPEAT...%FORPROFILES. This construct allows you to perform an arbitrary set of actions on SECURITY profiles. Although the %SEC CHANGE command lets you change large groups of profiles, and the %SEC LISTUSER lets you report on any set of profiles, there are still some limitations to these commands. The %SEC CHANGE command is limited to changing ALL the profiles in the profile set to have the SAME value, and the %SEC LISTUSER command displays profiles with only one format. Using %REPEAT...%FORPROFILES, however, you can change the fields of each profile that qualifies with different values (the changes may even be based upon current values of other fields). Simple reports can be generated by using the %ECHO command to format and display the values of any field within the profile. For example, lets say you have a user defined field that contains a three-digit department code and you want to change it to be four digits by adding a 1 to the beginning of each code. The following loop will do just that: %REPEAT Now finally we are up to the three VEAUDIT-specific loops, they are: %REPEAT ... %VEAUDIT FORACCTS Basically you have to own both MPEX and VEAUDIT for this to work, and you have to preface the FOR???? With VEAUDIT. Each construct lets you do things to MPE accounts, groups and users, for example: %REPEAT There you go, all
the fun you could possibly hope for in a utility until next
month. Copyright The 3000 NewsWire. All rights reserved. |